Postprocess module
PyMIALSRTK postprocessing functions.
It encompasses a High Resolution mask refinement and an N4 global bias field correction.
BinarizeImage
Bases: nipype.interfaces.base.core.BaseInterface
Runs the MIAL SRTK mask image module. .. rubric:: Example
>>> from pymialsrtk.interfaces.postprocess import BinarizeImage >>> maskImg = MialsrtkMaskImage() >>> maskImg.inputs.input_image = 'input_image.nii.gz'
- Mandatory Inputs
input_image (a pathlike object or string representing a file) – Input image filename to be binarized.
- Outputs
output_srmask (a pathlike object or string representing a file) – Image mask (binarized input).
FilenamesGeneration
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()
- Mandatory Inputs
sr_id (an integer) – 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 string) – Subject and session BIDS identifier to construct output filename.
use_manual_masks (a boolean) – Whether masks were computed or manually performed.
- Outputs
substitutions (a list of items which are any value) – Output correspondance between old and new filenames.
- FilenamesGeneration.m_substitutions = []
MialsrtkN4BiasFieldCorrection
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()
- Mandatory Inputs
bids_dir (a string or os.PathLike object referring to an existing directory) – BIDS root directory.
input_image (a pathlike object or string representing a file) – Input image filename to be normalized.
- Optional Inputs
input_mask (a pathlike object or string representing a file) – Input mask filename.
out_fld_postfix (a string) – (Nipype default value:
_gbcorrfield
)out_im_postfix (a string) – (Nipype default value:
_gbcorr
)- Outputs
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
Bases: nipype.interfaces.base.core.BaseInterface
Runs the MIALSRTK 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()
- Mandatory Inputs
bids_dir (a string or os.PathLike object referring to an existing directory) – BIDS root directory.
input_sr (a pathlike object or string representing a file) – SR image filename.
- Optional Inputs
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) – 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 string) – Suffix to be added to the Low resolution input_masks. (Nipype default value:
_LRmask
)out_srmask_postfix (a string) – Suffix to be added to the SR reconstruction filename to construct output SR mask filename. (Nipype default value:
_srMask
)- Outputs
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.