nabu.stitching.config module

nabu.stitching.config.str_to_shifts(my_str: str | None) str | tuple[source]
class nabu.stitching.config.SlurmConfig(partition: str = '', mem: str = '128', n_jobs: int = 1, other_options: str = '', preprocessing_command: str = '', clean_script: bool = '', n_tasks: int = 1, n_cpu_per_task: int = 4)[source]

Bases: object

configuration for slurm jobs

partition: str = ''
mem: str = '128'
n_jobs: int = 1
other_options: str = ''
preprocessing_command: str = ''
clean_script: bool = ''
n_tasks: int = 1
n_cpu_per_task: int = 4
to_dict() dict[source]

dump configuration to dict

static from_dict(config: dict)[source]
class nabu.stitching.config.StitchingType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Z_PREPROC = 'z-preproc'
Z_POSTPROC = 'z-postproc'
class nabu.stitching.config.StitchingConfiguration(axis_0_pos_px: tuple | str | None, axis_1_pos_px: tuple | str | None, axis_2_pos_px: tuple | str | None, axis_0_pos_mm: tuple | str | None = None, axis_1_pos_mm: tuple | str | None = None, axis_2_pos_mm: tuple | str | None = None, axis_0_params: dict = None, axis_1_params: dict = None, axis_2_params: dict = None, slurm_config: SlurmConfig = None, flip_lr: tuple | bool = False, flip_ud: tuple | bool = False, overwrite_results: bool = False, stitching_strategy: OverlapStitchingStrategy = OverlapStitchingStrategy.COSINUS_WEIGHTS, stitching_kernels_extra_params: dict = None, slice_for_cross_correlation: str | int = 'middle', rescale_frames: bool = False, rescale_params: dict = None)[source]

Bases: object

bass class to define stitching configuration

axis_0_pos_px: tuple | str | None

px

Type:

position along axis 0 in absolute. unit

axis_1_pos_px: tuple | str | None

px

Type:

position along axis 1 in absolute. unit

axis_2_pos_px: tuple | str | None

px

Type:

position along axis 2 in absolute. unit

axis_0_pos_mm: tuple | str | None = None

mm

Type:

position along axis 0 in absolute. unit

axis_1_pos_mm: tuple | str | None = None

mm

Type:

position along axis 0 in absolute. unit

axis_2_pos_mm: tuple | str | None = None

mm

Type:

position along axis 0 in absolute. unit

axis_0_params: dict = None
axis_1_params: dict = None
axis_2_params: dict = None
slurm_config: SlurmConfig = None
flip_lr: tuple | bool = False

flip frame left-right. For scan this will happen after possible flip of NXtomo metadata x_flipped field (also know as lr_flipped)

flip_ud: tuple | bool = False

flip frame up-down. For scan this will happen after possible flip of NXtomo metadata y_flipped field (also know as ud_flipped)

overwrite_results: bool = False
stitching_strategy: OverlapStitchingStrategy = 'cosinus weights'
stitching_kernels_extra_params: dict = None
slice_for_cross_correlation: str | int = 'middle'
rescale_frames: bool = False
rescale_params: dict = None
property stitching_type
static get_description_dict() dict[source]
to_dict()[source]

dump configuration to a dict. Must be serializable because might be dump to HDF5 file

class nabu.stitching.config.ZStitchingConfiguration(axis_0_pos_px: tuple | str | None, axis_1_pos_px: tuple | str | None, axis_2_pos_px: tuple | str | None, axis_0_pos_mm: tuple | str | None = None, axis_1_pos_mm: tuple | str | None = None, axis_2_pos_mm: tuple | str | None = None, axis_0_params: dict = None, axis_1_params: dict = None, axis_2_params: dict = None, slurm_config: SlurmConfig = None, flip_lr: tuple | bool = False, flip_ud: tuple | bool = False, overwrite_results: bool = False, stitching_strategy: OverlapStitchingStrategy = OverlapStitchingStrategy.COSINUS_WEIGHTS, stitching_kernels_extra_params: dict = None, slice_for_cross_correlation: str | int = 'middle', rescale_frames: bool = False, rescale_params: dict = None, slices: slice | tuple | None = None)[source]

Bases: StitchingConfiguration

base class to define z-stitching parameters

