Hi Doug,

I have tried the command that you suggested below. Still not working. System gave the same error message again "segment fault".

Any other ideas?

Best wishes,
Jingjing

*
try running this command
mri_label2vol --label lh.words10_10.label --temp rawavg.mgz --reg
rawreg.dat --fillthresh .5 --o lh.words10_10.nii

*
On 11/04/2013 07:55 AM, Zhao Jingjing wrote:
> Hi Doug,
>
> I asked a question a couple days ago for how to convert .label files
> into .nii files in freesurfer. At the end of this email, you can see
> the original email from me and your response.
>
> I tried to run the function mri_label2vol by myself. However, it seems
> not working quite well.
>
> In order to run mri_label2vol, it seems that I have to have a
> registration.dat file. I search online for how to generate it and get
> an answer from maillinglist posted by you several years ago. That is,
> I need to run the function of tkregister2. Then I tried to find out
> how to run tkregister2 and I found out an example suggested by you,
> although I don't know how it works because there is no information
> online for this function.
>
> Your example is like this:
>
> *tkregister2 --mov rawavg.mgz --targ aseg.mgz --regheader
> --regrawreg.dat --noedit*
>
>
> I ran it and it successfully generated a rawreg.dat file, but I don't
> know if it is a correct file that I should use. Below is the results
> that I got from the command window:
>
> *tkregister_tcl /opt/freesurfer/lib/tcl/
tkregister2.tcl
> target  volume aseg.mgz
> movable volume rawavg.mgz
> reg file       rawreg.dat
> LoadVol        0
> ZeroCRAS       0
> $Id: tkregister2.c,v 1.117.2.1 2010/08/02 17:42:03 greve Exp $
> Diagnostic Level -1
> INFO: loading target aseg.mgz
> 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 rawavg.mgz
> Tmov: --------------------
> -0.900   0.000   0.000   100.799;
>  0.000   0.000   0.898  -115.000;
>  0.000  -0.898   0.000   115.000;
>  0.000   0.000   0.000   1.000;
> mkheaderreg = 1, float2int = 0
> Computing reg from header (and possibly input matrix)
> ---- Input registration matrix (computed) --------
> -1.000  -0.012  -0.025  -0.000;
> -0.025   0.069   0.997   0.000;
>  0.010  -0.998   0.070  -0.000;
>  0.000   0.000   0.000   1.000;
> ---------------------------------------
> ---- Input registration matrix --------
> -1.000  -0.012  -0.025  -0.000;
> -0.025   0.069   0.997   0.000;
>  0.010  -0.998   0.070  -0.000;
>  0.000   0.000   0.000   1.000;
> Determinant -1
> subject = subject-unknown
> RegMat ---------------------------
> -1.000  -0.012  -0.025  -0.000;
> -0.025   0.069   0.997   0.000;
>  0.010  -0.998   0.070  -0.000;
>  0.000   0.000   0.000   1.000;*
>
> Then I tried to run the function of mri_label2vol. I specifically
> referred to the example posted online in freesurfer website. It seems
> to me that this is a popular function that a lot of people have used.
> My command line is as below:
>
> *mri_label2vol --label lh.words10_10.label --temp T1.mgz --reg
> rawreg.dat --fillthresh .5 --o lh.words10_10.nii*
>
>
> However, my command line didn't run successfully to generate the nii
> file that I want. The error message is "segmentation flaut". Here I
> attached all the results from the command window after I run this
> function.
>
> *Number of labels: 1
> lh.words10_10.label
> Annot File:      (null)
> Template Volume: T1.mgz
> Outut Volume: lh.words10_10.nii
> Registration File: rawreg.dat
> Fill Threshold: 0.5
> Label Vox Vol:  1
> ProjType:       (null)
> ProjTypeId:     0
> ProjStart:      0
> ProjStop:       0
> ProjDelta:      0.1
> Subject:  (null)
> Hemi:     (null)
> UseNewASeg2Vol:  1
> DoLabelStatVol  0
> $Id: mri_label2vol.c,v 1.32 2009/10/22 23:35:53 greve Exp $
> Template RAS-to-Vox: --------
> -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;
> Template Voxel Volume: 1
> nHits Thresh: 0.5
> Loading registration from rawreg.dat
> RegMat: --------
> -1.000  -0.012  -0.025  -0.000;
> -0.025   0.069   0.997   0.000;
>  0.010  -0.998   0.070  -0.000;
>  0.000   0.000   0.000   1.000;
> Label RAS-to-Vox: --------
>  1.000   0.012   0.025   128.000;
> -0.010   0.998  -0.070   128.000;
> -0.025   0.069   0.997   128.000;
>  0.000   0.000   0.000   1.000;
> Allocating Hit Volume (16777216) voxels
> nlabels = 1
> Loading lh.words10_10.label
>
> Thesholding hit volume.
> Segmentation fault*
>
>
> I was surprised by this result, because it tells me that "the template
> voxel volume is 1". How strange! And finally, no nii file was generated.
>
> Can you help check whether I did something wrong? Attachment I put the
> files that might be used for running these two functions (I didn't put
> T1.mgz and rawavg.mgz in this email since it makes the file bigger
> than 500K, but if you need it please let me know and I will send you
> the link from my dropbox). I might need to specify more parameters in
> the functions, which I didn't how to either. If you can supervise me
> for how to write the functions correctly, that would be really
> appreciated.
>
> And after I generate nii file, how can I visualize it and see how it
> matches the ROI from the .label file? I tried tksurfer "subject name"
> lh inflated, but it doesn't work. If I can get some instructions for
> this command, that would be also helpful.
>
> Thanks.
>
> Best,
> Jingjing
>
>
>
> Date: Tue, 29 Oct 2013 10:21:59 -0400
> From: Douglas N Greve <greve@nmr.mgh.harvard.edu
> <mailto:greve@nmr.mgh.harvard.edu>>
> Subject: Re: [Freesurfer] how to transfer .label file to .nii file
> To: freesurfer@nmr.mgh.harvard.edu <mailto:freesurfer@nmr.mgh.harvard.edu>
> Message-ID: <526FC487.6020601@nmr.mgh.harvard.edu
> <mailto:526FC487.6020601@nmr.mgh.harvard.edu>>
> Content-Type: text/plain; charset=windows-1252; format=flowed
>
>
> You can use mri_label2vol to create a nii mask from the label. To map
> the label to the DTI space, register your DTI (b=0) to the anatomical
> using bbregsiter. You can then use mri_label2vol to transfer the label.
>
> doug
>
>
> On 10/28/2013 06:14 AM, Zhao Jingjing wrote:
> > Hi,
> >
> > Our lab have managed to generate ROIs in T1 images using Freesurfer,
> > which led to .label files. We succesfully measured the cortical
> > thickness in these ROIs for each subject in Freesurfer. Now we are
> > aiming to track white matter fibers from these ROIs in a tractography
> > software Trackvis. However, .lable files seem not be readable in
> > Trackvis. Thus, we are wondering if .label files can be tranferred to
> > .nii files easily in Freesurfer so that we can use the converted .nii
> > ROI files to track fibers in Trackvis. Another related question is how
> > can we coregister the ROIs drawn in T1 images with DTI images and make
> > sure that those ROIs converted from T1 images are the still in the
> > same regions in the DTI images?
> >
> > Thanks.
> > Jingjing Zhao