dosma.register

dosma.register(target: ~typing.Union[~dosma.core.med_volume.MedicalVolume, str], moving: ~typing.Union[~dosma.core.med_volume.MedicalVolume, str, ~typing.Sequence[~typing.Union[~dosma.core.med_volume.MedicalVolume, str]]], parameters: ~typing.Union[str, ~typing.Sequence[str]], output_path: str, target_mask: ~typing.Optional[~typing.Union[~dosma.core.med_volume.MedicalVolume, str]] = None, moving_masks: ~typing.Optional[~typing.Union[~dosma.core.med_volume.MedicalVolume, str, ~typing.Sequence[~typing.Union[~dosma.core.med_volume.MedicalVolume, str]]]] = None, sequential: bool = False, collate: bool = True, num_workers: int = 0, num_threads: int = 1, show_pbar: bool = False, return_volumes: bool = False, rtype: type = <class 'dict'>, **kwargs)[source]

Register moving image(s) to the target.

MedVolOrPath is a shorthand for Union[MedicalVolume, str, Path]. It indicates the argument can be either a MedicalVolume or a path to a nifti file.

Parameters:
  • target (MedicalVolume or str) – The target/fixed image.

  • moving (MedicalVolume(s) or str(s)) – The moving/source image(s).

  • parameters (str(s)) – Elastix parameter files to use.

  • output_path (str) – Output directory to store files.

  • target_mask (MedicalVolume or str, optional) – The target/fixed mask.

  • moving_masks (MedicalVolume(s) or str(s), optional) – The moving mask(s). If only one specified, the mask will be used for all moving images.

  • sequential (bool, optional) – If True, apply parameter files sequentially.

  • collate (bool, optional) – If True, will collate outputs from sequential registration into single RegistrationOutputSpec instance. If sequential=False, this argument is ignored.

  • num_workers (int, optional) – Number of workers to use for reading and writing data and for registration.

  • num_threads (int, optional) – Number of threads to use for registration. Note total number of threads used will be num_workers * num_threads.

  • show_pbar (bool, optional) – If True, show progress bar during registration. Note the progress bar will not be shown for intermediate reading/writing.

  • return_volumes (bool, optional) – If True, registered volumes will also be returned. By default, only the output namespaces (RegistrationOutputSpec) of the registrations are returned.

  • rtype (type, optional) – The return type. Either dict or tuple.

  • kwargs – Keyword arguments used to initialize nipype.interfaces.elastix.Registration.

Returns:

Type specified by rtype. If rtype=dict, returns dict with keys 'outputs' and 'volumes' (if return_volumes=True). If rtype=tuple, returns (outputs, volumes or None). Length of outputs and volumes depends on number of images specified in moving:

outputs (Sequence[RegistrationOutputSpec]): The output objects from elastix registration, one for each moving image. Each object is effectively a namespace with four main attributes:

  • ’transform’ (List[str]): Paths to transform files produced using registration.

  • ’warped_file’ (str): Path to the final registered image.

  • ’warped_files’ (List[str]): Paths to all intermediate images created if multiple parameter files used.

volumes (Sequence[MedicalVolume]): Registered volumes.

Return type:

Dict or Tuple