20130225 - Description of Notes
Table of Contents
Notes on Atropos From Publication( 2011 Neuroinfomatics)
Avants et al._2008_Medical image analysis.pdf
Brainweb Application:
- Sequential Processing of N4 and Atropos
- 40% RF with 3% noise
- Beta of MRF = 0.2
- Initial K-Means K=3
- With Brian Mask
"The multivariate segmentation result, in combination with the low PD segmentation performance, suggests PD and T1 provide complementary information that may improve 3-tissue segmentation and serves to validate the multivariate Atropos implementation. In this case, the benefit is likely to derive from the fact that the PD image has no bias"
5. Atropos Trial on BSD with brain mask from BABC
Directory:
/IPLlinux/hjohnson/HDNI/20130125_BRAINSABC_Publication/Atropos_brainweb
Script:
Brain mask is created by thresholding brain_seg label from BRAINS ABC. (CHEATING!?)
Resut:
Similarity Index
Hausdorrf Distance
As they mentioned in their paper, yes multi-modality does not really helpful in their setting.
I have not succeeded with Prior initialization.
4. Data Delievery to Nict Tustison for Consult
From Attemp3
Directory:
/IPLlinux/hjohnson/HDNI/20130125_BRAINSABC_Publication/AtroposTest/BigTestFromHans_WithSyn_MRF0.05_data2/ToNictTustison
ZipFile:
/hjohnson/HDNI/20130125_BRAINSABC_Publication/AtroposTest/BigTestFromHans_WithSyn_MRF0.05_data2/atroposTrial20130208.tar.gz
Script:
3. Same Attempt to (2) but with SIEMENS data
Similar failure: Bright center of brain resulting in extended white matter
Data Info
fileList="/nfsscratch/PREDICT/hjohnson/TrackOn/Experiments/20130109_TrackOn_CACHE/288066870/BAW_20120813/WF_288066870_288066870_20100622_30_HDNI_001_PHASE_1/TissueClassify/BABC/atlas_to_subject.h5 \
/nfsscratch/PREDICT/hjohnson/TrackOn/Experiments/20130109_TrackOn_CACHE/288066870/BAW_20120813/WF_288066870_288066870_20100622_30_HDNI_001_PHASE_1/TissueClassify/BABC/atlas_to_subject_Inverse.h5 \
/nfsscratch/PREDICT/hjohnson/TrackOn/Experiments/20130109_TrackOn_CACHE/288066870/BAW_20120813/WF_288066870_288066870_20100622_30_HDNI_001_PHASE_1/LandmarkInitialize/BLI/landmarkInitializer_atlas_to_subject_transform.h5 \
/nfsscratch/PREDICT/hjohnson/TrackOn/Experiments/20130109_TrackOn_CACHE/288066870/BAW_20120813/WF_288066870_288066870_20100622_30_HDNI_001_PHASE_1/LandmarkInitialize/BROIAuto_cropped/Cropped_BCD_ACPC_Aligned.nii.gz \
/nfsscratch/PREDICT/hjohnson/TrackOn/HDNI_001/288066870/288066870_20100622_30/ANONRAW/288066870_288066870_20100622_30_T1-30_3.nii.gz \
/nfsscratch/PREDICT/hjohnson/TrackOn/HDNI_001/288066870/288066870_20100622_30/ANONRAW/288066870_288066870_20100622_30_T2-30_4.nii.gz \
"
for file in $fileList
do
targetFilename=(`basename $file`)
rsync helium.hpc.uiowa.edu:$file $targetFilename
done
2. Attempt with SyN Atlas to Subject Registration with 17 Priors
Below image is what I got from this trial. In general, images are real bright. I have to adjust constrast to see differecces in white and grey matter. It seems like Atropos made real bright sub-cortical area than surface, and saying all the center tissue is whiate matter.
How should I adjust?!
Data: (Phillps data- bad choice as a trial..)
Script:
1. Attempt with Big Test
Attempt with Big Test from Hans and Nick Tustison's test ( a while ago, Thank you Jess for finding this! )
1-A. Original Script
Orignal Directory: /hjohnson/HDNI/EXPERIEMENTS/AtroposBigTest/AtroposRun.sh
1. Input Description
2. Start with Rigid trasnformation intersubject images
3. Atlas to Subject BSpline Registration
4. Warp Priors to Subject Space
5. Run Atropos
1-B. My Trial
Script:
Change input information
PREFIX="/hjohnson/HDNI/20130125_BRAINSABC_Publication/AtroposTest/" TEMPLATE="${PREFIX}/subject_t1_01.nii.gz" ALLIAMGES=" ${PREFIX}/subject_t1_01.nii.gz ${PREFIX}/subject_t1_02.nii.gz ${PREFIX}/subject_t2_01.nii.gz" BASEDIR=.
Unchanged part
Update Atlas to Recent Ones
let counter=1; for probMap in \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_ACCUMBEN.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_AIR.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_CAUDATE.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_CRBLGM.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_CRBLWM.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_CSF.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_GLOBUS.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_HIPPOCAMPUS.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_NOTCSF.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_NOTGM.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_NOTVB.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_NOTWM.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_PUTAMEN.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_SURFGM.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_THALAMUS.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_VB.nii.gz \ /ipldev/scratch/eunyokim/src/BRAINS2012Dec/build/ReferenceAtlas-build/Atlas/Atlas_20130106/EXTENDED_WM.nii.gz; do \ if [ $counter -eq 1 ]; then BGVALUE=1; else BGVALUE=0; fi OUTPROB=$(printf "${PHASE2_DIR}/priorProbImages%02d.nii.gz" ${counter}) if [ ! -f ${OUTPROB} ]; then BRAINSResample \ --inputVolume ${probMap} \ --referenceVolume ${TEMPLATE} \ --outputVolume ${OUTPROB} \ --warpTransform ${AToS} \ --defaultValue ${BGVALUE} if [ $? -ne 0 ]; then echo "FAILURE" exit -1; fi fi let counter+=1 done
Unchanged Atropos Part
Console Out:
Output:
Apparently, Atropos is not going to work in this setting, because of tons of possible reasons: wrong priors, registration parameters, wrong initializations..
I will try with their priors in their setting.
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
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]
I found a directory containing bash scripts and tests for Atropos:
/IPLlinux/hjohnson/HDNI/EXPERIEMENTS/
- AtroposSimpleTest --- I used AtroposSimpleTest for the example inputs and outputs seen below.
- AtroposBigTest
- AtroposTest
Example Inputs
Test Directory : /raid0/homes/jforbes/Desktop/test_Atropos/20130130_10priors
Intensity Images
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
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
Example 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
User Information
interfaces.ants.segment
Link to user information on Nipype site
Atropos
Wraps command Atropos
A finite mixture modeling (FMM) segmentation approach with possibilities for specifying prior constraints. These prior constraints include the specification of a prior label image, prior probability images (one for each class), and/or an MRF prior to enforce spatial smoothing of the labels. Similar algorithms include FAST and SPM.
Examples
>>> from nipype.interfaces.ants import Atropos
>>> at = Atropos()
>>> at.inputs.dimension = 3
>>> at.inputs.intensity_images = 'structural.nii'
>>> at.inputs.mask_image = 'mask.nii'
>>> at.inputs.initialization = 'PriorProbabilityImages'
>>> at.inputs.prior_probability_images = ['rc1s1.nii', 'rc1s2.nii']
>>> at.inputs.number_of_tissue_classes = 2
>>> 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
>>> at.cmdline
'Atropos --image-dimensionality 3 --icm [1,1] --initialization PriorProbabilityImages[2,priors/priorProbImages%02d.nii,0.8,1e-07]
--intensity-image structural.nii --likelihood-model Gaussian --mask-image mask.nii --mrf [0.2,1x1x1] --convergence [5,1e-06]
--output [structural_labeled.nii,POSTERIOR_%02d.nii.gz] --posterior-formulation Socrates[1]'
Inputs:
[Mandatory]
initialization: ('Random' or 'Otsu' or 'KMeans' or 'PriorProbabilityImages' or
'PriorLabelImage')
requires: number_of_tissue_classes
mask_image: (an existing file name)
number_of_tissue_classes: (an integer)
[Optional]
args: (a string)
Additional parameters to the command
convergence_threshold: (a float)
requires: n_iterations
dimension: (3 or 2 or 4, nipype default value: 3)
image dimension (2, 3, or 4)
environ: (a dictionary with keys which are a value of type 'str' and with values which
are a value of type 'str', nipype default value: {})
Environment variables
icm_use_synchronous_update: (a boolean)
ignore_exception: (a boolean, nipype default value: False)
Print an error message instead of throwing an exception in case the interface fails to
run
intensity_images: (an existing file name)
likelihood_model: (a string)
maximum_number_of_icm_terations: (an integer)
requires: icm_use_synchronous_update
mrf_radius: (a list of items which are an integer)
requires: mrf_smoothing_factor
mrf_smoothing_factor: (a float)
n_iterations: (an integer)
num_threads: (an integer, nipype default value: 1)
Number of ITK threads to use
out_classified_image_name: (a file name)
output_posteriors_name_template: (a string, nipype default value: POSTERIOR_%02d.nii.gz)
posterior_formulation: (a string)
prior_probability_images: (an existing file name)
prior_probability_threshold: (a float)
requires: prior_weighting
prior_weighting: (a float)
save_posteriors: (a boolean)
use_mixture_model_proportions: (a boolean)
requires: posterior_formulation
Outputs:
classified_image: (an existing file name)
posteriors: (a file name)