Re: [Freesurfer] How can I create a grey matter volume in Matlab?
External Email - Use Caution Hello again, unfortunately, nobody is responding. . Until now I am able to create meshes from the freesurfer output files with the isosurface() and read_surf() functions from a MATLAB based toolbox . However, I still do not know with which combinations of the outputs of recon-all I could create a grey matter only mask. My goal is to get subject specific channel MNI coordinates projected onto the cortex (grey matter). My solution at the moment is to simply use the pial surfaces (rh.pial and lh.pial), however, I am not sure if this is sufficient. Any thoughts or ideas maybe? Thanks, Franziska Von: Franziska Klein Gesendet: Mittwoch, 27. Mai 2020 11:05 An: freesurfer@nmr.mgh.harvard.edu Betreff: How can I create a grey matter volume in Matlab? Dear freesurfer user, due to the Covid 19 situation I am working in home office with a windows computer and can not run any freesurfer functions (installing a virtual box is not really an option). For all my subjects I do already have all output files from recon all. In the output, I found a wm.mgz but unfortunately there is no gm.mgz. Is it somehow possible to create a grey matter volume by using the recon all output in combination with Matlab? Thank you and kind regards, Franziska -- Franziska Klein, M.Sc. Neurocognition and Functional Neurorehabilitation Group Neuropsychology Lab Department of Psychology University of Oldenburg D-26111 Oldenburg Germany Office: A7 0-066 Phone: +49-441-798-4947 Fax: +49-441-798-5522 ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Re: [Freesurfer] How can I create a grey matter volume in Matlab?
External Email - Use Caution Yes, I do only need cortex gray matter. Great, then I'll use the ribbon.mgz in order to create a gray matter mesh. Thank you for your answer! Von: freesurfer-boun...@nmr.mgh.harvard.edu im Auftrag von Douglas N. Greve Gesendet: Montag, 8. Juni 2020 16:23:12 An: freesurfer@nmr.mgh.harvard.edu Betreff: Re: [Freesurfer] How can I create a grey matter volume in Matlab? When you say "gray matter" do you mean all gray matter or just cortex? If just cortex, then you need to take all the voxels between white and pial surfaces. This is already done in the ribbon.mgz file On 6/8/2020 10:05 AM, Franziska Klein wrote: External Email - Use Caution Hello again, unfortunately, nobody is responding. . Until now I am able to create meshes from the freesurfer output files with the isosurface() and read_surf() functions from a MATLAB based toolbox . However, I still do not know with which combinations of the outputs of recon-all I could create a grey matter only mask. My goal is to get subject specific channel MNI coordinates projected onto the cortex (grey matter). My solution at the moment is to simply use the pial surfaces (rh.pial and lh.pial), however, I am not sure if this is sufficient. Any thoughts or ideas maybe? Thanks, Franziska ____ Von: Franziska Klein Gesendet: Mittwoch, 27. Mai 2020 11:05 An: freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu> Betreff: How can I create a grey matter volume in Matlab? Dear freesurfer user, due to the Covid 19 situation I am working in home office with a windows computer and can not run any freesurfer functions (installing a virtual box is not really an option). For all my subjects I do already have all output files from recon all. In the output, I found a wm.mgz but unfortunately there is no gm.mgz. Is it somehow possible to create a grey matter volume by using the recon all output in combination with Matlab? Thank you and kind regards, Franziska ------ Franziska Klein, M.Sc. Neurocognition and Functional Neurorehabilitation Group Neuropsychology Lab Department of Psychology University of Oldenburg D-26111 Oldenburg Germany Office: A7 0-066 Phone: +49-441-798-4947 Fax: +49-441-798-5522 ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto: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] Question regarding MRIread
External Email - Use Caution Hello, I am using the isosurface() function in order to create a mesh based on the T1.mgz and on the ribbon.mgz. I need those meshes for the coregistration of some channels. After coregistration I do project the channels onto the cortex and extract the corresponding voxel coordinates. Until here, everything works fine. Next, I am using MRIwrite in order to save the T1.mgz as *.nii.mgz which I am using to generate a deformation field with SPM12 to transform the voxel coordinates to normalized MNI coordinates. However, when I put the voxel coordinates (not normalized yet) into SPM12 while displaying my generated *.nii image it happens that the coordinates on the right hemisphere (MNI space) are slightly outside of the cortex which is of course not the case on my cortex mesh after projection. Now I am wondering whether there is a mismatch between the mesh and the *.nii image (one voxel maybe)? And whether that is introduced by MRIwrite? If so, do I have to shift all points of the meshes by +1 in order to get correct results the way I want to? If not, any ideas on where that mismatch could come from? Thank you and kind regards, Franziska ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Re: [Freesurfer] Question regarding MRIread
External Email - Use Caution I know, a lot of steps. 1-based vs. 0-based, that is basically what I mean and what I think is the problem, but I need to be sure. When I load in the *.nii file generated from the mesh and display it in SPM, then the origin shown in the SPM Gui is the last column in vox2ras1. Oversimplified, when I want to compare a voxel from SPM with a voxel from freesurfer, I need to shift the coordinates of that voxel from freesurfer by +1, right? (or substract one from the SPM one). Kind regards, Franziska Von: freesurfer-boun...@nmr.mgh.harvard.edu im Auftrag von Douglas N. Greve Gesendet: Montag, 29. Juni 2020 16:44:34 An: freesurfer@nmr.mgh.harvard.edu Betreff: Re: [Freesurfer] Question regarding MRIread There's a lot of stuff going on there, so it's hard to say withhout more detail. But it sounds like you might not be taking into account that the voxel coords in matlab are 1-based. On 6/26/2020 12:04 PM, Franziska Klein wrote: External Email - Use Caution Hello, I am using the isosurface() function in order to create a mesh based on the T1.mgz and on the ribbon.mgz. I need those meshes for the coregistration of some channels. After coregistration I do project the channels onto the cortex and extract the corresponding voxel coordinates. Until here, everything works fine. Next, I am using MRIwrite in order to save the T1.mgz as *.nii.mgz which I am using to generate a deformation field with SPM12 to transform the voxel coordinates to normalized MNI coordinates. However, when I put the voxel coordinates (not normalized yet) into SPM12 while displaying my generated *.nii image it happens that the coordinates on the right hemisphere (MNI space) are slightly outside of the cortex which is of course not the case on my cortex mesh after projection. Now I am wondering whether there is a mismatch between the mesh and the *.nii image (one voxel maybe)? And whether that is introduced by MRIwrite? If so, do I have to shift all points of the meshes by +1 in order to get correct results the way I want to? If not, any ideas on where that mismatch could come from? Thank you and kind regards, Franziska ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto: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
Re: [Freesurfer] Question regarding MRIread
External Email - Use Caution I've used the MRIwrite function. Von: freesurfer-boun...@nmr.mgh.harvard.edu im Auftrag von Douglas N. Greve Gesendet: Montag, 29. Juni 2020 18:55:01 An: freesurfer@nmr.mgh.harvard.edu Betreff: Re: [Freesurfer] Question regarding MRIread How did you generate the nii file from the mesh? On 6/29/2020 12:21 PM, Franziska Klein wrote: External Email - Use Caution I know, a lot of steps. 1-based vs. 0-based, that is basically what I mean and what I think is the problem, but I need to be sure. When I load in the *.nii file generated from the mesh and display it in SPM, then the origin shown in the SPM Gui is the last column in vox2ras1. Oversimplified, when I want to compare a voxel from SPM with a voxel from freesurfer, I need to shift the coordinates of that voxel from freesurfer by +1, right? (or substract one from the SPM one). Kind regards, Franziska Von: freesurfer-boun...@nmr.mgh.harvard.edu<mailto:freesurfer-boun...@nmr.mgh.harvard.edu> <mailto:freesurfer-boun...@nmr.mgh.harvard.edu> im Auftrag von Douglas N. Greve <mailto:dgr...@mgh.harvard.edu> Gesendet: Montag, 29. Juni 2020 16:44:34 An: freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu> Betreff: Re: [Freesurfer] Question regarding MRIread There's a lot of stuff going on there, so it's hard to say withhout more detail. But it sounds like you might not be taking into account that the voxel coords in matlab are 1-based. On 6/26/2020 12:04 PM, Franziska Klein wrote: External Email - Use Caution Hello, I am using the isosurface() function in order to create a mesh based on the T1.mgz and on the ribbon.mgz. I need those meshes for the coregistration of some channels. After coregistration I do project the channels onto the cortex and extract the corresponding voxel coordinates. Until here, everything works fine. Next, I am using MRIwrite in order to save the T1.mgz as *.nii.mgz which I am using to generate a deformation field with SPM12 to transform the voxel coordinates to normalized MNI coordinates. However, when I put the voxel coordinates (not normalized yet) into SPM12 while displaying my generated *.nii image it happens that the coordinates on the right hemisphere (MNI space) are slightly outside of the cortex which is of course not the case on my cortex mesh after projection. Now I am wondering whether there is a mismatch between the mesh and the *.nii image (one voxel maybe)? And whether that is introduced by MRIwrite? If so, do I have to shift all points of the meshes by +1 in order to get correct results the way I want to? If not, any ideas on where that mismatch could come from? Thank you and kind regards, Franziska ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto:Freesurfer@nmr.mgh.harvard.edu> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto: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
Re: [Freesurfer] Question regarding MRIread
External Email - Use Caution Sorry. I am not using the mesh for this, but the volume. Von: Franziska Klein Gesendet: Montag, 29. Juni 2020 19:15:01 An: freesurfer@nmr.mgh.harvard.edu Betreff: AW: [Freesurfer] Question regarding MRIread I've used the MRIwrite function. Von: freesurfer-boun...@nmr.mgh.harvard.edu im Auftrag von Douglas N. Greve Gesendet: Montag, 29. Juni 2020 18:55:01 An: freesurfer@nmr.mgh.harvard.edu Betreff: Re: [Freesurfer] Question regarding MRIread How did you generate the nii file from the mesh? On 6/29/2020 12:21 PM, Franziska Klein wrote: External Email - Use Caution I know, a lot of steps. 1-based vs. 0-based, that is basically what I mean and what I think is the problem, but I need to be sure. When I load in the *.nii file generated from the mesh and display it in SPM, then the origin shown in the SPM Gui is the last column in vox2ras1. Oversimplified, when I want to compare a voxel from SPM with a voxel from freesurfer, I need to shift the coordinates of that voxel from freesurfer by +1, right? (or substract one from the SPM one). Kind regards, Franziska Von: freesurfer-boun...@nmr.mgh.harvard.edu<mailto:freesurfer-boun...@nmr.mgh.harvard.edu> <mailto:freesurfer-boun...@nmr.mgh.harvard.edu> im Auftrag von Douglas N. Greve <mailto:dgr...@mgh.harvard.edu> Gesendet: Montag, 29. Juni 2020 16:44:34 An: freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu> Betreff: Re: [Freesurfer] Question regarding MRIread There's a lot of stuff going on there, so it's hard to say withhout more detail. But it sounds like you might not be taking into account that the voxel coords in matlab are 1-based. On 6/26/2020 12:04 PM, Franziska Klein wrote: External Email - Use Caution Hello, I am using the isosurface() function in order to create a mesh based on the T1.mgz and on the ribbon.mgz. I need those meshes for the coregistration of some channels. After coregistration I do project the channels onto the cortex and extract the corresponding voxel coordinates. Until here, everything works fine. Next, I am using MRIwrite in order to save the T1.mgz as *.nii.mgz which I am using to generate a deformation field with SPM12 to transform the voxel coordinates to normalized MNI coordinates. However, when I put the voxel coordinates (not normalized yet) into SPM12 while displaying my generated *.nii image it happens that the coordinates on the right hemisphere (MNI space) are slightly outside of the cortex which is of course not the case on my cortex mesh after projection. Now I am wondering whether there is a mismatch between the mesh and the *.nii image (one voxel maybe)? And whether that is introduced by MRIwrite? If so, do I have to shift all points of the meshes by +1 in order to get correct results the way I want to? If not, any ideas on where that mismatch could come from? Thank you and kind regards, Franziska ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto:Freesurfer@nmr.mgh.harvard.edu> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu<mailto: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
Re: [Freesurfer] Question regarding MRIread
External Email - Use Caution Okay. I'll try. The basic steps are, loading in a slightly adapted and I guess repaired version of the T1.mgz file called hseg.mgz (this is created by the AtlasViewer toolbox because I need to set the fiducials and some other reference points and this toolbox also calculates all other 10-20 points based on those reference points) and the ribbon.mgz file head = load_mgh(fullfile(DIR, 'mri/hseg.mgz')); brain = load_mgh(fullfile(DIR, 'mri/ribbon.mgz')); for both I am creating a mesh with isosurface function mesh_head = isosurface(head, .9); mesh_brain = isosurface(brain, .9); v = mesh_head .vertices(:, [2 1 3]); % isosurface flips x- and y-axes f = mesh_head .faces; Then I am doing the coregistration based on the meshes, resulting in some mesh voxel coordinates. In order to get a *.nii.gz file I simply use MRIwrite(head, filename) I checked already: hseg.vol and T1.vol (when loading T1.mgz instead of hseg.mgz) are identical. I want to use the new .nii file to generate a deformations field in SPM12 in order to normalize my mesh voxel coordinates to the normalized T1 generated in SPM12 for some specific analyses. Therefore the mesh coordinates (freesurfer 0-based) should be identical with those in the .nii file (SPM Matlab 1-based). I hope this is detailed enough. Von: freesurfer-boun...@nmr.mgh.harvard.edu im Auftrag von Douglas N. Greve Gesendet: Montag, 29. Juni 2020 20:08:04 An: freesurfer@nmr.mgh.harvard.edu Betreff: Re: [Freesurfer] Question regarding MRIread what volume? how did you create it? please give some details On 6/29/2020 1:19 PM, Franziska Klein wrote: External Email - Use Caution Sorry. I am not using the mesh for this, but the volume. ____ Von: Franziska Klein Gesendet: Montag, 29. Juni 2020 19:15:01 An: freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu> Betreff: AW: [Freesurfer] Question regarding MRIread I've used the MRIwrite function. Von: freesurfer-boun...@nmr.mgh.harvard.edu<mailto:freesurfer-boun...@nmr.mgh.harvard.edu> <mailto:freesurfer-boun...@nmr.mgh.harvard.edu> im Auftrag von Douglas N. Greve <mailto:dgr...@mgh.harvard.edu> Gesendet: Montag, 29. Juni 2020 18:55:01 An: freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu> Betreff: Re: [Freesurfer] Question regarding MRIread How did you generate the nii file from the mesh? On 6/29/2020 12:21 PM, Franziska Klein wrote: External Email - Use Caution I know, a lot of steps. 1-based vs. 0-based, that is basically what I mean and what I think is the problem, but I need to be sure. When I load in the *.nii file generated from the mesh and display it in SPM, then the origin shown in the SPM Gui is the last column in vox2ras1. Oversimplified, when I want to compare a voxel from SPM with a voxel from freesurfer, I need to shift the coordinates of that voxel from freesurfer by +1, right? (or substract one from the SPM one). Kind regards, Franziska Von: freesurfer-boun...@nmr.mgh.harvard.edu<mailto:freesurfer-boun...@nmr.mgh.harvard.edu> <mailto:freesurfer-boun...@nmr.mgh.harvard.edu> im Auftrag von Douglas N. Greve <mailto:dgr...@mgh.harvard.edu> Gesendet: Montag, 29. Juni 2020 16:44:34 An: freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu> Betreff: Re: [Freesurfer] Question regarding MRIread There's a lot of stuff going on there, so it's hard to say withhout more detail. But it sounds like you might not be taking into account that the voxel coords in matlab are 1-based. On 6/26/2020 12:04 PM, Franziska Klein wrote: External Email - Use Caution Hello, I am using the isosurface() function in order to create a mesh based on the T1.mgz and on the ribbon.mgz. I need those meshes for the coregistration of some channels. After coregistration I do project the channels onto the cortex and extract the corresponding voxel coordinates. Until here, everything works fine. Next, I am using MRIwrite in order to save the T1.mgz as *.nii.mgz which I am using to generate a deformation field with SPM12 to transform the voxel coordinates to normalized MNI coordinates. However, when I put the voxel coordinates (not normalized yet) into SPM12 while displaying my generated *.nii image it happens that the coordinates on the right hemisphere (MNI space) are slightly outside of the cortex which is of course not the case on my cortex mesh after projection. Now I am wondering whether there is a mismatch between the mesh and the *.nii image (one voxel maybe)? And whether that is introduced by MRIwrite? If so, do I have to shift all points of the meshes by +1 in order to get correct results the way I want to? If n