Visualization problem with tensors ? #1396

Closed
opened this Issue Jan 4, 2018 · 1 comment

Projects
2 participants

carpre commented Jan 4, 2018 • edited

 Hi, I did an experiment with 2 gradient tables. The second gradient table is the same than the first but with x and y flipped (-x and -y). I computed the tensors and tried to plot 3 slices (coronal, axial and sagittal) using vtk as shown in the examples. I can see that I get different eigen vectors for the 2 gradient tables when I print them. Original evec `[[[-0.71158536 0.21049986 0.67032535]` `[ 0.69739829 0.09573807 0.71026041]` `[ 0.08533406 0.97289467 -0.21492805]]]` Flipped evec `[[[-0.71158536 -0.21049986 0.67032535]` `[ 0.69739829 -0.09573807 0.71026041]` `[-0.08533406 0.97289467 0.21492805]]]` However, I get the exact same tensors for the 3 planes when plotting the same slices. I am not sure to understand how I can get the same tensors oriented the same way when my evecs are not in the same direction ? If I would have a flip in the 3 axes, it would obviously be the same direction, but not if only 2 out of 3 are flipped ? I did the same processing with MRtrix and there is a clear flip in sagittal when I plot the tensors with mrview. I assume it's the way I am plotting my tensors, but I can't figure out what's wrong. This is how I am doing it: `tenmodel = TensorModel(gtab)` `tenfit = tenmodel.fit(data)` `RGB = color_fa(tenfit.fa, tenfit.evecs)` `sphere = get_sphere('symmetric724')` `ren = fvtk.ren()` `fvtk.add(ren, fvtk.tensor(tenfit.evals[:,:28], tenfit.evecs[:,:28], RGB[:,:28]/RGB[:,:,28].max(), sphere))` `fvtk.record(ren, n_frames=1, out_path='out.png', size=(1000, 1000))` For the other planes, I am making sure to give it as a NxMx1x3 or NXMx1x3x3 like so: `evals = tenfit.evals[:, 40:41, :].squeeze()` `evecs = tenfit.evecs[:, 40:41, :].squeeze()` `rgb = (RGB[:, 40:41, :]/RGB[:, 40:41, :].max()).squeeze()` `ren = fvtk.ren()` `fvtk.add(ren, fvtk.tensor(evals[:, :, np.newaxis, :], evecs[:, :, np.newaxis, :, :], rgb[:, :, np.newaxis, :], sphere))` Doing that, the tensors look exactly the same in the 3 planes, even though the gradients are suppose to be flipped in x and y and that the evecs are not the same (some signs are different). Any idea what I am doing wrong ? Also, is there a way to put the corresponding FA slice under the tensors so it's easier to look at ? I tried adding an actor using vtk.add(ren, fvtk.slicer(fa[:, :, 28])) before the tensors, but the FA is not at the right place under the tensors. Thank you very much for your help :)

Open

Member

skoudoro commented Sep 20, 2018

 This issue was moved to fury-gl/fury#12