-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50339ff
commit 468b109
Showing
1 changed file
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 37, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%matplotlib inline\n", | ||
"import numpy as np\n", | ||
"import skimage\n", | ||
"import os" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# input" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 38, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def rotate180(inputFolder,outputFolder,file):\n", | ||
" latticeMovieFrame = skimage.external.tifffile.imread(inputFolder+file)\n", | ||
" \n", | ||
" latticeMovieFrame_rotated = np.rot90(latticeMovieFrame,k=2, axes=(1, 2))\n", | ||
" \n", | ||
"# slower option\n", | ||
"# latticeMovieFrame_rotated = skimage.transform.rotate(latticeMovieFrame, 180, resize=False, center=None, order=1, mode='constant', cval=0, clip=True, preserve_range=False) \n", | ||
"\n", | ||
"# not working option \n", | ||
"# latticeMovieFrame_rotated = scipy.ndimage.rotate(latticeMovieFrame, 180, axes=(0, 1), reshape=True, output=None, order=3, mode='constant', cval=0.0, prefilter=True)\n", | ||
" \n", | ||
" skimage.external.tifffile.imsave(outputFolder+file,latticeMovieFrame_rotated.astype('uint16'))\n", | ||
" print(outputFolder+file)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 39, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_560_pm50px_maxAmpl_0003.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_560_pm50px_maxAmpl_0002.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_560_pm50px_maxAmpl_0000.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_560_pm50px_maxAmpl_0001.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_560_pm50px_maxAmpl_0005.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_560_pm50px_maxAmpl_0004.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_560_pm50px_maxAmpl_0006.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_560_pm50px_maxAmpl_0007.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_488_pm50px_maxAmpl_0004.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_488_pm50px_maxAmpl_0005.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_488_pm50px_maxAmpl_0007.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_488_pm50px_maxAmpl_0006.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_488_pm50px_maxAmpl_0002.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_488_pm50px_maxAmpl_0003.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_488_pm50px_maxAmpl_0001.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_488_pm50px_maxAmpl_0000.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_488_pm50px_maxAmpl_0008.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_488_pm50px_maxAmpl_0009.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_560_pm50px_maxAmpl_0009.tif\n", | ||
"/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/cropped_560_pm50px_maxAmpl_0008.tif\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"inputFolder = '/Users/johannesschoeneberg/Dropbox/pyLattice_public_test_data/'\n", | ||
"outputFolder = '/Users/johannesschoeneberg/git/JohSchoeneberg/pyLattice2/SwAK_toolkit/outputFolder/' \n", | ||
"\n", | ||
"import os\n", | ||
"for file in os.listdir(inputFolder):\n", | ||
" if file.endswith(\".tif\"):\n", | ||
" rotate180(inputFolder,outputFolder,file)\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.6.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |