FYI
---------- Forwarded message ---------- Date: Tue, 7 Feb 2012 09:15:37 -0500 From: Ziad Saad saadz@mail.nih.gov To: Bruce Fischl fischl@nmr.mgh.harvard.edu Subject: Re: [Freesurfer] Conversion of an mgh file to nii
I just realized my post got rejected from the message list since I I am not a subscriber. Could you throw it up there for me? thanks z
On Feb 7, 2012, at 9:10 AM, Bruce Fischl wrote:
thanks Ziad Bruce On Tue, 7 Feb 2012, Ziad Saad wrote:
Greetings,
I am not sure what is causing the problem but if you are trying to create a volume where you have a non zero value at some coordinate you can use: 3dUndump with options -xyz and -master . This will create a mask volume with a non-zero value at specified xyz locations, or around these locations depending on the options you use. The -xyz option is used to specify the coordinate which you get from your seed location in FreeSurfer and the master option specifies the dataset grid that your output should match - the time series for regression analysis. This assumes, that the X Y Z of the dipole location corresponds to the same anatomical location as the X Y Z in your volumes. Note that AFNI uses RAI for axis orientation, so you'll likely need to negate the 1st two dimensions of the X Y Z you have at hand. You could also create volumetric masks with more complicated routes, such as 3dSurf2Vol but I don't see the reason for that.
cheers, Ziad
On Feb 6, 2012, at 7:16 PM, Bruce Fischl wrote:
you could do the same if you sampled your test.nii into the volume. At the moment it's a surface overlay, so as Doug points out no volume loader will know what to do with it. You need the surface geometry/topology to properly display it. If you want to sample it into the volume I think you want mri_surf2vol.
cheers Bruce
On Mon, 6 Feb 2012, Omer Tal wrote:
Hey Bruce,
Maybe I can give more background information to help explain what I am trying to do here.
I have a subject which I have both MEG and fMRI data on. When I reconstructed my subject, I chose a dipole as a seed location and used it for my MEG analysis. Now I want to use the same location as a seed for my fMRI analysis, so I created an mgh file which had the value of 1 only in the FS vertex/dipole corresponding to my seed. I can view all versions of it, mgh, mgz and nii w/ no problem on tksurfer. On FSL though, I can't.
The reason I went this approach is when I wanted to use the same aparc_aseg parcellations in my fMRI data, all i had to do is use mri_convert on the aprac+aseg.mgz and I had a nice nii file I could view in FSL or AFNI overlaying my fMRI data and use the same ROIs in both modalities for analysis. Therefore, I thought it would make sense to do the same here, and create a mgh/mgz file and convert to an nii to get my mask that I could use in AFNI.
Do you believe my approach is impractical?
For loading in AFNI, all I did was afni test.nii.
Thank you, Omer
Ziad: any idea why Omer can open this file in tksurfer but not afni? Omer: I don't think you'll be able to load it in FSL since it's essentially a surface. Can you give us details about how you are trying to load it in AFNI? Are you using SUMA?
On Mon, 6 Feb 2012, Omer Tal wrote:
Sorry, that was the wrong error description (for the AFNI portion).
It just says cannot open dataset test.nii
Well, if it doesn't work on FSL or AFNI, I would guess it is the conversion process from FreeSurfer. I don't think anyone on AFNI knows mri_convert or mri_sruf2surf.
Honestly just trying to get support for your product for a very simple task, not sure where else I could find someone who would know how to use FS outputs.
Omer
> It sounds like it is doing the right thing. The geometry is going to be > bogus because it is a surface. You should post to the AFNI list. > doug > > Omer Tal wrote: >> Hey Bruce, >> >> So the mgh file loads fine in tksurfer (shows proper map) for the >> given >> subject, and so does its corresponding mgz (created from mri_convert). >> >> In FSL there is no physical error, but when loading in the nii file, >> the >> X >> location is in ~786XX instead of the typical -128 to 128 or something >> close, Y has no slices to go through at all, and Z seems for the most >> part >> normal (240 slices centered at 0). >> >> When I was trying to load those in AFNI, it simply said "ncols 157373 >> in >> volumes exceeds 32768" even though the reshape has been done. >> >> Thank you, >> Omer Tal >> >> >> >>> does it load ok in freesurfer (in tksurfer)? What error do you get in >>> AFNI/FSL? If it >>> >>> On Mon, 6 Feb 2012, Omer Tal wrote: >>> >>> >>>> Hey Doug, >>>> >>>> Here is what I type it the terminal and what pops back at me. The >>>> error >>>> shows up later when trying to load (either though AFNI or FSL). >>>> >>>> mri_surf2surf --sval test.mgh --tval test.nii --reshape-factor 241 >>>> --s >>>> 111123 --hemi lh >>>> >>>> srcsubject = 111123 >>>> srcval = test.mgh >>>> srctype = >>>> trgsubject = 111123 >>>> trgval = test.nii >>>> trgtype = >>>> srcsurfreg = sphere.reg >>>> trgsurfreg = sphere.reg >>>> srchemi = lh >>>> trghemi = lh >>>> frame = 0 >>>> fwhm-in = 0 >>>> fwhm-out = 0 >>>> label-src = (null) >>>> label-trg = (null) >>>> OKToRevFaceOrder = 1 >>>> Reading source surface reg >>>> /home/otal/raweegmeg/structuralDB//111123/surf/lh.sphere.reg >>>> Loading source data >>>> INFO: trgsubject = srcsubject >>>> Saving target data >>>> Reshaping 241 (nvertices = 157373) >>>> Saving to test.nii >>>> >>>> Thank you, >>>> Omer Tal >>>> >>>> >>>> >>>> >>>>> what's your command line and terminal output? >>>>> >>>>> Omer Tal wrote: >>>>> >>>>>> Tried both, but neither gave a proper nii image. >>>>>> >>>>>> Any other ideas? >>>>>> >>>>>> Omer Tal >>>>>> >>>>>> >>>>>> >>>>>>> That particular number factors to 241 and 653, so use one of >>>>>>> those >>>>>>> as >>>>>>> the reshape factor to surf2surf. >>>>>>> doug >>>>>>> >>>>>>> Omer Tal wrote: >>>>>>> >>>>>>> >>>>>>>> Hey Doug, >>>>>>>> >>>>>>>> I believe for this patient/hemisphere the number of vertices is >>>>>>>> 157373. >>>>>>>> >>>>>>>> What is the workaround in the case my number of vertices is >>>>>>>> unluckily >>>>>>>> a >>>>>>>> prime? >>>>>>>> >>>>>>>> Thank you, >>>>>>>> Omer Tal >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> Hi Omar, how many vertices? The reshape only works if the >>>>>>>>> number >>>>>>>>> is >>>>>>>>> not >>>>>>>>> prime (actually the largest prime factor has to be less than >>>>>>>>> 2^15. >>>>>>>>> doug >>>>>>>>> >>>>>>>>> Omer Tal wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> Hey Bruce, >>>>>>>>>> >>>>>>>>>> Thank you for the prompt response. >>>>>>>>>> >>>>>>>>>> The line is as follows: >>>>>>>>>> >>>>>>>>>> mri_convert -it mgh -ot nii test.mgh test.nii. >>>>>>>>>> >>>>>>>>>> Since I do agree that the issue is arising from the NIFTI bit >>>>>>>>>> limit, >>>>>>>>>> i >>>>>>>>>> tried doug's suggestion of >>>>>>>>>> >>>>>>>>>> mri_surf2surf --sval test.mgh --tval test.nii --reshape-factor >>>>>>>>>> 6 >>>>>>>>>> --s >>>>>>>>>> subject_name --hemi lh >>>>>>>>>> >>>>>>>>>> But it doesn't seem to solve the problem. even though now i >>>>>>>>>> can >>>>>>>>>> load >>>>>>>>>> it >>>>>>>>>> through FSL without it failing and quitting, the image is >>>>>>>>>> faulty >>>>>>>>>> w/ >>>>>>>>>> over >>>>>>>>>> 78,000 data points in the X direction, none in Y, and 240 in >>>>>>>>>> Z. >>>>>>>>>> At >>>>>>>>>> this >>>>>>>>>> point, Doug told him to send the file in and no more follow-up >>>>>>>>>> is >>>>>>>>>> shown... >>>>>>>>>> >>>>>>>>>> Please advise. >>>>>>>>>> >>>>>>>>>> Thank you very much, >>>>>>>>>> Omer Tal >>>>>>>>>> UCSD Keck Center for Functional MRI >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> Hi Omer >>>>>>>>>>> >>>>>>>>>>> what file are you trying to convert? What is your entire >>>>>>>>>>> command >>>>>>>>>>> line >>>>>>>>>>> with output and what problems do you have? Nifti >>>>>>>>>>> unfortunately >>>>>>>>>>> only >>>>>>>>>>> allows >>>>>>>>>>> 16 bits for the width/height/depth/nframes, so surface >>>>>>>>>>> overlays >>>>>>>>>>> can't >>>>>>>>>>> usually fit as nvertices x 1 x 1 x nframes since nvertices > >>>>>>>>>>> 2^16 >>>>>>>>>>> (or >>>>>>>>>>> 2^15 >>>>>>>>>>> signed). >>>>>>>>>>> >>>>>>>>>>> cheers >>>>>>>>>>> Bruce >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Mon, 6 Feb 2012, Omer >>>>>>>>>>> Tal wrote: >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>> Hey there, >>>>>>>>>>>> >>>>>>>>>>>> I am trying to convert an mgh file I created into an nii >>>>>>>>>>>> volume >>>>>>>>>>>> so >>>>>>>>>>>> I >>>>>>>>>>>> can >>>>>>>>>>>> load it in AFNI. I was trying to use mri_convert, which I >>>>>>>>>>>> have >>>>>>>>>>>> used >>>>>>>>>>>> previously to make nii volumes from my aparc+aseg and it >>>>>>>>>>>> worked >>>>>>>>>>>> great, >>>>>>>>>>>> but >>>>>>>>>>>> this time the resulting file is faulty. >>>>>>>>>>>> >>>>>>>>>>>> I've noticed a previous thread where someone ran into a >>>>>>>>>>>> similar >>>>>>>>>>>> problem, >>>>>>>>>>>> and it had to do w/ too many vertices existing for NIFTI, >>>>>>>>>>>> and >>>>>>>>>>>> Doug >>>>>>>>>>>> suggested using mri_surf2surf, but it didn't work for that >>>>>>>>>>>> guy >>>>>>>>>>>> or >>>>>>>>>>>> me >>>>>>>>>>>> (at >>>>>>>>>>>> which point I think he was sending you files). >>>>>>>>>>>> >>>>>>>>>>>> Seems like it should be something common and trivial, but I >>>>>>>>>>>> can't >>>>>>>>>>>> get >>>>>>>>>>>> it >>>>>>>>>>>> too work, any suggestions? >>>>>>>>>>>> >>>>>>>>>>>> Thank you, >>>>>>>>>>>> Omer Tal >>>>>>>>>>>> UCSD Keck Center for Functional MRI >>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>> Freesurfer mailing list >>>>>>>>>>>> Freesurfer@nmr.mgh.harvard.edu >>>>>>>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Freesurfer mailing list >>>>>>>>>>> Freesurfer@nmr.mgh.harvard.edu >>>>>>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> 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. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> _______________________________________________ >>>>>>>>>> Freesurfer mailing list >>>>>>>>>> Freesurfer@nmr.mgh.harvard.edu >>>>>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> -- >>>>>>>>> Douglas N. Greve, Ph.D. >>>>>>>>> MGH-NMR Center >>>>>>>>> greve@nmr.mgh.harvard.edu >>>>>>>>> Phone Number: 617-724-2358 >>>>>>>>> Fax: 617-726-7422 >>>>>>>>> >>>>>>>>> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting >>>>>>>>> FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Freesurfer mailing list >>>>>>>>> Freesurfer@nmr.mgh.harvard.edu >>>>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> -- >>>>>>> Douglas N. Greve, Ph.D. >>>>>>> MGH-NMR Center >>>>>>> greve@nmr.mgh.harvard.edu >>>>>>> Phone Number: 617-724-2358 >>>>>>> Fax: 617-726-7422 >>>>>>> >>>>>>> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting >>>>>>> FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> -- >>>>> Douglas N. Greve, Ph.D. >>>>> MGH-NMR Center >>>>> greve@nmr.mgh.harvard.edu >>>>> Phone Number: 617-724-2358 >>>>> Fax: 617-726-7422 >>>>> >>>>> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting >>>>> FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html >>>>> >>>>> _______________________________________________ >>>>> Freesurfer mailing list >>>>> Freesurfer@nmr.mgh.harvard.edu >>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>>> >>>>> >>>> _______________________________________________ >>>> Freesurfer mailing list >>>> Freesurfer@nmr.mgh.harvard.edu >>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer >>>> >>>> >>>> >>>> >> >> >> > > -- > Douglas N. Greve, Ph.D. > MGH-NMR Center > greve@nmr.mgh.harvard.edu > Phone Number: 617-724-2358 > Fax: 617-726-7422 > > Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting > FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html > >
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
freesurfer@nmr.mgh.harvard.edu