Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
Merge pull request #31 from scitran-apps/parrecfix
Browse files Browse the repository at this point in the history
Parrecfix
  • Loading branch information
lmperry authored Feb 26, 2019
2 parents 2cf0b89 + 3e4a189 commit 5a916ad
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN apt-get update -qq \
python

# Compile DCM2NIIX from source
ENV DCMCOMMIT=5af76a90e46aebff790ab5d0f45846f95a940a2a
ENV DCMCOMMIT=3d74eabceeaab57213e9ffef91c96de128ac5150
RUN curl -#L https://github.com/rordenlab/dcm2niix/archive/$DCMCOMMIT.zip | bsdtar -xf- -C /usr/local
WORKDIR /usr/local/dcm2niix-${DCMCOMMIT}/build
RUN cmake -DUSE_OPENJPEG=ON -MY_DEBUG_GE=ON ../ && \
Expand Down
8 changes: 6 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
"source": "https://github.com/scitran-apps/dcm2niix",
"license": "BSD-2-Clause",
"flywheel": "0",
"version": "0.7.6_1.0.20180622_5af76a9",
"version": "0.7.7_1.0.20181114",
"custom": {
"docker-image": "scitran/dcm2niix:0.7.6_1.0.20180622_5af76a9",
"docker-image": "scitran/dcm2niix:0.7.7_1.0.20181114",
"flywheel": {
"uid": 1000,
"gid": 1000
},
"gear-builder": {
"category": "converter",
"image": "scitran/dcm2niix:0.7.7_1.0.20181114"
}
},
"config": {
Expand Down
12 changes: 11 additions & 1 deletion run_dcm2niix
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ if [[ "$input_file" == *.zip ]] ; then
# If there is no unzipped sub-directory, check for PAR/REC files at the top-level
if [[ -z "$dicom_input" ]]; then
dicom_input=$(find $INPUT_DIR/* -not -path '*/\.*' -type f -name "*.par" -o -name "*.PAR" | head -1)
if [[ -n "$dicom_input" ]]; then
# Rename par/rec pair using generic names
dicom_input=$INPUT_DIR/inputfile.par
find $INPUT_DIR/* -not -path '*/\.*' -type f -name "*.par" -o -name "*.PAR" -exec mv {} $dicom_input \;
find $INPUT_DIR/* -not -path '*/\.*' -type f -name "*.rec" -o -name "*.REC" -exec mv {} $INPUT_DIR/inputfile.rec \;
fi
fi

# Zip bomb: DICOMS are at the top level -- set dicom_input to INPUT_DIR
Expand All @@ -119,6 +125,8 @@ else
dicom_input=$INPUT_DIR
fi

echo -e "$CONTAINER $dicom_input"

##############################################################################
# Decompression of DICOM files.

Expand Down Expand Up @@ -211,7 +219,9 @@ else
fi
dcm2niix_exit_code=$?

mv $DCM_OUTPUT_DIR/* $OUTPUT_DIR/
if [[ $dcm2niix_exit_code == 0 ]] || [[ $ignore_errors == "true" ]]; then
mv $DCM_OUTPUT_DIR/* $OUTPUT_DIR/
fi


##############################################################################
Expand Down

0 comments on commit 5a916ad

Please sign in to comment.