Postprocess module

PyMIALSRTK postprocessing functions.

It encompasses a High Resolution mask refinement and an N4 global bias field correction.

FilenamesGeneration

Link to code

Bases: nipype.interfaces.base.core.BaseInterface

Generates final filenames from outputs of super-resolution reconstruction.

Example

>>> from pymialsrtk.interfaces.postprocess import FilenamesGeneration
>>> filenamesGen = FilenamesGeneration()
>>> filenamesGen.inputs.sub_ses = 'sub-01'
>>> filenamesGen.inputs.stacks_order = [3,1,4]
>>> filenamesGen.inputs.sr_id = 3
>>> filenamesGen.inputs.use_manual_masks = False
>>> filenamesGen.run() # doctest: +SKIP
sr_id : an integer (int or long)
Super-Resolution id.
stacks_order : a list of items which are any value
List of stack run-id that specify the order of the stacks.
sub_ses : a unicode string
Subject and session BIDS identifier to construct output filename.
use_manual_masks : a boolean
Whether masks were computed or manually performed.
substitutions : a list of items which are any value
Output correspondance between old and new filenames.
FilenamesGeneration.m_substitutions = []

MialsrtkN4BiasFieldCorrection

Link to code

Bases: nipype.interfaces.base.core.BaseInterface

Runs the MIAL SRTK slice by slice N4 bias field correction module.

This tools implements the method proposed by Tustison et al. [1]_ slice by slice.

References

[1]Tustison et al.; Medical Imaging, IEEE Transactions, 2010. (link to paper)

Example

>>> from pymialsrtk.interfaces.preprocess import MialsrtkSliceBySliceN4BiasFieldCorrection
>>> N4biasFieldCorr = MialsrtkSliceBySliceN4BiasFieldCorrection()
>>> N4biasFieldCorr.inputs.bids_dir = '/my_directory'
>>> N4biasFieldCorr.inputs.input_image = 'sub-01_acq-haste_run-1_SR.nii.gz'
>>> N4biasFieldCorr.inputs.input_mask = 'sub-01_acq-haste_run-1_mask.nii.gz'
>>> N4biasFieldCorr.run() # doctest: +SKIP
bids_dir : a directory name
BIDS root directory.
input_image : a pathlike object or string representing a file
Input image filename to be normalized.
input_mask : a pathlike object or string representing a file
Input mask filename.
out_fld_postfix : a unicode string
(Nipype default value: _gbcorrfield)
out_im_postfix : a unicode string
(Nipype default value: _gbcorr)
output_field : a pathlike object or string representing a file
Output bias field extracted from input image.
output_image : a pathlike object or string representing a file
Output corrected image.

MialsrtkRefineHRMaskByIntersection

Link to code

Bases: nipype.interfaces.base.core.BaseInterface

Runs the MIAL SRTK mask refinement module.

It uses the Simultaneous Truth And Performance Level Estimate (STAPLE) by Warfield et al. [1]_.

References

[1]Warfield et al.; Medical Imaging, IEEE Transactions, 2004. (link to paper)

Example

>>> from pymialsrtk.interfaces.postprocess import MialsrtkRefineHRMaskByIntersection
>>> refMask = MialsrtkRefineHRMaskByIntersection()
>>> refMask.inputs.bids_dir = '/my_directory'
>>> refMask.inputs.input_images = ['sub-01_acq-haste_run-1_T2w.nii.gz','sub-01_acq-haste_run-2_T2w.nii.gz']
>>> refMask.inputs.input_masks = ['sub-01_acq-haste_run-1_mask.nii.gz','sub-01_acq-haste_run-2_mask.nii.gz']
>>> refMask.inputs.input_transforms = ['sub-01_acq-haste_run-1_transform.txt','sub-01_acq-haste_run-2_transform.nii.gz']
>>> refMask.inputs.input_sr = 'sr_image.nii.gz'
>>> refMask.run()  # doctest: +SKIP
bids_dir : a directory name
BIDS root directory.
input_sr : a pathlike object or string representing a file
SR image filename.
in_use_staple : a boolean
Use STAPLE for voting (default is True). If False, Majority voting is used instead. (Nipype default value: True)
input_images : a list of items which are a pathlike object or string representing a file
Image filenames used in SR reconstruction.
input_masks : a list of items which are a pathlike object or string representing a file
Mask filenames.
input_rad_dilatation : an integer (int or long)
Radius of the structuring element (ball). (Nipype default value: 1)
input_transforms : a list of items which are a pathlike object or string representing a file
Transformation filenames.
out_lrmask_postfix : a unicode string
Suffix to be added to the Low resolution input_masks. (Nipype default value: _LRmask)
out_srmask_postfix : a unicode string
Suffix to be added to the SR reconstruction filename to construct output SR mask filename. (Nipype default value: _srMask)
output_lrmasks : a list of items which are a pathlike object or string representing a file
Output low-resolution reconstruction refined masks.
output_srmask : a pathlike object or string representing a file
Output super-resolution reconstruction refined mask.
pymialsrtk.interfaces.postprocess.binarize_image(input_image)[source]