Skip to content

Commit

Permalink
Merge pull request #1714 from MRtrix3/dwi2mask_fslgrad_fix
Browse files Browse the repository at this point in the history
dwi2mask: Fix segfault with -fslgrad
  • Loading branch information
jdtournier authored Sep 11, 2019
2 parents 1b818fc + ff11902 commit 30c24e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/dwi/gradient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ namespace MR
if (bvals.cols() != bvecs.cols())
throw Exception ("bvecs and bvals files must have same number of diffusion directions (file \"" + bvecs_path + "\" has " + str(bvecs.cols()) + ", file \"" + bvals_path + "\" has " + str(bvals.cols()) + ")");

if (bvals.cols() != header.size (3))
throw Exception ("bvecs and bvals files must have same number of diffusion directions as DW-image (gradients: " + str(bvecs.cols()) + ", image: " + str(header.size(3)) + ")");
const size_t num_volumes = header.ndim() < 4 ? 1 : header.size(3);
if (size_t(bvals.cols()) != num_volumes)
throw Exception ("bvecs and bvals files must have same number of diffusion directions as DW-image (gradients: " + str(bvecs.cols()) + ", image: " + str(num_volumes) + ")");

// bvecs format actually assumes a LHS coordinate system even if image is
// stored using RHS - x axis is flipped to make linear 3x3 part of
Expand Down

0 comments on commit 30c24e3

Please sign in to comment.