Skip to content

Commit

Permalink
trying 8.0.0 beta
Browse files Browse the repository at this point in the history
  • Loading branch information
vnm-neurodesk committed Nov 13, 2024
1 parent 08a528b commit 3dac173
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 16 deletions.
43 changes: 29 additions & 14 deletions recipes/freesurfer/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,21 @@ if [ "$1" != "" ]; then
fi

export toolName='freesurfer'
export toolVersion=7.4.1
export toolVersion=8.0.0

source ../main_setup.sh --reinstall_neurodocker=false

neurodocker generate ${neurodocker_buildMode} \
--base-image centos:8 \
--pkg-manager yum \
--base-image ubuntu:22.04 \
--pkg-manager apt \
--run="printf '#!/bin/bash\nls -la' > /usr/bin/ll" \
--run="chmod +x /usr/bin/ll" \
--run="mkdir -p ${mountPointList}" \
--run="yum upgrade -y dnf" \
--run="yum upgrade -y rpm" \
--install wget \
--run="wget --quiet https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/${toolVersion}/freesurfer-CentOS8-${toolVersion}-1.x86_64.rpm \
&& yum --nogpgcheck -y localinstall freesurfer-CentOS8-${toolVersion}-1.x86_64.rpm \
--run="wget --quiet https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/$toolVersion-beta/freesurfer_ubuntu22-$toolVersion-beta_amd64.deb \
&& deb install freesurfer_ubuntu22-$toolVersion-beta_amd64.deb \
&& ln -s /usr/local/freesurfer/${toolVersion}-1/ /opt/${toolName}-${toolVersion} \
&& rm -rf freesurfer-CentOS8-${toolVersion}-1.x86_64.rpm" \
&& rm -rf freesurfer_ubuntu22-$toolVersion-beta_amd64.deb" \
--install mesa-dri-drivers which unzip ncurses-compat-libs libgomp java-1.8.0-openjdk xorg-x11-server-Xvfb xorg-x11-xauth \
--matlabmcr version=2019b install_path=/opt/MCR2019b \
--run="ln -s /opt/MCR2019b/v97/ /opt/${toolName}-${toolVersion}/MCRv97" \
Expand All @@ -47,23 +45,38 @@ neurodocker generate ${neurodocker_buildMode} \
--env SHLVL=1 \
--env FS_OVERRIDE=0 \
--workdir /opt/workbench/ \
--run="wget --quiet -O workbench.zip 'https://humanconnectome.org/storage/app/media/workbench/workbench-rh_linux64-v1.5.0.zip' \
--run="wget --quiet -O workbench.zip 'https://humanconnectome.org/storage/app/media/workbench/workbench-linux64-v2.0.1.zip' \
&& unzip workbench.zip \
&& rm -rf workbench.zip" \
--env PATH="/opt/workbench/:/opt/${toolName}-${toolVersion}/bin:/opt/${toolName}-${toolVersion}/fsfast/bin:/opt/${toolName}-${toolVersion}/tktools:/opt/${toolName}-${toolVersion}/bin:/opt/${toolName}-${toolVersion}/fsfast/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/opt/${toolName}-${toolVersion}/mni/bin:/bin" \
--env PATH='$PATH':/opt/workbench/:/opt/${toolName}-${toolVersion}/bin:/opt/${toolName}-${toolVersion}/fsfast/bin:/opt/${toolName}-${toolVersion}/tktools:/opt/${toolName}-${toolVersion}/bin:/opt/${toolName}-${toolVersion}/fsfast/bin:/opt/${toolName}-${toolVersion}/mni/bin \
--matlabmcr version=2014b install_path=/opt/MCR2014b \
--run="ln -s /opt/MCR2014b/v84/ /opt/${toolName}-${toolVersion}/MCRv84" \
--env LD_LIBRARY_PATH='$LD_LIBRARY_PATH':/opt/${toolName}-${toolVersion}/MCRv84/runtime/glnxa64:/opt/${toolName}-${toolVersion}/MCRv84/bin/glnxa64:/opt/${toolName}-${toolVersion}/MCRv84/sys/os/glnxa64:/opt/${toolName}-${toolVersion}/MCRv84/sys/opengl/lib/glnxa64:/opt/${toolName}-${toolVersion}/MCRv84/extern/bin/glnxa64 \
--workdir /opt/AANsegment \
--run="wget https://raw.githubusercontent.com/freesurfer/freesurfer/refs/heads/dev/AANsegment/SegmentAAN.sh && chmod a+rwx SegmentAAN.sh" \
--run="wget https://raw.githubusercontent.com/freesurfer/freesurfer/refs/heads/dev/AANsegment/AtlasMesh.gz" \
--run="wget https://raw.githubusercontent.com/freesurfer/freesurfer/refs/heads/dev/AANsegment/compressionLookupTable.txt" \
--run="wget https://raw.githubusercontent.com/freesurfer/freesurfer/refs/heads/dev/AANsegment/targetReg.mgz" \
--run="wget https://raw.githubusercontent.com/freesurfer/freesurfer/refs/heads/dev/AANsegment/targetWorkingres.mgz" \
--workdir /opt/AANsegment/linux_x86_64 \
--run="wget https://raw.githubusercontent.com/freesurfer/freesurfer/refs/heads/dev/AANsegment/linux_x86_64/segmentNuclei && chmod a+rwx segmentNuclei" \
--run="wget https://raw.githubusercontent.com/freesurfer/freesurfer/refs/heads/dev/AANsegment/linux_x86_64/run_segmentNuclei.sh && chmod a+rwx run_segmentNuclei.sh" \
--workdir /opt/${toolName}-${toolVersion}/average/AAN/atlas/ \
--run="wget https://raw.githubusercontent.com/freesurfer/freesurfer/refs/heads/dev/AANsegment/freeview.lut.txt" \
--env PATH='$PATH':/opt/AANsegment:/opt/AANsegment/linux_x86_64 \
--env FREESURFER="/opt/${toolName}-${toolVersion}" \
--env DEPLOY_PATH="/opt/${toolName}-${toolVersion}/bin/" \
--env LD_LIBRARY_PATH="/usr/local/freesurfer/${toolVersion}-1/lib/qt/lib/:/usr/lib64/:/opt/${toolName}-${toolVersion}/MCRv97/runtime/glnxa64:/opt/${toolName}-${toolVersion}/MCRv97/bin/glnxa64:/opt/${toolName}-${toolVersion}/MCRv97/sys/os/glnxa64:/opt/${toolName}-${toolVersion}/MCRv97/sys/opengl/lib/glnxa64:/opt/${toolName}-${toolVersion}/MCRv97/extern/bin/glnxa64" \
--env DEPLOY_PATH="/opt/${toolName}-${toolVersion}/bin/:/opt/AANsegment:/opt/AANsegment/linux_x86_64" \
--env LD_LIBRARY_PATH='$LD_LIBRARY_PATH':/usr/local/freesurfer/${toolVersion}-1/lib/qt/lib/:/usr/lib64/:/opt/${toolName}-${toolVersion}/MCRv97/runtime/glnxa64:/opt/${toolName}-${toolVersion}/MCRv97/bin/glnxa64:/opt/${toolName}-${toolVersion}/MCRv97/sys/os/glnxa64:/opt/${toolName}-${toolVersion}/MCRv97/sys/opengl/lib/glnxa64:/opt/${toolName}-${toolVersion}/MCRv97/extern/bin/glnxa64 \
--run="ln -s /usr/local/freesurfer/${toolVersion}-1/* /usr/local/freesurfer/" \
--copy README.md /README.md \
--copy test.sh /test.sh \
--run="bash /test.sh" \
--copy README.md /README.md \
--copy license.txt /opt/${toolName}-${toolVersion}/license.txt \
> ${imageName}.${neurodocker_buildExt}

