Skip to content
Merged
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
21 changes: 16 additions & 5 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,26 @@ do
cp -v $out_nointcorr $out_unwarped
fi

echo "settings datatype to short and resetting header from original image"

#ensure final unwarped (out_unwarped) is same datatype and geom as input (assuming mr images are input type short)
echo fslmaths $out_unwarped $out_unwarped -odt short
fslmaths $out_unwarped $out_unwarped -odt short
echo "settings datatype to match input and resetting header from original image"

#ensure final unwarped (out_unwarped) is same datatype and geom as input
#detect the original datatype so we correctly handle both signed (INT16) and unsigned (UINT16) short
orig_dtype=$(fslinfo $nii | grep "^data_type" | awk '{print $2}')
case "$orig_dtype" in
UINT8) odt="char" ;;
INT16) odt="short" ;;
UINT16) odt="int" ;; # fslmaths has no ushort; INT32 holds all UINT16 values without sign corruption
INT32) odt="int" ;;
FLOAT32) odt="float" ;;
FLOAT64) odt="double" ;;
*) odt="short" ;;
esac
echo fslmaths $out_unwarped $out_unwarped -odt $odt
fslmaths $out_unwarped $out_unwarped -odt $odt
echo fslcpgeom $nii $out_unwarped
fslcpgeom $nii $out_unwarped


#copy extra files
for ext in json bvec bval tsv
do
Expand Down