Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ANTSPATH #1574

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ LABEL maintainer="ANTsX team" \
description="ANTs is part of the ANTsX ecosystem (https://github.com/ANTsX). \
ANTs Citation: https://pubmed.ncbi.nlm.nih.gov/24879923"

ENV ANTSPATH="/opt/ants/bin/" \
PATH="/opt/ants/bin:$PATH" \
ENV PATH="/opt/ants/bin:$PATH" \
LD_LIBRARY_PATH="/opt/ants/lib:$LD_LIBRARY_PATH"
RUN apt-get update \
&& apt install -y --no-install-recommends \
Expand Down
52 changes: 18 additions & 34 deletions Scripts/ants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@
NUMPARAMS=$#

MAXITERATIONS=30x90x20
if [[ -z ${ANTSPATH} ]] ; then
echo "Environment variable ANTSPATH must be defined"
exit 1
fi
if [[ ! -f "${ANTSPATH}/ANTS" ]] ; then
echo "Cannot find the ANTS program. Please \(re\)define \$ANTSPATH in your environment."

if ! command -v "ANTS" &> /dev/null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need the square brackets still

Copy link
Contributor Author

@ghisvail ghisvail Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works without brackets on my machine. I used the pattern in the accepted answer of the SO thread linked above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# Make ANTS disappear from PATH.
$ mv $HOME/.local/ants/bin/ANTS{,.bak}

# Run wrapper script.
$ ./Scripts/ants.sh
Cannot find the ANTS program. Please \(re\)define $PATH in your environment.

# Put it back.
$ mv $HOME/.local/ants/bin/ANTS{.bak,}

# Run wrapper script again.
$ ./Scripts/ants.sh
 USAGE ::  
  sh   ants.sh  ImageDimension  fixed.ext  moving.ext  OPTIONAL-OUTPREFIX   OPTIONAL-max-iterations  OPTIONAL-Labels-In-Fixed-Image-Space-To-Deform-To-Moving-

then
echo "Cannot find the ANTS program. Please \(re\)define \$PATH in your environment."
exit 1
fi

if [ $NUMPARAMS -lt 3 ]
then
echo " USAGE :: "
echo " sh ants.sh ImageDimension fixed.ext moving.ext OPTIONAL-OUTPREFIX OPTIONAL-max-iterations OPTIONAL-Labels-In-Fixed-Image-Space-To-Deform-To-Moving-Image Option-DoANTSQC "
echo " be sure to set ANTSPATH environment variable "
echo " Max-Iterations in form : JxKxL where "
echo " J = max iterations at coarsest resolution (here, reduce by power of 2^2) "
echo " K = middle resolution iterations ( here, reduce by power of 2 ) "
Expand All @@ -27,18 +24,6 @@ echo " Other parameters are updates of the defaults used in the A. Klein evaluat
exit
fi

