Building ROI on T1 of spectroscopy voxel

409 views
Skip to first unread message

Leonardo Tozzi

unread,
Feb 12, 2016, 5:29:08 AM2/12/16
to TARQUIN users' group
Dear all,

I have been scanning on a 3T Philips machine (SPAR/SDAT format). We have scanned a series of subjects and placed the spectroscopy voxel manually in each in the ACC. Now, we would like to create a mask for each subject that has the same orientation and position of the voxel, aligned with the subject T1 scan.
I have noticed that in the spectroscopy header (.SPAR file), there are some indications of the voxel position. I am having a hard time figuring out what they mean exactly and creating the ROI with the correct orientation, especially in a consistent way across subjects. The manual alignment of the voxel was made on a T2 with a smaller number of slices compared to the T1, but I was wondering what these header measures relate to: this T2 or a more general system of coordinates?
Maybe someone here has faced the same problem. I paste here a piece of the header from our data. I tried repeatedly to create a voxel using MarsBar and move it around with SPM using these numbers, but the results are not great. Probably the coordinate system escapes me.

ap_size : 25
lr_size : 30
cc_size : 35
ap_off_center : -72.24314117
lr_off_center : -0.186449796
cc_off_center : 36.74308014
ap_angulation : -0.124432914
lr_angulation : -1.030914307
cc_angulation : -0.3830426633

I have seen a similar post on this group concerning Siemens data. Perhaps someone can help me with Philips?
Thank you very much.
Yours faithfully,



Leonardo Tozzi

Felix Raschke

unread,
Feb 12, 2016, 5:53:16 AM2/12/16
to TARQUIN users' group
Hi Leonardo,

I indeed have a MATLAB script to do this for Philips and GE. The MRS position info in the Philips SPAR format is ambiguous. The sizes and centre coordinates are clear but the angles need to be applied in the right order to get the correct position.
I am therefore using the DICOM MRS output rather than the SPAR files for alignment and craeting an ROI. Do you have the MRS DICOM files? They are usually 29kB in size. They should open with TARQUIN. Last question, do you use multi-frame DICOM for your imaging?

best wishes

Felix

Leonardo Tozzi

unread,
Feb 12, 2016, 6:00:57 AM2/12/16
to TARQUIN users' group
Dear Felix,

Thank you very much!
To answer your questions:
We had tried to save the spectroscopy data as DICOM, but then after an update to the scanner they had changed them to a new DICOM format that was unreadable to all software packages. So we went back to SPAR/SDAT and that is all I have, sadly. For some people I might still have the DICOMS though.
I don't know if we use multi-frame DICOM, how can I access this information?
I attach the header of one subject and the sequence exam card, maybe you can find the information there.
Thank you,


Leonardo
SV_PRESS_80.txt
header.txt

Martin Wilson

unread,
Feb 12, 2016, 6:03:13 AM2/12/16
to tarquin_u...@googlegroups.com
Hi Leonardo,

Further to Felix's suggestion, a second way of getting the orientation info in a more standard (ie DICOM) format is to convert the data using TARQUIN:

tarquin --input YOUR_SPAR/SDAT_FILE --rw_only true --write_raw_v3 raw.dpt

This will generate an ASCII version of your data (raw.dpt). Open this in a text editor and you will be able to get the following DICOM style information:

PixelSpacing
SliceThickness
ImageOrientationPatient
ImagePositionPatient

That should be enough to do what you need.

Martin


--
You received this message because you are subscribed to the Google Groups "TARQUIN users' group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_g...@googlegroups.com.
To post to this group, send email to tarquin_u...@googlegroups.com.
Visit this group at https://groups.google.com/group/tarquin_users_group.
For more options, visit https://groups.google.com/d/optout.

Leonardo Tozzi

unread,
Feb 12, 2016, 6:26:19 AM2/12/16
to TARQUIN users' group, wils...@bham.ac.uk
Dear Martin,

Thank you, this is a very good solution and it works.
How do you suggest I then proceed with the ImageOrientationPatient and ImagePositionPatient to orient my ROI? Would you suggest a specific software package?
Are these coordinates in the same space as the T1 then? So I could "draw" a rectangle, set its upper left corner to "ImagePositionPatient" and then rotate it according to some values in "ImageOrientationPatient"? Or is "ImagePositionPatient" the origin and then I'd have to displace the ROI according to "ImageOrientationPatient"? This has 6 values, I assume maybe they are the displacements and rotations needed around each axis, but which one is which exactly?
Sorry, I am a bit confused, I am not very used to moving around between coordinates.

Thank you,

Leonardo
To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_group+unsub...@googlegroups.com.

Martin Wilson

unread,
Feb 12, 2016, 6:42:23 AM2/12/16
to tarquin_u...@googlegroups.com
Hi Leonardo,

Don't worry about being confused, this is a difficult problem to solve!

The approach I took was to have everything described in terms of the DICOM definitions and then use basic 3D geometry to do the rest (lines intersecting planes etc...). However, if you are using SPM then this is a bit more tricky as I suspect SPM uses Nifti definitions. I haven't been able to figure out how to convert between DICOM and Nifiti definitions but you might have better luck. This is a handy resource for the DICOM stuff:


