[Mrtrix-discussion] Re: Converting Fraction Images to Nifti

Donald Tournier d.tournier at brain.org.au
Wed Jun 20 21:32:43 PDT 2012


Hi Jason,

OK, I think I know what the issue is. For some reason, my version of FSL
works fine (it's quite old), but does spit out a (not very informative)
warning:

*QRangeControl::setRange: minValue 0 > maxValue -1*


In any case, checking the difference between the headers of images
generated using MRtrix 0.2.10 and my current development version, it became
apparent that this is an issue that Chris Adamson provided a path for
recently - see the original post at:
http://www.nitrc.org/pipermail/mrtrix-discussion/2012-April/000398.html

Basically, it boils down to inserting these lines at line 301 of the
lib/image/format/nifti1.cpp file:

*        // pad out the other dimensions with 1, fix for fslview*
*        for (gint i = H.ndim() + 1; i < 8; i++) *
*          put<gint16> (1, &NH->dim[i], is_BE);*

That should fix it.
Cheers!

Donald.


On 21 June 2012 13:35, Langley, Jason Allen <jason.langley at emory.edu> wrote:

>  Hi Donald,
>
> I am able to read your file. However, when I complete the procedure that
> you outlined in the previous email on a different subject, the converted
> .nii file still cannot be loaded into afni, fsl (I have attached the file)
> and I receive the cryptic segmentation fault error. When I look at the file
> with mrinfo, I get the following:
>
> ************************************************
> Image:               "output125_int32.nii"
>
> ************************************************
>   Format:            NIfTI-1.1
>   Dimensions:        282 x 282 x 95
>   Voxel size:        0.5 x 0.5 x 0.5
>   Dimension labels:  0. left->right (mm)
>                      1. posterior->anterior (mm)
>                      2. inferior->superior (mm)
>   Data type:         signed 32 bit integer (little endian)
>
>   Data layout:       [ +0 +1 +2 ]
>   Data scaling:      offset = 0, multiplier = 1
>   Comments:          FSL4.1
>                      count: 2500000; init_threshold: 0.2; lmax: 10;
> max_dist: 200; max_num_tracks: 25
>   Transform:               0.9974     0.06272     0.03417      -74.65
>                          -0.05008      0.9553     -0.2915       1.649
>                          -0.05093       0.289       0.956      -39.18
>                                 0           0           0           1
>
> Which shows exactly the same information (save the transform information)
> as the file you previously sent. I think the problem might be related with
> the install on our cluster and my desktop (I have a windows install and
> receive the same errors when converting the files). Has MRTRIX been updated
> in the past couple months? That might account for the issues on our end.
>
> Thanks,
> Jason
>
>  ------------------------------
> *From:* Donald Tournier [d.tournier at brain.org.au]
> *Sent:* Wednesday, June 20, 2012 2:30 AM
>
> *To:* Langley, Jason Allen
> *Subject:* Re: Converting Fraction Images to Nifti
>
>  Hi Jason,
>
>  I also had trouble opening the output125.nii file you sent through, but
> that was clearly due to the datatype issue, as confirmed with mrinfo:
>
>   *$ mrinfo output125.nii *
>  **************************************************
>  *Image:               "output125.nii"*
>  **************************************************
>  *  Format:            NIfTI-1.1*
>  *  Dimensions:        282 x 282 x 95*
>  *  Voxel size:        0.5 x 0.5 x 0.5*
>  *  Dimension labels:  0. left->right (mm)*
>  *                     1. posterior->anterior (mm)*
>  *                     2. inferior->superior (mm)*
>  *  Data type:         unsigned 32 bit integer (little endian)*
>  *  Data layout:       [ +0 +1 +2 ]*
>  *  Data scaling:      offset = 0, multiplier = 1*
>  *  Comments:          FSL4.1*
>  *                     count: 2500000; init_threshold: 0.2; lmax: 10;
> max_dist: 200; max_num_tracks: 25*
>  *  Transform:               0.9995    -0.01916     0.02647      -73.29*
>  *                          0.02174      0.9947     -0.1006      0.4578*
>  *                          -0.0244      0.1011      0.9946      -22.72*
>  *                                0           0           0           1*
>
>
>  Once I'd converted the image to an FSL-supported datatype, I had no
> trouble loading it into fslview. The command I used was:
>
>   *$ mrconvert output125.nii -datatype int32 output125_int32.nii*
>
>
>  I've also attached the file that worked, please try it out and let me
> know if it still doesn't load. If everything works out, it would be great
> if you could confirm (preferably on the mailing list so others can benefit
> from the solution).
>
>  Cheers,
>
>  Donald.
>
>
>
> On 20 June 2012 13:47, Langley, Jason Allen <jason.langley at emory.edu>wrote:
>
>>  Hi Donald,
>>
>> I've attached two FA maps: the .mif file and the converted .nii file. The
>> .nii file can be read by fslview and other readers. I will attach the
>> fractional images (connectivity maps) in the next email from a different
>> account since Emory / Microsoft does not allow attachments over 25 MB. The
>> account will be impulse at physast.uga.edu
>>
>> Thanks!
>> Jason
>>
>>
>>  ------------------------------
>> *From:* Donald Tournier [d.tournier at brain.org.au]
>> *Sent:* Tuesday, June 19, 2012 7:17 PM
>>
>> *To:* Langley, Jason Allen
>> *Cc:* mrtrix-discussion at www.nitrc.org
>> *Subject:* Re: Converting Fraction Images to Nifti
>>
>>   Hi Jason,
>>
>>  OK, not a memory issue, and error message is not helpful. Any chance
>> you could send me a file that works and one that doesn't? I might be able
>> to figure it out if I have the data. Or at least rule out the possibility
>> that this might be caused by MRtrix...
>>
>> Cheers,
>>
>> Donald.
>>
>>
>> On 20 June 2012 03:41, Langley, Jason Allen <jason.langley at emory.edu>wrote:
>>
>>>  Hi Donald,
>>>
>>>  The size of the files are only about 30 MB so memory is not an issue.
>>>
>>>  The error message that is displayed in the terminal is
>>> fslview: line 6: 8608 Segmentation fault ${FSLDIR}/bin/fslview_bin $@
>>>
>>>  The number 8608 changes for each instance of the fault and sometimes
>>> (core dumped) will appear in the error message as well.
>>>
>>>  Thanks,
>>> Jason
>>>
>>>  ------------------------------
>>> *From:* Donald Tournier [d.tournier at brain.org.au]
>>> *Sent:* Monday, June 18, 2012 8:07 PM
>>> *To:* Langley, Jason Allen
>>> *Cc:* mrtrix-discussion at www.nitrc.org
>>>
>>> *Subject:* Re: Converting Fraction Images to Nifti
>>>
>>>   Hi Jason,
>>>
>>>  OK, if the issue isn't datatype-related (i.e. if a command like
>>> "mrconvert output.mif -datatype int16 output.nii" doesn't produce an image
>>> you can load in fslview), then the issue might be related to memory. How
>>> large is the image you're having trouble with? There's a good chance it
>>> won't load if it's larger than 2GB, and fslview is compiled in 32-bit mode.
>>> Also, can you confirm that fslview crashes with no other information than
>>> 'segmentation fault'? On my system, an unexpected datatype causes fslview
>>> to crash with a failed assertion message:
>>>
>>>   *fslview: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T*
>>> boost::shared_ptr< <template-parameter-1-1> >::operator->() const [with T =
>>> OverlayList]: Assertion `px != 0' failed.*
>>>
>>>
>>>  which at least gives the *very* informed user some clue as to what
>>> might conceivable be the problem. A message such as 'std::bad_alloc' would
>>> already be a big clue...
>>>
>>>  Cheers,
>>>
>>>  Donald.
>>>
>>>
>>> On 19 June 2012 08:21, Langley, Jason Allen <jason.langley at emory.edu>wrote:
>>>
>>>>  Hi Donald,
>>>>
>>>> Oddly enough, the issue only occurs with the fraction images
>>>> (connectivity / TDI maps?). I am able to convert other .mif images (FA maps
>>>> for example) to .nii and read those images into FSL or other imaging
>>>> programs. The segmentation fault only occurs when I convert a fraction
>>>> image from .mif to .nii . I have tried all of the datatype options listed
>>>> in the source of mrconvert.cpp and none seem to work.
>>>>
>>>> I have noticed some issues between the other .mif images and the
>>>> fraction images. When looking at the images in a hex editor, the FA maps
>>>> (and other .mif images) seem to have nonzero values in each byte where as
>>>> in the fraction image, only the first byte in each group is nonzero. I have
>>>> attached an image that illustrates this with a FA map (in the terminal on
>>>> the left) and a fraction image (in the terminal on the right). However, I
>>>> am not sure if this is an issue.
>>>>
>>>> Best,
>>>> Jason
>>>>  ------------------------------
>>>> *From:* Donald Tournier [d.tournier at brain.org.au]
>>>> *Sent:* Sunday, June 17, 2012 8:25 PM
>>>> *To:* Langley, Jason Allen
>>>> *Subject:* Re: Converting Fraction Images to Nifti
>>>>
>>>>   Hi Jason,
>>>>
>>>>  This is not an uncommon issue. Basically, most packages don't support
>>>> the full set of datatypes allowed in the NIfTI specification, whereas
>>>> MRtrix does. If it produces an image using one of those datatypes, other
>>>> packages won't be able to handle it. In the case of FSL, rather than
>>>> detecting this case and reporting it, it typically just segfaults without
>>>> any useful information. In any case, you can easily get around this using
>>>> the -datatype option of mrconvert, with a datatype supported by FSL. In my
>>>> experience, the set of datatypes that will work are: uint8, int16, int32,
>>>> float32 & float64.
>>>>
>>>> On a different note: can I ask you to post these kinds of questions on
>>>> the MRtrix mailing list? You can find it at:
>>>> http://www.nitrc.org/mailman/listinfo/mrtrix-discussion. This way
>>>> other users might also benefit...
>>>>
>>>> Hope this helps.
>>>> Cheers,
>>>>
>>>>  Donald.
>>>>
>>>>
>>>> On 16 June 2012 02:24, Langley, Jason Allen <jason.langley at emory.edu>wrote:
>>>>
>>>>>  Dear Donald,
>>>>>
>>>>> I'm having issues reading converted fraction images. My processing
>>>>> steps are as follows:
>>>>> (1) Preprocessing and then fibre tracking using streamtrack
>>>>> (2) Creation of the fraction image from the tracks using tracks2prob
>>>>> (3) Conversion of the fraction image from .mif to .nii using mrconvert
>>>>>
>>>>> After the conversion, I am unable to read the resultant .nii file in
>>>>> FSL, Afni, SPM, ... . For example, if I use fslview to read the converted
>>>>> fraction image, an error saying 'Segmentation fault' will appear in the
>>>>> terminal.
>>>>>
>>>>> So far, I've only had this issue with the fraction images and other
>>>>> images (FA maps, masks, etc) that I convert can be read in other viewers.
>>>>> Do you have any thoughts / solutions to this issue?
>>>>>
>>>>> Thanks,
>>>>> Jason
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> This e-mail message (including any attachments) is for the sole use of
>>>>> the intended recipient(s) and may contain confidential and privileged
>>>>> information. If the reader of this message is not the intended
>>>>> recipient, you are hereby notified that any dissemination, distribution
>>>>> or copying of this message (including any attachments) is strictly
>>>>> prohibited.
>>>>>
>>>>> If you have received this message in error, please contact
>>>>> the sender by reply e-mail message and destroy all copies of the
>>>>> original message (including attachments).
>>>>>
>>>>
>>>>
>>>>
>>>>  --
>>>> 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
>>
>
>
>
>  --
> 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/20120621/e8d50f56/attachment-0001.html


More information about the Mrtrix-discussion mailing list