withinStackRegistration.py consists of two main steps: determining motion shifts in x & y, and then applying the calculated shifts. It is assumed that one channel will be used for determining the shifts at each unique timepoint and tile, and then the same shifts can be applied to all other channels. Shifts are calculated using phase cross correlation. The final images are padded with zeros such that all images are the same size, which reflects the maximal shifts measured across the entire time course. Final images will be saved in a subfolder of the original directory named withinStackRegistration.
withinStackRegistration.py requires a python environment with numpy and scikit-image. This repository includes a .yml file that can be used to create a conda environment using:
conda env create -f environment.yml
If you are not familiar with using environments this way, this is a helpful resource for learning more about using mamba environments for image analysis: Managing Scientific Python environments using Conda, Mamba and friends.
withinStackRegistration.py has two required parameters and one optional parameter.
inpath(required): The full path to the folder of images to correct.toCorrect(required): A string that uniquely specifies the channel of images to correct. For example,ch1orCamB_ch0. Indicate this using the argument--toCorrector-tC.nCores(optional): Specify the number of cores to use for processing using the-nCoresargument. The default value is the number of cpus on the system. A value of 0 will turn off multiprocessing and will correct the files sequentially.
python withinStackRegistration.py Y:/instruments/MOSAIC/YourName/ExperimentDate/Folder/ -tC ch1 -nCores 36