Another (probably easier) option that I've seen is to make use of a handy freesurfer function called mri_volsynth 


You should be able to pass the orientation info from TARQUIN to this function and generate a Nifti VOI of your MRS voxel.

Let us know how you get on - this is a common problem.

Martin

To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_g...@googlegroups.com.
To post to this group, send email to tarquin_u...@googlegroups.com.
Visit this group at https://groups.google.com/group/tarquin_users_group.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "TARQUIN users' group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_g...@googlegroups.com.

Leonardo Tozzi

unread,
Feb 12, 2016, 7:19:19 AM2/12/16
to TARQUIN users' group, wils...@bham.ac.uk
Thank you for the resources, I will try to work on this.
Although Felix was saying he has a script to do this so potentially he has solved the problem of DICOM coordinates already...?
We could just probably come up with a script in the end that takes the SPAR/SDAT information and returns them into a more intelligible space.
As an additional resource, this matlab script also probably contains the transform from DICOM to nii somewhere:

http://www.mathworks.com/matlabcentral/fileexchange/42997-dicom-to-nifti-converter/content/dicm2nii.m

Concerning mri_volsynth, the description of the function seems to be a bit obscure. My parameters are as follows:

ImageOrientationPatient:    0.999975\-0.00664515\0.00229164\0.00668529\0.999816\-0.017977
ImagePositionPatient:    -0.18645\-72.2431\36.7431

From what I understand from the mailing list (see: https://www.mail-archive.com/frees...@nmr.mgh.harvard.edu/msg42956.html), some flags should be:

--dim 1 1 1 1
--volres: from what I understand this has to be the center of the voxel, but I have only the coordinates of "the top left corner voxel"... but then, my images have only one voxel! So is this the center?  -0.18645 -72.2431 36.7431

About the rest, I am quite puzzled. How can I change the orientation of this voxel, as in the tilting and rotating?
I will try to find the transform I need also in the several dicom to nifti files in matlab... I'll keep you posted!
Thank you,



To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_group+unsub...@googlegroups.com.
To post to this group, send email to tarquin_u...@googlegroups.com.
Visit this group at https://groups.google.com/group/tarquin_users_group.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "TARQUIN users' group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_group+unsub...@googlegroups.com.

Leonardo Tozzi

unread,
Feb 12, 2016, 7:34:32 AM2/12/16
to TARQUIN users' group, wils...@bham.ac.uk

Felix Raschke

unread,
Feb 12, 2016, 7:36:49 AM2/12/16
to TARQUIN users' group, wils...@bham.ac.uk
At the moment I am modifying my matlab code to work with the Input from Martin's conversion suggestion:

PixelSpacing
SliceThickness
ImageOrientationPatient
ImagePositionPatient

ImageOrientationPatient is two consecutive 3D vectors (e1 and e2) whereas ImagePositionPatient is as you said the centre of the voxel (since you only got one voxel).
Could you please post the output for PixelSpacing and SliceThickness please so I can get an idea which is which.


A few more things. Multiframe DICOM means that individual slices of a MRI Volume are all stored in one DICOM file. Single frame DICOM is when there is a DICOM file for each slice.
Also I recommend starting to save the MRS DICOM data for the future, it just makes things easier. Additionally the MRS DICOMs can be transferred to PACS and are backed up this way. In fact you may even still have them on PACS and can just redownload them!

Leonardo Tozzi

unread,
Feb 12, 2016, 7:42:14 AM2/12/16
to TARQUIN users' group, wils...@bham.ac.uk
Thank you very much Felix!
In fact, I have a few DICOMs, but as I was saying they were not the "normal" DICOMs we are used to and even the Philips technician could not extract spectroscopy data from them.
Concerning the PACS, I am afraid the computer that was storing this data was wiped. In any case, thank you very much for your suggestion, I'll make sure to always output some DICOMs in the future. This is literally the first time we use spectroscopy in our institute, so we have been making loads of rookie mistakes.
The parameters you asked are:

PixelSpacing    2.50000000e+01\3.00000000e+01
SliceThickness    3.50000000e+01

Thank you so much and sorry for your trouble!

Leonardo

Felix Raschke

unread,
Feb 12, 2016, 8:25:02 AM2/12/16
to TARQUIN users' group, wils...@bham.ac.uk
No worries, see if the attached MATLAB code works. To run type:

ImageOrientationPatient = [0.9405;0.3386;0.0284;-0.3185;0.9077;-0.2733];
ImagePositionPatient = [-6.0265;31.9362;-25.2070];
SliceThickness = 35;
PixelSpacing = [25;30];
get_voxels_info_SVS_MRI_v2_Leonardo(ImageOrientationPatient,ImagePositionPatient,SliceThickness,PixelSpacing);

While using the parameters you got from the conversion tool. Now this is designed for the multiframe MRI DICOM data but should work with single frame data BUT only if the MRI is in axial or coronal orientation (but I am not sure).
If it works, use the sliders and rotate the figure to check if the voxel position and size is correct. If the size is wrong along the 3 dimensions you might have to adjust the order around line 82-84.
This code won't work with multivolume data (such as fMRI or DTI), adjustments are needed for that.

let me know how you get on.

Felix
PhilipsSV.zip

Paul Mullins

unread,
Feb 12, 2016, 9:04:06 AM2/12/16
to tarquin_u...@googlegroups.com
Hi Leonardo and all, 

in addition to Felix's code and Martins useful suggestions you could also try the code at http://biu.bangor.ac.uk/projects.php.en (right at the bottom of the page - we need to get the web guys to set the page up better).  The code is one we use for generating a voxel mask in spm for use in calculating the grey matter and white matter content of the voxel for tissue correction.  It is specifically written for phillips sdat/spar data and nifti data.  if you give it a try let me know how it works for you.

Paul.

To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_g...@googlegroups.com.
To post to this group, send email to tarquin_u...@googlegroups.com.
Visit this group at https://groups.google.com/group/tarquin_users_group.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "TARQUIN users' group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_g...@googlegroups.com.

To post to this group, send email to tarquin_u...@googlegroups.com.
Visit this group at https://groups.google.com/group/tarquin_users_group.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "TARQUIN users' group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_g...@googlegroups.com.

Leonardo Tozzi

unread,
Feb 12, 2016, 9:25:39 AM2/12/16
to TARQUIN users' group
Dear all,

Thank you all so much for your help, I am truly impressed by so helpful and patient you have all been!
Paul I tried your script and it seems to work perfectly on my data! Amazing! The anatomical and the ROI match perfectly. Browsing around I noticed we have exactly the same scanner. Your script is really an impressive piece of work, I don't know why I couldn't find it before. If anyone has the same problem again, at least now we'll have a standard answer!
Once again, thank you all!


Leonardo Tozzi
To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_group+unsub...@googlegroups.com.
To post to this group, send email to tarquin_u...@googlegroups.com.
Visit this group at https://groups.google.com/group/tarquin_users_group.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "TARQUIN users' group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_group+unsub...@googlegroups.com.

To post to this group, send email to tarquin_u...@googlegroups.com.
Visit this group at https://groups.google.com/group/tarquin_users_group.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "TARQUIN users' group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_group+unsub...@googlegroups.com.

Paul Mullins

unread,
Feb 12, 2016, 9:30:23 AM2/12/16
to tarquin_u...@googlegroups.com
Glad to hear it works OK Leo, I will let Nia know.  I would advise you tread cautiously when using the code for non standard voxel prescriptions (I.e when the voxel may be at a different angle or orientation then the image data).  It should work, but it is always good to check the location and angle are what you expect – and if it's not let me know.

P.S. This is not a new problem, and as Martin Says a lot of different ways to over come it have been found (as evidenced by you getting at least three methods today).  I would imagine most major spectroscopy groups will have some sort of solution.

Any how, welcome to MRS and have fun. :)

