nipype.interfaces.niftyseg.patchmatch module

The fusion module provides higher-level interfaces to some of the operations that can be performed with the seg_DetectLesions command-line program.

PatchMatch

Link to code

Bases: NiftySegCommand

Wrapped executable: seg_PatchMatch.

Interface for executable seg_PatchMatch from NiftySeg platform.

The database file is a text file and in each line we have a template file, a mask with the search region to consider and a file with the label to propagate.

Input image, input mask, template images from database and masks from database must have the same 4D resolution (same number of XxYxZ voxels, modalities and/or time-points). Label files from database must have the same 3D resolution (XxYxZ voxels) than input image but can have different number of volumes than the input image allowing to propagate multiple labels in the same execution.

Source code | Documentation

Examples

>>> from nipype.interfaces import niftyseg
>>> node = niftyseg.PatchMatch()
>>> node.inputs.in_file = 'im1.nii'
>>> node.inputs.mask_file = 'im2.nii'
>>> node.inputs.database_file = 'db.xml'
>>> node.cmdline
'seg_PatchMatch -i im1.nii -m im2.nii -db db.xml -o im1_pm.nii.gz'
Mandatory Inputs:
  • database_file (a pathlike object or string representing an existing file) – Database with the segmentations. Maps to a command-line argument: -db %s (position: 3).

  • in_file (a pathlike object or string representing an existing file) – Input image to segment. Maps to a command-line argument: -i %s (position: 1).

  • mask_file (a pathlike object or string representing an existing file) – Input mask for the area where applies PatchMatch. Maps to a command-line argument: -m %s (position: 2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • cs_size (an integer) – Constrained search area size, number of times bigger than the patchsize. Maps to a command-line argument: -cs %i.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • it_num (an integer) – Number of iterations for the patchmatch algorithm. Maps to a command-line argument: -it %i.

  • match_num (an integer) – Number of better matching. Maps to a command-line argument: -match %i.

  • out_file (a pathlike object or string representing a file) – The output filename of the patchmatch results. Maps to a command-line argument: -o %s (position: 4).

  • patch_size (an integer) – Patch size, #voxels. Maps to a command-line argument: -size %i.

  • pm_num (an integer) – Number of patchmatch executions. Maps to a command-line argument: -pm %i.

Outputs:

out_file (a pathlike object or string representing a file) – Output segmentation.