#ANTSPATH=YOURANTSPATH
if [ ${#ANTSPATH} -le 0 ]
then
echo " Please set ANTSPATH=LocationOfYourAntsBinaries "
echo " Either set this in your profile or directly, here in the script. "
echo " For example : "
echo " ANTSPATH=/home/yourname/bin/ants/ "
exit
else
echo " ANTSPATH is $ANTSPATH "
fi

#initialization, here, is unbiased
DIM=$1

Expand Down Expand Up @@ -101,7 +86,6 @@ fi
# exit


echo " ANTSPATH is $ANTSPATH "
echo " Mapping Parameters :: "
echo " Transformation is: $TRANSFORMATION "
echo " MaxIterations : $MAXITERATIONS "
Expand All @@ -116,10 +100,10 @@ echo " "


if [[ ! -s ${OUTPUTNAME}repaired.nii.gz ]] ; then
${ANTSPATH}/N4BiasFieldCorrection -d $DIM -i $MOVING -o ${OUTPUTNAME}repaired.nii.gz -s 2 -c [ 50x50x50x50,0.000001 ] -b [ 200 ]
# ${ANTSPATH}/N3BiasFieldCorrection $DIM $MOVING ${OUTPUTNAME}repaired.nii.gz 4
N4BiasFieldCorrection -d $DIM -i $MOVING -o ${OUTPUTNAME}repaired.nii.gz -s 2 -c [ 50x50x50x50,0.000001 ] -b [ 200 ]
# N3BiasFieldCorrection $DIM $MOVING ${OUTPUTNAME}repaired.nii.gz 4
fi
exe=" ${ANTSPATH}/ANTS $DIM -m ${METRIC}${FIXED},${OUTPUTNAME}repaired.nii.gz,${METRICPARAMS} -t $TRANSFORMATION -r $REGULARIZATION -o ${OUTPUTNAME} -i $MAXITERATIONS --use-Histogram-Matching --number-of-affine-iterations 10000x10000x10000x10000x10000 --MI-option 32x16000 "
exe=" ANTS $DIM -m ${METRIC}${FIXED},${OUTPUTNAME}repaired.nii.gz,${METRICPARAMS} -t $TRANSFORMATION -r $REGULARIZATION -o ${OUTPUTNAME} -i $MAXITERATIONS --use-Histogram-Matching --number-of-affine-iterations 10000x10000x10000x10000x10000 --MI-option 32x16000 "

echo " $exe "

Expand All @@ -128,31 +112,31 @@ exe=" ${ANTSPATH}/ANTS $DIM -m ${METRIC}${FIXED},${OUTPUTNAME}repaired.nii.gz,$
#below, some affine options
#--MI-option 16x8000 #-a InitAffine.txt --continue-affine 0

${ANTSPATH}/WarpImageMultiTransform $DIM ${OUTPUTNAME}repaired.nii.gz ${OUTPUTNAME}deformed.nii.gz ${OUTPUTNAME}Warp.nii.gz ${OUTPUTNAME}Affine.txt -R ${FIXED}
WarpImageMultiTransform $DIM ${OUTPUTNAME}repaired.nii.gz ${OUTPUTNAME}deformed.nii.gz ${OUTPUTNAME}Warp.nii.gz ${OUTPUTNAME}Affine.txt -R ${FIXED}

if [ ${#LABELIMAGE} -gt 3 ]
then
${ANTSPATH}/WarpImageMultiTransform $DIM $LABELIMAGE ${OUTPUTNAME}labeled.nii.gz -i ${OUTPUTNAME}Affine.txt ${OUTPUTNAME}InverseWarp.nii.gz -R ${MOVING} --use-NN
WarpImageMultiTransform $DIM $LABELIMAGE ${OUTPUTNAME}labeled.nii.gz -i ${OUTPUTNAME}Affine.txt ${OUTPUTNAME}InverseWarp.nii.gz -R ${MOVING} --use-NN
fi

exit

if [ $DoANTSQC -eq 1 ] ; then
# measure image similarity
for SIM in 0 1 2 ; do
${ANTSPATH}/MeasureImageSimilarity $DIM $SIM $FIXED ${OUTPUTNAME}deformed.nii.gz
MeasureImageSimilarity $DIM $SIM $FIXED ${OUTPUTNAME}deformed.nii.gz
done
# measure dice overlap and mds
${ANTSPATH}/ThresholdImage $DIM $FIXED ${OUTPUTNAME}fixthresh.nii.gz Otsu 4
${ANTSPATH}/ThresholdImage $DIM $MOVING ${OUTPUTNAME}movthresh.nii.gz Otsu 4
${ANTSPATH}/WarpImageMultiTransform $DIM ${OUTPUTNAME}movthresh.nii.gz ${OUTPUTNAME}defthresh.nii.gz ${OUTPUTNAME}Warp.nii.gz ${OUTPUTNAME}Affine.txt -R ${FIXED} --use-NN
${ANTSPATH}/ImageMath $DIM ${OUTPUTNAME}dicestats.txt DiceAndMinDistSum ${OUTPUTNAME}fixthresh.nii.gz ${OUTPUTNAME}movthresh.nii.gz ${OUTPUTNAME}mindistsum.nii.gz
ThresholdImage $DIM $FIXED ${OUTPUTNAME}fixthresh.nii.gz Otsu 4
ThresholdImage $DIM $MOVING ${OUTPUTNAME}movthresh.nii.gz Otsu 4
WarpImageMultiTransform $DIM ${OUTPUTNAME}movthresh.nii.gz ${OUTPUTNAME}defthresh.nii.gz ${OUTPUTNAME}Warp.nii.gz ${OUTPUTNAME}Affine.txt -R ${FIXED} --use-NN
ImageMath $DIM ${OUTPUTNAME}dicestats.txt DiceAndMinDistSum ${OUTPUTNAME}fixthresh.nii.gz ${OUTPUTNAME}movthresh.nii.gz ${OUTPUTNAME}mindistsum.nii.gz
# labelstats for jacobian wrt segmenation
# below, to compose
# ${ANTSPATH}ComposeMultiTransform $DIM ${OUTPUTNAME}CompWarp.nii.gz -R $FIXED ${OUTPUTNAME}Warp.nii.gz ${OUTPUTNAME}Affine.txt
# ${ANTSPATH}CreateJacobianDeterminantImage $DIM ${OUTPUTNAME}CompWarp.nii.gz ${OUTPUTNAME}jacobian.nii.gz 0
# ${ANTSPATH}ImageMath $DIM ${OUTPUTNAME}movlabstat.txt LabelStats ${OUTPUTNAME}movthresh.nii.gz ${OUTPUTNAME}movthresh.nii.gz
# ${ANTSPATH}ImageMath $DIM ${OUTPUTNAME}jaclabstat.txt LabelStats ${OUTPUTNAME}defthresh.nii.gz ${OUTPUTNAME}jacobian.nii.gz
# ComposeMultiTransform $DIM ${OUTPUTNAME}CompWarp.nii.gz -R $FIXED ${OUTPUTNAME}Warp.nii.gz ${OUTPUTNAME}Affine.txt
# CreateJacobianDeterminantImage $DIM ${OUTPUTNAME}CompWarp.nii.gz ${OUTPUTNAME}jacobian.nii.gz 0
# ImageMath $DIM ${OUTPUTNAME}movlabstat.txt LabelStats ${OUTPUTNAME}movthresh.nii.gz ${OUTPUTNAME}movthresh.nii.gz
# ImageMath $DIM ${OUTPUTNAME}jaclabstat.txt LabelStats ${OUTPUTNAME}defthresh.nii.gz ${OUTPUTNAME}jacobian.nii.gz
# we compare the output of these last two lines:
# the Volume of the movlabstat computation vs. the mass of the jaclabstat
fi
54 changes: 27 additions & 27 deletions Scripts/antsASLProcessing.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/bash

if [[ ! -s ${ANTSPATH}/antsRegistration ]]
if ! command -v antsRegistration &> /dev/null
then
echo "Cannot find antsRegistration. Please \(re\)define \$ANTSPATH in your environment."
echo "Cannot find antsRegistration. Please \(re\)define \$PATH in your environment."
fi
if [[ ! -s ${ANTSPATH}/antsApplyTransforms ]]
if ! command -v antsApplyTransforms &> /dev/null
then
echo "Cannot find antsApplyTransforms. Please \(re\)define \$ANTSPATH in your environment."
echo "Cannot find antsApplyTransforms. Please \(re\)define \$PATH in your environment."
fi
if [[ ! -s ${ANTSPATH}/antsIntermodalityIntrasubject.sh ]]
if ! command -v antsIntermodalityIntrasubject.sh &> /dev/null
then
echo "Cannot find antsIntermodalityIntrasubject.sh script. Please \(re\)define \$ANTSPATH in your environemnt."
echo "Cannot find antsIntermodalityIntrasubject.sh script. Please \(re\)define \$PATH in your environemnt."
fi

function Usage {
Expand Down Expand Up @@ -258,33 +258,33 @@ then
mkdir -p `dirname $OUTNAME`
fi
if [[ ! -s ${OUTNAME}/AveragePCASL.nii.gz ]] ; then
logCmd ${ANTSPATH}/antsMotionCorr -d 3 -a $PCASL -o ${OUTNAME}AveragePCASL.nii.gz
logCmd antsMotionCorr -d 3 -a $PCASL -o ${OUTNAME}AveragePCASL.nii.gz
fi
logCmd ${ANTSPATH}/ThresholdImage 3 ${OUTNAME}AveragePCASL.nii.gz ${OUTNAME}tmp.nii.gz 600 999999
logCmd ${ANTSPATH}/ImageMath 3 ${OUTNAME}tmp.nii.gz ME ${OUTNAME}tmp.nii.gz 2
logCmd ${ANTSPATH}/ImageMath 3 ${OUTNAME}tmp.nii.gz GetLargestComponent ${OUTNAME}tmp.nii.gz
logCmd ${ANTSPATH}/ImageMath 3 ${OUTNAME}tmp.nii.gz MD ${OUTNAME}tmp.nii.gz 3
logCmd ${ANTSPATH}/ImageMath 3 ${OUTNAME}pCASLBrain.nii.gz m ${OUTNAME}AveragePCASL.nii.gz ${OUTNAME}tmp.nii.gz
logCmd ThresholdImage 3 ${OUTNAME}AveragePCASL.nii.gz ${OUTNAME}tmp.nii.gz 600 999999
logCmd ImageMath 3 ${OUTNAME}tmp.nii.gz ME ${OUTNAME}tmp.nii.gz 2
logCmd ImageMath 3 ${OUTNAME}tmp.nii.gz GetLargestComponent ${OUTNAME}tmp.nii.gz
logCmd ImageMath 3 ${OUTNAME}tmp.nii.gz MD ${OUTNAME}tmp.nii.gz 3
logCmd ImageMath 3 ${OUTNAME}pCASLBrain.nii.gz m ${OUTNAME}AveragePCASL.nii.gz ${OUTNAME}tmp.nii.gz

INTERSUBJECT_PARAMS=" -d 3 -i ${OUTNAME}pCASLBrain.nii.gz -r $ANATOMICAL_IMAGE -x $BRAINMASK -w ${TRANSFORM_PREFIX}SubjectToTemplate -t 2 -o $OUTNAME "
if [[ -n $LABELS ]]
then
INTERSUBJECT_PARAMS=" ${INTERSUBJECT_PARAMS} -l $LABELS "
fi

logCmd ${ANTSPATH}/antsIntermodalityIntrasubject.sh $INTERSUBJECT_PARAMS
logCmd ${ANTSPATH}/N4BiasFieldCorrection -d 3 -i ${OUTNAME}AveragePCASL.nii.gz -o ${OUTNAME}AveragePCASL.nii.gz -r 1 -s 4
logCmd ${ANTSPATH}/N4BiasFieldCorrection -d 3 -i ${OUTNAME}AveragePCASL.nii.gz -o ${OUTNAME}AveragePCASL.nii.gz -r 1 -s 2
logCmd ${ANTSPATH}/N4BiasFieldCorrection -d 3 -i ${OUTNAME}AveragePCASL.nii.gz -o ${OUTNAME}AveragePCASL.nii.gz -r 1 -s 1
logCmd ${ANTSPATH}/ThresholdImage 3 ${OUTNAME}AveragePCASL.nii.gz ${OUTNAME}OtsuMask.nii.gz Otsu 4
logCmd ${ANTSPATH}/ThresholdImage 3 ${OUTNAME}OtsuMask.nii.gz ${OUTNAME}OtsuMask.nii.gz 2 4
logCmd ${ANTSPATH}/ImageMath 3 ${OUTNAME}OtsuMask.nii.gz ME ${OUTNAME}OtsuMask.nii.gz 1
logCmd ${ANTSPATH}/ImageMath 3 ${OUTNAME}OtsuMask.nii.gz MD ${OUTNAME}OtsuMask.nii.gz 1
logCmd ${ANTSPATH}/ThresholdImage 3 ${OUTNAME}brainmask.nii.gz ${OUTNAME}BrainThresh.nii.gz 1 999
logCmd ${ANTSPATH}/MultiplyImages 3 ${OUTNAME}OtsuMask.nii.gz ${OUTNAME}BrainThresh.nii.gz ${OUTNAME}OtsuMask.nii.gz
logCmd antsIntermodalityIntrasubject.sh $INTERSUBJECT_PARAMS
logCmd N4BiasFieldCorrection -d 3 -i ${OUTNAME}AveragePCASL.nii.gz -o ${OUTNAME}AveragePCASL.nii.gz -r 1 -s 4
logCmd N4BiasFieldCorrection -d 3 -i ${OUTNAME}AveragePCASL.nii.gz -o ${OUTNAME}AveragePCASL.nii.gz -r 1 -s 2
logCmd N4BiasFieldCorrection -d 3 -i ${OUTNAME}AveragePCASL.nii.gz -o ${OUTNAME}AveragePCASL.nii.gz -r 1 -s 1
logCmd ThresholdImage 3 ${OUTNAME}AveragePCASL.nii.gz ${OUTNAME}OtsuMask.nii.gz Otsu 4
logCmd ThresholdImage 3 ${OUTNAME}OtsuMask.nii.gz ${OUTNAME}OtsuMask.nii.gz 2 4
logCmd ImageMath 3 ${OUTNAME}OtsuMask.nii.gz ME ${OUTNAME}OtsuMask.nii.gz 1
logCmd ImageMath 3 ${OUTNAME}OtsuMask.nii.gz MD ${OUTNAME}OtsuMask.nii.gz 1
logCmd ThresholdImage 3 ${OUTNAME}brainmask.nii.gz ${OUTNAME}BrainThresh.nii.gz 1 999
logCmd MultiplyImages 3 ${OUTNAME}OtsuMask.nii.gz ${OUTNAME}BrainThresh.nii.gz ${OUTNAME}OtsuMask.nii.gz

if [ ! -f ${OUTNAME}_kcbf.nii.gz ]; then
logCmd ${ANTSPATH}/antsNetworkAnalysis.R \
logCmd antsNetworkAnalysis.R \
-o $OUTNAME \
--freq 0.01x0.1 \
--mask ${OUTNAME}OtsuMask.nii.gz \
Expand All @@ -298,7 +298,7 @@ if [ ! -f ${OUTNAME}_kcbf.nii.gz ]; then
--replace $SAMPLE_WITH_REPLACEMENT
fi

logCmd ${ANTSPATH}/antsApplyTransforms -d 3 \
logCmd antsApplyTransforms -d 3 \
-i ${OUTNAME}_kcbf.nii.gz \
-r $TEMPLATE \
-o ${OUTNAME}MeanCBFWarpedToTemplate.nii.gz \
Expand All @@ -308,7 +308,7 @@ logCmd ${ANTSPATH}/antsApplyTransforms -d 3 \
-t ${OUTNAME}1Warp.nii.gz \
-t ${OUTNAME}0GenericAffine.mat

logCmd ${ANTSPATH}/antsApplyTransforms -d 3 \
logCmd antsApplyTransforms -d 3 \
-i $LABELS \
-r ${OUTNAME}AveragePCASL.nii.gz \
-o ${OUTNAME}LabelsWarpedToPCASL.nii.gz \
Expand All @@ -318,15 +318,15 @@ logCmd ${ANTSPATH}/antsApplyTransforms -d 3 \
-t [ ${OUTNAME}0GenericAffine.mat,1 ] \
-t ${OUTNAME}1InverseWarp.nii.gz

logCmd ${ANTSPATH}/antsApplyTransforms -d 3 \
logCmd antsApplyTransforms -d 3 \
-i ${OUTNAME}_kcbf.nii.gz \
-r $ANATOMICAL_IMAGE \
-o ${OUTNAME}MeanCBFWarpedToT1.nii.gz \
-n Linear \
-t ${OUTNAME}1Warp.nii.gz \
-t ${OUTNAME}0GenericAffine.mat \

logCmd ${ANTSPATH}/antsApplyTransforms -d 3 \
logCmd antsApplyTransforms -d 3 \
-i $SEGMENTATION \
-r ${OUTNAME}AveragePCASL.nii.gz \
-o ${OUTNAME}SegmentationWarpedToPCASL.nii.gz \
Expand Down
30 changes: 16 additions & 14 deletions Scripts/antsAtroposN4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

VERSION="0.0"

if [[ ! -s ${ANTSPATH}/N4BiasFieldCorrection ]]; then
echo we cant find the N4 program -- does not seem to exist. please \(re\)define \$ANTSPATH in your environment.
if ! command -v N4BiasFieldCorrection &> /dev/null
then
echo we cant find the N4 program -- does not seem to exist. please \(re\)define \$PATH in your environment.
exit
fi
if [[ ! -s ${ANTSPATH}/Atropos ]]; then
echo we cant find the Atropos program -- does not seem to exist. please \(re\)define \$ANTSPATH in your environment.
if ! command -v Atropos &> /dev/null
then
echo we cant find the Atropos program -- does not seem to exist. please \(re\)define \$PATH in your environment.
exit
fi

Expand Down Expand Up @@ -46,13 +48,13 @@ DEBUG_MODE=0

N4_ATROPOS_NUMBER_OF_ITERATIONS=15

N4=${ANTSPATH}/N4BiasFieldCorrection
N4=N4BiasFieldCorrection
N4_CONVERGENCE="[ 50x50x50x50,0.0000000001 ]"
N4_SHRINK_FACTOR=2
N4_BSPLINE_PARAMS="[ 200 ]"
N4_WEIGHT_MASK_POSTERIOR_LABELS=()

ATROPOS=${ANTSPATH}/Atropos
ATROPOS=Atropos
ATROPOS_SEGMENTATION_PRIOR_WEIGHT=0.0
ATROPOS_SEGMENTATION_LIKELIHOOD="Gaussian"
ATROPOS_SEGMENTATION_POSTERIOR_FORMULATION="Socrates[ 1 ]"
Expand Down Expand Up @@ -457,10 +459,10 @@ ATROPOS_SEGMENTATION_POSTERIORS=${ATROPOS_SEGMENTATION_OUTPUT}Posteriors%${FORMA

if [[ ${DENOISE_ANATOMICAL_IMAGES} -ne 0 ]];
then
if [[ ! -s ${ANTSPATH}/DenoiseImage ]];
if [[ ! -s DenoiseImage ]];
then
echo "Error: we can't find the DenoiseImage program."
echo "Perhaps you need to \(re\)define \$ANTSPATH in your environment or update your repository."
echo "Perhaps you need to \(re\)define \$PATH in your environment or update your repository."
exit
fi
fi
Expand All @@ -472,10 +474,10 @@ for (( j = 0; j < ${#ANATOMICAL_IMAGES[@]}; j++ ))
do
SEGMENTATION_PREPROCESSED_IMAGES=( ${SEGMENTATION_PREPROCESSED_IMAGES[@]} ${ATROPOS_SEGMENTATION_OUTPUT}PreprocessedAnatomical${j}.${OUTPUT_SUFFIX} )
# Truncate on the whole head to get outliers over the whole volume, without losing contrast in the brain
logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${SEGMENTATION_PREPROCESSED_IMAGES[$j]} TruncateImageIntensity ${ANATOMICAL_IMAGES[$j]} 0 0.995 256
logCmd ImageMath ${DIMENSION} ${SEGMENTATION_PREPROCESSED_IMAGES[$j]} TruncateImageIntensity ${ANATOMICAL_IMAGES[$j]} 0 0.995 256
if [[ ${DENOISE_ANATOMICAL_IMAGES} -ne 0 ]];
then
logCmd ${ANTSPATH}/DenoiseImage -d ${DIMENSION} -i ${SEGMENTATION_PREPROCESSED_IMAGES[$j]} -o ${SEGMENTATION_PREPROCESSED_IMAGES[$j]} --verbose 1
logCmd DenoiseImage -d ${DIMENSION} -i ${SEGMENTATION_PREPROCESSED_IMAGES[$j]} -o ${SEGMENTATION_PREPROCESSED_IMAGES[$j]} --verbose 1
fi
done

Expand Down Expand Up @@ -508,7 +510,7 @@ if [[ $INITIALIZE_WITH_KMEANS -eq 0 ]]

if [[ ${#N4_WEIGHT_MASK_IMAGES[@]} -gt 0 ]];
then
logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${SEGMENTATION_WEIGHT_MASK} PureTissueN4WeightMask ${N4_WEIGHT_MASK_IMAGES[@]}
logCmd ImageMath ${DIMENSION} ${SEGMENTATION_WEIGHT_MASK} PureTissueN4WeightMask ${N4_WEIGHT_MASK_IMAGES[@]}
fi
fi

Expand All @@ -530,8 +532,8 @@ for (( i = 0; i < ${N4_ATROPOS_NUMBER_OF_ITERATIONS}; i++ ))
exe_n4_correction="${exe_n4_correction} -w ${SEGMENTATION_WEIGHT_MASK}"
fi
logCmd $exe_n4_correction
logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${SEGMENTATION_N4_IMAGES[$j]} Normalize ${SEGMENTATION_N4_IMAGES[$j]}
logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${SEGMENTATION_N4_IMAGES[$j]} m ${SEGMENTATION_N4_IMAGES[$j]} 1000
logCmd ImageMath ${DIMENSION} ${SEGMENTATION_N4_IMAGES[$j]} Normalize ${SEGMENTATION_N4_IMAGES[$j]}
logCmd ImageMath ${DIMENSION} ${SEGMENTATION_N4_IMAGES[$j]} m ${SEGMENTATION_N4_IMAGES[$j]} 1000
done

ATROPOS_ANATOMICAL_IMAGES_COMMAND_LINE=''
Expand Down Expand Up @@ -642,7 +644,7 @@ for (( i = 0; i < ${N4_ATROPOS_NUMBER_OF_ITERATIONS}; i++ ))

if [[ ${#N4_WEIGHT_MASK_IMAGES[@]} -gt 0 ]];
then
logCmd ${ANTSPATH}/ImageMath ${DIMENSION} ${SEGMENTATION_WEIGHT_MASK} PureTissueN4WeightMask ${N4_WEIGHT_MASK_IMAGES[@]}
logCmd ImageMath ${DIMENSION} ${SEGMENTATION_WEIGHT_MASK} PureTissueN4WeightMask ${N4_WEIGHT_MASK_IMAGES[@]}
fi

done
Expand Down
Loading