To unsubscribe from this group and stop receiving emails from it, send an email to tarquin_users_g...@googlegroups.com.

To post to this group, send email to tarquin_u...@googlegroups.com.
Visit this group at https://groups.google.com/group/tarquin_users_group.
For more options, visit https://groups.google.com/d/optout.

 

Rhif Elusen Gofrestredig 1141565 - Registered Charity No. 1141565

Gall y neges e-bost hon, ac unrhyw atodiadau a anfonwyd gyda hi, gynnwys deunydd cyfrinachol ac wedi eu bwriadu i'w defnyddio'n unig gan y sawl y cawsant eu cyfeirio ato (atynt). Os ydych wedi derbyn y neges e-bost hon trwy gamgymeriad, rhowch wybod i'r anfonwr ar unwaith a dilewch y neges. Os na fwriadwyd anfon y neges atoch chi, rhaid i chi beidio a defnyddio, cadw neu ddatgelu unrhyw wybodaeth a gynhwysir ynddi. Mae unrhyw farn neu safbwynt yn eiddo i'r sawl a'i hanfonodd yn unig ac nid yw o anghenraid yn cynrychioli barn Prifysgol Bangor. Nid yw Prifysgol Bangor yn gwarantu bod y neges e-bost hon neu unrhyw atodiadau yn rhydd rhag firysau neu 100% yn ddiogel. Oni bai fod hyn wedi ei ddatgan yn uniongyrchol yn nhestun yr e-bost, nid bwriad y neges e-bost hon yw ffurfio contract rhwymol - mae rhestr o lofnodwyr awdurdodedig ar gael o Swyddfa Cyllid Prifysgol Bangor.

This email and any attachments may contain confidential material and is solely for the use of the intended recipient(s). If you have received this email in error, please notify the sender immediately and delete this email. If you are not the intended recipient(s), you must not use, retain or disclose any information contained in this email. Any views or opinions are solely those of the sender and do not necessarily represent those of Bangor University. Bangor University does not guarantee that this email or any attachments are free from viruses or 100% secure. Unless expressly stated in the body of the text of the email, this email is not intended to form a binding contract - a list of authorised signatories is available from the Bangor University Finance Office.

Reply all
Reply to author
Forward
0 new messages