You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: console/nii_dicom_batch.cpp
+13-6Lines changed: 13 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -303,6 +303,12 @@ void geCorrectBvecs(struct TDICOMdata *d, int sliceDir, struct TDTI *vx, int isV
303
303
if (abs(sliceDir) != 3)
304
304
printWarning("Limited validation for non-Axial DTI: confirm gradient vector transformation.\n");
305
305
// GE vectors from Xiangrui Li' dicm2nii, validated with datasets from https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Diffusion_Tensor_Imaging
306
+
//
307
+
// GE → FSL bvec (see issue 970) for unit vector
308
+
// 1) Apply plane-dependent flip first
309
+
// 2) Always negate Y
310
+
// 3) ROW swap/flip (if !col)
311
+
// 4) Negate all components (compatibility)
306
312
ivec3 flp;
307
313
if (abs(sliceDir) == 1)
308
314
flp = setiVec3(1, 1, 0); // SAGITTAL
@@ -353,18 +359,19 @@ void geCorrectBvecs(struct TDICOMdata *d, int sliceDir, struct TDTI *vx, int isV
353
359
vx[i].V[2] = vx[i].V[2] * bVecScale;
354
360
vx[i].V[3] = vx[i].V[3] * bVecScale;
355
361
}
362
+
for (int v = 0; v < 3; v++)
363
+
if (flp.v[v] == 1)
364
+
vx[i].V[v + 1] = -vx[i].V[v + 1];
365
+
vx[i].V[2] = -vx[i].V[2]; // we read out Y-direction opposite order as dicm2nii, see also opts.isFlipY
366
+
// 3) ROW swap/flip (if !col) (see issue 970)
356
367
if (!col) { // rows need to be swizzled
357
368
// see Stanford dataset Ax_DWI_Tetrahedral_7 unable to resolve between possible solutions
0 commit comments