Skip to content

Preprocessing

Pre-processing starts from multiple T2-weighted stacks and processed each stack individually to prepare them for super-resolution reconstruction.

Available tools

Fetpype pre-processes the data in the following order.


Data Loading (→ Brain extraction)Resolution checksCroppingDenoisingBias field correctionOutput checks


The three steps in boldface are run from the fetpype_utils container. The code for building the docker is available at this repository.

Currently, we implement the following options:

  • Brain extraction: Fetal-BET1 (default) and MONAIfbs2
  • Denoising: Non-local means denosing3 (calling ANTS' DenoiseImage)
  • Bias field correction: N4 bias field correction4

Config structure

The config file is structured as follows:

brain_extraction:
  docker:
    cmd: "docker run --gpus all <mount> thsanchez/fetpype_utils:latest run_brain_extraction 
      --input_stacks <input_stacks> 
      --output_masks <output_masks> 
      --method fet_bet"
  singularity:
    cmd: "singularity run --bind <singularity_mount> --nv
      <singularity_path>/fetpype_utils.sif
      run_brain_extraction
      --input_stacks <input_stacks> 
      --output_masks <output_masks> --method monaifbs"

check_stacks_and_masks:
  enabled: true

denoising:
  enabled: true
  docker:
    cmd: "docker run <mount> thsanchez/fetpype_utils:latest run_denoising 
      --input_stacks <input_stacks> 
      --output_stacks <output_stacks>"
  singularity:
    cmd: "singularity run --bind <singularity_mount>
      <singularity_path>/fetpype_utils.sif
      run_denoising
      --input_stacks <input_stacks> 
      --output_stacks <output_stacks>"
cropping:
  enabled: true

bias_correction:
  enabled: true
  docker:
    cmd: "docker run <mount> thsanchez/fetpype_utils:latest run_bias_field_correction 
      --input_stacks <input_stacks> 
      --input_masks <input_masks> 
      --output_stacks <output_stacks>"
  singularity:
    cmd: "singularity run --bind <singularity_mount>
      <singularity_path>/fetpype_utils.sif
      run_bias_field_correction
      --input_stacks <input_stacks> 
      --input_masks <input_masks> 
      --output_stacks <output_stacks>"

Note

All the container runs use the command above and are passed through the function run_prepro_cmd

Note

  • Each pre-processing step that can be disabled has a boolean entry enabled: true that can be set to false.
  • The steps that rely on a container are set with a list of valid tags

Tags

There are a limited set of tags that can be used for preprocessing:

Command
Description Comments
<mount> Where the different folders will be mounted on Docker Docker only
<singularity_mount> Where the different folders will be mounted on Singularity Singularity only
<singularity_path> The base path of the Singularity image Singularity only
<input_stacks> The list of inputs stacks will be given as arguments Mutually exclusive with <input_dir>
<input_masks> The list of inputs masks will be given as arguments Mutually exclusive with <input_masks_dir>
<output_stacks> The list of output stacks
<output_masks> The list of output masks

  1. Razieh Faghihpirayesh, Davood Karimi, Deniz Erdoğmuş, and Ali Gholipour. Fetal-BET: brain extraction tool for fetal MRI. IEEE Open Journal of Engineering in Medicine and Biology, 2024. 

  2. Marta Ranzini, Lucas Fidon, Sébastien Ourselin, Marc Modat, and Tom Vercauteren. MONAIfbs: monai-based fetal brain mri deep learning segmentation. arXiv preprint arXiv:2103.13314, 2021. 

  3. José V Manjón, Pierrick Coupé, Luis Martí-Bonmatí, D Louis Collins, and Montserrat Robles. Adaptive non-local means denoising of mr images with spatially varying noise levels. Journal of Magnetic Resonance Imaging, 31(1):192–203, 2010. 

  4. Nicholas J Tustison, Brian B Avants, Philip A Cook, Yuanjie Zheng, Alexander Egan, Paul A Yushkevich, and James C Gee. N4ITK: improved n3 bias correction. IEEE transactions on medical imaging, 29(6):1310–1320, 2010.