Postprocess module

PyMIALSRTK postprocessing functions.

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

class pymialsrtk.interfaces.postprocess.FilenamesGeneration(*args, **kwargs)[source]

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
input_spec

alias of FilenamesGenerationInputSpec

output_spec

alias of FilenamesGenerationOutputSpec

class pymialsrtk.interfaces.postprocess.FilenamesGenerationInputSpec(*args, **kwargs)[source]

Class used to represent inputs of the FilenamesGeneration interface.

sub_ses <string>

Subject and session BIDS identifier to construct output filename.

stacks_order <list<int>>

List of stack run-id that specify the order of the stacks

sr_id <str>

Super-Resolution id

use_manual_masks <bool>

Whether masks were computed or manually performed.

See also

pymialsrtk.interfaces.preprocess.FilenamesGeneration

class pymialsrtk.interfaces.postprocess.FilenamesGenerationOutputSpec(*args, **kwargs)[source]

Class used to represent outputs of the FilenamesGeneration interface.

substitutions <list<string>, list<string>>

Output correspondance between old and new filenames.

See also

pymialsrtk.interfaces.preprocess.FilenamesGeneration

class pymialsrtk.interfaces.postprocess.MialsrtkN4BiasFieldCorrection(*args, **kwargs)[source]

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
input_spec

alias of MialsrtkN4BiasFieldCorrectionInputSpec

output_spec

alias of MialsrtkN4BiasFieldCorrectionOutputSpec

class pymialsrtk.interfaces.postprocess.MialsrtkN4BiasFieldCorrectionInputSpec(*args, **kwargs)[source]

Class used to represent inputs of the MialsrtkN4BiasFieldCorrection interface.

bids_dir <string>

BIDS root directory (required)

input_image <string>

Input image filename (required)

input_mask <string>

Mask of the input image

out_im_postfix <string>

suffix added to construct output image corrected filename (default is ‘_gbcorr’)

out_fld_postfix <string>

suffix added to construct output bias field filename (default is ‘_gbcorrfield’)

See also

pymialsrtk.interfaces.preprocess.MialsrtkN4BiasFieldCorrection

class pymialsrtk.interfaces.postprocess.MialsrtkN4BiasFieldCorrectionOutputSpec(*args, **kwargs)[source]

Class used to represent outputs of the MialsrtkN4BiasFieldCorrection interface.

output_image <string>

Output corrected image file

output_field <string>

Output field file

See also

pymialsrtk.interfaces.preprocess.MialsrtkN4BiasFieldCorrection

class pymialsrtk.interfaces.postprocess.MialsrtkRefineHRMaskByIntersection(*args, **kwargs)[source]

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
input_spec

alias of MialsrtkRefineHRMaskByIntersectionInputSpec

output_spec

alias of MialsrtkRefineHRMaskByIntersectionOutputSpec

class pymialsrtk.interfaces.postprocess.MialsrtkRefineHRMaskByIntersectionInputSpec(*args, **kwargs)[source]

Class used to represent inputs of the MialsrtkRefineHRMaskByIntersection interface.

bids_dir <string>

BIDS root directory (required)

input_images <list<string>>

Input image filenames (required)

input_masks <list<string>>

Mask of the input images (required)

input_transforms <list<string>>

Input transformation filenames (required)

input_sr <string>

SR reconstruction filename (required)

input_rad_dilatation <float>

Radius of the structuring element (ball) used for binary morphological dilation (default is 1)

in_use_staple <bool>

Use STAPLE for voting (default is True). If STAPLE is not used, Majority Voting is used instead.

out_lrmask_postfix <string>

suffix added to construct output low-resolution mask filenames (default is ‘_LRmask’)

out_srmask_postfix <string>

suffix added to construct output super-resolution mask filename (default is ‘_srMask’)

stacks_order <list<int>>

order of images index. To ensure images are processed with their correct corresponding mask.

See also

pymialsrtk.interfaces.preprocess.MialsrtkRefineHRMaskByIntersection

class pymialsrtk.interfaces.postprocess.MialsrtkRefineHRMaskByIntersectionOutputSpec(*args, **kwargs)[source]

Class used to represent outputs of the MialsrtkRefineHRMaskByIntersection interface.

output_lrmasks <string>

Output refined low-resolution mask file

output_srmask <string>

Output refined high-resolution mask file

See also

pymialsrtk.interfaces.preprocess.MialsrtkRefineHRMaskByIntersection