[Freesurfer] Extracting anatomical locations for a set of RAS coordinates

2019-02-05 Thread Sparsh Jain
External Email - Use Caution

Good afternoon

Is there is way to automatically extract the anatomical locations
corresponding to a set of RAS coordinates using Freesurfer's atlas? I have
a set of 200 points and I am trying to get their anatomical labels
automatically.

Thank you
Sparsh
___
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

Re: [Freesurfer] Extracting anatomical locations for a set of RAS coordinates

2019-02-07 Thread Greve, Douglas N.,Ph.D.
First, you'll have to find the closest vertex for each point in 
fsavarage. You can do this with by creating a label file then using 
mri_label2label with the --paint option.

To find the label associated with each vertex, it is  probably easiest 
to use matlab using read_surf.m and read_annotation.m

On 2/5/19 11:17 AM, Sparsh Jain wrote:
>
> External Email - Use Caution
>
> Good afternoon
>
> Is there is way to automatically extract the anatomical locations 
> corresponding to a set of RAS coordinates using Freesurfer's atlas? I 
> have a set of 200 points and I am trying to get their anatomical 
> labels automatically.
>
> Thank you
> Sparsh
>
> ___
> 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

Re: [Freesurfer] Extracting anatomical locations for a set of RAS coordinates

2019-02-20 Thread Sparsh Jain
External Email - Use Caution

Hi Doug,

I tried what you suggested, but it did not work (see below for details of
what we tried). We have TkReg RAS coordinates (or vertex points) for our
electrode contacts; most contacts are *deep within the brain* (e.g.,
hippocampus and amygdala). We want to get a variable in Matlab that will
give us the anatomical labels as a function of the TkReg RAS coordinates
(or vertex points). How can we do this?

Thanks!

Sparsh

*What I tried:* I read the 'rh.aparc.2009a.annot' file in matlab using
read_annotation.m. That gave me 76 labels for right hemisphere, which I
believe correspond to the surface parcellations only. In freeview I loaded
the orig.mgz, aparc.a2009s+aseg.mgz, rh.pial and rh.inflated. I then
clicked on a cortical surface point to see if I can get the corresponding
vertex number or structure ID. On doing so, I found a value in the Vertex
row under rh.pial of freeview but this number wasn't found in the matlab
output (in the colortable.label or colortable.table). I think I am looking
in the wrong place to find the vertex # on freeview.

Also, I did not find a readable file for the segmentation data. I tried to
read the aparc.a2009s+aseg.mgz on Matlab but that didn't work.
Show quoted text

On Thu, 7 Feb 2019, 16:10 Greve, Douglas N.,Ph.D.  First, you'll have to find the closest vertex for each point in
> fsavarage. You can do this with by creating a label file then using
> mri_label2label with the --paint option.
>
> To find the label associated with each vertex, it is  probably easiest
> to use matlab using read_surf.m and read_annotation.m
>
> On 2/5/19 11:17 AM, Sparsh Jain wrote:
> >
> > External Email - Use Caution
> >
> > Good afternoon
> >
> > Is there is way to automatically extract the anatomical locations
> > corresponding to a set of RAS coordinates using Freesurfer's atlas? I
> > have a set of 200 points and I am trying to get their anatomical
> > labels automatically.
> >
> > Thank you
> > Sparsh
> >
> > ___
> > 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

Re: [Freesurfer] Extracting anatomical locations for a set of RAS coordinates

2019-02-21 Thread Greve, Douglas N.,Ph.D.
For a volume, I would do it differently. In matlab

[segcodes segnames ] = read_fscolorlut(); % read in the seg lookup table

