multiScaleAnalysis.Stitching package
Submodules
multiScaleAnalysis.Stitching.multiScale_stitching module
- class multiScaleAnalysis.Stitching.multiScale_stitching.image_stitcher[source]
Bases:
object
This class stitches images from the low-resolution data acquisiton of the self-driving, multi-scale microscope.
- crop_images(image_crops_x, image_crops_y)[source]
Remove/crop parts of the images and update self.rawimage array with cropped images. This is function is helpful, e.g. to cut away parts of the image that were not properly illuminated.
- Parameters:
image_crops_x – For every image specify cropping in x direction [startpoint, endpoint], e.g. [[396, 396 + 3300], [208, 208 + 3236], [200, 200 + 3052]]
image_crops_y – For every image specify cropping in y direction [startpoint, endpoint], e.g. [[396, 396 + 3300], [208, 208 + 3236], [200, 200 + 3052]]
- iterate_overfolder(experimentfolder_parent, experimentfolder_result, channelnames, region, sample, image_crops_y, image_crops_x, displacement_x, displacement_y, optimize_alignment=1, limit_search=[], use_reference=0)[source]
Iterate over the output of the low-resolution imaging of the multi-scale microscope to stitch all the data based on an initial guess of the translational shift (from the stage positions).
- Parameters:
experimentfolder_parent – Folder where all timepoints are in
experimentfolder_result – Folder to save the result of Stitching
channelnames – List of channels to stitch
region – List of regions, e.g. “low_stack000”
sample – Which fish/sample are you Stitching, e.g. “fish3”
image_crops_y – Cropping parameters so that empty regions/at border can be removed, e.g. [[396, 396 + 3336], [308, 308 + 3336], [212, 212 + 3052]]
image_crops_x – Cropping parameters so that empty regions/at border can be removed, e.g. [[200, 2200], [200, 2200], [200, 2200]]
displacement_x – Approximate displacement in x
displacement_y – Approximate displacement in y
optimize_alignment – (Optional) do you want to optimize the alignment per timepoint or apply the same parameters to whole timelapse
limit_search – (Optional) do you want to restrict the finding of optimal Stitching to a small overlap window? if yes, give a range: [100, 15]
use_reference – Use a reference for individual timepoints
- load_image(pathlist)[source]
Load the images specified by the path list and populate the self.rawimages array.
- Parameters:
pathlist – Array of image paths to open
- make_maxprojections()[source]
Make maximum projections of the images in the self.rawimages array and save them in the self.maxprojections array.
- optimize_overlap(limit_search=[], extendfactor=100)[source]
Optimizes the provided overlap, based on the maximum projections.
- Parameters:
limit_search – Constrain the search around the center of a predefined position, e.g. what maximum displacement is expected
extendfactor – Determines how large the overlap region is on which you calculate the overlap.
- Returns:
The optimized translation values (translation_values_x, translation_values_y).
- perform_2D_maximum_fusion(imagearrays)[source]
Perform image fusion by selecting the maximum intensity of both images.
- Parameters:
imagearrays – list of images to fuse, translation based on self.calculated_displacement
- Returns:
fused maximum projection image of imagearrays
- perform_2D_weighted_average_fusion(imagearrays)[source]
Perform fusion based on a sigmoidal blending curve of both images.
- Parameters:
imagearrays – list of images to fuse
- Returns:
weighted average fused image
- perform_3D_fusion(mode='weighted')[source]
Perform plane-by-plane wise fusion on 3D stack.
- Parameters:
mode – select mode of image fusion (maximum or weighted)
- Returns:
fused_image. 3D image fused stack.
- stitching_workflow(imagelist, image_crops_x=None, image_crops_y=None, optimizeAlignment=1, limit_search=[], clipped=1, use_reference=1)[source]
Process one set of filepaths, load images, (optionally) crop them, (optionally) improve alignment, fuse data and (optionally) clip data.
- Parameters:
imagelist – Filepaths of images to stitch
image_crops_x – (Optional) crop images before Stitching
image_crops_y – (Optional) crop images before Stitching
optimizeAlignment – (Optional) run optimization of alignment for stack (1 = yes, 0 = no)
limit_search – (Optional) if you want to limit the search to a region around a pre-aligned setting
clipped – (Optional) clip stack so that no zero value pixels are in the image (1 = yes, 0 = no)
use_reference – (Optional) use a reference set at the beginning for Stitching so that parameters don’t drift outside expected values
- Returns:
Fused image of files in imagelist