I don't know that function. vox2ras0 is used when you have 0-based indices (as in C) and vox2ras1 is used when you have 1-based indices (as in matlab). doug
On 12/18/2012 02:26 PM, octavian lie wrote:
Can I use your function xyzlab for this? If yes, I see that uses vox2ras0 instead of vox2ras1. Please advise, Octavian
On Tue, Dec 18, 2012 at 11:52 AM, Douglas N Greve <greve@nmr.mgh.harvard.edu mailto:greve@nmr.mgh.harvard.edu> wrote:
Use the matlab ind2sub command doug On 12/18/2012 12:38 PM, octavian lie wrote: Dear Douglas, How do I convert the index to its CRS correspondent? I could think of using in matlab something like ind=c+r*255+s* 255^2 then using floor () to obtain c,r,s, but seems convoluted, is there any code written on this that you can share? Thank you again, Octavian. On Tue, Dec 18, 2012 at 11:06 AM, Douglas N Greve <greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu> <mailto:greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>>> wrote: If you load the volume in with MRIread a = MRIread('yourvolume.mgz'); a.vox2ras1 is the one-based vox2ras matrix which takes a 1-based column, row, slice and converts it to RAS. So you just need to convert your indices to col, row, slice and apply this matrix. doug On 12/17/2012 06:53 PM, octavian lie wrote: Dear Douglas, Thank you very much for your input. 1. I generated the ind matrix as per your script, but what I wanted is to get a matrix with the RAS coordinates for the pixels indexed in ind. Is there a way to do this? Thank you, Octavian -- Douglas N. Greve, Ph.D. MGH-NMR Center greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu> <mailto:greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu>> Phone Number: 617-724-2358 <tel:617-724-2358> <tel:617-724-2358 <tel:617-724-2358>> Fax: 617-726-7422 <tel:617-726-7422> <tel:617-726-7422 <tel:617-726-7422>> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting <http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting> <http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting> FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html> <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html> Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/ The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. -- Douglas N. Greve, Ph.D. MGH-NMR Center greve@nmr.mgh.harvard.edu <mailto:greve@nmr.mgh.harvard.edu> Phone Number: 617-724-2358 <tel:617-724-2358> Fax: 617-726-7422 <tel:617-726-7422> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting <http://surfer.nmr.mgh.harvard.edu/fswiki/BugReporting> FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html <http://www.nmr.mgh.harvard.edu/facility/filedrop/index.html> Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/