aparcaseg = MRIread('aparc+aseg.mgz'); % Load in the volume
crs = round(inv(aparcaseg.tkrvox2ras)*[tkr tka tks 1]')+1; % convert 
your tkreg coords to col, row, and slice
c = crs(1);
r = crs(2);
s = crs(3);
segno = aparcaseg.vol(r,c,s); % extract the segmentation number
ind = find(segno == segcodes); % convert to the ne name of the segmentation
segname = segnames(ind,:)


On 2/20/19 9:58 AM, Sparsh Jain wrote:
>
> External Email - Use Caution
>
> Hi Doug,
>
> I tried what you suggested, but it did not work (see below for details 
> of what we tried). We have TkReg RAS coordinates (or vertex points) 
> for our electrode contacts; most contacts are _deep within the 
> brain_ (e.g., hippocampus and amygdala). We want to get a variable in 
> Matlab that will give us the anatomical labels as a function of the 
> TkReg RAS coordinates (or vertex points). How can we do this?
>
> Thanks!
>
> Sparsh
>
> _What I tried:_ I read the 'rh.aparc.2009a.annot' file in matlab using 
> read_annotation.m. That gave me 76 labels for right hemisphere, which 
> I believe correspond to the surface parcellations only. In freeview I 
> loaded the orig.mgz, aparc.a2009s+aseg.mgz, rh.pial and rh.inflated. I 
> then clicked on a cortical surface point to see if I can get the 
> corresponding vertex number or structure ID. On doing so, I found a 
> value in the Vertex row under rh.pial of freeview but this number 
> wasn't found in the matlab output (in the colortable.label or 
> colortable.table). I think I am looking in the wrong place to find the 
> vertex # on freeview.
>
> Also, I did not find a readable file for the segmentation data. I 
> tried to read the aparc.a2009s+aseg.mgz on Matlab but that didn't work.
> Show quoted text
>
> On Thu, 7 Feb 2019, 16:10 Greve, Douglas N.,Ph.D. 
> mailto:dgr...@mgh.harvard.edu> wrote:
>
> First, you'll have to find the closest vertex for each point in
> fsavarage. You can do this with by creating a label file then using
> mri_label2label with the --paint option.
>
> To find the label associated with each vertex, it is  probably
> easiest
> to use matlab using read_surf.m and read_annotation.m
>
> On 2/5/19 11:17 AM, Sparsh Jain wrote:
> >
> > External Email - Use Caution
> >
> > Good afternoon
> >
> > Is there is way to automatically extract the anatomical locations
> > corresponding to a set of RAS coordinates using Freesurfer's
> atlas? I
> > have a set of 200 points and I am trying to get their anatomical
> > labels automatically.
> >
> > Thank you
> > Sparsh
> >
> > ___
> > 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


___
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

Re: [Freesurfer] Extracting anatomical locations for a set of RAS coordinates

2019-03-07 Thread Greve, Douglas N.,Ph.D.
Is that point labeled as WM in the aseg? If so, then it is not a problem 
with matlab:)

On 3/7/19 5:58 PM, Sparsh Jain wrote:
>
> External Email - Use Caution
>
> Thanks a lot! It worked.
> While most of the labels were correct, the matlab script returned the 
> wrong location for one point . The script returned the label 'right 
> cerebral white matter' for a point that seems to lie in the middle of 
> the right amygdala. I have attached the screenshots. I do not think 
> that there is a white matter area close enough to confuse the script. 
> Could you tell me why this may have occurred?
> When I write the line "crs = round(inv(aparcaseg.tkrvox2ras)*[tkr tka 
> tks 1]')+1" , is there an error due to rounding in the conversion?
>
> I was planning to inflate a sphere around each electrode point and get 
> the neighboring anatomical regions as well.
>
> Sparsh
>
> On Thu, Feb 21, 2019 at 12:51 PM Greve, Douglas N.,Ph.D. 
> mailto:dgr...@mgh.harvard.edu>> wrote:
>
> For a volume, I would do it differently. In matlab
>
> [segcodes segnames ] = read_fscolorlut(); % read in the seg lookup
> table
>
> aparcaseg = MRIread('aparc+aseg.mgz'); % Load in the volume
> crs = round(inv(aparcaseg.tkrvox2ras)*[tkr tka tks 1]')+1; % convert
> your tkreg coords to col, row, and slice
> c = crs(1);
> r = crs(2);
> s = crs(3);
> segno = aparcaseg.vol(r,c,s); % extract the segmentation number
> ind = find(segno == segcodes); % convert to the ne name of the
> segmentation
> segname = segnames(ind,:)
>
>
> On 2/20/19 9:58 AM, Sparsh Jain wrote:
> >
> > External Email - Use Caution
> >
> > Hi Doug,
> >
> > I tried what you suggested, but it did not work (see below for
> details
> > of what we tried). We have TkReg RAS coordinates (or vertex points)
> > for our electrode contacts; most contacts are _deep within the
> > brain_ (e.g., hippocampus and amygdala). We want to get a
> variable in
> > Matlab that will give us the anatomical labels as a function of the
> > TkReg RAS coordinates (or vertex points). How can we do this?
> >
> > Thanks!
> >
> > Sparsh
> >
> > _What I tried:_ I read the 'rh.aparc.2009a.annot' file in matlab
> using
> > read_annotation.m. That gave me 76 labels for right hemisphere,
> which
> > I believe correspond to the surface parcellations only. In
> freeview I
> > loaded the orig.mgz, aparc.a2009s+aseg.mgz, rh.pial and
> rh.inflated. I
> > then clicked on a cortical surface point to see if I can get the
> > corresponding vertex number or structure ID. On doing so, I found a
> > value in the Vertex row under rh.pial of freeview but this number
> > wasn't found in the matlab output (in the colortable.label or
> > colortable.table). I think I am looking in the wrong place to
> find the
> > vertex # on freeview.
> >
> > Also, I did not find a readable file for the segmentation data. I
> > tried to read the aparc.a2009s+aseg.mgz on Matlab but that
> didn't work.
> > Show quoted text
> >
> > On Thu, 7 Feb 2019, 16:10 Greve, Douglas N.,Ph.D.
> > mailto:dgr...@mgh.harvard.edu>
> > wrote:
> >
> >     First, you'll have to find the closest vertex for each point in
> >     fsavarage. You can do this with by creating a label file
> then using
> >     mri_label2label with the --paint option.
> >
> >     To find the label associated with each vertex, it is  probably
> >     easiest
> >     to use matlab using read_surf.m and read_annotation.m
> >
> >     On 2/5/19 11:17 AM, Sparsh Jain wrote:
> >     >
> >     > External Email - Use Caution
> >     >
> >     > Good afternoon
> >     >
> >     > Is there is way to automatically extract the anatomical
> locations
> >     > corresponding to a set of RAS coordinates using Freesurfer's
> >     atlas? I
> >     > have a set of 200 points and I am trying to get their
> anatomical
> >     > labels automatically.
> >     >
> >     > Thank you
> >     > Sparsh
> >     >
> >     > ___
> >     > 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/fr

