Skip to content

Commit

Permalink
Added some documentation and example scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
vfonov committed Aug 4, 2017
1 parent fc0f9ce commit 2d67bcc
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 41 deletions.
7 changes: 7 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Example scripts for various subtools

* `real_tests` - tests with real data
* `synthetic_tests` - tests with synthetic data
* `validation_dataset` - validation dataset for longitudinal pipeline


6 changes: 6 additions & 0 deletions examples/synthetic_tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## examples for running various pipelines with synthetic data

* `test_lng_model` - longitudinal model creation (4D)
* `test_model_creation` - model creation (3D)
* `test_registration` - registration
* `test_segmentation` - segmentation
16 changes: 16 additions & 0 deletions examples/synthetic_tests/test_model_creation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Model creation examples

* `prepare_test_data.sh` - prepare synthetic dataset
* `prepare_test_data_with_bias.sh` - prepare synthetic dataset with some bias field

To execute examples, setup PYTHONPATH to point to the location of `ipl` directory, then run `python -m scoop -n <n> <script.py>`

* `scoop_test_1.py` - create 3 symmetric models, using linear registration with 6 parameters (rigid body), 9 parameters and 12 parameters
* `scoop_test_2.py` - create 3 non-symmetric models, using linear registration with 6 parameters (rigid body), 9 parameters and 12 parameters
* `scoop_test_bias*.py` - generate models compensating for bias field ( linear coregistration)
* `scoop_test_nl.py` - generate model using non-linear coregistration with minctracc, non-simmetric
* `scoop_test_nl_sym.py` - generate model using non-linear coregistration with minctracc, simmetric
* `scoop_test_nl_elastix.py` - generate model using non-linear coregistration with Elastix
* `scoop_test_nl_ants.py` - generate model using non-linear coregistration with ANTs
* `scoop_test_nl_dd.py` - generate model using non-linear coregistration with diffeomorphic demons
* `scoop_test_nl_ldd.py` - generate model using non-linear coregistration with log-diffeomorphic demons
11 changes: 0 additions & 11 deletions examples/synthetic_tests/test_model_creation/test_scipy.xfm

This file was deleted.

12 changes: 0 additions & 12 deletions examples/synthetic_tests/test_model_creation/test_std.xfm

This file was deleted.

6 changes: 6 additions & 0 deletions examples/validation_dataset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Validation dataset for longitudinal pipeline

To run:
* Download data using `download_validation_dataset.sh` script
* Run pipleine on 4 cores : `PARALLEL=4 MNI_DATAPATH=/opt/minc/share run_validation_nc.sh`

5 changes: 5 additions & 0 deletions examples/validation_dataset/download_validation_dataset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/sh


wget ipl_subject43.tar.gz
tar zxf ipl_subject43.tar.gz
13 changes: 5 additions & 8 deletions examples/validation_dataset/run_validation_nc.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -e
set -e -x

output_dir=$1

Expand All @@ -20,7 +20,6 @@ PARALLEL=${PARALLEL:-1}
icbm_model_dir=$MNI_DATAPATH/icbm152_model_09c
beast_model_dir=$MNI_DATAPATH/beast-library-1.1


if [ ! -d $icbm_model_dir ];then
echo "Missing $icbm_model_dir"
exit 1
Expand All @@ -31,19 +30,17 @@ if [ ! -d $beast_model_dir ];then
exit 1
fi

pipeline_dir=$(dirname $0)/..
pipeline_dir=$(dirname $0)/../..
data_dir=$(dirname $0)

#export PYTHONPATH=$(realpath $pipeline_dir/python)
export PYTHONPATH=$pipeline_dir/python
#export PATH=$pipeline_dir/bin:$PATH
export PYTHONPATH=$pipeline_dir
export OMP_NUM_THREADS=1
export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1

### Run pipeline for NC scan rescan data ###
python -m scoop -vvv -n $PARALLEL $pipeline_dir/python/iplLongitudinalPipeline.py \
python -m scoop -vvv -n $PARALLEL $pipeline_dir/iplLongitudinalPipeline.py \
-L \
-l $data_dir/nc_scan_rescan_validation_list.csv \
-l $data_dir/subject43.csv \
-o $output_dir \
--model-dir=$icbm_model_dir \
--model-name=mni_icbm152_t1_tal_nlin_sym_09c \
Expand Down
10 changes: 0 additions & 10 deletions iplPatient.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ def __init__(self, id):
self.run_skullreg = False # default - do not attempt to run skull registration
self.large_atrophy = False # default - do not use the ventricle mask for the linear template creation
self.geo_corr = False # default - do not perform distortion correction
self.dohc = False # default - do not perform hippocampi segmentation
self.dovent = False # default - do not perform ventricle segmentation
self.doface = False # default - do not perform FACE cortical segmntation
self.dodbm = False # default - do not perform ventricle segmentation
self.vbm_options = {} # VBM options

Expand Down Expand Up @@ -620,13 +617,6 @@ def setFilenames(patient):
patient[tp].vbm['ixfm'] = vbmdir + 'vbm_xfm_' + patient.id + '_' + tp + '_inverse.xfm'
patient[tp].vbm['igrid'] = vbmdir + 'vbm_xfm_' + patient.id + '_' + tp + '_inverse_grid_0.mnc'

# FACE
patient[tp].face['basedir'] = facedir
patient[tp].face['Makefile'] = facedir + 'Makefile'
patient[tp].face['qc'] = facedir + os.sep + 'verify' + os.sep \
+ 'verify_surfaces.jpg'
patient[tp].face['lobes'] = facedir + os.sep + 'atlas' + os.sep \
+ 'lobes.csv'

# TODO: add more needed files
# end of timepoints
Expand Down

0 comments on commit 2d67bcc

Please sign in to comment.