diff --git a/pymialsrtk/interfaces/postprocess.py b/pymialsrtk/interfaces/postprocess.py index b9d87aaad..ae5ab20b6 100644 --- a/pymialsrtk/interfaces/postprocess.py +++ b/pymialsrtk/interfaces/postprocess.py @@ -27,50 +27,12 @@ ####################### class MialsrtkRefineHRMaskByIntersectionInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MialsrtkRefineHRMaskByIntersection interface. - - Attributes - ---------- - bids_dir - BIDS root directory (required) - - input_images > - Input image filenames (required) - - input_masks > - Mask of the input images (required) - - input_transforms > - Input transformation filenames (required) - - input_sr - SR reconstruction filename (required) - - input_rad_dilatation - Radius of the structuring element (ball) used for binary morphological dilation (default is 1) - - in_use_staple - Use STAPLE for voting (default is True). If STAPLE is not used, Majority Voting is used instead. - - out_lrmask_postfix - suffix added to construct output low-resolution mask filenames (default is '_LRmask') - - out_srmask_postfix - suffix added to construct output super-resolution mask filename (default is '_srMask') - - stacks_order > - order of images index. To ensure images are processed with their correct corresponding mask. - - See Also - ---------- - pymialsrtk.interfaces.preprocess.MialsrtkRefineHRMaskByIntersection - - """ + """Class used to represent inputs of the MialsrtkRefineHRMaskByIntersection interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - input_images = InputMultiPath(File(desc='Image filenames used in SR reconstruction', mandatory=True)) - input_masks = InputMultiPath(File(desc='Mask filenames', mandatory=True)) - input_transforms = InputMultiPath(File(desc='Transformation filenames', mandatory=True)) + input_images = InputMultiPath(File(mandatory=True), desc='Image filenames used in SR reconstruction') + input_masks = InputMultiPath(File(mandatory=True), desc='Mask filenames') + input_transforms = InputMultiPath(File(mandatory=True), desc='Transformation filenames') input_sr = File(desc='SR image filename', mandatory=True) input_rad_dilatation = traits.Int(1,desc='Radius of the structuring element (ball)', usedefault=True) @@ -84,24 +46,10 @@ class MialsrtkRefineHRMaskByIntersectionInputSpec(BaseInterfaceInputSpec): class MialsrtkRefineHRMaskByIntersectionOutputSpec(TraitedSpec): - """Class used to represent outputs of the MialsrtkRefineHRMaskByIntersection interface. - - Attributes - ----------- - output_lrmasks - Output refined low-resolution mask file - - output_srmask - Output refined high-resolution mask file - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkRefineHRMaskByIntersection - - """ + """Class used to represent outputs of the MialsrtkRefineHRMaskByIntersection interface.""" output_srmask = File(desc='Output super-resolution reconstruction refined mask') - output_lrmasks = OutputMultiPath(File(desc='Output low-resolution reconstruction refined masks')) + output_lrmasks = OutputMultiPath(File(), desc='Output low-resolution reconstruction refined masks') class MialsrtkRefineHRMaskByIntersection(BaseInterface): @@ -184,30 +132,7 @@ def _list_outputs(self): ############################ class MialsrtkN4BiasFieldCorrectionInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MialsrtkN4BiasFieldCorrection interface. - - Attributes - ---------- - bids_dir - BIDS root directory (required) - - input_image - Input image filename (required) - - input_mask - Mask of the input image - - out_im_postfix - suffix added to construct output image corrected filename (default is '_gbcorr') - - out_fld_postfix - suffix added to construct output bias field filename (default is '_gbcorrfield') - - See Also - ---------- - pymialsrtk.interfaces.preprocess.MialsrtkN4BiasFieldCorrection - - """ + """Class used to represent inputs of the MialsrtkN4BiasFieldCorrection interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) input_image = File(desc='Input image filename to be normalized', mandatory=True) @@ -218,21 +143,7 @@ class MialsrtkN4BiasFieldCorrectionInputSpec(BaseInterfaceInputSpec): class MialsrtkN4BiasFieldCorrectionOutputSpec(TraitedSpec): - """Class used to represent outputs of the MialsrtkN4BiasFieldCorrection interface. - - Attributes - ----------- - output_image - Output corrected image file - - output_field - Output field file - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkN4BiasFieldCorrection - - """ + """Class used to represent outputs of the MialsrtkN4BiasFieldCorrection interface.""" output_image = File(desc='Output corrected image') output_field = File(desc='Output bias field extracted from input image') @@ -297,49 +208,18 @@ def _list_outputs(self): ############################ class FilenamesGenerationInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the FilenamesGeneration interface. - - Attributes - ---------- - sub_ses - Subject and session BIDS identifier to construct output filename. - - stacks_order > - List of stack run-id that specify the order of the stacks - - sr_id - Super-Resolution id - - use_manual_masks - Whether masks were computed or manually performed. - - See Also - ---------- - pymialsrtk.interfaces.preprocess.FilenamesGeneration + """Class used to represent inputs of the FilenamesGeneration interface.""" - """ - - sub_ses = traits.Str(mandatory=True) - stacks_order = traits.List(mandatory=True) - sr_id = traits.Int(mandatory=True) - use_manual_masks = traits.Bool(mandatory=True) + sub_ses = traits.Str(mandatory=True, desc='Subject and session BIDS identifier to construct output filename.') + stacks_order = traits.List(mandatory=True, desc='List of stack run-id that specify the order of the stacks') + sr_id = traits.Int(mandatory=True, desc='Super-Resolution id') + use_manual_masks = traits.Bool(mandatory=True, desc='Whether masks were computed or manually performed.') class FilenamesGenerationOutputSpec(TraitedSpec): - """Class used to represent outputs of the FilenamesGeneration interface. - - Attributes - ----------- - substitutions , list> - Output correspondance between old and new filenames. - - See also - -------------- - pymialsrtk.interfaces.preprocess.FilenamesGeneration - - """ + """Class used to represent outputs of the FilenamesGeneration interface.""" - substitutions = traits.List(desc='Correspondence old/new filenames') + substitutions = traits.List(desc='Output correspondance between old and new filenames.') class FilenamesGeneration(BaseInterface): diff --git a/pymialsrtk/interfaces/preprocess.py b/pymialsrtk/interfaces/preprocess.py index 2b1769e61..cd718765f 100644 --- a/pymialsrtk/interfaces/preprocess.py +++ b/pymialsrtk/interfaces/preprocess.py @@ -49,53 +49,23 @@ ############### class BtkNLMDenoisingInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the BtkNLMDenoising interface. - - Attributes - ---------- - bids_dir - BIDS root directory (required) - - in_file - Input image file (required) - - in_mask - Mask of the input image - - out_postfix - suffix added to input image filename to construct output filename (default is '_nlm') - - weight - smoothing parameter (high beta produces smoother result, default is 0.1) - - See Also - ---------- - pymialsrtk.interfaces.preprocess.BtkNLMDenoising - - """ + """Class used to represent inputs of the BtkNLMDenoising interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) in_file = File(desc='Input image filename', mandatory=True) in_mask = File(desc='Input mask filename', mandatory=False) - out_postfix = traits.Str("_nlm", desc='Suffix to be added to input image filename to construst denoised output filename', usedefault=True) - weight = traits.Float(0.1, desc='NLM smoothing parameter (0.1 by default)', usedefault=True) + out_postfix = traits.Str("_nlm", + desc='Suffix to be added to input image filename to construst denoised output filename', + usedefault=True) + weight = traits.Float(0.1, + desc='NLM smoothing parameter (high beta produces smoother result)', + usedefault=True) class BtkNLMDenoisingOutputSpec(TraitedSpec): - """Class used to represent outputs of the BtkNLMDenoising interface. + """Class used to represent outputs of the BtkNLMDenoising interface.""" - Attributes - ----------- - out_file - Output denoised image file - - See also - -------------- - pymialsrtk.interfaces.preprocess.BtkNLMDenoising - - """ - - out_file = File(desc='Output denoised image') + out_file = File(desc='Output denoised image file') class BtkNLMDenoising(BaseInterface): @@ -149,53 +119,23 @@ def _list_outputs(self): class MultipleBtkNLMDenoisingInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MultipleBtkNLMDenoising interface. - - Attributes - ---------- - bids_dir - BIDS root directory (required) - - input_images > - Input image files (required) - - input_masks > - Masks of the input images - - out_postfix - suffix added to images files to construct output filenames (default is '_nlm') - - weight - smoothing parameter (high beta produces smoother result, default is 0.1) - - See Also - ---------- - pymialsrtk.interfaces.preprocess.MultipleBtkNLMDenoising - - """ + """Class used to represent inputs of the MultipleBtkNLMDenoising interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - input_images = InputMultiPath(File(desc='Input image filenames to be denoised', mandatory=True)) - input_masks = InputMultiPath(File(desc='Input mask filenames', mandatory=False)) - weight = traits.Float(0.1, desc='NLM smoothing parameter (0.1 by default)', usedefault=True) - out_postfix = traits.Str("_nlm", desc='Suffix to be added to input image filenames to construst denoised output filenames',usedefault=True) + input_images = InputMultiPath(File(mandatory=True), desc='Input image filenames to be denoised') + input_masks = InputMultiPath(File(mandatory=False), desc='Input mask filenames') + weight = traits.Float(0.1, + desc='NLM smoothing parameter (high beta produces smoother result)', + usedefault=True) + out_postfix = traits.Str("_nlm", + desc='Suffix to be added to input image filenames to construst denoised output filenames', + usedefault=True) class MultipleBtkNLMDenoisingOutputSpec(TraitedSpec): - """Class used to represent outputs of the MultipleBtkNLMDenoising interface. + """Class used to represent outputs of the MultipleBtkNLMDenoising interface.""" - Attributes - ----------- - output_images list<> - Output denoised images - - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleBtkNLMDenoising - - """ - - output_images = OutputMultiPath(File(desc='Output denoised images')) + output_images = OutputMultiPath(File(), desc='Output denoised images') class MultipleBtkNLMDenoising(BaseInterface): @@ -259,54 +199,24 @@ def _list_outputs(self): ############################# class MialsrtkCorrectSliceIntensityInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MialsrtkCorrectSliceIntensity interface. - - Attributes - ---------- - bids_dir - BIDS root directory (required) - - in_file - Input image file (required) - - in_mask - Masks of the input image - - out_postfix - suffix added to image filename to construct output filename (default is '') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkCorrectSliceIntensity - - """ + """Class used to represent inputs of the MialsrtkCorrectSliceIntensity interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) in_file = File(desc='Input image filename', mandatory=True) in_mask = File(desc='Input mask filename', mandatory=False) - out_postfix = traits.Str("", desc='Suffix to be added to input image file to construct corrected output filename', usedefault=True) + out_postfix = traits.Str("", + desc='Suffix to be added to input image file to construct corrected output filename', + usedefault=True) class MialsrtkCorrectSliceIntensityOutputSpec(TraitedSpec): - """Class used to represent outputs of the MialsrtkCorrectSliceIntensity interface. - - Attributes - ----------- - out_file - Output corrected image file - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkCorrectSliceIntensity - - """ + """Class used to represent outputs of the MialsrtkCorrectSliceIntensity interface.""" out_file = File(desc='Output image with corrected slice intensities') class MialsrtkCorrectSliceIntensity(BaseInterface): - """ - Runs the MIAL SRTK mean slice intensity correction module. + """Runs the MIAL SRTK mean slice intensity correction module. Example ======= @@ -343,55 +253,28 @@ def _list_outputs(self): class MultipleMialsrtkCorrectSliceIntensityInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MultipleMialsrtkCorrectSliceIntensity interface. - - Attributes - ----------- - bids_dir - BIDS root directory (required) - - input_images > - Input image files (required) - - input_masks > - Masks of the input images - - out_postfix - suffix added to images files to construct output filenames (default is '') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleMialsrtkCorrectSliceIntensity - - """ + """Class used to represent inputs of the MultipleMialsrtkCorrectSliceIntensity interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - input_images = InputMultiPath(File(desc='Input image filenames to be corrected for slice intensity', mandatory=True)) - input_masks = InputMultiPath(File(desc='Input mask filenames', mandatory=False)) - out_postfix = traits.Str("", desc='Suffix to be added to input image filenames to construct corrected output filenames',usedefault=True) + input_images = InputMultiPath(File(mandatory=True), + desc='Input image filenames to be corrected for slice intensity') + input_masks = InputMultiPath(File(mandatory=False), + desc='Input mask filenames') + out_postfix = traits.Str("", + desc='Suffix to be added to input image filenames to construct corrected output filenames', + usedefault=True) class MultipleMialsrtkCorrectSliceIntensityOutputSpec(TraitedSpec): - """Class used to represent outputs of the MultipleMialsrtkCorrectSliceIntensity interface. - - Attributes - ----------- - output_images list<> - Output slice intensity corrected images + """Class used to represent outputs of the MultipleMialsrtkCorrectSliceIntensity interface.""" - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleMialsrtkCorrectSliceIntensity - - """ - - output_images = OutputMultiPath(File(desc='Output slice intensity corrected images')) + output_images = OutputMultiPath(File(), desc='Output slice intensity corrected images') class MultipleMialsrtkCorrectSliceIntensity(BaseInterface): - """ - Apply the MIAL SRTK slice intensity correction module on multiple images. - Calls MialsrtkCorrectSliceIntensity interface with a list of images/masks. + """Apply the MIAL SRTK slice intensity correction module on multiple images. + + It calls MialsrtkCorrectSliceIntensity interface with a list of images/masks. Example ======= @@ -439,53 +322,21 @@ def _list_outputs(self): ########################################## class MialsrtkSliceBySliceN4BiasFieldCorrectionInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MialsrtkSliceBySliceN4BiasFieldCorrection interface. - - Attributes - ----------- - bids_dir - BIDS root directory (required) - - in_file - Input image file (required) - - in_mask - Masks of the input image (required) - - out_im_postfix - suffix added to image filename to construct output corrected image filename (default is '_bcorr') - - out_fld_postfix - suffix added to image filename to construct output bias field image filename (default is '_n4bias') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkSliceBySliceN4BiasFieldCorrection - - """ + """Class used to represent inputs of the MialsrtkSliceBySliceN4BiasFieldCorrection interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) in_file = File(desc='Input image', mandatory=True) in_mask = File(desc='Input mask', mandatory=True) - out_im_postfix = traits.Str("_bcorr", desc='Suffix to be added to input image filename to construct corrected output filename', usedefault=True) - out_fld_postfix = traits.Str("_n4bias", desc='Suffix to be added to input image filename to construct output bias field filename', usedefault=True) + out_im_postfix = traits.Str("_bcorr", + desc='Suffix to be added to input image filename to construct corrected output filename', + usedefault=True) + out_fld_postfix = traits.Str("_n4bias", + desc='Suffix to be added to input image filename to construct output bias field filename', + usedefault=True) class MialsrtkSliceBySliceN4BiasFieldCorrectionOutputSpec(TraitedSpec): - """Class used to represent outputs of the MialsrtkSliceBySliceN4BiasFieldCorrection interface. - - Attributes - ----------- - out_im_file - Output N4 bias field corrected image file - out_fld_file - Output bias field - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkSliceBySliceN4BiasFieldCorrection - - """ + """Class used to represent outputs of the MialsrtkSliceBySliceN4BiasFieldCorrection interface.""" out_im_file = File(desc='Filename of corrected output image from N4 bias field (slice by slice).') out_fld_file = File(desc='Filename bias field extracted slice by slice from input image.') @@ -545,57 +396,24 @@ def _list_outputs(self): class MultipleMialsrtkSliceBySliceN4BiasFieldCorrectionInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MultipleMialsrtkSliceBySliceN4BiasFieldCorrection interface. - - Attributes - ---------- - bids_dir - BIDS root directory (required) - - input_images > - Input image files (required) - - input_masks > - Masks of the input images (required) - - out_im_postfix - suffix added to image filename to construct output corrected image filename (default is '_bcorr') - - out_fld_postfix - suffix added to image filename to construct output bias field image filename (default is '_n4bias') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleMialsrtkSliceBySliceN4BiasFieldCorrection - - """ + """Class used to represent inputs of the MultipleMialsrtkSliceBySliceN4BiasFieldCorrection interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - input_images = InputMultiPath(File(desc='files to be corrected for intensity', mandatory=True)) - input_masks = InputMultiPath(File(desc='mask of files to be corrected for intensity', mandatory=True)) - out_im_postfix = traits.Str("_bcorr", desc='Suffix to be added to input image filenames to construct corrected output filenames', usedefault=True) - out_fld_postfix = traits.Str("_n4bias", desc='Suffix to be added to input image filenames to construct output bias field filenames', usedefault=True) + input_images = InputMultiPath(File(mandatory=True), desc='files to be corrected for intensity') + input_masks = InputMultiPath(File(mandatory=True), desc='mask of files to be corrected for intensity') + out_im_postfix = traits.Str("_bcorr", + desc='Suffix to be added to input image filenames to construct corrected output filenames', + usedefault=True) + out_fld_postfix = traits.Str("_n4bias", + desc='Suffix to be added to input image filenames to construct output bias field filenames', + usedefault=True) class MultipleMialsrtkSliceBySliceN4BiasFieldCorrectionOutputSpec(TraitedSpec): - """Class used to represent outputs of the MultipleMialsrtkSliceBySliceN4BiasFieldCorrection interface. + """Class used to represent outputs of the MultipleMialsrtkSliceBySliceN4BiasFieldCorrection interface.""" - Attributes - ----------- - output_images list<> - Output N4 bias field corrected images (required) - - output_fields list<> - Output bias fields (required) - - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleMialsrtkSliceBySliceN4BiasFieldCorrection - - """ - - output_images = OutputMultiPath(File(desc='Output N4 bias field corrected images')) - output_fields = OutputMultiPath(File(desc='Output bias fields')) + output_images = OutputMultiPath(File(), desc='Output N4 bias field corrected images') + output_fields = OutputMultiPath(File(), desc='Output bias fields') class MultipleMialsrtkSliceBySliceN4BiasFieldCorrection(BaseInterface): @@ -647,53 +465,19 @@ def _list_outputs(self): ##################################### class MialsrtkSliceBySliceCorrectBiasFieldInputSpec(BaseInterfaceInputSpec): - """Class used to represent outputs of the MialsrtkSliceBySliceCorrectBiasField interface. - - Attributes - ---------- - bids_dir - BIDS root directory (required) - - in_file - Input image file (required) - - in_mask - Masks of the input image (required) - - in_field - Bias field to correct in the input image (required) - - out_im_postfix - suffix added to image filename to construct output corrected image filename (default is '_bcorr') - - out_fld_postfix - suffix added to image filename to construct output bias field image filename (default is '_n4bias') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkSliceBySliceCorrectBiasField - - """ + """Class used to represent outputs of the MialsrtkSliceBySliceCorrectBiasField interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - in_file = File(desc='Input image', mandatory=True) - in_mask = File(desc='Input mask', mandatory=True) - in_field = File(desc='Input bias field', mandatory=True) - out_im_postfix = traits.Str("_bcorr", desc='Suffixe to be added to bias field corrected in_file', usedefault=True) + in_file = File(desc='Input image file', mandatory=True) + in_mask = File(desc='Input mask file', mandatory=True) + in_field = File(desc='Input bias field file', mandatory=True) + out_im_postfix = traits.Str("_bcorr", + desc='Suffix to be added to bias field corrected `in_file`', + usedefault=True) class MialsrtkSliceBySliceCorrectBiasFieldOutputSpec(TraitedSpec): - """Class used to represent outputs of the MialsrtkSliceBySliceCorrectBiasField interface. - - Attributes - ----------- - out_im_file - Output bias field corrected image file - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkSliceBySliceCorrectBiasField - """ + """Class used to represent outputs of the MialsrtkSliceBySliceCorrectBiasField interface.""" out_im_file = File(desc='Bias field corrected image') @@ -736,58 +520,25 @@ def _list_outputs(self): return outputs class MultipleMialsrtkSliceBySliceCorrectBiasFieldInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MultipleMialsrtkSliceBySliceCorrectBiasField interface. - - Attributes - ----------- - bids_dir - BIDS root directory (required) - - input_images > - Input image files (required) - - input_masks > - Masks of the input images (required) - - input_fields > - Bias fields to correct in the input images (required) - - out_im_postfix - suffix added to image filename to construct output corrected image filename (default is '_bcorr') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleMialsrtkSliceBySliceCorrectBiasField - - """ + """Class used to represent inputs of the MultipleMialsrtkSliceBySliceCorrectBiasField interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - input_images = InputMultiPath(File(desc='files to be corrected for intensity', mandatory=True)) - input_masks = InputMultiPath(File(desc='mask of files to be corrected for intensity', mandatory=True)) - input_fields = InputMultiPath(File(desc='field to remove', mandatory=True)) - out_im_postfix = traits.Str("_bcorr", desc='Suffixe to be added to bias field corrected input_images', usedefault=True) + input_images = InputMultiPath(File(mandatory=True), desc='Files to be corrected for intensity') + input_masks = InputMultiPath(File(mandatory=True), desc='Mask files to be corrected for intensity') + input_fields = InputMultiPath(File(mandatory=True), desc='Bias field files to be removed', ) + out_im_postfix = traits.Str("_bcorr", + desc='Suffix to be added to bias field corrected input_images', + usedefault=True) class MultipleMialsrtkSliceBySliceCorrectBiasFieldOutputSpec(TraitedSpec): - """Class used to represent outputs of the MultipleMialsrtkSliceBySliceCorrectBiasField interface. + """Class used to represent outputs of the MultipleMialsrtkSliceBySliceCorrectBiasField interface.""" - Attributes - ----------- - output_images list<> - Output bias field corrected images - - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleMialsrtkSliceBySliceCorrectBiasField - - """ - - output_images = OutputMultiPath(File(desc='Output bias field corrected images')) + output_images = OutputMultiPath(File(), desc='Output bias field corrected images') class MultipleMialsrtkSliceBySliceCorrectBiasField(BaseInterface): - """ - Runs the MIAL SRTK slice by slice bias field correction module on multiple images. + """Runs the MIAL SRTK slice by slice bias field correction module on multiple images. It calls :class:`pymialsrtk.interfaces.preprocess.MialsrtkSliceBySliceCorrectBiasField` interface with a list of images/masks/fields. @@ -833,30 +584,10 @@ def _list_outputs(self): ############################# class MialsrtkIntensityStandardizationInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MialsrtkIntensityStandardization interface. - - Attributes - ----------- - bids_dir - BIDS root directory (required) - - input_images > - Input image filenames (required) - - in_max - Maximum intensity (default is 255) - - out_postfix - suffix added to image filenames to construct output standardized image filenames (default is '') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkIntensityStandardization - - """ + """Class used to represent inputs of the MialsrtkIntensityStandardization interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - input_images = InputMultiPath(File(desc='files to be corrected for intensity', mandatory=True)) + input_images = InputMultiPath(File(mandatory=True), desc='Files to be corrected for intensity') out_postfix = traits.Str("", desc='Suffix to be added to intensity corrected input_images', usedefault=True) in_max = traits.Float(desc='Maximal intensity', usedefault=False) stacks_order = traits.List(desc='Order of images index. To ensure images are processed with their correct corresponding mask', @@ -864,20 +595,9 @@ class MialsrtkIntensityStandardizationInputSpec(BaseInterfaceInputSpec): class MialsrtkIntensityStandardizationOutputSpec(TraitedSpec): - """Class used to represent outputs of the MialsrtkIntensityStandardization interface. + """Class used to represent outputs of the MialsrtkIntensityStandardization interface.""" - Attributes - ----------- - output_images list<> - Output intensity standardized images - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkIntensityStandardization - - """ - - output_images = OutputMultiPath(File(desc='Images corrected for intensity')) + output_images = OutputMultiPath(File(), desc='Intensity-standardized images') class MialsrtkIntensityStandardization(BaseInterface): @@ -928,50 +648,20 @@ def _list_outputs(self): ########################### class MialsrtkHistogramNormalizationInputSpec(BaseInterfaceInputSpec): - """Class used to represent outputs of the MialsrtkHistogramNormalization interface. - - Attributes - ----------- - bids_dir - BIDS root directory (required) - - input_images > - Input image filenames (required) - - input_masks > - Masks of the input images - - out_postfix - suffix added to image filenames to construct output normalized image filenames (default is '_histnorm') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkHistogramNormalization - - """ + """Class used to represent outputs of the MialsrtkHistogramNormalization interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - input_images = InputMultiPath(File(desc='Input image filenames to be normalized', mandatory=True)) - input_masks = InputMultiPath(File(desc='Input mask filenames', mandatory=False)) - out_postfix = traits.Str("_histnorm", desc='Suffix to be added to normalized input image filenames to construct ouptut normalized image filenames', + input_images = InputMultiPath(File(mandatory=True), desc='Input image filenames to be normalized') + input_masks = InputMultiPath(File(mandatory=False), desc='Input mask filenames') + out_postfix = traits.Str("_histnorm", + desc='Suffix to be added to normalized input image filenames to construct ouptut normalized image filenames', usedefault=True) class MialsrtkHistogramNormalizationOutputSpec(TraitedSpec): - """Class used to represent outputs of the MialsrtkHistogramNormalization interface. + """Class used to represent outputs of the MialsrtkHistogramNormalization interface.""" - Attributes - ----------- - output_images list<> - Output histogram normalized images - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkHistogramNormalization - - """ - - output_images = OutputMultiPath(File(desc='Histogram normalized images')) + output_images = OutputMultiPath(File(), desc='Histogram-normalized images') class MialsrtkHistogramNormalization(BaseInterface): @@ -1034,27 +724,7 @@ def _list_outputs(self): ############## class MialsrtkMaskImageInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MialsrtkMaskImage interface. - - Attributes - ----------- - bids_dir - BIDS root directory (required) - - in_file - Input image file (required) - - in_mask - Masks of the input image (required) - - out_im_postfix - suffix added to image filename to construct output masked image filename (default is '') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkMaskImage - - """ + """Class used to represent inputs of the MialsrtkMaskImage interface.""" bids_dir = Directory(desc='BIDS root directory',mandatory=True,exists=True) in_file = File(desc='Input image filename to be masked',mandatory=True) @@ -1063,18 +733,7 @@ class MialsrtkMaskImageInputSpec(BaseInterfaceInputSpec): class MialsrtkMaskImageOutputSpec(TraitedSpec): - """Class used to represent outputs of the MialsrtkMaskImage interface. - - Attributes - ----------- - out_im_file - Output masked image - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkMaskImage - - """ + """Class used to represent outputs of the MialsrtkMaskImage interface.""" out_im_file = File(desc='Masked image') @@ -1118,52 +777,19 @@ def _list_outputs(self): class MultipleMialsrtkMaskImageInputSpec(BaseInterfaceInputSpec): - """Class used to represent outputs of the MultipleMialsrtkMaskImage interface. - - Attributes - ----------- - bids_dir - BIDS root directory (required) - - input_images > - Input image files (required) - - input_masks > - Masks of the input images (required) - - input_fields > - Bias fields to correct in the input images (required) - - out_im_postfix - suffix added to image filename to construct output masked image filenames (default is '') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleMialsrtkMaskImage - - """ + """Class used to represent outputs of the MultipleMialsrtkMaskImage interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - input_images = InputMultiPath(File(desc='Input image filenames to be corrected for intensity', mandatory=True)) - input_masks = InputMultiPath(File(desc='Input mask filenames ', mandatory=True)) + input_images = InputMultiPath(File(mandatory=True), + desc='Input image filenames to be corrected for intensity') + input_masks = InputMultiPath(File(mandatory=True), desc='Input mask filenames ') out_im_postfix = traits.Str("", desc='Suffix to be added to masked input_images', usedefault=True) class MultipleMialsrtkMaskImageOutputSpec(TraitedSpec): - """Class used to represent outputs of the MultipleMialsrtkMaskImage interface. + """Class used to represent outputs of the MultipleMialsrtkMaskImage interface.""" - Attributes - ----------- - output_images list<> - Output masked images - - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleMialsrtkMaskImage - - """ - - output_images = OutputMultiPath(File(desc='Output masked image filenames')) + output_images = OutputMultiPath(File(), desc='Output masked image filenames') class MultipleMialsrtkMaskImage(BaseInterface): @@ -1213,42 +839,17 @@ def _list_outputs(self): class FilteringByRunidInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the FilteringByRunid interface. - - Attributes - ----------- - input_files > - Input brain masks on which motion is computed. + """Class used to represent inputs of the FilteringByRunid interface.""" - stacks_id > - List of stacks id to be kept - - - See also - -------------- - pymialsrtk.interfaces.preprocess.FilteringByRunid - - """ - - input_files = InputMultiPath(File(desc='Input files', mandatory=True)) - stacks_id = traits.List() + input_files = InputMultiPath(File(mandatory=True), + desc='Input files on which motion is computed') + stacks_id = traits.List(desc='List of stacks id to be kept') class FilteringByRunidOutputSpec(TraitedSpec): - """Class used to represent outputs of the FilteringByRunid interface. - - Attributes - ----------- - output_files > - Filtered files. - - See also - -------------- - pymialsrtk.interfaces.preprocess.FilteringByRunid - - """ + """Class used to represent outputs of the FilteringByRunid interface.""" - output_files = traits.List(desc='Order of stacks') + output_files = traits.List(desc='Filtered list of stack files') class FilteringByRunid(BaseInterface): @@ -1294,37 +895,16 @@ def _filter_by_runid(self, input_files, p_stacks_id): class StacksOrderingInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the StacksOrdering interface. + """Class used to represent inputs of the StacksOrdering interface.""" - Attributes - ----------- - input_masks > - Input brain masks on which motion is computed. - - See also - -------------- - pymialsrtk.interfaces.preprocess.StacksOrdering - - """ - - input_masks = InputMultiPath(File(desc='Input masks', mandatory=True)) + input_masks = InputMultiPath(File(mandatory=True), + desc='Input brain masks on which motion is computed') class StacksOrderingOutputSpec(TraitedSpec): - """Class used to represent outputs of the StacksOrdering interface. + """Class used to represent outputs of the StacksOrdering interface.""" - Attributes - ----------- - stacks_order - Order of images' run-id to be used for reconstruction - - See also - -------------- - pymialsrtk.interfaces.preprocess.StacksOrdering - - """ - - stacks_order = traits.List(desc='Order of stacks') + stacks_order = traits.List(desc='Order of image `run-id` to be used for reconstruction') class StacksOrdering(BaseInterface): @@ -1450,61 +1030,21 @@ def _compute_stack_order(self, in_files): class BrainExtractionInputSpec(BaseInterfaceInputSpec): - """Class used to represent outputs of the BrainExtraction interface. - - Attributes - ----------- - base_dir - BIDS root directory (required) - - in_file - Input image file (required) - - in_ckpt_loc - Network_checkpoint for localization (required) - - threshold_loc - Threshold determining cutoff probability (default is 0.49) - - in_ckpt_seg - Network_checkpoint for segmentation - - threshold_seg - Threshold determining cutoff probability (default is 0.5) - - out_postfix - Suffix of the automatically generated mask (default is '_brainMask.nii.gz') - - See also - -------------- - pymialsrtk.interfaces.preprocess.BrainExtraction - - """ + """Class used to represent outputs of the BrainExtraction interface.""" bids_dir = Directory(desc='Root directory', mandatory=True, exists=True) in_file = File(desc='Input image', mandatory=True) in_ckpt_loc = File(desc='Network_checkpoint for localization', mandatory=True) threshold_loc = traits.Float(0.49, desc='Threshold determining cutoff probability (0.49 by default)') in_ckpt_seg = File(desc='Network_checkpoint for segmentation', mandatory=True) - threshold_seg = traits.Float(0.5, desc='Threshold determining cutoff probability (0.5 by default)') + threshold_seg = traits.Float(0.5, desc='Threshold for cutoff probability (0.5 by default)') out_postfix = traits.Str("_brainMask.nii.gz", desc='Suffix of the automatically generated mask', usedefault=True) class BrainExtractionOutputSpec(TraitedSpec): - """Class used to represent outputs of the BrainExtraction interface. + """Class used to represent outputs of the BrainExtraction interface.""" - Attributes - ----------- - out_file - Brain mask output image - - See also - -------------- - pymialsrtk.interfaces.preprocess.BrainExtraction - - """ - - out_file = File(desc='Brain mask image') + out_file = File(desc='Output brain mask image') class BrainExtraction(BaseInterface): @@ -2001,61 +1541,21 @@ def _list_outputs(self): class MultipleBrainExtractionInputSpec(BaseInterfaceInputSpec): - """Class used to represent outputs of the MultipleBrainExtraction interface. - - Attributes - ----------- - bids_dir - BIDS root directory (required) - - input_images list<> - List of input image file (required) - - in_ckpt_loc - Network_checkpoint for localization (required) - - threshold_loc - Threshold determining cutoff probability (default is 0.49) - - in_ckpt_seg - Network_checkpoint for segmentation - - threshold_seg - Threshold determining cutoff probability (default is 0.5) - - out_postfix - Suffix of the automatically generated mask (default is '_brainMask') - - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleBrainExtraction - - """ + """Class used to represent outputs of the MultipleBrainExtraction interface.""" bids_dir = Directory(desc='Root directory', mandatory=True, exists=True) - input_images = InputMultiPath(File(desc='MRI Images', mandatory=True)) + input_images = InputMultiPath(File(mandatory=True), desc='MRI Images') in_ckpt_loc = File(desc='Network_checkpoint for localization', mandatory=True) threshold_loc = traits.Float(0.49, desc='Threshold determining cutoff probability (0.49 by default)') in_ckpt_seg = File(desc='Network_checkpoint for segmentation', mandatory=True) threshold_seg = traits.Float(0.5, desc='Threshold determining cutoff probability (0.5 by default)') - out_postfix = traits.Str("_brainMask", desc='Suffixe of the automatically generated mask', usedefault=True) + out_postfix = traits.Str("_brainMask", desc='Suffix of the automatically generated mask', usedefault=True) class MultipleBrainExtractionOutputSpec(TraitedSpec): - """Class used to represent outputs of the MultipleBrainExtraction interface. - - Attributes - ----------- - output_images list<> - Output masks - - See also - -------------- - pymialsrtk.interfaces.preprocess.MultipleBrainExtraction - - """ + """Class used to represent outputs of the MultipleBrainExtraction interface.""" - masks = OutputMultiPath(File(desc='Output masks')) + masks = OutputMultiPath(File(), desc='Output masks') class MultipleBrainExtraction(BaseInterface): diff --git a/pymialsrtk/interfaces/reconstruction.py b/pymialsrtk/interfaces/reconstruction.py index c6284cf9b..7a991cae4 100644 --- a/pymialsrtk/interfaces/reconstruction.py +++ b/pymialsrtk/interfaces/reconstruction.py @@ -23,76 +23,43 @@ ######################## class MialsrtkImageReconstructionInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MialsrtkImageReconstruction interface. - - Attributes - ---------- - bids_dir - BIDS root directory (required) - - input_images > - Input image filenames (required) - - input_masks > - Mask of the input images (required) - - in_roi - Define region of interest (required): - - 'box': Use intersections for roi calculation - - 'mask': Use masks for roi calculation - - 'all': Use the whole image FOV - - input_rad_dilatation - Radius dilatation used in prior step to construct output filename. (default is 1.0) - - sub_ses - Subject and session BIDS identifier to construct output filename. - - out_sdi_postfix - suffix added to construct output scattered data interpolation filename (default is '_SDI') - - out_transf_postfix - suffix added to construct output transformation filenames (default is '_transform') - - stacks_order > - List of stack run-id that specify the order of the stacks - - See Also - ---------- - pymialsrtk.interfaces.preprocess.MialsrtkImageReconstruction - - """ - - bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - in_roi = traits.Enum('mask', "all", "box", "mask", mandatory=True, usedefault=True) - input_masks = InputMultiPath(File(desc='Input masks')) - input_images = InputMultiPath(File(desc='Input images')) - input_rad_dilatation = traits.Float(1.0, usedefault=True) - sub_ses = traits.Str("x", usedefault=True) - out_sdi_prefix = traits.Str("SDI_", usedefault=True) - out_transf_postfix = traits.Str("_transform", usedefault=True) - stacks_order = traits.List(mandatory=True) + """Class used to represent inputs of the MialsrtkImageReconstruction interface.""" + + bids_dir = Directory(desc='BIDS root directory', + mandatory=True, + exists=True) + in_roi = traits.Enum('mask', "all", "box", "mask", + desc="""Define region of interest (required): + - `box`: Use intersections for roi calculation + - `mask`: Use masks for roi calculation + - `all`: Use the whole image FOV""", + mandatory=True, + usedefault=True) + input_masks = InputMultiPath(File(), + desc='Masks of the input images') + input_images = InputMultiPath(File(), + desc='Input images') + input_rad_dilatation = traits.Float(1.0, + desc='Radius dilatation used in prior step to construct output filename', + usedefault=True) + sub_ses = traits.Str("x", + desc='Subject and session BIDS identifier to construct output filename', + usedefault=True) + out_sdi_prefix = traits.Str("SDI_", + desc='Suffix added to construct output scattered data interpolation filename', + usedefault=True) + out_transf_postfix = traits.Str("_transform", + desc='Suffix added to construct output transformation filenames', + usedefault=True) + stacks_order = traits.List(mandatory=True, + desc='List of stack run-id that specify the order of the stacks') class MialsrtkImageReconstructionOutputSpec(TraitedSpec): - """Class used to represent outputs of the MialsrtkImageReconstruction interface. - - Attributes - ----------- - output_sdi - Output scattered data interpolation image file - - output_transforms - Output transformation files - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkImageReconstruction - - """ + """Class used to represent outputs of the MialsrtkImageReconstruction interface.""" - output_sdi = File(desc='Output reconstructed image') - output_transforms = OutputMultiPath(File(desc='Output transformation files')) + output_sdi = File(desc='Output scattered data interpolation image file') + output_transforms = OutputMultiPath(File(), desc='Output transformation files') class MialsrtkImageReconstruction(BaseInterface): @@ -186,123 +153,70 @@ def _list_outputs(self): ##################################### class MialsrtkTVSuperResolutionInputSpec(BaseInterfaceInputSpec): - """Class used to represent inputs of the MialsrtkTVSuperResolution interface. - - Attributes - ---------- - bids_dir - BIDS root directory (required) - - input_images > - Input image filenames (required) - - input_masks > - Mask of the input images (required) - - input_transforms > - Input transformation filenames (required) - - input_sdi - Reconstructed image for initialization. Typically the output of MialsrtkImageReconstruction is used. (required) - - deblurring - Flag to set deblurring PSF during SR (double the neighborhood) (default is 0). - - in_loop - Number of loops (SR/denoising) (required) - - in_deltat - Parameter deltat (required) - - in_lambda - Regularization factor (required) - - in_bregman_loop - Number of Bregman loops (default is 1) - - in_iter - Number of inner iterations (default is 50) - - in_step_scale - Parameter step scale (default is 10.0) - - in_gamma - Parameter gamma (default is 10.0) - - in_inner_thresh - Inner loop convergence threshold (default = 1e-5) - - in_outer_thresh - Outer loop convergence threshold (default = 1e-6) - - out_prefix - prefix added to construct output super-resolution filename (default is 'SRTV_') - - stacks_order > - List of stack run-id that specify the order of the stacks - - input_rad_dilatation - Radius dilatation used in prior step to construct output filename. (default is 1.0) - - sub_ses - Subject and session BIDS identifier to construct output filename. - - See Also - ---------- - pymialsrtk.interfaces.preprocess.MialsrtkTVSuperResolution - - """ + """Class used to represent inputs of the MialsrtkTVSuperResolution interface.""" bids_dir = Directory(desc='BIDS root directory', mandatory=True, exists=True) - input_images = InputMultiPath(File(desc='files to be SR', mandatory=True)) - input_masks = InputMultiPath(File(desc='mask of files to be SR', mandatory=True)) - input_transforms = InputMultiPath(File(desc='', mandatory=True)) - input_sdi = File(File(desc='', mandatory=True)) - deblurring = traits.Bool(False, usedefault=True) - - in_loop = traits.Int(mandatory=True) - in_deltat = traits.Float(mandatory=True) - in_lambda = traits.Float(mandatory=True) - - in_bregman_loop = traits.Int(1, usedefault=True) - in_iter = traits.Int(50, usedefault=True) - in_step_scale = traits.Int(10, usedefault=True) - in_gamma = traits.Int(10, usedefault=True) - in_inner_thresh = traits.Float(0.00001, usedefault=True) - in_outer_thresh = traits.Float(0.000001, usedefault=True) - - out_prefix = traits.Str("SRTV_", usedefault=True) - stacks_order = traits.List(mandatory=False) - - input_rad_dilatation = traits.Float(1.0, usedefault=True) - - sub_ses = traits.Str("x", usedefault=True) - use_manual_masks = traits.Bool(False, usedefault=True) + input_images = InputMultiPath(File(desc='Input image filenames for super-resolution', mandatory=True)) + input_masks = InputMultiPath(File(desc='Masks of input images for super-resolution', mandatory=True)) + input_transforms = InputMultiPath(File(mandatory=True), + desc='Estimated slice-by-slice ITK transforms of input images') + input_sdi = File(File(desc='Reconstructed image for initialization. ' + 'Typically the output of MialsrtkImageReconstruction is used', + mandatory=True)) + deblurring = traits.Bool(False, + desc='Flag to set deblurring PSF during SR (double the neighborhood)', + usedefault=True) + + in_loop = traits.Int(mandatory=True, + desc='Number of loops (SR/denoising)') + in_deltat = traits.Float(mandatory=True, + desc='Parameter deltat of TV optimizer') + in_lambda = traits.Float(mandatory=True, + desc='TV regularization factor which weights the data fidelity term in TV optimizer') + + in_bregman_loop = traits.Int(1, + desc='Number of Bregman loops', + usedefault=True) + in_iter = traits.Int(50, + desc='Number of inner iterations', + usedefault=True) + in_step_scale = traits.Int(10, + desc='Parameter step scale', + usedefault=True) + in_gamma = traits.Int(10, + desc='Parameter gamma', + usedefault=True) + in_inner_thresh = traits.Float(0.00001, + desc='Inner loop convergence threshold', + usedefault=True) + in_outer_thresh = traits.Float(0.000001, + desc='Outer loop convergence threshold', + usedefault=True) + + out_prefix = traits.Str("SRTV_", + desc='Prefix added to construct output super-resolution filename', + usedefault=True) + stacks_order = traits.List(mandatory=False, + desc='List of stack run-id that specify the order of the stacks') + + input_rad_dilatation = traits.Float(1.0, + desc='Radius dilatation used in prior step to construct output filename', + usedefault=True) + sub_ses = traits.Str("x", + desc='Subject and session BIDS identifier to construct output filename', + usedefault=True) + + use_manual_masks = traits.Bool(False, + desc='Use masks of input files', + usedefault=True) class MialsrtkTVSuperResolutionOutputSpec(TraitedSpec): - """Class used to represent outputs of the MialsrtkTVSuperResolution interface. - - Attributes - ----------- - output_sr - Output super-resolution reconstruction file - - output_dict - Super-resolution reconstruction parameters summarized in a python dictionary - - output_json - Emplacement where should be saved - - See also - -------------- - pymialsrtk.interfaces.preprocess.MialsrtkTVSuperResolution - - """ + """Class used to represent outputs of the MialsrtkTVSuperResolution interface.""" - output_sr = File(desc='Super-resolution reconstruction output image') - output_dict = Dict(desc='Super-resolution reconstruction parameter dictionary') - output_json_path = File(desc='') + output_sr = File(desc='Output super-resolution image file') + output_dict = Dict(desc='Super-resolution reconstruction parameters summarized in a python dictionary') + output_json_path = File(desc='Output path where `output_dict` should be saved ') class MialsrtkTVSuperResolution(BaseInterface):