[Camino-users] FA and MD alignment, registration of Freesurfer labels

Philip A Cook cookpa at mail.med.upenn.edu
Mon Aug 4 08:49:58 PDT 2014


Thanks for the details. I don't get how the FA and MD ended up different, but the introduction of other images might account for some of the problems

On Aug 1, 2014, at 6:10 AM, Oren Geri <oren_geri at yahoo.com> wrote:

> Hi Philip,
>  
> I still think there is a problem with the results I get when calculating connectivity matrix. I tried calculating five area matrixes using the brain stem, the left and right precentral gyri, and the left and right postcentral gyri for 18 subjects. I got very large inconsistencies between subjects and between hemispheres within subjects in the number of streamlines connecting areas.  In some subjects the right gyri are connected to the brainstem while the left gyri aren't.
>  
> I used the following steps for the diffusion data:
>  
> Convert Dicoms to Nifty with Mricron creating C6.nii file
>  
> fsl2scheme -bvecfile C6.bvec -bvalfile C6.bval >C6scheme.txt
>  
> image2voxel -4dimage C6.nii -outputfile C6.Bfloat
>  
> dtfit C6.Bfloat C6scheme.txt >diffTenC6.Bdouble
>  
> track -inputmodel dt -seedfile all_brain_t.nii -anisthresh 0.2 -curvethresh 60 -inputfile diffTenC6.Bdouble > Alltracts.Bfloat

Here all_brain_t.nii is used to define the transform to physical space. If that is not the same as C6.nii, any downstream processing will be wrong. One quick way to check this is to make a global image of the streamline density:

procstreamlines -header all_brain_t.nii -inputfile Alltracts.Bfloat -outputacm -outputroot Alltracts_

If the output of this does not overlay on C6.nii, then the tracts have been written to an incorrect coordinate system.

>  
> (all_brain_t is a template of the entire image, not only the brain. I'll probably change it to a brain mask in the future)
>  
> conmat -inputfile Alltracts.Bfloat -targetfile new_segmentation.nii -outputroot mymatrix5

Assuming you've done the tracking in the right DT space (as defined by C6.nii), this works as long as the physical space of new_segmentation.nii is aligned to C6.nii.

>  
> (I created the new_segmentation.nii labels with Freesurfer and SPM to register the labels file "aprac+aseg.nii" using "orig.nii" (the structural file) as source and the B0 data as reference)
>  
> Regarding the FA and MD:
>  
> When I used FSL to view these file they looked aligned.
>  
> for PROG in fa md; do
>   cat diffTen.Bdouble | ${PROG} | voxel2image -outputroot ${PROG} -header C6.nii
> done
>  
> (C6.nii is the nifty file from Mricron for the entire diffusion data)
>  
> Using:  "niftiheader -readheader <image>" on the MD and FA produce similar results except from different row affine transform values.
> 

I don't know how this code could produce output with different orientation. voxel2image can only take its transformation matrix from C6.nii, and the different input would not affect this. I think there must have been some mistake here.


> conmat -inputfile Alltracts.Bfloat -targetfile new_segmentation.nii -scalarfile r_fa.nii -tractstat median  -outputroot mymatrix1
>  
> I had to register the FA to the B0 image for this line to work. I suppose that's because I used the entire diffusion data header to create the FA? Perhaps if I use only B0 file instead it will also solve the SPM apparent registration problem?

Yes, conmat works by taking in streamline coordinates, which are stored in physical space, and then looking up the appropriate voxels in the target file (to determine connectivity) and the scalar file (to determine FA or whatever). Each coordinate has to map correctly to the same anatomical location in the respective images.

>  
> To create the B0 files I manually erased the other values from the Nifti image. I didn't change the header since SPM registration seems to work fine that way. I suppose these two lines in Matlab are sufficient to change the header also:
>  
> nii.hdr.dime.dim(1)=3; % 3 dim instead of 4
> nii.hdr.dime.dim(5)=1; % reducing the 4 dim size to 1
>  
>  
> Thank you very much!
>  Oren
>  
>   
> 
> 
> On Thursday, July 31, 2014 5:59 PM, Philip A Cook <cookpa at mail.med.upenn.edu> wrote:
> 
> 
> Hi,
> 
> If you created the nii for FA and the MD with the same reference header, they ought to produce the same output. Can you send me the commands you ran? You can also run
> 
>   niftiheader -readheader <image>
> 
> to get a printout of the header information for the images involved. 
> 
> The Paraview problem is a longstanding issue with inconsistency between VTK and NIfTI data in that software. In general a Nifti image loaded into Paraview won't overlap with the same image in VTK format. I should at least make note of this in the tutorial. I would like to find a fix but I think there are heuristics inside the Paraview NIFTI code to determine how to orient things, so I've not found a single transformation that has worked consistently. 
> 
> On Jul 29, 2014, at 9:14 AM, Oren Geri <oren_geri at yahoo.com> wrote:
> 
> > Hi,
> > I have a few questions about creating connectivity matrix with Camino and Freesurfer labels.
> >  
> > First, I followed the tutorial instructions to create fa.nii and md.nii files.
> > I checked these files using SPM8 display command. The images didn't seem to be aligned, also I got different "Origin" and "Dir Cos" values for the images and a warning : "shears involved" message (This problem doesn’t occur using the tutorial data).
> >  
> > Second, I used Freesurfer for labeling different volumes and SPM to register the labels file "aprac+aseg.nii" using "orig.nii" (the structural file) as source and the B0 data as reference.
> > I viewed some of the streamlines created by Camino (following the tutorial using dtfit) and volumes from the registered image of labels with Paraview. It seems that there is a registration problem since the streamlines appear shifted from the place they should be.
> > Thanks a lot,
> >  Oren
> 
> > 
> > _______________________________________________
> > Camino-users mailing list
> > Camino-users at www.nitrc.org
> > http://www.nitrc.org/mailman/listinfo/camino-users
> 
> 
> 



More information about the Camino-users mailing list