[Mrtrix-discussion] Problem converting DICOMS with mrconvert

Todd Jolly todd.jolly at uon.edu.au
Mon Jul 18 01:27:15 PDT 2011


Hi Donald,
Excellent news. The new version of the /lib/file/dicom/mapper.cpp works perfectly. I checked the output and you were correct with the matrix, as the 128th column is padded with zero's. The package that I used before to convert the files is called dcm2nii, the converted .nii file also had the 128th column padded with zeros.
Thanks again for all your help
Todd
________________________________
From: Donald Tournier [d.tournier at brain.org.au]
Sent: Monday, 18 July 2011 2:36 PM
To: Todd Jolly
Cc: mrtrix-discussion at www.nitrc.org
Subject: Re: [Mrtrix-discussion] Problem converting DICOMS with mrconvert

Hi Todd,

I'm guessing that when you say you can convert the images to NIfTI, you are using a different package for this? If so, I'd be interested to know which package, and how it handles your data. In any case, there are as you say issues with using a bvecs file as expected by FSL, since the coordinate systems are different: FSL assumes that the gradients are supplied with respect to the image axes, whereas MRtrix expects them to be supplied with respect to the real/scanner axes. There will be discrepancies between the two if there is any significant tilt of the images away from the axial plane. This was discussed in earlier posts, e.g.:
http://www.nitrc.org/pipermail/mrtrix-discussion/2008-September/000018.html

So in general, I'd advise you to use the directions extracted directly from the DICOM data using mrconvert - if you actually manage to get it to work with your data, that is... On that note, I see that the fix I suggested doesn't work out of the box - sorry about that. I've attached a new version of the lib/file/dicom/mapper.ccp that should compile fine, just replace the original with this one and recompile. Would be good to know if it now works correctly...

Cheers,

Donald.


On 18 July 2011 12:36, Todd Jolly <todd.jolly at uon.edu.au<mailto:todd.jolly at uon.edu.au>> wrote:
Hi Donald,
I am able to convert the DICOM's to nifti format. I was able to get it to work by using the nifti file and specifying the encoding.b gradient file? However, I am not sure if I have the DW scheme correct as I just used the bvecs and bvals without inverting any of the gradient orientation components? Is there a way to tell what reference frame a Siemens Verio scanner uses and which component I have to invert (if any) so that it matches the mrtrix co-ordinate system?
Thanks again
Todd
________________________________
From: Donald Tournier [d.tournier at brain.org.au<mailto:d.tournier at brain.org.au>]
Sent: Thursday, 14 July 2011 3:42 PM

To: Todd Jolly
Cc: mrtrix-discussion at www.nitrc.org<mailto:mrtrix-discussion at www.nitrc.org>
Subject: Re: [Mrtrix-discussion] Problem converting DICOMS with mrconvert

Hi Todd,

Yes, this is pretty strange. I thought I had Siemens mosaic format figured out, but maybe I don't... In any case, there doesn't seem to be any information in the CSA headers about how to handle a case where the mosaic is not a multiple of the acquired matrix. Since you say the other derived images are all 128x128, I have to assume that it must divide out the mosaic evenly into as many chunks as will fit in, but that really is just a guess. I can propose a fix, which is my best guess as to how to handle this case, but it really is just a guess - worth a shot though. If this works, I'm guessing the top or bottom row of the derived images will be padded with zeros - maybe you can check this?

In any case, the fix is to modify a few lines of code in lib/file/dicom/mapper.cpp at line 249 from:

          if (image.dim[0] % image.acq_dim[0] || image.dim[1] % image.acq_dim[1])
            throw Exception ("acquisition matrix [ " + str (image.acq_dim[0]) + " " + str (image.acq_dim[1])
                + " ] does not fit into DICOM mosaic [ " + str (image.dim[0]) + " " + str (image.dim[1])
                + " ] in image \"" + H.name + "\"");

to:

          if (image.dim[0] % image.acq_dim[0] || image.dim[1] % image.acq_dim[1]) {
            error ("WARNING: acquisition matrix [ " + str (image.acq_dim[0]) + " " + str (image.acq_dim[1])
                + " ] does not fit into DICOM mosaic [ " + str (image.dim[0]) + " " + str (image.dim[1])
                + " ] in image \"" + H.name + "\" - adjusting matrix size to suit");
            image.acq_dim[0] = image.dim[0] / guint (float(image.dim[0]) / float(image.acq_dim[0]));
            image.acq_dim[1] = image.dim[1] / guint (float(image.dim[1]) / float(image.acq_dim[1]));
          }

Obviously, you'll need to ./build and install again after the change.
Let us know how that works out...
Cheers,

Donald.


