Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output diffusion gradients #8

Closed
lconcha opened this issue Jun 2, 2020 · 12 comments
Closed

output diffusion gradients #8

lconcha opened this issue Jun 2, 2020 · 12 comments

Comments

@lconcha
Copy link
Contributor

lconcha commented Jun 2, 2020

Thanks for such an amazing tool.

Can brkraw output diffusion gradient directions and b values (bvals, bvecs)? I cannot find any information on the documentation.

@dvm-shlee
Copy link
Member

dvm-shlee commented Jun 2, 2020

@lconcha
Yes, it can output the gradient direction, just I had not activated it for other functions

from version 0.3.3rc8, the gradient direction files will be generated as default.
It will work only the sequence contains 'dti' (without case sensitive) in their Method filed in method parameter file.

Not sure the generated file is the correct form that you can employ the analysis directly,
If you have any issue, please let me know, I will make a quick update for that.

Thank you!

@lconcha
Copy link
Contributor Author

lconcha commented Jun 3, 2020

You are fast! Thanks for the patch.

It seems to be working properly, even for multi-shell acquisitions.
Of note, Bruker stores gradient directions without normalizing the vectors, with those corresponding to maximum bvalue having a norm=1, and the others gradient vectors scaled according to b value. brkraw outputs the bvecs and bvals according to this style. Not all dMRI software likes this convention, so the user may need to normalize the gradient vectors.

I have compared the gradient directions that are obtained through brkraw and mrtrix (using mrinfo -bvalue_scaling false -export_grad_mrtrix (see here) from the same data set. Note that the gradient vectors are normalized in the mrtrix output, and not in brkraw (this is not a bug, I'm just pointing it out). Also note that the z gradient sign appears flipped between the two (this one I need to run more tests on different acquisiton orientations).

So, in general, your implementation seems to do the job, and I thank you for it!

Screenshot from 2020-06-03 10-37-32

@dvm-shlee
Copy link
Member

@lconcha Thank you for your feedback and providing useful information. If the normalization function would be preferred, I could also integrate it so please let me know.

Regarding the Z direction, since the data from BrkRaw just extract raw value from raw data without conversion, there would be some facter that MRtrix conver it intentionally. so hope to ask if you could share raw data (at least method and visu_pars without 2dseq) of the data you present. That would be great help to figure out to resolve this issue!

Thank you!

@dvm-shlee
Copy link
Member

dvm-shlee commented Jun 4, 2020

@lconcha Thank you for sharing the data, but I couldn't found any clue from here what can cause the inverse-sign at the Z axis.

The only difference with my usual setting will be the animal position is Head_Prone instead of Head_Supine. but according to this document. It seems the bvec that I parsed from PVM_DwGradVec no need to correct the position.

And also there was some discussion on here regarding the invert sign issue you shown. But ended up with no answer.

Since I'm not familiar with DTI image, could you provide later which signed direction gives correct DTI measurement (mrtrix vs brkraw) if it can be figured out from the result?
According to the github link above, If you get bvec after Dicom conversion, it may relate that. but not sure. :(

BTW, I found that there is some bug on the conversion of reconstructed DTI, I will figure out the solution and patch it once I figure out.

Again, Thank you for sharing the data!

@eugenegkim
Copy link
Contributor

@dvm-shlee Does bids_convert have an option to write out the bvec and bval files?

@dvm-shlee
Copy link
Member

@eugenegkim there is no option, it just outputs bvec and bval files always if the data is DTI.
(in the condition that 'Method' parameter in method contains string 'dti')
But I can consider putting some options if you think its better than just outputting always.

Thanks!

@eugenegkim
Copy link
Contributor

@dvm-shlee I've found that bvec and bval files are written if the modality for the DTI scan is set to 'dwi' in the BIDS datasheet. But the modality was initially blank after running bids_helper. So maybe bids_helper can be updated to set the modality of all DTI scans to 'dwi'? And I would say that it's fine to always output the bvec and bval files.

Oh and BIDS wants the bvecs in 3 rows. They are currently written out in 3 columns.

@dvm-shlee
Copy link
Member

@eugenegkim The BIDS helper documents are not related to the bvec and bval conversion, its internally check the parameter file. but I can make default value for DTI to have dwi.

Also, I will correct output of bvec to have 3 rows instead of 3 columns,
thank you for your suggestion and for reporting the issue!

dvm-shlee added a commit that referenced this issue Jun 4, 2020
…heet.

Correct bvec to have 3 rows instead of 3 columns
@dvm-shlee
Copy link
Member

dvm-shlee commented Jun 4, 2020

@eugenegkim The bvec now has 3 rows and DTI will have default modality as dwi on BIDS excel sheet
Please let me know if you still have any issues. (from 0.3.3)

@lconcha
After release the version 0.3.3, I realized that 'tonii' option does not generate automatically gradient direction in case no scan id provided. This has been pached on the github. In case you need this function, please install the brkraw through github.

Thanks!

@eugenegkim
Copy link
Contributor

@dvm-shlee Thanks for your quick responses!

@lconcha
Copy link
Contributor Author

lconcha commented Jun 9, 2020

Thanks for the patches. Seems to be working now.
Regarding gradient vector sign, I cannot get dcm2niix to output gradients from bruker dicoms, so I have not been able to compare the two. I do not have much access to the scanner these days (covid), but will try to run some simple tests to figure out which version is the one that reflects the user-specified gradients.

Just a note on the new patch: the converted .nii.gz gets placed in the specified output folder, but the .bvec .bvec and .bmat files are written to the current working directory.

Thanks again for all your help.

@dvm-shlee
Copy link
Member

@lconcha Thank you for report additional bug. I will check and make a patch for it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants