Skip to content

Commit

Permalink
Merge pull request #14 from BIDS-Apps/fs6bug
Browse files Browse the repository at this point in the history
Fs6bug
  • Loading branch information
fliem authored Jan 26, 2017
2 parents 84607b1 + 9a4b425 commit 2efaa34
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 17 deletions.
42 changes: 40 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
FROM fliem/tracula_base:fs6
FROM bids/base_fsl


#### FreeSurfer
RUN apt-get -y update && \
wget -qO- https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.0/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0.tar.gz | tar zxv -C /opt \
--exclude='freesurfer/subjects/fsaverage_sym' \
--exclude='freesurfer/subjects/fsaverage3' \
--exclude='freesurfer/subjects/fsaverage4' \
--exclude='freesurfer/subjects/fsaverage5' \
--exclude='freesurfer/subjects/fsaverage6' \
--exclude='freesurfer/subjects/cvs_avg35' \
--exclude='freesurfer/subjects/cvs_avg35_inMNI152' \
--exclude='freesurfer/subjects/bert' \
--exclude='freesurfer/subjects/V1_average' \
--exclude='freesurfer/average/mult-comp-cor' \
--exclude='freesurfer/lib/cuda' \
--exclude='freesurfer/lib/qt'

# Set up the environment
ENV OS=Linux
ENV FS_OVERRIDE=0
ENV FIX_VERTEX_AREA=
ENV SUBJECTS_DIR=/opt/freesurfer/subjects
ENV FSF_OUTPUT_FORMAT=nii.gz
ENV MNI_DIR=/opt/freesurfer/mni
ENV LOCAL_DIR=/opt/freesurfer/local
ENV FREESURFER_HOME=/opt/freesurfer
ENV FSFAST_HOME=/opt/freesurfer/fsfast
ENV MINC_BIN_DIR=/opt/freesurfer/mni/bin
ENV MINC_LIB_DIR=/opt/freesurfer/mni/lib
ENV MNI_DATAPATH=/opt/freesurfer/mni/data
ENV FMRI_ANALYSIS_DIR=/opt/freesurfer/fsfast
ENV PERL5LIB=/opt/freesurfer/mni/lib/perl5/5.8.5
ENV MNI_PERL5LIB=/opt/freesurfer/mni/lib/perl5/5.8.5
ENV PATH=/opt/freesurfer/bin:/opt/freesurfer/fsfast/bin:/opt/freesurfer/tktools:/opt/freesurfer/mni/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
RUN echo "cHJpbnRmICJrcnp5c3p0b2YuZ29yZ29sZXdza2lAZ21haWwuY29tXG41MTcyXG4gKkN2dW12RVYzelRmZ1xuRlM1Si8yYzFhZ2c0RVxuIiA+IC9vcHQvZnJlZXN1cmZlci9saWNlbnNlLnR4dAo=" | base64 -d | sh


RUN sudo apt-get update && apt-get install -y python3
RUN sudo apt-get update && apt-get install -y python3-pip
RUN pip3 install pybids pandas ipython
RUN pip3 install pandas
RUN pip3 install pybids

RUN apt-get install -y tree htop
RUN apt-get install -y tcsh
Expand Down
20 changes: 8 additions & 12 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ general:
artifacts:
- "~/outputs1"
- "~/outputs2"

machine:
services:
- docker #don't use 1.10 - caching is broken
Expand All @@ -23,33 +24,28 @@ dependencies:
- docker build -t bids/${CIRCLE_PROJECT_REPONAME,,} . :
timeout: 21600
- mkdir -p ~/docker; docker save "bids/${CIRCLE_PROJECT_REPONAME,,}" > ~/docker/image.tar
- mkdir -p ${HOME}/outputs

test:
override:
# print version
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset -v ${HOME}/data/ds114_test1_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} --version
# participant level tests for single session dataset
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset -v ${HOME}/outputs1:/outputs -v ${HOME}/data/ds114_test1_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 01 --license_key="~/test.key" --freesurfer_dir /freesurfer --stages prep:
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset -v ${HOME}/outputs1:/outputs -v ${HOME}/data/ds114_test1_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 01 --license_key="~/test.key" --freesurfer_dir /freesurfer --stages prep && cat ${HOME}/outputs1/sub-01/scripts/trac-preproc.done :
timeout: 21600
# - docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset -v ${HOME}/outputs1:/outputs -v ${HOME}/data/ds114_test1_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 02 --license_key="~/test.key" --freesurfer_dir /freesurfer --stages prep :
# timeout: 21600
# group level test for single session dataset: group1
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset -v ${HOME}/data/ds114_test1_tracula_precomp:/outputs -v ${HOME}/data/ds114_test1_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group1 --license_key="~/test.key" --freesurfer_dir /freesurfer && mkdir -p ${HOME}/outputs1/ && sudo mv ${HOME}/data/ds114_test1_tracula_precomp/00_group* ${HOME}/outputs1/ :
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset -v ${HOME}/data/ds114_test1_tracula_precomp:/outputs -v ${HOME}/data/ds114_test1_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group1 --license_key="~/test.key" --freesurfer_dir /freesurfer && mkdir -p ${HOME}/outputs1/ && sudo mv ${HOME}/data/ds114_test1_tracula_precomp/00_group* ${HOME}/outputs1/ && cat ${HOME}/outputs1/00_group1_motion_stats/group_motion.tsv :
timeout: 21600
# group level test for single session dataset: group2
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset -v ${HOME}/data/ds114_test1_tracula_precomp:/outputs -v ${HOME}/data/ds114_test1_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group2 --license_key="~/test.key" --freesurfer_dir /freesurfer && mkdir -p ${HOME}/outputs1/ && sudo mv ${HOME}/data/ds114_test1_tracula_precomp/00_group* ${HOME}/outputs1/ :
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test1:/bids_dataset -v ${HOME}/data/ds114_test1_tracula_precomp:/outputs -v ${HOME}/data/ds114_test1_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group2 --license_key="~/test.key" --freesurfer_dir /freesurfer && mkdir -p ${HOME}/outputs1/ && sudo mv ${HOME}/data/ds114_test1_tracula_precomp/00_group* ${HOME}/outputs1/ && cat ${HOME}/outputs1/00_group2_tract_stats/fminor_stats.tsv :
timeout: 21600
# participant level tests for a longitudinal dataset
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test2:/bids_dataset -v ${HOME}/outputs2:/outputs -v ${HOME}/data/ds114_test2_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 01 --license_key="~/test.key" --freesurfer_dir /freesurfer --stages prep :
# participant level tests for a longitudinal dataset
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test2:/bids_dataset -v ${HOME}/outputs2:/outputs -v ${HOME}/data/ds114_test2_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 01 --license_key="~/test.key" --freesurfer_dir /freesurfer --stages prep && cat ${HOME}/outputs2/sub-01_ses-test.long.sub-01/scripts/trac-preproc.done :
timeout: 21600
# - docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test2:/bids_dataset -v ${HOME}/outputs2:/outputs -v ${HOME}/data/ds114_test2_freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs participant --participant_label 02 --license_key="~/test.key" --freesurfer_dir /freesurfer --stages prep :
# timeout: 21600
# group level test for a longitudinal dataset: group1
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test2:/bids_dataset -v ${HOME}/data/ds114_test2_tracula_precomp:/outputs -v ${HOME}/data/ds114_test2_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group1 --license_key="~/test.key" --freesurfer_dir /freesurfer && mkdir -p ${HOME}/outputs2/ && sudo mv ${HOME}/data/ds114_test2_tracula_precomp/00_group* ${HOME}/outputs2/ :
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test2:/bids_dataset -v ${HOME}/data/ds114_test2_tracula_precomp:/outputs -v ${HOME}/data/ds114_test2_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group1 --license_key="~/test.key" --freesurfer_dir /freesurfer && mkdir -p ${HOME}/outputs2/ && sudo mv ${HOME}/data/ds114_test2_tracula_precomp/00_group* ${HOME}/outputs2/ && cat ${HOME}/outputs2/00_group1_motion_stats/group_motion.tsv :
timeout: 21600
# group level test for a longitudinal dataset: group2
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test2:/bids_dataset -v ${HOME}/data/ds114_test2_tracula_precomp:/outputs -v ${HOME}/data/ds114_test2_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group2 --license_key="~/test.key" --freesurfer_dir /freesurfer && mkdir -p ${HOME}/outputs2/ && sudo mv ${HOME}/data/ds114_test2_tracula_precomp/00_group* ${HOME}/outputs2/ :
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds114_test2:/bids_dataset -v ${HOME}/data/ds114_test2_tracula_precomp:/outputs -v ${HOME}/data/ds114_test2_freesurfer:/freesurfer bids/${CIRCLE_PROJECT_REPONAME,,} /bids_dataset /outputs group2 --license_key="~/test.key" --freesurfer_dir /freesurfer && mkdir -p ${HOME}/outputs2/ && sudo mv ${HOME}/data/ds114_test2_tracula_precomp/00_group* ${HOME}/outputs2/ && cat ${HOME}/outputs2/00_group2_tract_stats/fminor_stats.tsv:
timeout: 21600

deployment:
Expand Down
6 changes: 3 additions & 3 deletions tracula.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ def get_data(layout, subject_label, freesurfer_dir, session_label=""):

# long
if session_label:
# regex magic to avoid https://github.com/INCF/pybids/issues/25
subject_session_info = {"subject": subject_label, "session": "^" + session_label + "$"}
subject_session_info = {"subject": subject_label, "session": session_label}
# cross
else:
subject_session_info = {"subject": subject_label}

dwi_files = [f.filename for f in layout.get(type="dwi", modality="dwi", ext="nii.gz", **subject_session_info)]
dwi_files = [f.filename for f in layout.get(type="dwi", modality="dwi", extensions=["nii", "nii.gz"],
**subject_session_info)]
bvecs_files = layout.get_bvecs(**subject_session_info)
if not bvecs_files:
# if bvecs only in root dir
Expand Down

0 comments on commit 2efaa34

Please sign in to comment.