aics_tf_registration.core package¶
Submodules¶
aics_tf_registration.core.alignment module¶
-
aics_tf_registration.core.alignment.
align_xy
(fixed: numpy.ndarray, moving: numpy.ndarray)[source]¶ Perform alignment of the images in 2d.
- Parameters
- fixed (image with larger field of view)
- moving (image with smaller field of view)
- Returns
- fixed_2dAlign_offset_x (rigid offset in x)
- fixed_2dAlign_offset_y (rigid offset in y)
-
aics_tf_registration.core.alignment.
align_z
(fixed: numpy.ndarray, moving: numpy.ndarray, prealign: bool, denoise: bool)[source]¶ Align the images in the z-plane.
- Parameters
- fixed (image with larger field of view)
- moving (image with smaller field of view)
- prealign (whether to initially estimate alignment by overlapping segmentations)
- denoise (“denoise” image through 10th & 90th percentile clipping)
- Returns
- fixed_addition_offset_z (rigid offset in z)
- fixed_addition_offset_x (rigid offset in x)
- fixed_addition_offset_y (rigid offset in y)
-
aics_tf_registration.core.alignment.
final_refinement
(lr: numpy.ndarray, hr: numpy.ndarray, scale_factor_xy: float, scale_factor_z: float, min_subcrop_xy: int, min_subcrop_z: int, error_thresh: float = 0.01)[source]¶ Adjust the final 3d alignment by repeating alignment in high resolution image scale.
- Parameters
- lr (low-res (source) image after initial alignment)
- hr (high-res (target) image after initial alignment)
- scale_factor_xy (upsample/downsample rate for x and y)
- scale_factor_z (upsample/downsample rate for z)
- min_subcrop_xy (minimum number of pixels to crop to match scale factor)
- min_subcrop_z (minimum number of pixels to crop to match scale factor)
- error_thresh (maximum error in scale factors tolerated for final image)
- Returns
- fixed_final (aligned and cropped fixed image)
- moving_final (aligned and cropped moving image)
-
aics_tf_registration.core.alignment.
finalize_alignment
(fixed: numpy.ndarray, moving_orig: numpy.ndarray, moving_scaled_shape: Tuple[int], moving_adjust_z_shape: Tuple[int], init_z_padding: int, fixed_addition_offset_z: int, fixed_addition_offset_y: int, fixed_addition_offset_x: int, fixed_2dAlign_offset_y: int, fixed_2dAlign_offset_x: int, scale_factor_xy: float, scale_factor_z: float)[source]¶ Use refineuse_refinement-force search adjust the final 3d alignment.
- Parameters
- fixed (image with larger field of view)
- moving_orig (image with smaller field of view)
- moving_scaled_shape (image dimensions of rescaled smaller FOV)
- moving_adjust_z_shape (image dimensions after adjustments to stack size)
- init_z_padding (number of stacks padded or clipped from rescaled image)
- fixed_addition_offset_z (rigid offset in z from itk alignment)
- fixed_addition_offset_y (rigid offset in y from itk alignment)
- fixed_addition_offset_x (rigid offest in x from itk alignment)
- fixed_2dAlign_offset_y (rigid offset in y from 2d alignment)
- fixed_2dAlign_offset_x (rigid offest in x from 2d alignment)
- scale_factor_xy (upsample/downsample rate for x and y)
- scale_factor_z (upsample/downsample rate for z)
- Returns
- fixed_final (aligned and cropped fixed image)
- moving_final (aligned and cropped moving image)
-
aics_tf_registration.core.alignment.
perform_alignment
(source: numpy.ndarray, target: numpy.ndarray, smaller_fov_modality: str, scale_factor_xy: float, scale_factor_z: float, source_alignment_channel: int, target_alignment_channel: int, source_output_channel: list, target_output_channel: list, prealign_z: bool, denoise_z: bool, use_refinement: bool, save_composite: bool)[source]¶ Wrapper function for all of the steps necessary to calculate alignment.
- Parameters
- source (low-res modality image)
- target (high-res modality image)
- smaller_fov_modality (which modality has the smaller field of view)
- scale_factor_xy (upsample/downsample rate to match image scales in x and y)
- scale_factor_z (upsample/downsample rate to match image scales in z)
- source_alignment_channel (source image channel used for calculating alignment)
- target_alignment_channel (target image channel used for calculating alignment)
- source_output_channel (source image channel to apply alignment on)
- target_output_channel (target image channel to apply alignment on)
- prealign (whether to calculate intitial estimate of z-alignment)
- denoise_z (denoise z-stacks prior to z-alignment)
- use_refinement (refine alignment by repeating in the target image resolution)
- save_composite (save composite image of final alignment)
- Returns
- source_aligned (aligned source image)
- target_aligned (aligned target image)
aics_tf_registration.core.image_aligner module¶
aics_tf_registration.core.preprocessing module¶
-
aics_tf_registration.core.preprocessing.
apply_transforms
(image: numpy.ndarray, transform_list: List[str])[source]¶ Apply the transformations from list provided to the moving image
- Parameters
- image (3D or 4D image)
- transform list (list of transforms to apply in sequence to image)
- Returns
- image
- Return type
transformed image
-
aics_tf_registration.core.preprocessing.
precrop_image
(image: numpy.ndarray, scales: numpy.ndarray)[source]¶ Applies precropping to the image
- Parameters
- image (3D or 4D image)
- scales (array containing percent of each axis to crop)
- Returns
- image_cropped
- Return type
cropped image
-
aics_tf_registration.core.preprocessing.
rearrange_multichannel_image
(image: numpy.ndarray)[source]¶ Rearrange the order of dimensions so that the channel dimension is first
- Parameters
- image (4d image)
- Returns
-image
- Return type
image with channels rearranged
-
aics_tf_registration.core.preprocessing.
rescale_image
(image: numpy.ndarray, scale_factor_xy: float, scale_factor_z: float)[source]¶ Upsample/Downsample the image to match voxel dimensions of the other image.
- Parameters
- image (3D or 4D image to rescale)
- scale_factor_xy (Upsample/downsample rate in x and y)
- scale_factor_z (Upsample/downsample rate in z)
- Returns
- image
- Return type
rescaled image