slices: slice | tuple | None = None
settle_inputs() None[source]
settle_slices() tuple[source]
get_output_object()[source]
to_dict()[source]

dump configuration to a dict. Must be serializable because might be dump to HDF5 file

class nabu.stitching.config.PreProcessedZStitchingConfiguration(axis_0_pos_px: tuple | str | None, axis_1_pos_px: tuple | str | None, axis_2_pos_px: tuple | str | None, axis_0_pos_mm: tuple | str | None = None, axis_1_pos_mm: tuple | str | None = None, axis_2_pos_mm: tuple | str | None = None, axis_0_params: dict = None, axis_1_params: dict = None, axis_2_params: dict = None, slurm_config: SlurmConfig = None, flip_lr: tuple | bool = False, flip_ud: tuple | bool = False, overwrite_results: bool = False, stitching_strategy: OverlapStitchingStrategy = OverlapStitchingStrategy.COSINUS_WEIGHTS, stitching_kernels_extra_params: dict = None, slice_for_cross_correlation: str | int = 'middle', rescale_frames: bool = False, rescale_params: dict = None, slices: slice | tuple | None = None, input_scans: tuple = (), output_file_path: str = '', output_data_path: str = '', output_nexus_version: float | None = None, pixel_size: float | None = None)[source]

Bases: ZStitchingConfiguration

base class to define z-stitching parameters

input_scans: tuple = ()
output_file_path: str = ''
output_data_path: str = ''
output_nexus_version: float | None = None
pixel_size: float | None = None
property stitching_type: StitchingType
get_output_object()[source]
settle_inputs() None[source]
settle_input_scans()[source]
slice_idx_from_str_to_int(index)[source]
settle_slices() tuple[source]

interpret the slices to be stitched if needed

Nore: if slices is an instance of slice will redefine start and stop to avoid having negative indexes

Returns:

(slices:[slice,Iterable], n_proj:int)

Return type:

tuple

to_dict()[source]

dump configuration to a dict. Must be serializable because might be dump to HDF5 file

static get_description_dict() dict[source]
static from_dict(config: dict)[source]
class nabu.stitching.config.PostProcessedZStitchingConfiguration(axis_0_pos_px: tuple | str | None, axis_1_pos_px: tuple | str | None, axis_2_pos_px: tuple | str | None, axis_0_pos_mm: tuple | str | None = None, axis_1_pos_mm: tuple | str | None = None, axis_2_pos_mm: tuple | str | None = None, axis_0_params: dict = None, axis_1_params: dict = None, axis_2_params: dict = None, slurm_config: SlurmConfig = None, flip_lr: tuple | bool = False, flip_ud: tuple | bool = False, overwrite_results: bool = False, stitching_strategy: OverlapStitchingStrategy = OverlapStitchingStrategy.COSINUS_WEIGHTS, stitching_kernels_extra_params: dict = None, slice_for_cross_correlation: str | int = 'middle', rescale_frames: bool = False, rescale_params: dict = None, slices: slice | tuple | None = None, input_volumes: tuple = (), output_volume: VolumeIdentifier | None = None, voxel_size: float | None = None)[source]

Bases: ZStitchingConfiguration

base class to define z-stitching parameters

input_volumes: tuple = ()
output_volume: VolumeIdentifier | None = None
voxel_size: float | None = None
property stitching_type: StitchingType
get_output_object()[source]
settle_inputs() None[source]
settle_input_volumes()[source]
slice_idx_from_str_to_int(index)[source]
settle_slices() tuple[source]

interpret the slices to be stitched if needed

Nore: if slices is an instance of slice will redefine start and stop to avoid having negative indexes

Returns:

(slices:[slice,Iterable], n_proj:int)

Return type:

tuple

static from_dict(config: dict)[source]
to_dict()[source]

dump configuration to a dict. Must be serializable because might be dump to HDF5 file

static get_description_dict() dict[source]
nabu.stitching.config.identifiers_as_str_to_instances(list_identifiers_as_str: str) tuple[source]
nabu.stitching.config.dict_to_config_obj(config: dict)[source]
nabu.stitching.config.get_default_stitching_config(stitching_type: StitchingType | str | None) tuple[source]

Return a default configuration for doing stitching.

Parameters:

stitching_type – if None then return a configuration were use can provide inputs for any of the stitching. Else return config dict dedicated to a particular stitching

Returns:

(config, section comments)