Set Paths

Add the bin directory containing Atropos to the PATH:

  • export PATH=$PATH:/ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/bin

Add the build directory to the PYTHONPATH:

  • export PYTHONPATH=$PYTHONPATH:your_BRAINSStandAlone-build_dir/NIPYPE

Code

from nipype.interfaces.ants import Atropos
at = Atropos()
at.inputs.dimension = 3
at.inputs.intensity_images = ['T1_0.nii.gz','T1_1_fixed.nii.gz','T1_2_fixed.nii.gz','T2_0_fixed.nii.gz','T2_1_fixed.nii.gz']
at.inputs.mask_image = 'T1_0_roi.nii.gz'
at.inputs.initialization = 'PriorProbabilityImages'
at.inputs.prior_probability_images = ['priorProbImages01.nii.gz', 'priorProbImages04.nii.gz', 'priorProbImages07.nii.gz',
                                      'priorProbImages10.nii.gz','priorProbImages02.nii.gz', 'priorProbImages05.nii.gz',
                                      'priorProbImages08.nii.gz','priorProbImages03.nii.gz', 'priorProbImages06.nii.gz',
                                      'priorProbImages09.nii.gz']
at.inputs.number_of_tissue_classes = 10
at.inputs.prior_weighting = 0.8
at.inputs.prior_probability_threshold = 0.0000001
at.inputs.likelihood_model = 'Gaussian'
at.inputs.mrf_smoothing_factor = 0.2
at.inputs.mrf_radius = [1, 1, 1]
at.inputs.icm_use_synchronous_update = True
at.inputs.maximum_number_of_icm_terations = 1
at.inputs.n_iterations = 5
at.inputs.convergence_threshold = 0.000001
at.inputs.posterior_formulation = 'Socrates'
at.inputs.use_mixture_model_proportions = True
at.inputs.save_posteriors = True
print at.cmdline

result = at.run()
print result.outputs

Notes

A new folder in the current working directory called "priors" will be created. It contains renamed copies of all of the input Prior Probability Images in the form of priorProbImages%02d.nii.gz. These are then used as the input in the --initialization flag for the priors.

For example:

--initialization PriorProbabilityImages[10,priors/priorProbImages%02d.nii.gz,0.8,1e-07]

Inputs

Test Directory : /raid0/homes/jforbes/Desktop/test_Atropos/20130130_10priors

Intensity Images
T1_0.nii.gz
T1_1_fixed.nii.gz
T1_2_fixed.nii.gz
T2_0_fixed.nii.gz
T2_1_fixed.nii.gz
Mask Image

T1_0_roi.nii.gz

Prior Probability Images
priorProbImages01.nii.gz
priorProbImages02.nii.gz
priorProbImages03.nii.gz
priorProbImages04.nii.gz
priorProbImages05.nii.gz
priorProbImages06.nii.gz
priorProbImages07.nii.gz
priorProbImages08.nii.gz
priorProbImages09.nii.gz
priorProbImages10.nii.gz

Outputs

The output files will be placed in the current working directory.

POSTERIOR_01.nii.gz
POSTERIOR_02.nii.gz
POSTERIOR_03.nii.gz
POSTERIOR_04.nii.gz
POSTERIOR_05.nii.gz
POSTERIOR_06.nii.gz
POSTERIOR_07.nii.gz
POSTERIOR_08.nii.gz
POSTERIOR_09.nii.gz
POSTERIOR_10.nii.gz

T1_0_labeled.nii.gz

priors/

priorProbImages01.nii.gz
priorProbImages02.nii.gz
priorProbImages03.nii.gz
priorProbImages04.nii.gz
priorProbImages05.nii.gz
priorProbImages06.nii.gz
priorProbImages07.nii.gz
priorProbImages08.nii.gz
priorProbImages09.nii.gz
priorProbImages10.nii.gz