From 0f91f7f24ef7462463644c28c870ab949d032c71 Mon Sep 17 00:00:00 2001
From: Priscille
Date: Fri, 30 Oct 2020 10:22:13 +0100
Subject: [PATCH] DOC: Update documentation for
SliceBySliceN4BiasFieldCorrection - multiple and single.
---
pymialsrtk/interfaces/preprocess.py | 51 +++++++++++++++++++++++++++--
1 file changed, 49 insertions(+), 2 deletions(-)
diff --git a/pymialsrtk/interfaces/preprocess.py b/pymialsrtk/interfaces/preprocess.py
index faae7c785..392677997 100644
--- a/pymialsrtk/interfaces/preprocess.py
+++ b/pymialsrtk/interfaces/preprocess.py
@@ -407,6 +407,23 @@ class MialsrtkSliceBySliceN4BiasFieldCorrection(BaseInterface):
"""
Runs the MIAL SRTK slice by slice N4 bias field correction module that implements the method proposed by Tustison et al. [1]_.
+ Parameters
+ ----------
+ 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')
+
References
------------
.. [1] Tustison et al.; Medical Imaging, IEEE Transactions, 2010. `(link to paper) `_
@@ -418,8 +435,6 @@ class MialsrtkSliceBySliceN4BiasFieldCorrection(BaseInterface):
>>> N4biasFieldCorr.inputs.bids_dir = '/my_directory'
>>> N4biasFieldCorr.inputs.in_file = 'my_image.nii.gz'
>>> N4biasFieldCorr.inputs.in_mask = 'my_mask.nii.gz'
- >>> N4biasFieldCorr.inputs.out_im_postfix = '_bcorr'
- >>> N4biasFieldCorr.inputs.out_fld_postfix = '_n4bias'
>>> N4biasFieldCorr.run() # doctest: +SKIP
"""
@@ -476,6 +491,34 @@ class MultipleMialsrtkSliceBySliceN4BiasFieldCorrection(BaseInterface):
Runs on multiple images the MIAL SRTK slice by slice N4 bias field correction module that implements the method proposed by Tustison et al. [1]_.
Calls MialsrtkSliceBySliceN4BiasFieldCorrection interface with a list of images/masks.
+ 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')
+
+ stacksOrder >
+ order of images index. To ensure images are processed with their correct corresponding mask.
+
+ Example
+ ----------
+ >>> from pymialsrtk.interfaces.preprocess import MultipleMialsrtkSliceBySliceN4BiasFieldCorrection
+ >>> multiN4biasFieldCorr = MialsrtkSliceBySliceN4BiasFieldCorrection()
+ >>> multiN4biasFieldCorr.inputs.bids_dir = '/my_directory'
+ >>> multiN4biasFieldCorr.inputs.in_file = ['my_image01.nii.gz', 'my_image02.nii.gz']
+ >>> multiN4biasFieldCorr.inputs.in_mask = ['my_mask01.nii.gz', 'my_mask02.nii.gz']
+ >>> multiN4biasFieldCorr.inputs.stacksOrder = [0,1]
+ >>> multiN4biasFieldCorr.run() # doctest: +SKIP
+
See also
------------
pymialsrtk.interfaces.preprocess.MialsrtkSliceBySliceN4BiasFieldCorrection
@@ -491,6 +534,10 @@ class MultipleMialsrtkSliceBySliceN4BiasFieldCorrection(BaseInterface):
def _run_interface(self, runtime):
+ # ToDo: self.inputs.stacksOrder not tested
+ if not self.inputs.stacksOrder:
+ self.inputs.stacksOrder = list(range(0, len(self.inputs.input_images)))
+
run_nb_images = []
for in_file in self.inputs.input_images:
cut_avt = in_file.split('run-')[1]