Re: [Freesurfer] Extracting anatomical locations for a set of RAS coordinates

2019-03-07 Thread Sparsh Jain
External Email - Use Caution

I see. How may I check that?

Sparsh

On Thu, Mar 7, 2019 at 6:42 PM Greve, Douglas N.,Ph.D. <
dgr...@mgh.harvard.edu> wrote:

> Is that point labeled as WM in the aseg? If so, then it is not a problem
> with matlab:)
>
> On 3/7/19 5:58 PM, Sparsh Jain wrote:
> >
> > External Email - Use Caution
> >
> > Thanks a lot! It worked.
> > While most of the labels were correct, the matlab script returned the
> > wrong location for one point . The script returned the label 'right
> > cerebral white matter' for a point that seems to lie in the middle of
> > the right amygdala. I have attached the screenshots. I do not think
> > that there is a white matter area close enough to confuse the script.
> > Could you tell me why this may have occurred?
> > When I write the line "crs = round(inv(aparcaseg.tkrvox2ras)*[tkr tka
> > tks 1]')+1" , is there an error due to rounding in the conversion?
> >
> > I was planning to inflate a sphere around each electrode point and get
> > the neighboring anatomical regions as well.
> >
> > Sparsh
> >
> > On Thu, Feb 21, 2019 at 12:51 PM Greve, Douglas N.,Ph.D.
> > mailto:dgr...@mgh.harvard.edu>> wrote:
> >
> > For a volume, I would do it differently. In matlab
> >
> > [segcodes segnames ] = read_fscolorlut(); % read in the seg lookup
> > table
> >
> > aparcaseg = MRIread('aparc+aseg.mgz'); % Load in the volume
> > crs = round(inv(aparcaseg.tkrvox2ras)*[tkr tka tks 1]')+1; % convert
> > your tkreg coords to col, row, and slice
> > c = crs(1);
> > r = crs(2);
> > s = crs(3);
> > segno = aparcaseg.vol(r,c,s); % extract the segmentation number
> > ind = find(segno == segcodes); % convert to the ne name of the
> > segmentation
> > segname = segnames(ind,:)
> >
> >
> > On 2/20/19 9:58 AM, Sparsh Jain wrote:
> > >
> > > External Email - Use Caution
> > >
> > > Hi Doug,
> > >
> > > I tried what you suggested, but it did not work (see below for
> > details
> > > of what we tried). We have TkReg RAS coordinates (or vertex points)
> > > for our electrode contacts; most contacts are _deep within the
> > > brain_ (e.g., hippocampus and amygdala). We want to get a
> > variable in
> > > Matlab that will give us the anatomical labels as a function of the
> > > TkReg RAS coordinates (or vertex points). How can we do this?
> > >
> > > Thanks!
> > >
> > > Sparsh
> > >
> > > _What I tried:_ I read the 'rh.aparc.2009a.annot' file in matlab
> > using
> > > read_annotation.m. That gave me 76 labels for right hemisphere,
> > which
> > > I believe correspond to the surface parcellations only. In
> > freeview I
> > > loaded the orig.mgz, aparc.a2009s+aseg.mgz, rh.pial and
> > rh.inflated. I
> > > then clicked on a cortical surface point to see if I can get the
> > > corresponding vertex number or structure ID. On doing so, I found a
> > > value in the Vertex row under rh.pial of freeview but this number
> > > wasn't found in the matlab output (in the colortable.label or
> > > colortable.table). I think I am looking in the wrong place to
> > find the
> > > vertex # on freeview.
> > >
> > > Also, I did not find a readable file for the segmentation data. I
> > > tried to read the aparc.a2009s+aseg.mgz on Matlab but that
> > didn't work.
> > > Show quoted text
> > >
> > > On Thu, 7 Feb 2019, 16:10 Greve, Douglas N.,Ph.D.
> > > mailto:dgr...@mgh.harvard.edu>
> > >
> wrote:
> > >
> > > First, you'll have to find the closest vertex for each point in
> > > fsavarage. You can do this with by creating a label file
> > then using
> > > mri_label2label with the --paint option.
> > >
> > > To find the label associated with each vertex, it is  probably
> > > easiest
> > > to use matlab using read_surf.m and read_annotation.m
> > >
> > > On 2/5/19 11:17 AM, Sparsh Jain wrote:
> > > >
> > > > External Email - Use Caution
> > > >
> > > > Good afternoon
> > > >
> > > > Is there is way to automatically extract the anatomical
> > locations
> > > > corresponding to a set of RAS coordinates using Freesurfer's
> > > atlas? I
> > > > have a set of 200 points and I am trying to get their
> > anatomical
> > > > labels automatically.
> > > >
> > > > Thank you
> > > > Sparsh
> > > >
> > > > ___
> > > > Freesurfer mailing list
> > > > Freesurfer@nmr.mgh.harvard.edu
> > 
> > >  > >
> > > > https:/

Re: [Freesurfer] Extracting anatomical locations for a set of RAS coordinates

2019-03-08 Thread Tim Schäfer
External Email - Use Caution

You could load the aseg in freeview and navigate to the voxel (you can enter 
the CRS at the bottom, no need to scroll there). Then you have its intensity 
value, which you can check against FreeSurferColorLUT.txt.

Tim

--
Dr. Tim Schäfer
Postdoc Computational Neuroimaging
Department of Child and Adolescent Psychiatry, Psychosomatics and Psychotherapy
University Hospital Frankfurt, Goethe University Frankfurt am Main, Germany

> On March 8, 2019 at 12:55 AM Sparsh Jain  wrote:
> 
> 
> External Email - Use Caution
> 
> I see. How may I check that?
> 
> Sparsh
> 
> On Thu, Mar 7, 2019 at 6:42 PM Greve, Douglas N.,Ph.D. <
> dgr...@mgh.harvard.edu> wrote:
> 
> > Is that point labeled as WM in the aseg? If so, then it is not a problem
> > with matlab:)
> >
> > On 3/7/19 5:58 PM, Sparsh Jain wrote:
> > >
> > > External Email - Use Caution
> > >
> > > Thanks a lot! It worked.
> > > While most of the labels were correct, the matlab script returned the
> > > wrong location for one point . The script returned the label 'right
> > > cerebral white matter' for a point that seems to lie in the middle of
> > > the right amygdala. I have attached the screenshots. I do not think
> > > that there is a white matter area close enough to confuse the script.
> > > Could you tell me why this may have occurred?
> > > When I write the line "crs = round(inv(aparcaseg.tkrvox2ras)*[tkr tka
> > > tks 1]')+1" , is there an error due to rounding in the conversion?
> > >
> > > I was planning to inflate a sphere around each electrode point and get
> > > the neighboring anatomical regions as well.
> > >
> > > Sparsh
> > >
> > > On Thu, Feb 21, 2019 at 12:51 PM Greve, Douglas N.,Ph.D.
> > > mailto:dgr...@mgh.harvard.edu>> wrote:
> > >
> > > For a volume, I would do it differently. In matlab
> > >
> > > [segcodes segnames ] = read_fscolorlut(); % read in the seg lookup
> > > table
> > >
> > > aparcaseg = MRIread('aparc+aseg.mgz'); % Load in the volume
> > > crs = round(inv(aparcaseg.tkrvox2ras)*[tkr tka tks 1]')+1; % convert
> > > your tkreg coords to col, row, and slice
> > > c = crs(1);
> > > r = crs(2);
> > > s = crs(3);
> > > segno = aparcaseg.vol(r,c,s); % extract the segmentation number
> > > ind = find(segno == segcodes); % convert to the ne name of the
> > > segmentation
> > > segname = segnames(ind,:)
> > >
> > >
> > > On 2/20/19 9:58 AM, Sparsh Jain wrote:
> > > >
> > > > External Email - Use Caution
> > > >
> > > > Hi Doug,
> > > >
> > > > I tried what you suggested, but it did not work (see below for
> > > details
> > > > of what we tried). We have TkReg RAS coordinates (or vertex points)
> > > > for our electrode contacts; most contacts are _deep within the
> > > > brain_ (e.g., hippocampus and amygdala). We want to get a
> > > variable in
> > > > Matlab that will give us the anatomical labels as a function of the
> > > > TkReg RAS coordinates (or vertex points). How can we do this?
> > > >
> > > > Thanks!
> > > >
> > > > Sparsh
> > > >
> > > > _What I tried:_ I read the 'rh.aparc.2009a.annot' file in matlab
> > > using
> > > > read_annotation.m. That gave me 76 labels for right hemisphere,
> > > which
> > > > I believe correspond to the surface parcellations only. In
> > > freeview I
> > > > loaded the orig.mgz, aparc.a2009s+aseg.mgz, rh.pial and
> > > rh.inflated. I
> > > > then clicked on a cortical surface point to see if I can get the
> > > > corresponding vertex number or structure ID. On doing so, I found a
> > > > value in the Vertex row under rh.pial of freeview but this number
> > > > wasn't found in the matlab output (in the colortable.label or
> > > > colortable.table). I think I am looking in the wrong place to
> > > find the
> > > > vertex # on freeview.
> > > >
> > > > Also, I did not find a readable file for the segmentation data. I
> > > > tried to read the aparc.a2009s+aseg.mgz on Matlab but that
> > > didn't work.
> > > > Show quoted text
> > > >
> > > > On Thu, 7 Feb 2019, 16:10 Greve, Douglas N.,Ph.D.
> > > > mailto:dgr...@mgh.harvard.edu>
> > > >
> > wrote:
> > > >
> > > > First, you'll have to find the closest vertex for each point in
> > > > fsavarage. You can do this with by creating a label file
> > > then using
> > > > mri_label2label with the --paint option.
> > > >
> > > > To find the label associated with each vertex, it is  probably
> > > > easiest
> > > > to use matlab using read_surf.m and read_annotation.m
> > > >
> > > > On 2/5/19 11:17 AM, Sparsh Jain wrote:
> > > > >
> > > > > External Email - Use Caution
> > > > >
> > > > 

Re: [Freesurfer] Extracting anatomical locations for a set of RAS coordinates

2019-03-20 Thread Sparsh Jain
External Email - Use Caution

Thank you. I loaded aseg and input the crs values. The aseg file gave an
intensity value of 54 and the label as right amygdala! So it seems like the
problem is not with the aseg file. Is there another possibility?

Sparsh

On Fri, Mar 8, 2019 at 3:00 AM Tim Schäfer  wrote:

> External Email - Use Caution
>
> You could load the aseg in freeview and navigate to the voxel (you can
> enter the CRS at the bottom, no need to scroll there). Then you have its
> intensity value, which you can check against FreeSurferColorLUT.txt.
>
> Tim
>
> --
> Dr. Tim Schäfer
> Postdoc Computational Neuroimaging
> Department of Child and Adolescent Psychiatry, Psychosomatics and
> Psychotherapy
> University Hospital Frankfurt, Goethe University Frankfurt am Main, Germany
>
> > On March 8, 2019 at 12:55 AM Sparsh Jain  wrote:
> >
> >
> > External Email - Use Caution
> >
> > I see. How may I check that?
> >
> > Sparsh
> >
> > On Thu, Mar 7, 2019 at 6:42 PM Greve, Douglas N.,Ph.D. <
> > dgr...@mgh.harvard.edu> wrote:
> >
> > > Is that point labeled as WM in the aseg? If so, then it is not a
> problem
> > > with matlab:)
> > >
> > > On 3/7/19 5:58 PM, Sparsh Jain wrote:
> > > >
> > > > External Email - Use Caution
> > > >
> > > > Thanks a lot! It worked.
> > > > While most of the labels were correct, the matlab script returned the
> > > > wrong location for one point . The script returned the label 'right
> > > > cerebral white matter' for a point that seems to lie in the middle of
> > > > the right amygdala. I have attached the screenshots. I do not think
> > > > that there is a white matter area close enough to confuse the script.
> > > > Could you tell me why this may have occurred?
> > > > When I write the line "crs = round(inv(aparcaseg.tkrvox2ras)*[tkr tka
> > > > tks 1]')+1" , is there an error due to rounding in the conversion?
> > > >
> > > > I was planning to inflate a sphere around each electrode point and
> get
> > > > the neighboring anatomical regions as well.
> > > >
> > > > Sparsh
> > > >
> > > > On Thu, Feb 21, 2019 at 12:51 PM Greve, Douglas N.,Ph.D.
> > > > mailto:dgr...@mgh.harvard.edu>> wrote:
> > > >
> > > > For a volume, I would do it differently. In matlab
> > > >
> > > > [segcodes segnames ] = read_fscolorlut(); % read in the seg
> lookup
> > > > table
> > > >
> > > > aparcaseg = MRIread('aparc+aseg.mgz'); % Load in the volume
> > > > crs = round(inv(aparcaseg.tkrvox2ras)*[tkr tka tks 1]')+1; %
> convert
> > > > your tkreg coords to col, row, and slice
> > > > c = crs(1);
> > > > r = crs(2);
> > > > s = crs(3);
> > > > segno = aparcaseg.vol(r,c,s); % extract the segmentation number
> > > > ind = find(segno == segcodes); % convert to the ne name of the
> > > > segmentation
> > > > segname = segnames(ind,:)
> > > >
> > > >
> > > > On 2/20/19 9:58 AM, Sparsh Jain wrote:
> > > > >
> > > > > External Email - Use Caution
> > > > >
> > > > > Hi Doug,
> > > > >
> > > > > I tried what you suggested, but it did not work (see below for
> > > > details
> > > > > of what we tried). We have TkReg RAS coordinates (or vertex
> points)
> > > > > for our electrode contacts; most contacts are _deep within the
> > > > > brain_ (e.g., hippocampus and amygdala). We want to get a
> > > > variable in
> > > > > Matlab that will give us the anatomical labels as a function
> of the
> > > > > TkReg RAS coordinates (or vertex points). How can we do this?
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Sparsh
> > > > >
> > > > > _What I tried:_ I read the 'rh.aparc.2009a.annot' file in
> matlab
> > > > using
> > > > > read_annotation.m. That gave me 76 labels for right hemisphere,
> > > > which
> > > > > I believe correspond to the surface parcellations only. In
> > > > freeview I
> > > > > loaded the orig.mgz, aparc.a2009s+aseg.mgz, rh.pial and
> > > > rh.inflated. I
> > > > > then clicked on a cortical surface point to see if I can get
> the
> > > > > corresponding vertex number or structure ID. On doing so, I
> found a
> > > > > value in the Vertex row under rh.pial of freeview but this
> number
> > > > > wasn't found in the matlab output (in the colortable.label or
> > > > > colortable.table). I think I am looking in the wrong place to
> > > > find the
> > > > > vertex # on freeview.
> > > > >
> > > > > Also, I did not find a readable file for the segmentation
> data. I
> > > > > tried to read the aparc.a2009s+aseg.mgz on Matlab but that
> > > > didn't work.
> > > > > Show quoted text
> > > > >
> > > > > On Thu, 7 Feb 2019, 16:10 Greve, Douglas N.,Ph.D.
> > > > > mailto:dgr...@mgh.harvard.edu>
> > > > >
> > > wrote:
> > > > >
> > > > > First, you'll have to find th