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
How to fix dcm2nii transform #29
Comments
It looks like the header is still not set correctly - specifically the freq_dim and phase_dim. Just to confirm - you save down those changes that you made into the nifti file right? That is, once you have fixed the dims to be non-zero, you make another call to 'niftiWrite' is that correct? |
I don't know anything about the slice slider problem. But I do know about the upside-down issue. When the code was updated to use NIFTI's rather than Matlab matrices to store inplane images, we made a choice about how to display brains (that is, about the orientation). I believe the view in your attached image accurately reflects the orientation we specified in the code. So this view is not a bug in your NIFTI or the code. However, a couple of people have pointed out that they like the brains oriented the other way on the vertical axis. I'm not sure that one orientation or the other is objectively correct, since the brain is not actually in your screen. That said, on the next major upgrade, we will probably reverse the images vertically (compared to now) because people find that more natural. We do not want to change the code now because this will cause a mis-alignement between the inplane and functional data on sessions that are already initialized. The next major upgrade should happen in the next month or two. |
As well, to build on top of what Jon said, the 'Left <---> Right' labels should still be accurate even if the image itself can be considered upside down. That is to say, the orientation is 'correct', albeit not completely standard. In terms of your slice issues, I think that the problem that you are running into now is that your slice_start and slice_end dimensions are also zero. Those are used to calculate which slices to display (and thus, a mask can be chosen to be used in case certain frames need to be discarded) and need to be non-zero. You will probably need to use a similar fix to what you did with the dims. It appears that the DICOM to NIFTI pipeline that you are using is potentially somewhat broken in that it doesn't populate a number of these fields that should be populated. I'd recommend you take a look at the wiki, and specifically http://white.stanford.edu/newlm/index.php/Anatomical-Processing#Data_Collected_from_SIEMENS_Scanners, looking at the 'Other Options' and trying some of those out. Especially in Linux, some of these methods should be higher fidelity in terms of producing a complete NIFTI. Your problems should all go away if you change your method of going from DICOM to NIFTI. |
Jon and Adrian,thanks so much. dinifti and MRIConvert works and don't need fix. |
Do you mind sharing with us what ended up solving the problem? We'd like to ensure that we capture all of the learning somewhere so that for the next time someone is having similar issues we'd be able to point them to that location and they can see how you ended up solving it. Glad to hear that it is all working now, however! |
Sure, I am glad to write some details for newbies like me.
Note: If you use a mean file as the anatomy inplane and you generate it with other software like SPM, instead of using vistasoft command-line. Make sure that you check and fix the resulting nifty file as described in method 1. Actually, most of my struggle comes from my neglect of errors in this file. |
Thank you for your write-up. This will be very helpful for others encountering similar issues. I have updated the wiki with your comments here: http://white.stanford.edu/newlm/index.php/Anatomical-Processing#Data_Collected_from_SIEMENS_Scanners as well as referred back to this issue. |
Also now immortalized here: https://github.com/vistalab/vistasoft/wiki/Siemens-dicoms-converted-with-dcm2nii On Fri, Apr 19, 2013 at 9:35 AM, Adrian Spanu notifications@github.comwrote:
|
The method >> ni = readFileNifti(yourniftiFile);ni = niftiSetQto(ni,ni.sto_xyz);writeFileNifti(ni); suggested by frakkopesto in #28 created a ni struct, in which there were many parameters( for image converted by dcm2nii, values of freq_dim, phase_dim and slice_dim is 0, while values for images converted by MRIConverter seems right-1,2,3 respectively, see pictures for more detail).
ni created for dcm2nii conversion
ni created for MRIConvert conversion
But I am not clear what to do next, I tried to reset the value of freq_dim, phase_dim and slice_dim to 1,2,3 respectively(There are also something wrong with Qto matrix, but I'm not sure how to fix ) and saved the ni struct with names corresponding to original nii images. Then used mrInit again, but that make no difference and warnings listed below.
Warning: [niftiSet] Qto matrix defines an origin very far away from the isocenter.
Warning: [niftiSet] This implies that the Qto matrix could be bad. Please check qto_ijk.
Warning: [niftiSet] Origin to the image center is at [64.000,64.000,17.500] pix.
freq_dim not set correctly in NIFTI header.
phase_dim not set correctly in NIFTI header.
[niftiCheckQto] NIFTI header origin is at or outside the image volume.
[niftiCheckQto] Origin to the image center [64.000,64.000,17.500] pix.
??? Subscript indices must either be real positive integers or logicals.
How to solve this problem, and what to do next when the ni struct is created? Any suggestions? Thanks!
The text was updated successfully, but these errors were encountered: