Skip to content

Instantly share code, notes, and snippets.

@chaddupuis
Created April 15, 2024 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaddupuis/008fdeb09fe17001c9b0cda01ddc39ea to your computer and use it in GitHub Desktop.
Save chaddupuis/008fdeb09fe17001c9b0cda01ddc39ea to your computer and use it in GitHub Desktop.
apptainer build for deepdicomsort-dcm2niix-fsl on rockylinux8
Bootstrap: docker
From: rockylinux:8.9
%post
dnf -y update
dnf -y install epel-release curl wget git file bzip2 which libmng libpng12 libSM gtk2 mesa-dri-drivers mesa-libGL-devel
dnf config-manager --set-enabled powertools
dnf -y install R
# R brings in openblas and dependencies
dnf -y install make cmake
dnf module -y install python36
dnf -y install openjpeg2-devel libstdc++-static
# install dcm2niix
cd /opt
git clone https://github.com/rordenlab/dcm2niix.git
cd /opt/dcm2niix/
git checkout tags/v1.0.20190720
#git clone --depth 1 --branch v1.0.20190720 https://github.com/rordenlab/dcm2niix.git
mkdir /opt/dcm2niix/build && cd /opt/dcm2niix/build
# drop zlib and use pigz instead since cloudflare zlib was not found
#cmake -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON ..
cmake -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON ..
make -j$(nproc)
# install fsl 5.0.9
### note this is grabbing the older installer per their site for versions < 6.x
### 6.0.3 is apparently as far back as you can go with python fslinstaller.py --listversions
cd /opt
wget https://git.fmrib.ox.ac.uk/fsl/installer/-/raw/master/fslinstaller.py?inline=false -O fslinstaller.py \
&& python3 /opt/fslinstaller.py -d /usr/local/fsl -V 6.0.3 -p
# setup FSL environment
export FSLDIR="/usr/local/fsl"
export PATH="$FSLDIR/bin/:$PATH"
export FSLMULTIFILEQUIT=TRUE
export FSLGECUDAQ=cuda.q
export FSLTCLSH="$FSLDIR/bin/fsltclsh"
export FSLWISH="$FSLDIR/bin/fslwish"
export FSLOUTPUTTYPE=NIFTI_GZ
# apply patch
$FSLDIR/fslpython/bin/conda install -y -n fslpython -c conda-forge deprecation==1.*
## dcmsorter
cd /opt
git clone https://github.com/ErasmusMC-NeuroOnco/DeepDicomSort.git
cd /opt/DeepDicomSort
python3 -m pip install -r requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment