Problem solved! took some effort trying everything out, but finally found a simple solution by transforming everything into MNI
Here's how to convert from surface RAS to mni305 mni305ras = X*S*inv(K)*ras X = talairach.xfm S = scanner vox2ras (mri_info --vox2ras orig.mgz) K = tkreg vox2ras (mri_info --vox2ras-tkr orig.mgz) ras = surface ras from gifti file. found here: https://surfer.nmr.mgh.harvard.edu/fswiki/CoordinateSystems On 3 June 2014 09:08, Bastian Cheng <bastianch...@gmail.com> wrote: > Hi Nick, > > again thank you your help! That works nicely. > > Where to I find the transformation matrix to register my structural > volume data to the gii. surface file? > > I found two matrices in the lh.white.gii (<MatrixData>), but not sure > if it fits. > > I have to use the volume scan and gii suface in matlab for > localization and source reconstruction of EEG data (that's why I can't > use freeview). > > Bastian > > > On 2 June 2014 20:50, Nick Schmansky, MGH <ni...@nmr.mgh.harvard.edu> wrote: >> Bastian, >> >> Are you using freeview to display the surface? If so, you will need to >> get the newest freeview.bin, which is here: >> >> ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/freeview/linux_centos6_x86_64/ >> >> this has been updated to read the new volume geometry info now included >> in the lh.white.gii file, so that it aligns with the volume (via the >> c_ras info). >> >> Nick >> >> >> On Mon, 2014-06-02 at 12:10 +0200, Bastian Cheng wrote: >>> Hi, >>> >>> Ok, thank you! >>> >>> One additional follow up: >>> >>> Once I converted the lh.white (freesurfer) to the lh.white.gii >>> (gifti), the converted surface (.gii) does not fit on the structural >>> scan from freesurfer anymore (neither brain.mgz or orig.mgz or >>> nu.omz). >>> >>> How can I register my freesurfer structural data to the new gifti surface? >>> >>> I have noticed that a transformation matrix is inserted in the gifti >>> file, but have not figured out in which space the image is transformed >>> to.. >>> >>> maybe you could help me clarify that. >>> >>> Best, >>> Bastian. >>> >>> On 29 May 2014 17:25, Bruce Fischl <fis...@nmr.mgh.harvard.edu> wrote: >>> > Hi Bastian >>> > >>> > do you mean a surface that is only a piece of th original surface? You can >>> > use label2patch for that, but I'm not sure if we can convert patches to >>> > gifti. You should ask the FSL crew about label2surf though - we can't help >>> > with that. >>> > >>> > cheers >>> > Bruce >>> > >>> > >>> > On Thu, >>> > 29 May 2014, Bastian Cheng wrote: >>> > >>> >> Hi Nick, >>> >> >>> >> That works PERFECTLY! Thank you so much, it has been a big help! >>> >> >>> >> I hope I may ask you another question: >>> >> >>> >> I am actually trying to convert each freesurfer-label (from >>> >> aparc.annot) into separate surfaces (not gifti-labels) >>> >> >>> >> So ideally I would convert lh.precentral.label > lh.precentral.gii. >>> >> >>> >> I have used the command "label2surf", Part of FSL (build 504). (and I >>> >> have used the "new" gifti lh.white created with your updated version >>> >> as the input surface) >>> >> >>> >> However, the output gifti does not open in matlab (instead shows the >>> >> same error message seen before). >>> >> >>> >> Now I would guess that whatever changes you made to mris_convert would >>> >> have to be applied to "label2surf" as well. I have noticed some >>> >> changes in the gifti files with your new mris_convert command. >>> >> However, I'm not so familiar with the gifti file structure. >>> >> >>> >> Maybe I could ask you to have a look into this? >>> >> >>> >> Also, If there is a easier way to achieve my goal any advise is welcome! >>> >> >>> >> Again, many thanks for your efforts so far! >>> >> Bastian. >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> On 29 May 2014 02:05, Nick Schmansky, MGH <ni...@nmr.mgh.harvard.edu> >>> >> wrote: >>> >>> Bastian, >>> >>> >>> >>> Hi, I've posted a new mris_convert which should solve the problem for >>> >>> you. It's built for Centos 6, so if you need it for another platform, >>> >>> let me know. It's here: >>> >>> >>> >>> ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/misc/linux-centos6_x86_64/ >>> >>> >>> >>> Nick >>> >>> >>> >>> >>> >>> >>> >>> On Wed, 2014-05-28 at 11:42 +0200, Bastian Cheng wrote: >>> >>>> Dear Freesurfer-Experts, >>> >>>> >>> >>>> I would like to create gifti-surfaces to use in matlab. >>> >>>> >>> >>>> That's what I am doing so far (latest FS-Version): >>> >>>> >>> >>>> mris_convert lh.white lh.white.gii >>> >>>> >>> >>>> I then try to open it using the "gifti" command (g=gifti('file.gii')) >>> >>>> (http://www.artefact.tk/software/matlab/gifti/) >>> >>>> >>> >>>> however, I get an error message from matlab: >>> >>>> >>> >>>>>>>>>>>>>>> >>> >>>> ??? Attempt to reference field of non-structure array. >>> >>>> Error in ==> gifti.subsref at 28 >>> >>>> varargout{1} = this.data{j}.space.MatrixData; >>> >>>> Error in ==> gifti.struct at 17 >>> >>>> [values{i,:}] = subsref(this(:), substruct('.',names{i})); >>> >>>> Error in ==> gifti.display at 17 >>> >>>> eval([display_name ' = struct(this);']); >>> >>>>>>>>>>>>>>>>>>> >>> >>>> >>> >>>> Am I missing something? Is there anything special with the .gii file >>> >>>> form FS? >>> >>>> >>> >>>> here is the surface file I created with mris_convert: >>> >>>> http://we.tl/B2n4Ex6ifJ >>> >>>> >>> >>>> I am able to open the gifti file with freeview. >>> >>>> I also updated the gifti-toolbox in matlab to the latest version. >>> >>>> >>> >>>> >>> >>>> Any help is appreciated! >>> >>>> _______________________________________________ >>> >>>> 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 >>> >> >>> >> >>> >> >>> > _______________________________________________ >>> > 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