Fork me on GitHub
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Definition of Colour Code

Re: Definition of Colour Code 8 years 10 months ago #268

  • Viertann
  • Viertann's Avatar
Hi Olivier,
I succeded in getting Vectors out of a Nifti-File with Matlab. Thank you very much for your help. The file I used for that is a File produced by MedInria with the 'Show Tensors' option in the Diffusion Workspace. Could you tell me which vectors are saved in this nifti-file? I'd guess that they are the main Eigenvectors. Is that true?

Thanks

Olivier
The administrator has disabled public write access.

Re: Definition of Colour Code 8 years 10 months ago #269

  • ocommowick
  • ocommowick's Avatar
  • OFFLINE
  • Administrator
  • Posts: 49
  • Thank you received: 5
  • Karma: 7
Hi,

Sorry for taking so long to answer. Technically, the tensors file we save does not contain the eigen vectors but rather a 6-component vector representing the whole tensor. If I use D as the vector of the image at pixel x, then the tensor can be recomposed like this :

T = [
D0 D1 D3
D1 D2 D4
D3 D4 D5
];

So you can read the file in matlab and use this little correspondance to compute the tensor. Then if you want to get the eigen vector, just use the eig function in matlab and that should do the trick.

Hope that helps
The administrator has disabled public write access.

Re: Definition of Colour Code 8 years 10 months ago #270

  • Viertann
  • Viertann's Avatar
Hi,
Thanks again for your answer. Reviewing the files and what I got in Matlab I saw that I got two Outputs. I got the two Outputs with these two lines in Matlab:
V = spm_vol('tensor.nii');
[Y, XYZ] = spm_read_vols(V)

the Outputs are Y and XYZ. XYZ contains 921600 Vectors with three components. Y has the Value 192x192x25. The second commands help text says that Y contains the 4D Image Matrix where the fourth dimension is the number of Images. How I understand it that means that I got a Matrix with 192x192 components for every of the 25 Slices in the measurement. XYZ gives the Location of every Voxel. Is that the wrong command to get the diffusion Tensors? Or could you guess what I did wrong so that I don't get a 6 component vector in every Voxel?

Hope you can help

thanks

Olivier
The administrator has disabled public write access.

Re: Definition of Colour Code 8 years 9 months ago #271

  • ocommowick
  • ocommowick's Avatar
  • OFFLINE
  • Administrator
  • Posts: 49
  • Thank you received: 5
  • Karma: 7
Hi again,

Well I have to admit not being an expert of matlab and even less of SPM. What I know though is that the image should appear as a vector image or a 4D image whose dimensions are X,Y,Z,V where X Y and Z are the sizes in the corresponding planes and V should be 6. You can get X, Y, and Z by opening the original 4d image in medinria and looking at the number of slices in each plane. In your case, it's probably 192x192x25 .

For the rest, I'm sorry, I guess a closer look at the SPM doc would be needed to know if it reads correctly vector images...
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.124 seconds