GTract V4 questions

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

GTract V4 questions

Darren R Gitelman
I have some questions about gtract v4, and I hope this is the right place to ask.

I would like to use gtractCoregBvalues to align 2 DTI runs and perform eddy current correction. I followed the instructions on this web page: http://www.slicer.org/slicerWiki/index.php/GTRACT_V4#GTRACT_Overview, but they didn't discuss explicitly how to align the volumes.

In order to align the 2 dti runs and perform eddy current correction would I first align the runs and then perform the eddy current correct separately, or would I first do the eddy current correction on each DTI series and then the alignment, or do I have to concatenate the runs into one *.nrrd type of file?

If I was going to align the runs first would this be the correct sequence of commands?

gtractCoregBvalues  --fixedVolume volume1.nhdr  --movingVolume volume2.nhdr  --fixedVolumeIndex 0 --outputVolume volume2_moved.nhdr

then would I eddy current correct each run separately?

gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume1.nhdr  --movingVolume volume1.nhdr  --fixedVolumeIndex 0 \
--outputVolume volume1_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume1_transform.txt

gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume2_moved.nhdr  --movingVolume volume2_moved.nhdr  --fixedVolumeIndex 0 \
--outputVolume volume2_moved_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume2_moved_transform.txt

When I perform the eddy current correct I notice that gtractCoregBvalues permutes the image dimensions from [116 116 72 65] to [65 116 116 72]. Is there a way for it to keep the same dimension order?

Finally, and I hope this isn't heresy on this list, does anyone have a script that can convert a *.nhdr file for a dti image to a nifti image file + bvecs and bvals files for fsl?

Thank you for this great tool.

Darren


--
Darren Gitelman, MD
710 N. Lake Shore Dr., 1122
Chicago, IL 60611
Ph: (312) 908-8614
Fax: (312) 908-5073


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: GTract V4 questions

Magnotta, Vincent A
Darren,

The eddy current correction is simply specifying that you want to use an affine transformation (12 parameters) instead of rigid body (6 parameter) transformation. You just need to specify --eddyCurrentCorrection  option and both subject motion and eddy current correction will be performed. You can either concatenate the data together before or after registration, but would suggest the following command lines if you are going to concatenate the data downstream after registration.

gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume1.nhdr  --movingVolume volume1.nhdr  --fixedVolumeIndex 0 \
--outputVolume volume1_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume1_transform.mat

gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume1.nhdr   --fixedVolumeIndex 0 \
  --movingVolume volume2.nhdr --outputVolume volume2_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  \
  --outputTransform volume2_moved_transform.mat

I will have to look into the ordering issue. I have not worried about this because the NRRD specifies the meaning of each dimension and the ordering inversion is not a problem for this format, but it may be for other formats. I think that you may be on your own for the image converter.

Vince

-- 
Associate Professor
Department of Radiology
0453-D JCP
200 Hawkins Drive
Iowa City, IA 52242
E-mail: [hidden email]
Phone: 319-356-8255 Fax: 319-353-6275
Website: http://www.healthcare.uiowa.edu/Radiology

From: Darren Gitelman <[hidden email]>
Date: Sun, 10 Apr 2011 22:49:30 -0500
To: <[hidden email]>
Subject: [slicer-users] GTract V4 questions

I have some questions about gtract v4, and I hope this is the right place to ask.

I would like to use gtractCoregBvalues to align 2 DTI runs and perform eddy current correction. I followed the instructions on this web page: http://www.slicer.org/slicerWiki/index.php/GTRACT_V4#GTRACT_Overview, but they didn't discuss explicitly how to align the volumes.

In order to align the 2 dti runs and perform eddy current correction would I first align the runs and then perform the eddy current correct separately, or would I first do the eddy current correction on each DTI series and then the alignment, or do I have to concatenate the runs into one *.nrrd type of file?

If I was going to align the runs first would this be the correct sequence of commands?

gtractCoregBvalues  --fixedVolume volume1.nhdr  --movingVolume volume2.nhdr  --fixedVolumeIndex 0 --outputVolume volume2_moved.nhdr

then would I eddy current correct each run separately?

gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume1.nhdr  --movingVolume volume1.nhdr  --fixedVolumeIndex 0 \
--outputVolume volume1_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume1_transform.txt

gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume2_moved.nhdr  --movingVolume volume2_moved.nhdr  --fixedVolumeIndex 0 \
--outputVolume volume2_moved_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume2_moved_transform.txt

When I perform the eddy current correct I notice that gtractCoregBvalues permutes the image dimensions from [116 116 72 65] to [65 116 116 72]. Is there a way for it to keep the same dimension order?

Finally, and I hope this isn't heresy on this list, does anyone have a script that can convert a *.nhdr file for a dti image to a nifti image file + bvecs and bvals files for fsl?

Thank you for this great tool.

Darren


--
Darren Gitelman, MD
710 N. Lake Shore Dr., 1122
Chicago, IL 60611
Ph: (312) 908-8614
Fax: (312) 908-5073

_______________________________________________ slicer-users mailing list [hidden email] http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users To unsubscribe: send email to [hidden email] with unsubscribe as the subject



Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: GTract V4 questions

inorton
In reply to this post by Darren R Gitelman
Hi Darren,

Regarding conversion: if you have access to the original DICOM images, try dcm2nii to convert directly. It knows about the fsl dwi convention and will write nii+bvec+bval for you.

http://www.cabiatl.com/mricro/mricron/dcm2nii.html

If that is not an option, there are a couple ways to convert from nrrd.

Briefly: either write the dwi stack as a 4d nifti from slicer/itk -- n/avail currently AFAIK. would probably need a C++ layer to access the itk writers
-or-
build the nifti from scratch around the nhdr's paired .raw file using fslcreatehd or maybe nibabel. It's a bit tricky to get the order and orientation/origin interpreted correctly.

Let me know (please cc: list) if you want more detailed info and I'll help to the extent I can - I use fsl, but only sporadically. Getting bvec+bval from the nhdr is straightforward.
 
-Isaiah



On Sun, Apr 10, 2011 at 11:49 PM, Darren Gitelman <[hidden email]> wrote:
I have some questions about gtract v4, and I hope this is the right place to ask.

I would like to use gtractCoregBvalues to align 2 DTI runs and perform eddy current correction. I followed the instructions on this web page: http://www.slicer.org/slicerWiki/index.php/GTRACT_V4#GTRACT_Overview, but they didn't discuss explicitly how to align the volumes.

In order to align the 2 dti runs and perform eddy current correction would I first align the runs and then perform the eddy current correct separately, or would I first do the eddy current correction on each DTI series and then the alignment, or do I have to concatenate the runs into one *.nrrd type of file?

If I was going to align the runs first would this be the correct sequence of commands?

gtractCoregBvalues  --fixedVolume volume1.nhdr  --movingVolume volume2.nhdr  --fixedVolumeIndex 0 --outputVolume volume2_moved.nhdr

then would I eddy current correct each run separately?

gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume1.nhdr  --movingVolume volume1.nhdr  --fixedVolumeIndex 0 \
--outputVolume volume1_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume1_transform.txt

gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume2_moved.nhdr  --movingVolume volume2_moved.nhdr  --fixedVolumeIndex 0 \
--outputVolume volume2_moved_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume2_moved_transform.txt

When I perform the eddy current correct I notice that gtractCoregBvalues permutes the image dimensions from [116 116 72 65] to [65 116 116 72]. Is there a way for it to keep the same dimension order?

Finally, and I hope this isn't heresy on this list, does anyone have a script that can convert a *.nhdr file for a dti image to a nifti image file + bvecs and bvals files for fsl?

Thank you for this great tool.

Darren


--
Darren Gitelman, MD
710 N. Lake Shore Dr., 1122
Chicago, IL 60611
Ph: <a href="tel:%28312%29%20908-8614" value="+13129088614" target="_blank">(312) 908-8614
Fax: <a href="tel:%28312%29%20908-5073" value="+13129085073" target="_blank">(312) 908-5073


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: GTract V4 questions

Darren R Gitelman
Dear Isaiah

