nipype.interfaces.niftyseg.label_fusion module¶
The fusion module provides higher-level interfaces to some of the operations that can be performed with the seg_LabFusion command-line program.
CalcTopNCC¶
Bases: NiftySegCommand
Wrapped executable:
seg_CalcTopNCC.Interface for executable seg_CalcTopNCC from NiftySeg platform.
Examples
>>> from nipype.interfaces import niftyseg >>> node = niftyseg.CalcTopNCC() >>> node.inputs.in_file = 'im1.nii' >>> node.inputs.num_templates = 2 >>> node.inputs.in_templates = ['im2.nii', 'im3.nii'] >>> node.inputs.top_templates = 1 >>> node.cmdline 'seg_CalcTopNCC -target im1.nii -templates 2 im2.nii im3.nii -n 1'
- in_file : a pathlike object or string representing an existing file
- Target file. Maps to a command-line argument:
-target %s(position: 1).- in_templates : a list of items which are a pathlike object or string representing an existing file
- Maps to a command-line argument:
%s(position: 3).- num_templates : an integer (int or long)
- Number of Templates. Maps to a command-line argument:
-templates %s(position: 2).- top_templates : an integer (int or long)
- Number of Top Templates. Maps to a command-line argument:
-n %s(position: 4).
- args : a unicode string
- Additional parameters to the command. Maps to a command-line argument:
%s.- 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:
{})- mask_file : a pathlike object or string representing an existing file
- Filename of the ROI for label fusion. Maps to a command-line argument:
-mask %s.out_files : any value
CalcTopNCC.aggregate_outputs(runtime=None, needed_outputs=None)¶Collate expected outputs and apply output traits validation.
LabelFusion¶
Bases: NiftySegCommand
Wrapped executable:
seg_LabFusion.Interface for executable seg_LabelFusion from NiftySeg platform using type STEPS as classifier Fusion.
This executable implements 4 fusion strategies (-STEPS, -STAPLE, -MV or - SBA), all of them using either a global (-GNCC), ROI-based (-ROINCC), local (-LNCC) or no image similarity (-ALL). Combinations of fusion algorithms and similarity metrics give rise to different variants of known algorithms. As an example, using LNCC and MV as options will run a locally weighted voting strategy with LNCC derived weights, while using STAPLE and LNCC is equivalent to running STEPS as per its original formulation. A few other options pertaining the use of an MRF (-MRF beta), the initial sensitivity and specificity estimates and the use of only non-consensus voxels (-unc) for the STAPLE and STEPS algorithm. All processing can be masked (-mask), greatly reducing memory consumption.
As an example, the command to use STEPS should be: seg_LabFusion -in 4D_Propragated_Labels_to_fuse.nii -out FusedSegmentation.nii -STEPS 2 15 TargetImage.nii 4D_Propagated_Intensities.nii
Examples
>>> from nipype.interfaces import niftyseg >>> node = niftyseg.LabelFusion() >>> node.inputs.in_file = 'im1.nii' >>> node.inputs.kernel_size = 2.0 >>> node.inputs.file_to_seg = 'im2.nii' >>> node.inputs.template_file = 'im3.nii' >>> node.inputs.template_num = 2 >>> node.inputs.classifier_type = 'STEPS' >>> node.cmdline 'seg_LabFusion -in im1.nii -STEPS 2.000000 2 im2.nii im3.nii -out im1_steps.nii'
- classifier_type : ‘STEPS’ or ‘STAPLE’ or ‘MV’ or ‘SBA’
- Type of Classifier Fusion. Maps to a command-line argument:
-%s(position: 2).- file_to_seg : a pathlike object or string representing an existing file
- Original image to segment (3D Image).
- in_file : a pathlike object or string representing an existing file
- Filename of the 4D integer label image. Maps to a command-line argument:
-in %s(position: 1).
- args : a unicode string
- Additional parameters to the command. Maps to a command-line argument:
%s.- conv : a float
- Ratio for convergence (default epsilon = 10^-5). Maps to a command-line argument:
-conv %f.- dilation_roi : an integer (int or long)
- Dilation of the ROI ( <int> d>=1 ).
- 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:
{})- kernel_size : a float
- Gaussian kernel size in mm to compute the local similarity.
- mask_file : a pathlike object or string representing an existing file
- Filename of the ROI for label fusion. Maps to a command-line argument:
-mask %s.- max_iter : an integer (int or long)
- Maximum number of iterations (default = 15). Maps to a command-line argument:
-max_iter %d.- mrf_value : a float
- MRF prior strength (between 0 and 5). Maps to a command-line argument:
-MRF_beta %f.- out_file : a pathlike object or string representing a file
- Output consensus segmentation. Maps to a command-line argument:
-out %s.- prob_flag : a boolean
- Probabilistic/Fuzzy segmented image. Maps to a command-line argument:
-outProb.- prob_update_flag : a boolean
- Update label proportions at each iteration. Maps to a command-line argument:
-prop_update.- proportion : a float
- Proportion of the label (only for single labels). Maps to a command-line argument:
-prop %s.- set_pq : a tuple of the form: (a float, a float)
- Value of P and Q [ 0 < (P,Q) < 1 ] (default = 0.99 0.99). Maps to a command-line argument:
-setPQ %f %f.- sm_ranking : ‘ALL’ or ‘GNCC’ or ‘ROINCC’ or ‘LNCC’
- Ranking for STAPLE and MV. Maps to a command-line argument:
-%s(position: 3). (Nipype default value:ALL)- template_file : a pathlike object or string representing an existing file
- Registered templates (4D Image).
- template_num : an integer (int or long)
- Number of labels to use.
- unc : a boolean
- Only consider non-consensus voxels to calculate statistics. Maps to a command-line argument:
-unc.- unc_thresh : a float
- If <float> percent of labels agree, then area is not uncertain. Maps to a command-line argument:
-uncthres %f.- verbose : ‘0’ or ‘1’ or ‘2’
- Verbose level [0 = off, 1 = on, 2 = debug] (default = 0). Maps to a command-line argument:
-v %s.
- out_file : a pathlike object or string representing an existing file
- Image written after calculations.
LabelFusion.get_staple_args(ranking)¶
LabelFusion.get_steps_args()¶
