Skip to content

Commit

Permalink
Add Freesurfer back in (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo authored Aug 9, 2024
1 parent c8de1f8 commit 917bab9
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -148,6 +155,11 @@ workflows:
version: 2
build_test_deploy:
jobs:
- build_FreeSurfer:
filters:
tags:
only: /.*/

- build_3Tissue:
filters:
tags:
Expand Down Expand Up @@ -194,6 +206,7 @@ workflows:

- deployable:
requires:
- build_FreeSurfer
- build_3Tissue
- build_MRtrix3
- build_DSIStudio
Expand Down
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ARG TAG_FREESURFER
ARG TAG_ANTS
ARG TAG_MRTRIX3
ARG TAG_3TISSUE
Expand All @@ -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
Expand Down Expand Up @@ -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" \
Expand Down
35 changes: 35 additions & 0 deletions Dockerfile_Freesurfer
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions setup_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
Expand All @@ -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} \
Expand Down

0 comments on commit 917bab9

Please sign in to comment.