sample_preparation#

This is the part that is common to both pipelines to process the raw images. It includes file conversion, stitching and registration

class PreProcessor[source]#

Bases: TabProcessor

Handle the stitching and alignment of the raw images

align(force=False)[source]#
check_has_all_tiles(channel)[source]#

Check whether all the tiles of the channel exist on disk

Parameters:

channel (str) – The channel to check

Returns

bool

True if all the tiles exist

clear_landmarks()[source]#

Clear (remove) the landmarks files

convert_tiles(force=False)[source]#

Convert list of input files to numpy files for efficiency reasons

Returns

convert_to_image_format()[source]#

Convert (optionally) to image formats readable by e.g. Fiji

delete_resampled_files()[source]#
filename(*args, **kwargs)[source]#

A shortcut to get the filename from the workspace

Parameters:
  • args

  • kwargs

Returns

str

The filename

get_atlas_files()[source]#
get_autofluo_pts_path(direction='resampled_to_auto')[source]#

Get the path to the autofluorescence landmarks file

Parameters:

direction

Returns

str

The path to the autofluorescence landmarks file

get_configs()[source]#
get_wobbly_layout(**kwargs)#
overlay_layout_plane(layout)[source]#

Overlays the sources to check their placement.

Arguments

layoutLayout class

The layout with the sources to overlay.

Returns

imagearray

A color image.

static patch_elastix_cfg_landmarks(elastix_cfg_path)[source]#

Patches the elastix configuration file to use landmarks (CorrespondingPointsEuclideanDistanceMetric), in addition to AdvancedMattesMutualInformation

Warning

This method modifies the file in place and assumes that the existing

metric is AdvancedMattesMutualInformation

Parameters:

elastix_cfg_path (str) – Path to the elastix configuration file

plot_atlas()[source]#
plot_layout(postfix='aligned_axis')[source]#
plot_stitching_results(parent=None)[source]#
resample_for_registration(force=False)[source]#
static restore_elastix_cfg_no_landmarks(elastix_cfg_path)[source]#

Restores the elastix configuration file to not use landmarks (CorrespondingPointsEuclideanDistanceMetric), only AdvancedMattesMutualInformation

Warning

This method modifies the file in place and assumes that the existing metric is

AdvancedMattesMutualInformation

Parameters:

elastix_cfg_path

run()[source]#
set_configs(cfg_paths)[source]#
setup(cfgs, watcher=None, convert_tiles=True)[source]#
Parameters:
  • (machine_cfg_path (cfgs tuple of) – (machine_cfg, sample_cfg, processing_cfg)

  • sample_cfg_path – (machine_cfg, sample_cfg, processing_cfg)

  • or (processing_cfg_path)) – (machine_cfg, sample_cfg, processing_cfg)

Returns

setup_atlases()[source]#
stack_columns()[source]#
stitch()[source]#
stitch_overlay(channel, color=True)[source]#

This creates a dumb overlay of the tiles i.e. only using the fixed guess overlap :param channel: :param color:

Returns

stitch_rigid(**kwargs)#
stitch_wobbly(force=False)[source]#
unpack_atlas(atlas_base_name)[source]#
use_npy()[source]#
z_only(channel='raw')[source]#

Check if the channel is z only (no x or y tiles)

Parameters:

channel (str) – The channel to check

Returns

bool

True if the channel is z only

property aligned_autofluo_path#
property autofluorescence_is_tiled#

Check if the autofluorescence channel is tiled (has x and y tiles) .. rubric:: Returns

bool

True if the autofluorescence channel is tiled

property has_npy#

Check if the raw channel is in npy format

Returns

bool

True if the raw channel is in npy format

property has_tiles#
property is_tiled#

Check if the raw channel is tiled (has x and y tiles)

Returns

bool

True if the raw channel is tiled

property n_channels#
property n_channels_convert#
property n_registration_steps#
property n_rigid_steps_to_run#
property n_wobbly_steps_to_run#
property prefix#

Get the prefix to use for the files

Returns

str

The prefix to use, None to not use any

property raw_stitched_shape#
property ref_pts_path#
property resampled_pts_path#
property resampled_shape#
property was_registered#
property was_stitched_rigid#
init_preprocessor(folder, atlas_base_name=None, convert_tiles=False)[source]#
main()[source]#