Thank you for your suggestions. I have a few questions about
converting the hdr from nhdr to nifti. I have pasted part of an nhdr
file below (made by DicomToNrrdConverter.

NRRD0005
content: exists(dti001_series_7.raw,0)
type: short
dimension: 4
space: left-posterior-superior
sizes: 260 260 65 36
thicknesses:  NaN  NaN 2 NaN
space directions: (0.738344,0.0129796,-0.00220629)
(-0.0131451,0.719828,-0.164318) (-0.00199748,0.445064,1.94985) none
centerings: cell cell cell ???
kinds: space space space list
endian: little
encoding: raw
space units: "mm" "mm" "mm"
space origin: (-94.1976,-121.837,-26.0451)
data file: dti001_series_7.raw
measurement frame: (1,0,0) (0,1,0) (0,0,1)
modality:=DWMR

I assume to make the nifti transformation matrix I would take the
space directions together with the space origin like this:

0.738344,       0.0129796,   -0.00220629  -94.1976
-0.0131451,    0.719828,     -0.164318     -121.837
-0.00199748,  0.445064,      1.94985       -26.0451
       0                    0               0                 1

I'm not sure if I should be doing anything with the measurement frame.
I think not because my data are axial, but it might be different if
they were acquired differently.

One question about the gradient list in the nhdr files. Are the
gradient directions listed in the file already transformed by the
space directions or is this done when the image is opened?

Thanks,
Darren


On Mon, Apr 11, 2011 at 12:31 PM, Isaiah Norton <[hidden email]> wrote:

>
> Hi Darren,
>
> Regarding conversion: if you have access to the original DICOM images, try dcm2nii to convert directly. It knows about the fsl dwi convention and will write nii+bvec+bval for you.
>
> http://www.cabiatl.com/mricro/mricron/dcm2nii.html
>
> If that is not an option, there are a couple ways to convert from nrrd.
>
> Briefly: either write the dwi stack as a 4d nifti from slicer/itk -- n/avail currently AFAIK. would probably need a C++ layer to access the itk writers
> -or-
> build the nifti from scratch around the nhdr's paired .raw file using fslcreatehd or maybe nibabel. It's a bit tricky to get the order and orientation/origin interpreted correctly.
>
> Let me know (please cc: list) if you want more detailed info and I'll help to the extent I can - I use fsl, but only sporadically. Getting bvec+bval from the nhdr is straightforward.
>
> -Isaiah
>
>
>
> On Sun, Apr 10, 2011 at 11:49 PM, Darren Gitelman <[hidden email]> wrote:
>>
>> I have some questions about gtract v4, and I hope this is the right place to ask.
>>
>> I would like to use gtractCoregBvalues to align 2 DTI runs and perform eddy current correction. I followed the instructions on this web page: http://www.slicer.org/slicerWiki/index.php/GTRACT_V4#GTRACT_Overview, but they didn't discuss explicitly how to align the volumes.
>>
>> In order to align the 2 dti runs and perform eddy current correction would I first align the runs and then perform the eddy current correct separately, or would I first do the eddy current correction on each DTI series and then the alignment, or do I have to concatenate the runs into one *.nrrd type of file?
>>
>> If I was going to align the runs first would this be the correct sequence of commands?
>>
>> gtractCoregBvalues  --fixedVolume volume1.nhdr  --movingVolume volume2.nhdr  --fixedVolumeIndex 0 --outputVolume volume2_moved.nhdr
>>
>> then would I eddy current correct each run separately?
>>
>> gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume1.nhdr  --movingVolume volume1.nhdr  --fixedVolumeIndex 0 \
>> --outputVolume volume1_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume1_transform.txt
>>
>> gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume2_moved.nhdr  --movingVolume volume2_moved.nhdr  --fixedVolumeIndex 0 \
>> --outputVolume volume2_moved_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume2_moved_transform.txt
>>
>> When I perform the eddy current correct I notice that gtractCoregBvalues permutes the image dimensions from [116 116 72 65] to [65 116 116 72]. Is there a way for it to keep the same dimension order?
>>
>> Finally, and I hope this isn't heresy on this list, does anyone have a script that can convert a *.nhdr file for a dti image to a nifti image file + bvecs and bvals files for fsl?
>>
>> Thank you for this great tool.
>>
>> Darren
>>
>>
>> --
>> Darren Gitelman, MD
>> 710 N. Lake Shore Dr., 1122
>> Chicago, IL 60611
>> Ph: (312) 908-8614
>> Fax: (312) 908-5073
>>
>>
>> _______________________________________________
>> slicer-users mailing list
>> [hidden email]
>> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
>> To unsubscribe: send email to [hidden email] with unsubscribe as the subject
>



--
Darren Gitelman, MD
710 N. Lake Shore Dr., 1122
Chicago, IL 60611
Ph: (312) 908-8614
Fax: (312) 908-5073
_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: GTract V4 questions

inorton
Hi Darren,

Regarding gradient directions: I don't really know, but maybe Xiaodong can answer. For what it's worth, the gradient vectors from DicomToNrrd and dcm2nii match in the tests I've tried (GE and Siemens datasets) - so you may be able to get away with copying what is in the nhdr.

Xiaodong:

One question about the gradient list in the nhdr files. Are the
gradient directions listed in the file already transformed by the
space directions or is this done when the image is opened?
 

The manual conversion process is slightly involved because of different orientation frames - building the nifti header requires flipping the orientation matrix along the x and y axes. So in your case this gives:

dotproduct

0.738344,       0.0129796,   -0.00220629  -94.1976
-0.0131451,    0.719828,     -0.164318     -121.837
-0.00199748,  0.445064,      1.94985       -26.0451
      0                    0               0                 1

-1 0 0 0
0 -1 0 0
0 0 1 0
0 0 0 1

=

-0.738344,       -0.0129796,   -0.00220629  -94.1976
0.0131451,    -0.719828,     -0.164318     -121.837
0.00199748,  -0.445064,      1.94985       -26.0451
      0                    0               0                 1


Modify the attached (xmpl.xml) fsl nifti xml descriptor to match your file. See the matching nhdr for comparison of required fields. fslcreatehd will fill in the rest. The origin seems to be interpreted differently between nifti and nrrd (nrrd uses the dicom Image Position Patient exactly, while nifti has a y offset). But good registration software should be able to handle this in initialization, or you can line up manually. Orientation is much more critical.

The fields which will need to be changed are at least: nx,ny,nz,nt,dx,dy,dz, and sto_xyz_matrix (using the matrix as above, one row at a time)

Then, use fslcreatehd to create an image from the xml file:

$ fslcreatehd xmpl.xml ser7_nifti.hdr

If all of the dimension information was entered correctly, the (zeros) file "output.img" should be exactly the same size as "dti_001_series_7.raw"

Now replace "output.img" with "dti_001_series_7.raw"

....Hopefully this should open with the correct orientation in fslview when compared to Slicer. If you want a single-file nifti, use fslchfiletype.

This was tested on some asymmetric dti data from xnat central, and on this small 4D epi dataset with a helpful orientation marker on the L side of the head:
http://www.cabiatl.com/mricro/mricron/trio_12.zip
linked here: http://www.cabiatl.com/mricro/mricron/dcm2nii.html

Hope this helps,
-Isaiah



On Tue, Apr 12, 2011 at 9:57 AM, Darren Gitelman <[hidden email]> wrote:
Dear Isaiah

Thank you for your suggestions. I have a few questions about
converting the hdr from nhdr to nifti. I have pasted part of an nhdr
file below (made by DicomToNrrdConverter.

NRRD0005
content: exists(dti001_series_7.raw,0)
type: short
dimension: 4
space: left-posterior-superior
sizes: <a href="tel:260%20260%2065%2036" value="+12602606536" target="_blank">260 260 65 36
thicknesses:  NaN  NaN 2 NaN
space directions: (0.738344,0.0129796,-0.00220629)
(-0.0131451,0.719828,-0.164318) (-0.00199748,0.445064,1.94985) none
centerings: cell cell cell ???
kinds: space space space list
endian: little
encoding: raw
space units: "mm" "mm" "mm"
space origin: (-94.1976,-121.837,-26.0451)
data file: dti001_series_7.raw
measurement frame: (1,0,0) (0,1,0) (0,0,1)
modality:=DWMR

I assume to make the nifti transformation matrix I would take the
space directions together with the space origin like this:

0.738344,       0.0129796,   -0.00220629  -94.1976
-0.0131451,    0.719828,     -0.164318     -121.837
-0.00199748,  0.445064,      1.94985       -26.0451
      0                    0               0                 1

I'm not sure if I should be doing anything with the measurement frame.
I think not because my data are axial, but it might be different if
they were acquired differently.

One question about the gradient list in the nhdr files. Are the
gradient directions listed in the file already transformed by the
space directions or is this done when the image is opened?

Thanks,
Darren


On Mon, Apr 11, 2011 at 12:31 PM, Isaiah Norton <[hidden email]> wrote:
>
> Hi Darren,
>
> Regarding conversion: if you have access to the original DICOM images, try dcm2nii to convert directly. It knows about the fsl dwi convention and will write nii+bvec+bval for you.
>
> http://www.cabiatl.com/mricro/mricron/dcm2nii.html
>
> If that is not an option, there are a couple ways to convert from nrrd.
>
> Briefly: either write the dwi stack as a 4d nifti from slicer/itk -- n/avail currently AFAIK. would probably need a C++ layer to access the itk writers
> -or-
> build the nifti from scratch around the nhdr's paired .raw file using fslcreatehd or maybe nibabel. It's a bit tricky to get the order and orientation/origin interpreted correctly.
>
> Let me know (please cc: list) if you want more detailed info and I'll help to the extent I can - I use fsl, but only sporadically. Getting bvec+bval from the nhdr is straightforward.
>
> -Isaiah
>
>
>
> On Sun, Apr 10, 2011 at 11:49 PM, Darren Gitelman <[hidden email]> wrote:
>>
>> I have some questions about gtract v4, and I hope this is the right place to ask.
>>
>> I would like to use gtractCoregBvalues to align 2 DTI runs and perform eddy current correction. I followed the instructions on this web page: http://www.slicer.org/slicerWiki/index.php/GTRACT_V4#GTRACT_Overview, but they didn't discuss explicitly how to align the volumes.
>>
>> In order to align the 2 dti runs and perform eddy current correction would I first align the runs and then perform the eddy current correct separately, or would I first do the eddy current correction on each DTI series and then the alignment, or do I have to concatenate the runs into one *.nrrd type of file?
>>
>> If I was going to align the runs first would this be the correct sequence of commands?
>>
>> gtractCoregBvalues  --fixedVolume volume1.nhdr  --movingVolume volume2.nhdr  --fixedVolumeIndex 0 --outputVolume volume2_moved.nhdr
>>
>> then would I eddy current correct each run separately?
>>
>> gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume1.nhdr  --movingVolume volume1.nhdr  --fixedVolumeIndex 0 \
>> --outputVolume volume1_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume1_transform.txt
>>
>> gtractCoregBvalues  --eddyCurrentCorrection --fixedVolume volume2_moved.nhdr  --movingVolume volume2_moved.nhdr  --fixedVolumeIndex 0 \
>> --outputVolume volume2_moved_ec.nhdr --relaxationFactor 0.25 --maximumStepSize 0.1  --outputTransform volume2_moved_transform.txt
>>
>> When I perform the eddy current correct I notice that gtractCoregBvalues permutes the image dimensions from [116 116 72 65] to [65 116 116 72]. Is there a way for it to keep the same dimension order?
>>
>> Finally, and I hope this isn't heresy on this list, does anyone have a script that can convert a *.nhdr file for a dti image to a nifti image file + bvecs and bvals files for fsl?
>>
>> Thank you for this great tool.
>>
>> Darren
>>
>>
>> --
>> Darren Gitelman, MD
>> 710 N. Lake Shore Dr., 1122
>> Chicago, IL 60611
>> Ph: <a href="tel:%28312%29%20908-8614" value="+13129088614" target="_blank">(312) 908-8614
>> Fax: <a href="tel:%28312%29%20908-5073" value="+13129085073" target="_blank">(312) 908-5073
>>
>>
>> _______________________________________________
>> slicer-users mailing list
>> [hidden email]
>> http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
>> To unsubscribe: send email to [hidden email] with unsubscribe as the subject
>



--
Darren Gitelman, MD
710 N. Lake Shore Dr., 1122
Chicago, IL 60611
Ph: <a href="tel:%28312%29%20908-8614" value="+13129088614" target="_blank">(312) 908-8614
Fax: <a href="tel:%28312%29%20908-5073" value="+13129085073" target="_blank">(312) 908-5073


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject

xmpl.xml (656 bytes) Download Attachment
fmriasc.nhdr (804 bytes) Download Attachment