dke-questions > DKE + FSL pipeline has issue
Showing 1-18 of 18 posts
Display:
Results per page:
Sep 2, 2015  03:09 PM | Robert Welsh
DKE + FSL pipeline has issue
Hi,

I have successfully used DKE on a Mac (10.10.5) to reconstruct DKE metrics. I would now like to take the estimates from the DKE and utilize my FSL TBSS pipeline to run statistical analyses. Here is what I'm doing.

Data were converted from DICOM to NII using mcverter from University of Oregon

(0) the data have a qform and sform of "Scanner Anat" 
(1) taking native space DKI data set and running through FSL DTIFIT to get a FA map. 
(2) use the native space FA map (I'll call it FA_FSL) to run TBSS with my two cohorts
(3) use DKE on the native space DKI data set to calculate metrics (KFA, KMEAN etcetera). I have DKE resample to 1.5mm isotropic 
(4) I now want to take the TBSS derived warps and apply them to the DKE data. 

This doesn't work. It appears that the qform and sform are change by DKE to be in "Aligned Anat" with diagonal qto_xyz and sto_xyz matrices. 

If I do a "Check Reg" in spm, the images show they are aligned.

If I try to a FSL/flirt realignment without resampling/reslicing, specifying rigid body (dof = 6), they affine matrix is the identity matrix

If, however, I try to do a flirt resampling/resclicing using the identity matrix, the resulting image is all skewed with respect to the original b=0 image.

And of course, if I apply the warping, that is also messed up.

Robert
Sep 2, 2015  04:09 PM | C C
RE: DKE + FSL pipeline has issue
Hi Robert,

Great to hear that DKE runs successfully in the latest build of Yosemite.  In my experience in using DKE (version 2.6) and TBSS, I have always started the processing from the straight dicoms.  [Or alternatively, generated a nifti from the dicoms (DKI sequence, DKI B0 sequence) using dcm2nii, found in MRIcron]

If you are using the DKE GUI, you don't have to presort your dicom folder with different sequences, as the GUI will display the different sequences to be used for processing in the folder that you specified for the GUI to load from. I bring this up due to the fact that DKE by default will generate the standard 7 metrics (3 diffusion, 1 FA, and 3 kurtosis) among others.  The key is this generated FA map that DKE gives us for each subject.

It is this FA map for each subject that I feed into the standard TBSS pipeline.  In my opinion and experience, I believe it is unnecessary to go through the trouble of of using the extra tools in FSL to obtain the FA map that you specified.  The reason is because if you use the FA map that is generated from the DKE processing, it will be in the same space as your output diffusion and kurtosis maps.  Which in the case of TBSS, it will take care of all normalization and coregistration for you anyways based on your template or option that you are choosing (tbss_2_reg tbss_3_postreg).

Furthermore, if you are looking to normalize all the FA maps to same space and subsequent non-FA maps (kmean, krad, dmean, etc...), FSL's TBSS also takes care of that for you in their standard pipeline.  If you are following the TBSS standard pipeline Steps 1-4, once you use the FA maps and other non-FA maps, there will be a stats folder generated that contains the 4D nifti files for your metrics such as: all_FA.nii.gz; all_kmean.nii.gz; all_krad.nii.gz; etc.  These 4D files contain all of the subjects metric map concatenated into one file with normalization and coregistration taken care of into MNI space.  From this 4D file where each time series corresponds with one independent subject, you can then use FSL split to retrieve the independent 3D nifiti.  TBSS can be tricky when using non-FA maps due to the file directory organization.

To wrap it up though, this is my standard pipeline of processing of utilizing DKE to output my metric maps of interest, and using them in a TBSS analysis, hope that provides some clarity in using TBSS.

Cliff
Aug 14, 2017  03:08 PM | Eric Forman - University of Kentucky
RE: DKE + FSL pipeline has issue
Hi Cliff,

  We are running the DKE through TBSS and getting bad images and low numbers.  For example, in the attached pic, you can see that the FA in the genu is only 0.14.  From what we are finding, the average on a normal healthy adult should be around 0.64.  Any ideas on what might be going on here?  Any help is greatly appreciated.

Thanks, 
Eric
Attachment: Low_genu.png
Aug 15, 2017  08:08 AM | Kirk Feindel - University of Western Australia
RE: DKE + FSL pipeline has issue
Hi Robert,

You have entered the lovely realm of file format interpretation . . . FSL requires a specific orientation and is rather inflexible, which can cause problems such as you are encountering.

Personally, I convert from DICOM to nifti using MRtrix.  We use the FSL eddy tool and BET, and then feed into DKE after restructuring the nifti to have one leading B0, then each Bseries.

After DKE you can use fslreorient2std on the niftis to get them in the orientation that FSL likes, coregister to MNI via an FA atlas (using the FA out of DKE).  We first go FA atlas to MNI atlas (once) then FA(DKE) to FA(atlas), and then concatenate the matrices to go direct FA(DKE) to MNI.  Then we're good to go for TBSS.

If you want more details, I can ask one of my student's who's set up our TBSS analysis pipeline.

Cheers,

Kirk
Aug 8, 2018  10:08 AM | Shereif Haykal
RE: DKE + FSL pipeline has issue
Dear Kirk,

I'm running into the same problem as the original poster. Whenever I try to run the first step of TBSS (tbss_1_preproc) with the produced fa maps, I get the message "ERROR: Inconsistent left-right order stored in sform and qform in file fa Using sform instead of qform values". I tried using fslreorient2std as suggested to put them in an FSL-friendly orientation, but still got the same error message. I tried to register the maps to MNI space, still same error.

FSL just refuses to to handle any DKE output files. I tested my input files with FSL dtifit, and produced regular FA maps which I was able to feed into the TBSS pipeline, so my input files definitely have no orientation issue (I think!).

Is there any solution to that problem? I was so excited to finally produce DKI maps, but now I have no idea how to handle them.... 

Thanks for the help.

Cheers,

Shereif
Aug 8, 2018  01:08 PM | Corinne McGill - MUSC
RE: DKE + FSL pipeline has issue
Hi Shereif,

I run TBSS on the outputs of DKE weekly and have never run into this problem. I also use fslreorient2std, FNIRT, and many other FSL commands on this data. 

Perhaps the problem is originating earlier in your pipeline. How are you converting your dicoms to niftis? Can you describe your pipeline prior to running DKE?

Thank you,
Corinne
Originally posted by Shereif Haykal:
Dear Kirk,

I'm running into the same problem as the original poster. Whenever I try to run the first step of TBSS (tbss_1_preproc) with the produced fa maps, I get the message "ERROR: Inconsistent left-right order stored in sform and qform in file fa Using sform instead of qform values". I tried using fslreorient2std as suggested to put them in an FSL-friendly orientation, but still got the same error message. I tried to register the maps to MNI space, still same error.

FSL just refuses to to handle any DKE output files. I tested my input files with FSL dtifit, and produced regular FA maps which I was able to feed into the TBSS pipeline, so my input files definitely have no orientation issue (I think!).

Is there any solution to that problem? I was so excited to finally produce DKI maps, but now I have no idea how to handle them.... 

Thanks for the help.

Cheers,

Shereif
Aug 8, 2018  03:08 PM | Shereif Haykal
RE: DKE + FSL pipeline has issue
Hi Corinne,

Thank you for the prompt reply!


So first, the data was aquired on a Siemens scanner, 3 shells (0, 1000, 2500), in both AP and PA directions.

My pipline is as follows:

I convert my data from dicom to nifti using dcm2nii gui, then I denoise the data using dwidenoise function in MRTrix3. The denosied dwi data is then corrected for motion, eddy current and susceptibility artifacts using FSL topup and eddy. Then using fslmerge and fslroi, I arrange the corrected diffusion data in the format required by DKE, average b0 first, then the second shell (b=1000 in my case) and then the third (b=2500). As for the bvecs, they are transposed in matlab to put them in 3 colums (x,y,z), and then arranged in a txt file to correspond to the arrangement of shells.

Would it help if I attach an example of the DKE produced fa/kfa files?

Thank you so much for the help! Looking forward to your reply.

Best,
Shereif
Aug 8, 2018  03:08 PM | Hunter Moss
RE: DKE + FSL pipeline has issue
Hi Shereif,

Have you compared the sform and qform fields in the image headers before and after running DKE? 

-Hunter
Aug 8, 2018  05:08 PM | Shereif Haykal
RE: DKE + FSL pipeline has issue
Hello Hunter,

Thank you for taking the time to contribute to the discussion.

I'm not very well-versed in the world of image orientations to be honest, and this is the first time I encounter such an issue, so please bear with me...


So, using fslhd, the nifti file going in has the following orientation:

qform_name Scanner Anat
qform_code 1
qto_xyz:1 -2.018740 -0.000000 0.044033 103.536331
qto_xyz:2 -0.010218 1.965173 -0.459562 -75.819267
qto_xyz:3 0.043266 0.464093 1.945987 -87.045891
qto_xyz:4 0.000000 0.000000 0.000000 1.000000
qform_xorient Right-to-Left
qform_yorient Posterior-to-Anterior
qform_zorient Inferior-to-Superior
sform_name Scanner Anat
sform_code 1
sto_xyz:1 -2.018740 0.000000 0.044034 103.536331
sto_xyz:2 -0.010218 1.965174 -0.459562 -75.819267
sto_xyz:3 0.043267 0.464093 1.945987 -87.045891
sto_xyz:4 0.000000 0.000000 0.000000 1.000000
sform_xorient Right-to-Left
sform_yorient Posterior-to-Anterior
sform_zorient Inferior-to-Superior



And checking the file header for the DKE fa output, first I got this message:


ERROR: Inconsistent left-right order stored in sform and qform in file fa
Using sform instead of qform values 



Followed by the usual header info:


qform_name Aligned Anat
qform_code 2
qto_xyz:1 1.000000 0.000000 -0.000000 -104.393929
qto_xyz:2 0.000000 1.000000 -0.000000 -106.743248
qto_xyz:3 0.000000 0.000000 -1.000000 -87.045891
qto_xyz:4 0.000000 0.000000 0.000000 1.000000
qform_xorient Left-to-Right
qform_yorient Posterior-to-Anterior
qform_zorient Superior-to-Inferior
sform_name Aligned Anat
sform_code 2
sto_xyz:1 1.000000 0.000000 0.000000 -104.393929
sto_xyz:2 0.000000 1.000000 0.000000 -106.743248
sto_xyz:3 0.000000 0.000000 1.000000 -87.045891
sto_xyz:4 0.000000 0.000000 0.000000 1.000000
sform_xorient Left-to-Right
sform_yorient Posterior-to-Anterior
sform_zorient Inferior-to-Superior


There seems to be some obvious changes in the image orientation, e.g from Right-to-Left  to Left-to-Right and "Scanner Anat" to "Aligned Anat" etc.

Any idea why this is happening? Can it be rectified somehow? 

Thanks again for the help!

Cheers,
Shereif
Aug 8, 2018  05:08 PM | Hunter Moss
RE: DKE + FSL pipeline has issue
Hi Shereif,

Is this the nifti file you pulled the first qform/sform from the nifti following the eddy and TOPUP? Either way, it looks like there is a left-to-right flip and a different alignment present in the files afterwards. I am unsure at the moment how this would happen.

-Hunter
Aug 8, 2018  10:08 PM | Shereif Haykal
RE: DKE + FSL pipeline has issue
Hi Hunter,

Yes, the first fslhd output is from the eddy corrected and rearranged nifti file that I fed the DKE software (sorry if that wasn't clear!). And the second header is from the fa file produced by DKE.

Hopefully now that the problem is clearer someone might be able to help. In any case, thanks for your time :)


-Shereif
Aug 9, 2018  12:08 PM | Emilie McKinnon - MUSC
RE: DKE + FSL pipeline has issue
Hi Shereif,

Would it be possible to share both .nii files with us (before and after DKE)? I have an idea of what is going on, but would need to see the headers to confirm! 

Best, 
Emilie
Aug 9, 2018  04:08 PM | Shereif Haykal
RE: DKE + FSL pipeline has issue
Hi Emilie,

I would be more than happy to share the files, but unfortunately I'm away from the office for the next few days. As soon as I'm back next week I'll share the before and after .nii files. 

Thanks for  your willingness to  help!

Best,
Shereif
Aug 13, 2018  11:08 AM | Shereif Haykal
RE: DKE + FSL pipeline has issue
Hello again,

I attached a zipped folder containing the diffusion data before using DKE and the resulting fa and kfa files. Let me know if you need anything else. And thanks again for the help!!

Best,
Shereif

EDIT: it seems the file is too big to upload directly on the forum, I keep getting an error after the uploading is done. Instead, I uploaded it to wetransfer, here's the link. Hope that's ok!
Aug 13, 2018  12:08 PM | Emilie McKinnon - MUSC
RE: DKE + FSL pipeline has issue
Hi Shereif, 

While we look at this in some more detail, can you do me a favor and run DKE without interpolating the resulting parametric maps and see if that fixed the problem? If you are using the GUI the interpolation option is a checkbox on the second panel, or if you are using the command line just change "map_interpolation_method.flag= 1" to "map_interpolation_method.flag = 0" in your dkeparameters.dat file.  We would recommend to have this option turned off (even though by default it's turned on (oops)).

Thanks, 
Emilie
Aug 13, 2018  02:08 PM | Shereif Haykal
RE: DKE + FSL pipeline has issue
Hi Emilie,

I ran DKE with interpolation off like you suggested and it worked!! I checked the headers of the output files and they show the same orientation as the input files, and I got no sform/qform errors as before. Thank you so much!! 

I attached the fa.nii file produced by DKE (with no interpolation), just in case you want to compare it to the files I uploaded earlier.

Thanks again!

Cheers,
Shereif
Attachment: fa.nii
Aug 13, 2018  02:08 PM | Emilie McKinnon - MUSC
RE: DKE + FSL pipeline has issue
Happy that this fixed the problem! We will look into the header inconsistenties generated by the interpolation option. 

Don't hesitate to reach out if you have any more problems/questions.

Best,
Emilie
Sep 16, 2018  08:09 AM | jing zhao
RE: DKE + FSL pipeline has issue
Hi,
Recently i began to processing the DKI data by using DKE and FSL. 
I met a problem, the TBSS anlysis need all the diffusion paramters after scalping. So I preanalysis the data by FSL (BET), then, put the data after scalping into DKE and DKE did not work. 
How are you deal with this situation? would you please give your suggestion?
Thanks!
Jing 
Hi,

I have successfully used DKE on a Mac (10.10.5) to reconstruct DKE metrics. I would now like to take the estimates from the DKE and utilize my FSL TBSS pipeline to run statistical analyses. Here is what I'm doing.

Data were converted from DICOM to NII using mcverter from University of Oregon

(0) the data have a qform and sform of "Scanner Anat" 
(1) taking native space DKI data set and running through FSL DTIFIT to get a FA map. 
(2) use the native space FA map (I'll call it FA_FSL) to run TBSS with my two cohorts
(3) use DKE on the native space DKI data set to calculate metrics (KFA, KMEAN etcetera). I have DKE resample to 1.5mm isotropic 
(4) I now want to take the TBSS derived warps and apply them to the DKE data. 

This doesn't work. It appears that the qform and sform are change by DKE to be in "Aligned Anat" with diagonal qto_xyz and sto_xyz matrices. 

If I do a "Check Reg" in spm, the images show they are aligned.

If I try to a FSL/flirt realignment without resampling/reslicing, specifying rigid body (dof = 6), they affine matrix is the identity matrix

If, however, I try to do a flirt resampling/resclicing using the identity matrix, the resulting image is all skewed with respect to the original b=0 image.

And of course, if I apply the warping, that is also messed up.

Robert