# Hack to make CENTOS8 work with neurodocker
sed -i '4i RUN sed -i '\''s/mirrorlist/#mirrorlist/g'\'' /etc/yum.repos.d/CentOS-*' ${imageName}.${neurodocker_buildExt}
sed -i '5i RUN sed -i '\''s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g'\'' /etc/yum.repos.d/CentOS-*' ${imageName}.${neurodocker_buildExt}
sed -i '6i RUN yum install -y ca-certificates' ${imageName}.${neurodocker_buildExt}

sed -i '/ENV LANG="en_US.UTF-8" \\/,+2d' ${imageName}.${neurodocker_buildExt}
sed -i '/localedef \\/d' ${imageName}.${neurodocker_buildExt}
Expand All @@ -73,6 +86,8 @@ if [ "$1" != "" ]; then
./../main_build.sh
fi




# debug segmentSubjectT1_autoEstimateAlveusML:
# dnf install strace -y
Expand Down
11 changes: 9 additions & 2 deletions recipes/freesurfer/test.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
segmentSubjectT1_autoEstimateAlveusML #should not complain about libraries missing
checkMCR.sh #should not complain
segmentThalamicNuclei.sh --help #should not compalin about matlab libraries missing
mris_left_right_register # should not through permission denied error
mris_left_right_register # should not through permission denied error (was an apparmor problem)

# interactive test:
if [[ -v DISPLAY ]]; then
export QT_DEBUG_PLUGINS=1
freeview
fi
fi

[ -f ./mp2rage.nii ] && echo "$FILE exist." || wget https://imaging.org.au/uploads/Human7T/mp2rageModel_L13_work03-plus-hippocampus-7T-sym-norm-mincanon_v0.8.nii -O ./mp2rage.nii
mkdir ./freesurfer_output
recon-all -subject subjectname -i mp2rage.nii -all -sd ./freesurfer_output
export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=16
SegmentAAN.sh subjectname ./freesurfer_output
freeview -v $SUBJECTS_DIR/$SUBJECT/T1.mgz -v $SUBJECTS_DIR/$SUBJECT/arousalNetworkLabels.$SUFFIX.mgz:colormap=lut:lut=$FREESURFER_HOME/average/AAN/atlas/freeview.lut.txt

0 comments on commit 3dac173

Please sign in to comment.