mia_processes.bricks.preprocess.freesurfer package

The atomic calculations from freesurfer.

Submodules

mia_processes.bricks.preprocess.freesurfer.processes module

The freesurfer preprocess library of the mia_processes package.

The purpose of this module is to customise the main freesurfer preprocessing bricks provided by nipype and to correct some things that do not work directly in populse_mia.

Contains:
Class:
  • Binarize

  • SynthStrip

  • SynthStripMriqc

class mia_processes.bricks.preprocess.freesurfer.processes.Binarize[source]

Bases: ProcessMIA

Binarize a volume (or volume-encoded surface file) using FreeSurfer mri_binarize

Binarization can be done based on threshold or on matched values.

Please, see the complete documentation for the Binarize brick in the mia_processes website

Note

  • Type ‘Binarize.help()’ for a full description of this process parameters.

  • Type ‘<Binarize>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<Binarize>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None, iteration=False)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters:
  • is_plugged – the state, linked or not, of the plugs.

  • iteration – the state, iterative or not, of the process.

Returns:

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.preprocess.freesurfer.processes.SynthStrip[source]

Bases: ProcessMIA

Skull stripping using SynthStrip

Please, see the complete documentation for the ‘SynthStrip brick in the mia_processes website <https://populse.github.io/mia_processes/html/documentation/bricks/preprocess/freesurfer/SynthStrip.html>`_

Note

  • Type ‘SynthStrip.help()’ for a full description of this process parameters.

  • Type ‘<SynthStrip>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<SynthStrip>.get_output_spec()’ for a full description of this process output trait types.

__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

list_outputs(is_plugged=None, iteration=False)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters:
  • is_plugged – the state, linked or not, of the plugs.

  • iteration – the state, iterative or not, of the process.

Returns:

a dictionary with requirement, outputs and inheritance_dict.

run_process_mia()[source]

Dedicated to the process launch step of the brick.

class mia_processes.bricks.preprocess.freesurfer.processes.SynthStripMriqc[source]

Bases: ProcessMIA

Skull stripping using SynthStrip

STATEMENT OF CHANGES: This class is derived from the work done by MRIQC 22.06 and FreeSurfer 1.0. The original file for this work derives from is found at https://github.com/nipreps/mriqc/blob/22.0.6/mriqc/synthstrip/cli.py and https://github.com/nipreps/mriqc/blob/22.0.6/mriqc/synthstrip/model.py and https://github.com/freesurfer/freesurfer/blob/2995ded957961a7f3704de57eee88eb6cc30d52d/mri_synthstrip/mri_synthstrip

Please, see the complete documentation for the ‘SynthStripMriqc brick in the mia_processes website <https://populse.github.io/mia_processes/html/documentation/bricks/preprocess/freesurfer/SynthStripMriqc.html>`_

Note

  • Type ‘SynthStripMriqc.help()’ for a full description of this process parameters.

  • Type ‘<SynthStripMriqc>.get_input_spec()’ for a full description of this process input trait types.

  • Type ‘<SynthStripMriqc>.get_output_spec()’ for a full description of this process output trait types.

class ConvBlock(ndims, in_channels, out_channels, stride=1, activation='leaky')[source]

Bases: Module

Specific convolutional block followed by leakyrelu for unet

__init__(ndims, in_channels, out_channels, stride=1, activation='leaky')[source]

blabla

forward(x)[source]

blabla

training: bool
class StripModel(nb_features=16, nb_levels=7, feat_mult=2, max_features=64, nb_conv_per_level=2, max_pool=2, return_mask=False)[source]

Bases: Module

blabla

__init__(nb_features=16, nb_levels=7, feat_mult=2, max_features=64, nb_conv_per_level=2, max_pool=2, return_mask=False)[source]

blabla

forward(x)[source]

blabla

training: bool
__init__()[source]

Dedicated to the attributes initialisation/instantiation.

The input and output plugs are defined here. The special ‘self.requirement’ attribute (optional) is used to define the third-party products necessary for the running of the brick.

conform(input_nii)[source]

Resample image as SynthStrip likes it.

list_outputs(is_plugged=None, iteration=False)[source]

Dedicated to the initialisation step of the brick.

The main objective of this method is to produce the outputs of the bricks (self.outputs) and the associated tags (self.inheritance_dic), if defined here. In order not to include an output in the database, this output must be a value of the optional key ‘notInDb’ of the self.outputs dictionary. To work properly this method must return self.make_initResult() object.

Parameters:
  • is_plugged – the state, linked or not, of the plugs.

  • iteration – the state, iterative or not, of the process.

Returns:

a dictionary with requirement, outputs and inheritance_dict.

resample_like(image, target, output_dtype=None, cval=0)[source]

Resample the input image to be in the target’s grid via identity transform.

run_process_mia()[source]

Dedicated to the process launch step of the brick.