Skip to content

Commit

Permalink
Several last bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Michiel Cottaar authored and glasserm committed Oct 29, 2019
1 parent 66843ba commit 36c6beb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DiffusionPreprocessing/scripts/DiffusionToStructural.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ if [ ${GdcorrectionFlag} -eq 1 ]; then

# Transforms field of view mask to T1-weighted space
# (Be sure to use the fov_mask derived prior to application of GDC)
${FSLDIR}/bin/applywarp --rel -i "$DataDirectory"/warped/fov_mask -r "$T1wRestoreImage"_${DiffRes} -w "$WorkingDirectory"/grad_unwarp_diff2str --interp=trilinear -o "$T1wOutputDirectory"/fov_mask
${FSLDIR}/bin/applywarp --rel -i "$DataDirectory"/warped/fov_mask_warped -r "$T1wRestoreImage"_${DiffRes} -w "$WorkingDirectory"/grad_unwarp_diff2str --interp=trilinear -o "$T1wOutputDirectory"/fov_mask

# Now register the grad_dev tensor
${FSLDIR}/bin/vecreg -i "$DataDirectory"/grad_dev -o "$T1wOutputDirectory"/grad_dev -r "$T1wRestoreImage"_${DiffRes} -t "$WorkingDirectory"/diff2str.mat --interp=spline
Expand All @@ -129,7 +129,7 @@ fi
# only include voxels fully(!) within the field of view for every volume
${FSLDIR}/bin/fslmaths "$T1wOutputDirectory"/fov_mask -thr 0.999 -bin "$T1wOutputDirectory"/fov_mask

# Mask out data outside the brain adn outside the fov
# Mask out data outside the brain and outside the fov
${FSLDIR}/bin/fslmaths "$T1wOutputDirectory"/data -mas "$T1wOutputDirectory"/nodif_brain_mask_temp -mas "$T1wOutputDirectory"/fov_mask "$T1wOutputDirectory"/data
${FSLDIR}/bin/fslmaths "$T1wOutputDirectory"/data -thr 0 "$T1wOutputDirectory"/data #Remove negative intensity values (from eddy) from final data
${FSLDIR}/bin/imrm "$T1wOutputDirectory"/nodif_brain_mask_temp
Expand Down
4 changes: 2 additions & 2 deletions DiffusionPreprocessing/scripts/eddy_postproc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ if [ ! $GdCoeffs = "NONE" ] ; then
${FSLDIR}/bin/immv ${datadir}/data ${datadir}/data_warped

# Dilation outside of the field of view to minimise the effect of the hard field of view edge on the interpolation
DiffRes=`${FSLDIR}/bin/fslval ${datadir}/data pixdim1`
DiffRes=`${FSLDIR}/bin/fslval ${datadir}/data_warped pixdim1`
DilateDistance=`echo "$DiffRes * 4" | bc` # Extrapolates the diffusion data up to 4 voxels outside of the FOV
${CARET7DIR}/wb_command -volume-dilate ${datadir}/warped/data_warped.nii.gz $DilateDistance NEAREST ${datadir}/warped/data_warped_dilated.nii.gz
${CARET7DIR}/wb_command -volume-dilate ${datadir}/data_warped.nii.gz $DilateDistance NEAREST ${datadir}/data_warped_dilated.nii.gz

# apply gradient distortion correction
${globalscriptsdir}/GradientDistortionUnwarp.sh --workingdir="${datadir}" --coeffs="${GdCoeffs}" --in="${datadir}/data_warped_dilated" --out="${datadir}/data" --owarp="${datadir}/fullWarp"
Expand Down

0 comments on commit 36c6beb

Please sign in to comment.