Cross correlation-based drift correction recipe module written for PYME.
Supports 2/3D localization or 2D image data.
- Windows, Linux or OS X
- Python 2.7, 3.6, or 3.7
- PYME (>18.7.18) and dependencies
- Tested on Windows 10 with PYME (18.7.18)
- Clone repository.
- Run the following in the project folder.
python setup.py develop
- Start
dh5view
orVisGUI
(PYME).
(Runtime < 5 min)
- Open this simulated dataset (wormlike_simulated_locs_with_drift.hdf) with
VisGUI
(PYME). - Load and run this demo recipe (correct_drift_locs.yaml).
- The measured drift will display in a new window.
- Select the new output (
corrected_localizations
) in the Data Pipeline pane to see the drift-corrected data. - The drift data will be saved as
drift.npz
(Runtime < 5 min)
- Open this simulated dataset (wormlike_simulated_locs_with_drift.hdf) with
VisGUI
(PYME). - Load and run this demo recipe (correct_drift_locs_load.yaml).
- The drift data will be loaded from drift.npz
- The loaded drift will display in a new window.
- Select the new output (
corrected_localizations
) in the Data Pipeline pane to see the drift-corrected data.
(Runtime < 5 min)
- Open this simulated image (wormlike_simulated_images_with_drift.h5) with
dh5view
(PYME). - Load and run this demo recipe (correct_drift_images.yaml).
- The measured drift will display in a new window.
- Open the drift-corrected images by clicking the output (
drift_corrected_image
) on the final Image_Post_Shift module.
(Runtime < 5 min)
-
Refer to PYME documentation for general use of PYME.
-
Detailed description of each module and their inputs, outputs and parameters are accessible in PYME.
-
Open localization file with
VisGUI
(PYME). -
To correct drift, chain the modules in this order:
- Locs_RCC
- Drift_Interpolate
- Locs_Post_Shift
-
Alternatively, to save/load drift: To save:
- Locs_RCC
- Drift_Save
To load:
- Drift_Load_Interpolate
- Locs_Post_Shift
-
Recipes in `VisGUI' auto-run when modules are added. Since drift correction can be slow, it may be desirable to suspend this behaviour by entering this in the Shell tab.
pipeline.recipe.trait_set(execute_on_invalidation=False)
Then after building the complete recipe, enter the following to execute it once:
pipeline.recipe.execute()
This behavior may have changed in more recent PYME versions.
-
Refer to PYME documentation for general use of PYME.
-
Detailed description of each module and their inputs, outputs and parameters are accessible in PYME.
-
Open image file with
dh5view
(PYME). -
(Optional) Standard image processing methods to clean up the images may be required depending on their quality.
- Image_Pre_Clip&Filter
- Image_Pre_Downsample
-
To correct drift, chain the modules in this order:
- Image_RCC
- Drift_Interpolate
- Image_Post_Shift
-
Alternatively, to save/load drift: To save:
- Image_RCC
- Drift_Save
To load:
- Drift_Load_Interpolate
- Image_Post_Shift
-
Cross correlation-based methods require the same object to be visible throughout a number of frames. Sparse labelling without fiducials is unlikely to ever work well.
-
This was designed with large datasets in mind and on a single computer so intermediate results are cached to files on the hard disk. Cached files may need to be removed manually for some of the modules or when errors occur.
-
Runtime can vary hugely depending on the size of the dataset, 2D/3D, pixel size, cross-correlation window size, etc. It is probably worth adjusting the settings if runtime is over 30 mins. Longer runtime may not coincide with better drift correction.
- Add more metadata
- Support for 4D (time and z) image data