Skip to content

Commit

Permalink
Merge pull request #114 from DCAN-Labs/rmCC
Browse files Browse the repository at this point in the history
Remove chirality correction from postbibsnet
  • Loading branch information
lundq163 authored Aug 19, 2024
2 parents b7e4e67 + 02e5470 commit ace7a36
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 601 deletions.
49 changes: 34 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM nvcr.io/nvidia/pytorch:21.11-py3

# Manually update the BIBSnet version when building
ENV BIBSNET_VERSION="3.3.2"

ENV BIBSNET_VERSION="3.3.0"

# Prepare environment
RUN apt-get update && \
Expand Down Expand Up @@ -49,9 +50,11 @@ RUN apt-get update -qq \
&& rm -rf /var/lib/apt/lists/* \
&& echo "Downloading FSL ..." \
&& mkdir -p /opt/fsl-6.0.5.1 \
&& curl -sSL "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.0.tar.gz" \
| tar -xzpf - fsl-6.0.5.1-centos7_64.tar.gz -O | tar -xzpC /opt/fsl-6.0.5.1 --no-same-owner --strip-components 1

&& wget -O bibsnet-v3.3.0.tar.gz "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.0.tar.gz" \
&& tar -xzf bibsnet-v3.3.0.tar.gz fsl-6.0.5.1-centos7_64.tar.gz \
&& tar -xzf fsl-6.0.5.1-centos7_64.tar.gz -C /opt/fsl-6.0.5.1 --no-same-owner --strip-components 1 \
&& rm bibsnet-v3.3.0.tar.gz fsl-6.0.5.1-centos7_64.tar.gz

ENV FSLDIR="/opt/fsl-6.0.5.1" \
PATH="/opt/afni-latest:/opt/ants:/opt/fsl-6.0.5.1/bin:$PATH" \
FSLOUTPUTTYPE="NIFTI_GZ" \
Expand All @@ -66,9 +69,13 @@ ENV FSLDIR="/opt/fsl-6.0.5.1" \

# Installing ANTs 2.3.3 (NeuroDocker build)
# Note: the URL says 2.3.4 but it is actually 2.3.3
RUN mkdir -p /opt/ants \
&& curl -sSL --retry 5 "https://dl.dropbox.com/s/gwf51ykkk5bifyj/ants-Linux-centos6_x86_64-v2.3.4.tar.gz" \
| tar -xzC /opt/ants --strip-components 1
# TESTING: installing ANTS from tier2 tar.gz
RUN echo "Downloading ANTs ..." && \
mkdir -p /opt/ants && \
wget -O bibsnet-v3.3.0.tar.gz "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.0.tar.gz" && \
tar -xzf bibsnet-v3.3.0.tar.gz ants-Linux-centos6_x86_64-v2.3.4.tar.gz && \
tar -xzf ants-Linux-centos6_x86_64-v2.3.4.tar.gz -C /opt/ants --no-same-owner --strip-components 1 && \
rm bibsnet-v3.3.0.tar.gz ants-Linux-centos6_x86_64-v2.3.4.tar.gz

# Create a shared $HOME directory
RUN useradd -m -s /bin/bash -G users -u 1000 bibsnet
Expand All @@ -89,16 +96,28 @@ ENV nnUNet_preprocessed="/opt/nnUNet/nnUNet_raw_data_base/nnUNet_preprocessed" \
RESULTS_FOLDER="/opt/nnUNet/nnUNet_raw_data_base/nnUNet_trained_models"

RUN mkdir -p /opt/nnUNet/nnUNet_raw_data_base/ /opt/nnUNet/nnUNet_raw_data_base/nnUNet_preprocessed /opt/nnUNet/nnUNet_raw_data_base/nnUNet_trained_models/nnUNet /home/bibsnet/data
#COPY trained_models/Task512_BCP_ABCD_Neonates_SynthSegDownsample.zip /opt/nnUNet/nnUNet_raw_data_base/nnUNet_trained_models/nnUNet
RUN curl -sSL "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.2.tar.gz" | tar -xzpf - Task526_previous_BIBSNet_Production_Model.tar.gz -O | tar -xzpC /opt/nnUNet/nnUNet_raw_data_base/nnUNet_trained_models/nnUNet --no-same-owner --strip-components 1 && \
curl -sSL "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.2.tar.gz" | tar -xzpf - Task514_BCP_ABCD_Neonates_SynthSeg_T1Only.tar.gz -O | tar -xzpC /opt/nnUNet/nnUNet_raw_data_base/nnUNet_trained_models/nnUNet --no-same-owner --strip-components 1 &&\
curl -sSL "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.2.tar.gz" | tar -xzpf - Task515_BCP_ABCD_Neonates_SynthSeg_T2Only.tar.gz -O | tar -xzpC /opt/nnUNet/nnUNet_raw_data_base/nnUNet_trained_models/nnUNet --no-same-owner --strip-components 1 && \
curl -sSL "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.2.tar.gz" | tar -xzpf - Task540_BIBSNet_Production_Model.tar.gz -O | tar -xzpC /opt/nnUNet/nnUNet_raw_data_base/nnUNet_trained_models/nnUNet --no-same-owner --strip-components 1

RUN wget -O bibsnet-v3.3.0.tar.gz "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.0.tar.gz" && \
tar -xzf bibsnet-v3.3.0.tar.gz Task540_BIBSnet_Production_T1T2_model.tar.gz && \
tar -xzf Task540_BIBSnet_Production_T1T2_model.tar.gz -C /opt/nnUNet/nnUNet_raw_data_base/nnUNet_trained_models/nnUNet --strip-components 1 && \
rm bibsnet-v3.3.0.tar.gz Task540_BIBSnet_Production_T1T2_model.tar.gz

RUN wget -O bibsnet-v3.3.0.tar.gz "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.0.tar.gz" && \
tar -xzf bibsnet-v3.3.0.tar.gz Task541_BIBSnet_Production_T1only_model.tar.gz && \
tar -xzf Task541_BIBSnet_Production_T1only_model.tar.gz -C /opt/nnUNet/nnUNet_raw_data_base/nnUNet_trained_models/nnUNet --strip-components 1 && \
rm bibsnet-v3.3.0.tar.gz Task541_BIBSnet_Production_T1only_model.tar.gz

RUN wget -O bibsnet-v3.3.0.tar.gz "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.0.tar.gz" && \
tar -xzf bibsnet-v3.3.0.tar.gz Task542_BIBSnet_Production_T2only_model.tar.gz && \
tar -xzf Task542_BIBSnet_Production_T2only_model.tar.gz -C /opt/nnUNet/nnUNet_raw_data_base/nnUNet_trained_models/nnUNet --strip-components 1 && \
rm bibsnet-v3.3.0.tar.gz Task542_BIBSnet_Production_T2only_model.tar.gz

COPY run.py /home/bibsnet/run.py
COPY src /home/bibsnet/src
COPY bin /home/bibsnet/bin
RUN curl -sSL "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.2.tar.gz" | tar -xzpf - data.tar.gz -O | tar -xzpC /home/bibsnet/data --no-same-owner --strip-components 1
RUN wget -O bibsnet-v3.3.0.tar.gz "https://s3.msi.umn.edu/bibsnet-data/bibsnet-v3.3.0.tar.gz" && \
tar -xzf bibsnet-v3.3.0.tar.gz data.tar.gz && \
tar -xzf data.tar.gz -C /home/bibsnet/data --strip-components 1 && \
rm bibsnet-v3.3.0.tar.gz data.tar.gz

COPY requirements.txt /home/bibsnet/requirements.txt

Expand All @@ -107,6 +126,6 @@ ENV PATH="${PATH}:/home/bibsnet/"
RUN cp /home/bibsnet/run.py /home/bibsnet/bibsnet

RUN cd /home/bibsnet/ && pip install -r requirements.txt
RUN cd /home/bibsnet/ && chmod 555 -R run.py bin src bibsnet
RUN cd /home/bibsnet/ && chmod 555 -R run.py src bibsnet

ENTRYPOINT ["bibsnet"]
40 changes: 0 additions & 40 deletions bin/LR_mask_registration.sh

This file was deleted.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ nibabel==3.2.1
nipype==1.8.6
pandas==1.3.5
scipy==1.10.0
niworkflows==1.9.0
niworkflows==1.9.0
5 changes: 4 additions & 1 deletion src/bibsnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ def run_nnUNet_predict(cli_args):
"""
to_run = [cli_args["nnUNet"], "-i",
cli_args["input"], "-o", cli_args["output"], "-t",
str(cli_args["task"]), "-m", cli_args["model"]]
str(cli_args["task"]), "-m", cli_args["model"],
"--disable_tta"
]

LOGGER.verbose(f"Now running nnUNet with these parameters: {to_run}")
process = subprocess.Popen(to_run, stdout=subprocess.PIPE, universal_newlines=True)
with process.stdout:
Expand Down
Loading

0 comments on commit ace7a36

Please sign in to comment.