Sorry Doug,
Could you please give me an example of how I would implement this?
Thanks,
Alex

-----Original Message-----
From:   Doug Greve [mailto:[EMAIL PROTECTED]
Sent:   Tue 7/5/2005 1:40 AM
To:     Bruce Fischl
Cc:     Fornito, Alexander; freesurfer@nmr.mgh.harvard.edu
Subject:        RE: [Freesurfer] mri_vol2surf

Something like this should work:


vertex_coords = read_surf('lh.white')
[w,v] = read_wfile(wfilename);

lindex = v;
lxyz = vertex_coords(lindex);
lvals = zeros(size(lindex));
write_label(lindex, lxyz, lvals, labelfile, subjid);




On Mon, 4 Jul 2005, Bruce Fischl wrote:

> Hi Alex,
>
> I think Doug has a .m file to do this in matlab. We'll put an mri_vol2label 
> on the to-do list, or maybe extend vol2roi to do it.
>
> Bruce
>
> On Mon, 4 Jul 2005, Fornito, Alexander wrote:
>
>> Never mind about the differences between tkmedit and tkregister - I 
>> retained --regheader in the command line, even though the mask and the 
>> volume were already correctly aligned, which caused them to move out of 
>> alignment. However, I'm still unsure of what the correct file format is for 
>> me to apply the image as an ROI to the surface to get regional anatomical 
>> info.
>> Thanks,
>> Alex
>> 
>>      -----Original Message-----
>>      From: Bruce Fischl [mailto:[EMAIL PROTECTED]
>>      Sent: Mon 7/4/2005 11:25 AM
>>      To: Fornito, Alexander
>>      Cc: Doug Greve; freesurfer@nmr.mgh.harvard.edu
>>      Subject: RE: [Freesurfer] mri_vol2surf
>> 
>> 
>> 
>>      Hi Alex,
>> 
>>      no, label files are text files  with the extension .label that 
>> usually
>>      reside in the subject's label directory. .w files are "weight" files
>>      (from EEG/MEG inverse solutions), and more generally, are a sparse 
>> set of
>>      floating point values. You can load them in tksurfer with file->load
>>      overlay, and leave the register field blank. but they probably aren't 
>> the
>>      right format for a label, which is just a list of voxels. Maybe Doug 
>> can
>>      point you in the right direction for that (mri_vol2roi?)
>> 
>>      cheers,
>>      Bruce
>> 
>> 
>>      On Mon, 4 Jul 2005, Fornito, Alexander wrote:
>> 
>>      > Hi,
>>      > I've managed to get the mask to a point where it's in the correct 
>> position if I load it through tkmedit (as a binary in analyze format).  I 
>> then run mri_vol2surf, which seems to work (output below). However, If I 
>> try to load the mask (now saved as a .w file) though tksurfer as file > 
>> label > load, nothing happens (nothing happens if I try to load it as an 
>> overlay with the register.dat file either). If I try to load it as a label 
>> in tkmedit, I get the following:
>>      >
>>      > Couldn't load the label.
>>      > Tkmedit couldn't read the label you specified. This could be 
>> because the format wasn't valid or the file wasn't found.
>>      >
>>      > Am I missing something? I though .w was the correct format for 
>> labels of this type.
>>      > Here's the mri_vol2surf output. Thanks again!
>>      >
>>      > mri_vol2surf --src 186_corconv_native_testmask_binary_y --src_type 
>> analyze --srcreg register.dat --hemi lh --out 
>> ./186_native_flip_y_mask_surf.w --out_type paint
>>      > INFO: output format is paint
>>      > srcvol = 186_corconv_native_testmask_binary_y
>>      > srctype = analyze
>>      > srcreg = register.dat
>>      > srcregold = 0
>>      > srcwarp unspecified
>>      > surf = white
>>      > hemi = lh
>>      > interp = nearest
>>      > float2int = round
>>      > INFO: float2int code = 0
>>      > INFO: analyzeRead(): found 1 files for 
>> /data/flanders/work/alex/freesurfer/subjects/186_corconv_native_testmask_binary_y
>>      > -----------------------------------------------------------------
>>      > INFO: could not find 
>> /data/flanders/work/alex/freesurfer/subjects/186_corconv_native_testmask_binary_y.mat
>>  
>> file for direction cosine info.
>>      > INFO: use Analyze 7.5 hdr->hist.orient value: 0, transverse 
>> unflipped (default).
>>      > INFO: if not valid, please provide the information in 
>> /data/flanders/work/alex/freesurfer/subjects/186_corconv_native_testmask_binary_y.mat
>>  
>> file
>>      > -----------------------------------------------------------------
>>      > INFO: analyzeRead(): min = 0, max = 1
>>      > INFO: chaning type to float
>>      > Done loading volume
>>      > Reading surface 
>> /data/flanders/work/alex/freesurfer/subjects/1000186/surf/lh.white
>>      > Done reading source surface
>>      > Mapping Source Volume onto Source Subject Surface
>>      > vol2surf_linear: nhits = 152789/152789
>>      > Done mapping volume to surface
>>      > Number of source voxels hit = 96553
>>      > avg = 1.000, stdev = 0.000, min = 1.000, max = 1.000
>>      >
>>      >
>>      > -----Original Message-----
>>      > From: Doug Greve [mailto:[EMAIL PROTECTED]
>>      > Sent: Fri 7/1/2005 10:11 PM
>>      > To:   Fornito, Alexander
>>      > Cc:   Bruce Fischl; freesurfer@nmr.mgh.harvard.edu
>>      > Subject:      Re: [Freesurfer] mri_vol2surf
>>      >
>>      > Sorry, I gave you a slightly wrong tkmedit command-line, it should 
>> have
>>      > been -overlay-reg ...
>>      >
>>      > As for tkmedit, the mask is probably too dark. Click in the window 
>> and
>>      > hit 'i'. This will turn on intensity normalization, which will 
>> probably
>>      > fix the problem. You may want to load in the volume that you traced 
>> the
>>      > mask on instead of the mask itself.
>>      >
>>      > doug
>>      >
>>      >
>>      > Fornito, Alexander wrote:
>>      >
>>      > >Hi Doug,
>>      > >I tried the tkmedit command and it loaded the volume with the 
>> mask, although I got a message saying:
>>      > >Error: Parsing command line options
>>      > >Option -reg not recognized
>>      > >This option was not recognized and ignored.
>>      > >
>>      > >Not sure why this occurred, as I loaded it from scratch through 
>> the GUI (File > Load Overlay Data, with the mask as the volume and 
>> register.dat as the registration file) and it produced the same with no 
>> error.
>>      > >In any case, I can see from tkmedit that the mask is not where it 
>> should be (It's in the neck, where it should be in the cingulate, above the 
>> corpus callosum).
>>      > >However, I tried running tkregister as you suggested to me, and 
>> although the GUI pops up, I'm unable to see the movable volume (ie., the 
>> mask). This has happened to me before when i tried something else in 
>> tkregister, and am not sure if I'm doing anything wrong. The output is 
>> below.
>>      > >Thanks for your help,
>>      > >Alex.
>>      > >
>>      > >tkregister2 --s ./1000186 --mov ./186_corconv_mask.img --reg 
>> ./register.dat --regheader
>>      > >INFO: no target volume specified, assuming FreeSurfer orig volume.
>>      > >target  volume orig
>>      > >movable volume ./186_corconv_mask.img
>>      > >reg file       ./register.dat
>>      > >LoadVol        1
>>      > >$Id: tkregister2.c,v 1.22 2003/11/05 21:30:50 greve Exp $
>>      > >Diagnostic Level -1
>>      > >INFO: analyzeRead(): found 1 files for ./186_corconv_mask.img
>>      > >-----------------------------------------------------------------
>>      > >INFO: could not find ./186_corconv_mask.mat file for direction 
>> cosine info.
>>      > >INFO: use Analyze 7.5 hdr->hist.orient value: 0, transverse 
>> unflipped (default).
>>      > >INFO: if not valid, please provide the information in 
>> ./186_corconv_mask.mat file
>>      > >-----------------------------------------------------------------
>>      > >INFO: loading target 
>> /data/flanders/work/alex/freesurfer/subjects/./1000186/mri/orig
>>      > >INFO: changing target type to float
>>      > >Ttarg: --------------------
>>      > >-1.000   0.000   0.000   128.000;
>>      > > 0.000   0.000   1.000  -128.000;
>>      > > 0.000  -1.000   0.000   128.000;
>>      > > 0.000   0.000   0.000   1.000;
>>      > >INFO: loading movable ./186_corconv_mask.img
>>      > >INFO: analyzeRead(): found 1 files for ./186_corconv_mask.img
>>      > >-----------------------------------------------------------------
>>      > >INFO: could not find ./186_corconv_mask.mat file for direction 
>> cosine info.
>>      > >INFO: use Analyze 7.5 hdr->hist.orient value: 0, transverse 
>> unflipped (default).
>>      > >INFO: if not valid, please provide the information in 
>> ./186_corconv_mask.mat file
>>      > >-----------------------------------------------------------------
>>      > >INFO: analyzeRead(): min = 0, max = 1
>>      > >INFO: changing move type to float
>>      > >Tmov: --------------------
>>      > >-1.000   0.000   0.000   128.000;
>>      > > 0.000   0.000   1.000  -128.000;
>>      > > 0.000  -1.000   0.000   128.000;
>>      > > 0.000   0.000   0.000   1.000;
>>      > >mkheaderreg = 1, float2int = 0
>>      > >---- Input registration matrix (computed) --------
>>      > > 1.000   0.000   0.000   0.000;
>>      > > 0.000   0.000   1.000  -0.000;
>>      > > 0.000  -1.000   0.000   0.000;
>>      > > 0.000   0.000   0.000   1.000;
>>      > >---------------------------------------
>>      > >subject = ./1000186
>>      > >Zoom Factor = 2
>>      > >---- Input registration matrix --------
>>      > > 1.000   0.000   0.000   0.000;
>>      > > 0.000   0.000   1.000  -0.000;
>>      > > 0.000  -1.000   0.000   0.000;
>>      > > 0.000   0.000   0.000   1.000;
>>      > >Opening window ./1000186
>>      > >Setting scale
>>      > >tkregister2: interface: 
>> /usr/local/freesurfer/lib/tcl/tkregister2.tcl
>>      > >tkregister.tcl: startup done
>>      > >tkregister.tcl: default macro interface (to change: 
>> macro,mini,micro)
>>      > >tkregister.tcl: or: setenv tkregisterinterface {macro,mini,micro}
>>      > >
>>      > >
>>      > >
>>      > >-----Original Message-----
>>      > >From:        Doug Greve [mailto:[EMAIL PROTECTED]
>>      > >Sent:        Fri 7/1/2005 12:47 PM
>>      > >To:  Fornito, Alexander
>>      > >Cc:  Bruce Fischl; freesurfer@nmr.mgh.harvard.edu
>>      > >Subject:     RE: [Freesurfer] mri_vol2surf
>>      > >
>>      > >
>>      > >The first thing that you should do is load your mask as an overlay 
>> in
>>      > >tkmedit to make sure that it is actually falling where you think 
>> it
>>      > >is:
>>      > >
>>      > >tkmedit yoursubject orig -overlay ./mask.img -reg ./register.dat \
>>      > >   -fthresh 0.5
>>      > >
>>      > >The fthresh is set assuming your mask is 0 or 1. You can even load
>>      > >the surface to see if it actually inersects.
>>      > >
>>      > >If this fails, then you need a new registration file. You can
>>      > >create this with:
>>      > >
>>      > >tkregiser2 --s yoursubject --mov mask.img --reg reg.dat 
>> --regheader
>>      > >
>>      > >tkregiser2 allows you to interactively change the registration. 
>> Note
>>      > >that you only use --regheader the first time you run it (ie, 
>> before
>>      > >you have a reg.dat).
>>      > >
>>      > >doug
>>      > >
>>      > >
>>      > >
>>      > >
>>      > >On Fri, 1 Jul 2005, Fornito, Alexander wrote:
>>      > >
>>      > >
>>      > >
>>      > >>Sorry, I forgot to mention, I have the mask in analyze format (I 
>> traced it in another program). I ran mri_vol2surf using the register.dat 
>> file format that Doug provided, and got the output below. Although it 
>> creates a .w file, nothing happens when I load it in tksurfer, I'm gessing 
>> because the vertex values are zero (?). Have I done something wrong?
>>      > >>
>>      > >> mri_vol2surf --src 186_corconv_mask --src_type analyze --srcreg 
>> register.dat --hemi lh --out ./186_mask_surf.w --out_type paint
>>      > >>INFO: output format is paint
>>      > >>srcvol = 186_corconv_mask
>>      > >>srctype = analyze
>>      > >>srcreg = register.dat
>>      > >>srcregold = 0
>>      > >>srcwarp unspecified
>>      > >>surf = white
>>      > >>hemi = lh
>>      > >>interp = nearest
>>      > >>float2int = round
>>      > >>INFO: float2int code = 0
>>      > >>INFO: analyzeRead(): found 1 files for 
>> /data/flanders/work/alex/freesurfer/subjects/186_corconv_mask
>>      > >>-----------------------------------------------------------------
>>      > >>INFO: could not find 
>> /data/flanders/work/alex/freesurfer/subjects/186_corconv_mask.mat file for 
>> direction cosine info.
>>      > >>INFO: use Analyze 7.5 hdr->hist.orient value: 0, transverse 
>> unflipped (default).
>>      > >>INFO: if not valid, please provide the information in 
>> /data/flanders/work/alex/freesurfer/subjects/186_corconv_mask.mat file
>>      > >>-----------------------------------------------------------------
>>      > >>INFO: analyzeRead(): min = 0, max = 1
>>      > >>INFO: chaning type to float
>>      > >>Done loading volume
>>      > >>Reading surface 
>> /data/flanders/work/alex/freesurfer/subjects/1000186/surf/lh.white
>>      > >>Done reading source surface
>>      > >>Mapping Source Volume onto Source Subject Surface
>>      > >>vol2surf_linear: nhits = 152789/152789
>>      > >>Done mapping volume to surface
>>      > >>Number of source voxels hit = 96553
>>      > >>Warning: all vertex values are zero
>>      > >>
>>      > >>
>>      > >>
>>      > >>-----Original Message-----
>>      > >>From:       Bruce Fischl [mailto:[EMAIL PROTECTED]
>>      > >>Sent:       Fri 7/1/2005 11:06 AM
>>      > >>To: Fornito, Alexander
>>      > >>Cc: freesurfer@nmr.mgh.harvard.edu
>>      > >>Subject:    Re: [Freesurfer] mri_vol2surf
>>      > >>Hi Alex,
>>      > >>
>>      > >>I think you can just load the label into tksurfer 
>> (file->label->load) and
>>      > >>it will sample it onto the surface, assuming that it was drawn on 
>> one of
>>      > >>the volumes that the surface was created from (or a coregistered 
>> one).
>>      > >>The 1st time you do this it may take a bit, but if you save it 
>> again it
>>      > >>will save the vertex #s.
>>      > >>
>>      > >>cheers,
>>      > >>Bruce
>>      > >>
>>      > >>
>>      > >>On Fri, 1 Jul 2005, Fornito, Alexander wrote:
>>      > >>
>>      > >>
>>      > >>
>>      > >>>Hi,
>>      > >>>I'm trying apply ROI masks that I've manually traced in volume 
>> space to the same image's surface using mri_vol2surf. mri_vol2surf seems to 
>> requires a register.dat file, and I'm unsure what needs to be registered, 
>> since the volume that I traced the masks on is exactly the same as the one 
>> that I began with to create the surface (so presumably they are in the same 
>> space?) . Any hints would be appreciated.
>>      > >>>Thanks,
>>      > >>>Alex
>>      > >>>
>>      > >>>_______________________________________________
>>      > >>>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
[EMAIL PROTECTED]
Phone Number: 617-724-2358 
Fax: 617-726-7422




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

Reply via email to