nstm.commands package
Submodules
nstm.commands.czi_conversion module
Convert .czi image stack (saved by Zeiss microscopes) into .tif image stack.
This script is used to convert .czi image stack into .tif image stack. The .czi file is saved by Zeiss microscopes
and contains 3D SIM data. While the .czi file can be directly loaded by the SIM3DDataLoader class in nstm.datasets,
.tif file can be handy for fiji or other image processing software. The .czi file can contain multiple timepoints,
and the user need to choose to convert a specific timepoint by setting the flag timepoint_ind. The user can also choose
to extract a specific region of interest by setting the flag zyxshw. The .tif file is saved in the format of
orientation -> z -> phase by default. The user can also choose to save the .tif file in the format of
z -> orientation -> phase by setting the flag z_first=True.
Example
Convert and save the timepoint_ind=1 from a .czi file into .tif file:
$ python czi_conversion.py --czi_path=path/to/example.czi --save_path=path/to/example.tif --timepoint_ind=1
- nstm.commands.czi_conversion.define_flags()
- nstm.commands.czi_conversion.main(unused_argv)
nstm.commands.full_to_patches module
Cut a large image into patches for patch-based 3D SIM reconstruction and later merge them together.
- nstm.commands.full_to_patches.cut_patches(full_dim, target_dim, overlap)
- nstm.commands.full_to_patches.define_flags()
- nstm.commands.full_to_patches.get_no_overlap_mask_2d(coord_start, patch_dim, full_dim, overlap, dtype=<class 'numpy.float32'>)
- nstm.commands.full_to_patches.main(unused_argv)
- nstm.commands.full_to_patches.merge_yx(file_name, out_dim_yx, fov_offset_yx, overlap_mode='avg', tail_dim=False, normalize_modamp=False, write_tiff=False)
nstm.commands.get_modamp module
nstm.commands.process_raw_images module
Load raw 3D SIM images, OTF, timestamps and save as .npz for reconstruction using sim3d_main.py.
This script is used to load raw 3D SIM images, OTF, timestamps and save as .npz for reconstruction using sim3d_main.py.
The raw 3D SIM images will be loaded, subtracted from the background intensity, and then oversampled by the specified
zoom factor zoomfact in x and y dimensions. This script assumes a radially averaged OTF in the format generated by
the makeotf script in cudasirecon package. The timestamps will be loaded and used for the reconstruction.
Example
Process raw 3D-SIM images and save as .npz for reconstruction using sim3d_main.py:
$ python process_raw_images.py --data_dir=path/to/data --raw_path=raw.tif --otf_path=otf.tif
--meta_path=timestamps.json --save_path=save.npz --zoomfact=1.6
- nstm.commands.process_raw_images.define_flags()
- nstm.commands.process_raw_images.main(unused_argv)
nstm.commands.timestamp_generation module
Generate estimated timestamps for Zeiss SIM data where the timestamps for raw images are not recorded.
- nstm.commands.timestamp_generation.define_flags()
- nstm.commands.timestamp_generation.main(unused_argv)