On 14 July 2011 14:55, Todd Jolly <todd.jolly at uon.edu.au<mailto:todd.jolly at uon.edu.au>> wrote:
Hi Donald,
Yes we are using a Siemens Verio 3T. After running 'read_dicom -all -csa' it does show that the acquisition matrix is 127p*128... However it does also say that there are 1024 rows x 1024 columns?
Further, if I open up the header on all of the other diffusion DICOM's (e.g. ADC, EXP, FA etc) the acquisition matrix is 128x128?

I have attached the information from the header after running 'read_dicom'.
Many thanks
Todd
________________________________
From: Donald Tournier [d.tournier at brain.org.au<mailto:d.tournier at brain.org.au>]
Sent: Thursday, 14 July 2011 11:04 AM
To: Todd Jolly
Cc: mrtrix-discussion at www.nitrc.org<mailto:mrtrix-discussion at www.nitrc.org>
Subject: Re: [Mrtrix-discussion] Problem converting DICOMS with mrconvert

Hi Todd,

That's an odd problem, I've never come across that before. Not sure where the problem is, but maybe we can figure it out with a bit more info. Judging from the sequence names, this is using the Siemens product sequence? Can you confirm that the acquisition matrix was indeed 128x127 on the scanner? Sounds like an odd (as in strange :) number to me. One other thing you could do is run 'read_dicom -all -csa FILE' on an individual DICOM file from the relevant series. I appreciate this not always easy to do, since the DICOM standard pretty much states that filenames should be meaningless... If you're struggling with that, this little command might help:

$ find /home/todd/CF002dicom/ -type f -print -exec dicom_filename -q {} \;

This will print the name of every file in the folder hierarchy, followed by a more readily interpreted filename suggestion if it is DICOM. That should allow you find at least one relevant file to run 'read_dicom' on, and post the results (make sure you remove all patient-specific information first though).

Cheers,

Donald.



On 13 July 2011 16:26, Todd Jolly <todd.jolly at uon.edu.au<mailto:todd.jolly at uon.edu.au>> wrote:
Hi all,
I have been having trouble converting my DICOM files to .mif format using mrconvert. Once the DICOM series has been read, an error comes up saying that the acquisition matrix [ 128 127 ] does not fit into the DICOM mosaic. I was wondering if anyone else has come across this problem and if there is a way around it? The error is shown below.
Thank you in advance
Todd

todd-Precision-T1500:~> mrconvert /home/todd/CF002dicom/ dwi.mif
mrconvert: scanning DICOM folder "/home/todd/CF002dicom/"  - ok
Select series ('q' to abort):
   0 -    3 MR images 10:25:25 localizer (fl2d1) [1]
   1 -  176 MR images 10:29:54 T1_Sag_iso_ASRB (tfl3d1_ns) [2]
   2 -   65 MR images 10:46:33 ep2d_diff_mddw_55 slice_64 directions (ep_b3000#34) [11]
   3 -   55 MR images 10:58:21 ep2d_diff_mddw_55 slice_64 directions_ADC (ep_b0_3000) [12]
   4 -   55 MR images 10:58:22 ep2d_diff_mddw_55 slice_64 directions_TRACEW (ep_b3000t) [13]
   5 -   55 MR images 10:58:22 ep2d_diff_mddw_55 slice_64 directions_EXP (ep_b3000) [14]
   6 -   55 MR images 10:58:22 ep2d_diff_mddw_55 slice_64 directions_FA (ep_b0_3000) [15]
   7 -   55 MR images 10:58:22 ep2d_diff_mddw_55 slice_64 directions_ColFA (?) [16]
? 2
mrconvert: reading DICOM series "ep2d_diff_mddw_55 slice_64 directions"... 100%
mrconvert: acquisition matrix [ 128 127 ] does not fit into DICOM mosaic [ 1024 1024 ] in image "CF002 (CF002) [MR] ep2d_diff_mddw_55 slice_64 directions"
mrconvert: error opening image "/home/todd/CF002dicom/"


_______________________________________________
Mrtrix-discussion mailing list
Mrtrix-discussion at www.nitrc.org<mailto:Mrtrix-discussion at www.nitrc.org>
http://www.nitrc.org/mailman/listinfo/mrtrix-discussion




--
Jacques-Donald Tournier (PhD)
Brain Research Institute, Melbourne, Australia
Tel: +61 (0)3 9035 7033



--
Jacques-Donald Tournier (PhD)
Brain Research Institute, Melbourne, Australia
Tel: +61 (0)3 9035 7033



--
Jacques-Donald Tournier (PhD)
Brain Research Institute, Melbourne, Australia
Tel: +61 (0)3 9035 7033
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.nitrc.org/pipermail/mrtrix-discussion/attachments/20110718/5db1e92d/attachment.html


More information about the Mrtrix-discussion mailing list