From 917bab919f6613ce44ab424bad7a39bfc6a6ec32 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Fri, 9 Aug 2024 15:40:46 -0400 Subject: [PATCH] Add Freesurfer back in (#3) --- .circleci/config.yml | 13 +++++++++++++ Dockerfile | 24 ++++++++++++++++++++++++ Dockerfile_Freesurfer | 35 +++++++++++++++++++++++++++++++++++ setup_build.sh | 3 +++ 4 files changed, 75 insertions(+) create mode 100644 Dockerfile_Freesurfer diff --git a/.circleci/config.yml b/.circleci/config.yml index 58af617..4aed311 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,6 +52,13 @@ build: &build jobs: + build_FreeSurfer: + environment: + VERSION_TAG: "TAG_FREESURFER" + IMG_NAME: "qsirecon-freesurfer" + BUILD_FILE: "Dockerfile_FreeSurfer" + <<: *build + build_3Tissue: environment: VERSION_TAG: "TAG_3TISSUE" @@ -148,6 +155,11 @@ workflows: version: 2 build_test_deploy: jobs: + - build_FreeSurfer: + filters: + tags: + only: /.*/ + - build_3Tissue: filters: tags: @@ -194,6 +206,7 @@ workflows: - deployable: requires: + - build_FreeSurfer - build_3Tissue - build_MRtrix3 - build_DSIStudio diff --git a/Dockerfile b/Dockerfile index 68cad0f..ee15b1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +ARG TAG_FREESURFER ARG TAG_ANTS ARG TAG_MRTRIX3 ARG TAG_3TISSUE @@ -8,6 +9,7 @@ ARG TAG_TORTOISE ARG TAG_TORTOISECUDA # COPY can't handle variables, so here we go +FROM pennlinc/qsirecon-freesurfer:${TAG_FREESURFER} as build_freesurfer FROM pennlinc/qsirecon-ants:${TAG_ANTS} as build_ants FROM pennlinc/qsirecon-mrtrix3:${TAG_MRTRIX3} as build_mrtrix3 FROM pennlinc/qsirecon-3tissue:${TAG_3TISSUE} as build_3tissue @@ -43,6 +45,28 @@ COPY --from=build_3tissue /opt/3Tissue /opt/3Tissue ENV PATH="$PATH:/opt/mrtrix3-latest/bin:/opt/3Tissue/bin" \ MRTRIX3_DEPS="bzip2 ca-certificates curl libpng16-16 libblas3 liblapack3" +## Freesurfer +COPY --from=build_freesurfer /opt/freesurfer /opt/freesurfer +# Simulate SetUpFreeSurfer.sh +ENV FSL_DIR="/opt/conda/envs/fslqsirecon" \ + OS="Linux" \ + FS_OVERRIDE=0 \ + FIX_VERTEX_AREA="" \ + FSF_OUTPUT_FORMAT="nii.gz" \ + FREESURFER_HOME="/opt/freesurfer" +ENV SUBJECTS_DIR="$FREESURFER_HOME/subjects" \ + FUNCTIONALS_DIR="$FREESURFER_HOME/sessions" \ + MNI_DIR="$FREESURFER_HOME/mni" \ + LOCAL_DIR="$FREESURFER_HOME/local" \ + MINC_BIN_DIR="$FREESURFER_HOME/mni/bin" \ + MINC_LIB_DIR="$FREESURFER_HOME/mni/lib" \ + MNI_DATAPATH="$FREESURFER_HOME/mni/data" +ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \ + MNI_PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \ + PATH="$FREESURFER_HOME/bin:$FSFAST_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH" \ + FREESURFER_DEPS="bc ca-certificates curl libgomp1 libxmu6 libxt6 tcsh perl" +RUN chmod a+rx /opt/freesurfer/bin/mri_synthseg /opt/freesurfer/bin/mri_synthstrip + ## AFNI COPY --from=build_afni /opt/afni-latest /opt/afni-latest ENV PATH="$PATH:/opt/afni-latest" \ diff --git a/Dockerfile_Freesurfer b/Dockerfile_Freesurfer new file mode 100644 index 0000000..b1f919b --- /dev/null +++ b/Dockerfile_Freesurfer @@ -0,0 +1,35 @@ +FROM freesurfer/freesurfer:7.3.1 as freesurfer +FROM ubuntu:18.04 +ARG TAG_ANTS + +COPY --from=freesurfer \ + /usr/local/freesurfer/bin/mri_rigid_register \ + /opt/freesurfer/bin/mri_rigid_register + +COPY --from=freesurfer \ + /usr/local/freesurfer/bin/mri_robust_register \ + /opt/freesurfer/bin/mri_robust_register + +COPY --from=freesurfer \ + /usr/local/freesurfer/bin/mri_robust_template \ + /opt/freesurfer/bin/mri_robust_template + +COPY --from=freesurfer \ + /usr/local/freesurfer/bin/lta_convert \ + /opt/freesurfer/bin/lta_convert + +COPY --from=freesurfer \ + /usr/local/freesurfer/bin/lta_diff \ + /opt/freesurfer/bin/lta_diff + +COPY --from=freesurfer \ + /usr/local/freesurfer/python/scripts/mri_synthseg \ + /opt/freesurfer/bin/mri_synthseg + +COPY --from=freesurfer \ + /usr/local/freesurfer/models \ + /opt/freesurfer/models + +COPY --from=freesurfer \ + /usr/local/freesurfer/python/scripts/mri_synthstrip \ + /opt/freesurfer/bin/mri_synthstrip diff --git a/setup_build.sh b/setup_build.sh index d67e8c1..1401208 100644 --- a/setup_build.sh +++ b/setup_build.sh @@ -8,6 +8,7 @@ fi export BUILD_TAG # Versions of the components +export TAG_FREESURFER=23.3.0 export TAG_ANTS=24.4.24 export TAG_MRTRIX3=24.4.24 export TAG_3TISSUE=24.4.24 @@ -21,6 +22,7 @@ echo "Settings:" echo "----------" echo "" echo "BUILD_TAG=${BUILD_TAG}" +echo "TAG_FREESURFER=${TAG_FREESURFER}" echo "TAG_ANTS=${TAG_ANTS}" echo "TAG_MRTRIX3=${TAG_MRTRIX3}" echo "TAG_3TISSUE=${TAG_3TISSUE}" @@ -39,6 +41,7 @@ do_build() { BUILDKIT_PROGRESS=plain \ docker build -t \ pennlinc/qsirecon_build:${THIS_TAG} \ + --build-arg TAG_FREESURFER=${TAG_FREESURFER} \ --build-arg TAG_ANTS=${TAG_ANTS} \ --build-arg TAG_MRTRIX3=${TAG_MRTRIX3} \ --build-arg TAG_3TISSUE=${TAG_3TISSUE} \