<div>Hi Jason,</div><div><br></div><div>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:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><i>QRangeControl::setRange: minValue 0 > maxValue -1</i></div></blockquote><div><br></div><div>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:</div>
<div><a href="http://www.nitrc.org/pipermail/mrtrix-discussion/2012-April/000398.html">http://www.nitrc.org/pipermail/mrtrix-discussion/2012-April/000398.html</a></div><div><br></div><div>Basically, it boils down to inserting these lines at line 301 of the lib/image/format/nifti1.cpp file:</div>
<div><br></div><div><i> // pad out the other dimensions with 1, fix for fslview</i></div><div><i> for (gint i = H.ndim() + 1; i < 8; i++) </i></div><div><i> put<gint16> (1, &NH->dim[i], is_BE);</i></div>
<div><br></div><div>That should fix it. </div><div>Cheers!</div><div><br></div><div>Donald.</div><div><br></div><br><div class="gmail_quote">On 21 June 2012 13:35, Langley, Jason Allen <span dir="ltr"><<a href="mailto:jason.langley@emory.edu" target="_blank">jason.langley@emory.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi Donald,
<br>
<br>
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:<br>
<br>
************************************************<br>
Image: "output125_int32.nii"<div class="im"><br>
************************************************<br>
Format: NIfTI-1.1<br>
Dimensions: 282 x 282 x 95<br>
Voxel size: 0.5 x 0.5 x 0.5<br>
Dimension labels: 0. left->right (mm)<br>
1. posterior->anterior (mm)<br>
2. inferior->superior (mm)<br></div>
Data type: <span style="font-weight:bold">signed</span> 32 bit integer (little endian)<div class="im"><br>
Data layout: [ +0 +1 +2 ]<br>
Data scaling: offset = 0, multiplier = 1<br>
Comments: FSL4.1<br>
count: 2500000; init_threshold: 0.2; lmax: 10; max_dist: 200; max_num_tracks: 25<br></div>
Transform: 0.9974 0.06272 0.03417 -74.65<br>
-0.05008 0.9553 -0.2915 1.649<br>
-0.05093 0.289 0.956 -39.18<br>
0 0 0 1<br>
<br>
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.
<br>
<br>
Thanks,<br>
Jason<br>
<br>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> Donald Tournier [<a href="mailto:d.tournier@brain.org.au" target="_blank">d.tournier@brain.org.au</a>]<br>
<b>Sent:</b> Wednesday, June 20, 2012 2:30 AM<div><div class="h5"><br>
<b>To:</b> Langley, Jason Allen<br>
<b>Subject:</b> Re: Converting Fraction Images to Nifti<br>
</div></div></font><br>
</div><div><div class="h5">
<div></div>
<div>Hi Jason,
<div><br>
</div>
<div>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:</div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>
<div><i>$ mrinfo output125.nii </i></div>
</div>
<div>
<div><i>************************************************</i></div>
</div>
<div>
<div><i>Image: "output125.nii"</i></div>
</div>
<div>
<div><i>************************************************</i></div>
</div>
<div>
<div><i> Format: NIfTI-1.1</i></div>
</div>
<div>
<div><i> Dimensions: 282 x 282 x 95</i></div>
</div>
<div>
<div><i> Voxel size: 0.5 x 0.5 x 0.5</i></div>
</div>
<div>
<div><i> Dimension labels: 0. left->right (mm)</i></div>
</div>
<div>
<div><i> 1. posterior->anterior (mm)</i></div>
</div>
<div>
<div><i> 2. inferior->superior (mm)</i></div>
</div>
<div>
<div><i><font color="#ff0000"> Data type: unsigned 32 bit integer (little endian)</font></i></div>
</div>
<div>
<div><i> Data layout: [ +0 +1 +2 ]</i></div>
</div>
<div>
<div><i> Data scaling: offset = 0, multiplier = 1</i></div>
</div>
<div>
<div><i> Comments: FSL4.1</i></div>
</div>
<div>
<div><i> count: 2500000; init_threshold: 0.2; lmax: 10; max_dist: 200; max_num_tracks: 25</i></div>
</div>
<div>
<div><i> Transform: 0.9995 -0.01916 0.02647 -73.29</i></div>
</div>
<div>
<div><i> 0.02174 0.9947 -0.1006 0.4578</i></div>
</div>
<div>
<div><i> -0.0244 0.1011 0.9946 -22.72</i></div>
</div>
<div>
<div><i> 0 0 0 1</i></div>
</div>
</blockquote>
<div>
<div><br>
</div>
<div>Once I'd converted the image to an FSL-supported datatype, I had no trouble loading it into fslview. The command I used was:</div>
<div><br>
</div>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>
<div><i>$ mrconvert output125.nii -datatype int32 output125_int32.nii</i></div>
</div>
</blockquote>
<div>
<div><br>
</div>
<div>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).</div>
<div><br>
</div>
<div>Cheers,</div>
<div><br>
</div>
<div>Donald.</div>
<div><br>
</div>
<div><br>
</div>
<br>
<div class="gmail_quote">On 20 June 2012 13:47, Langley, Jason Allen <span dir="ltr">
<<a href="mailto:jason.langley@emory.edu" target="_blank">jason.langley@emory.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi Donald, <br>
<br>
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 <a href="mailto:impulse@physast.uga.edu" target="_blank">
impulse@physast.uga.edu</a> <br>
<br>
Thanks! <br>
Jason<br>
<br>
<br>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> Donald Tournier [<a href="mailto:d.tournier@brain.org.au" target="_blank">d.tournier@brain.org.au</a>]<br>
<b>Sent:</b> Tuesday, June 19, 2012 7:17 PM
<div>
<div><br>
<b>To:</b> Langley, Jason Allen<br>
<b>Cc:</b> <a href="mailto:mrtrix-discussion@www.nitrc.org" target="_blank">mrtrix-discussion@www.nitrc.org</a><br>
<b>Subject:</b> Re: Converting Fraction Images to Nifti<br>
</div>
</div>
</font><br>
</div>
<div>
<div>
<div></div>
<div>Hi Jason,
<div><br>
</div>
<div>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...<br>
<br>
Cheers,</div>
<div><br>
Donald.</div>
<div><br>
<br>
<div class="gmail_quote">On 20 June 2012 03:41, Langley, Jason Allen <span dir="ltr">
<<a href="mailto:jason.langley@emory.edu" target="_blank">jason.langley@emory.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi Donald,
<div><br>
</div>
<div>The size of the files are only about 30 MB so memory is not an issue. </div>
<div><br>
</div>
<div>The error message that is displayed in the terminal is</div>
<div>fslview: line 6: 8608 Segmentation fault<span style="white-space:pre-wrap"> </span>
${FSLDIR}/bin/fslview_bin $@</div>
<div><br>
</div>
<div>The number 8608 changes for each instance of the fault and sometimes (core dumped) will appear in the error message as well. </div>
<div><br>
</div>
<div>Thanks,</div>
<div>Jason</div>
<div><br>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> Donald Tournier [<a href="mailto:d.tournier@brain.org.au" target="_blank">d.tournier@brain.org.au</a>]<br>
<b>Sent:</b> Monday, June 18, 2012 8:07 PM<br>
<b>To:</b> Langley, Jason Allen<br>
<b>Cc:</b> <a href="mailto:mrtrix-discussion@www.nitrc.org" target="_blank">mrtrix-discussion@www.nitrc.org</a>
<div>
<div><br>
<b>Subject:</b> Re: Converting Fraction Images to Nifti<br>
</div>
</div>
</font><br>
</div>
<div>
<div>
<div></div>
<div>Hi Jason,
<div><br>
</div>
<div>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: </div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>
<div><i>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.</i></div>
</div>
</blockquote>
<div>
<div><br>
</div>
<div>which at least gives the <i>very</i> 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...</div>
<div><br>
</div>
<div>Cheers,</div>
<div><br>
</div>
<div>Donald.</div>
<div><br>
</div>
<br>
<div class="gmail_quote">On 19 June 2012 08:21, Langley, Jason Allen <span dir="ltr">
<<a href="mailto:jason.langley@emory.edu" target="_blank">jason.langley@emory.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi Donald, <br>
<br>
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.
<br>
<br>
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.
<br>
<br>
Best,<br>
Jason<br>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> Donald Tournier [<a href="mailto:d.tournier@brain.org.au" target="_blank">d.tournier@brain.org.au</a>]<br>
<b>Sent:</b> Sunday, June 17, 2012 8:25 PM<br>
<b>To:</b> Langley, Jason Allen<br>
<b>Subject:</b> Re: Converting Fraction Images to Nifti<br>
</font><br>
</div>
<div>
<div>
<div></div>
<div>Hi Jason,
<div><br>
</div>
<div>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. </div>
<div><br>
On a different note: can I ask you to post these kinds of questions on the MRtrix mailing list? You can find it at: <a href="http://www.nitrc.org/mailman/listinfo/mrtrix-discussion" target="_blank">http://www.nitrc.org/mailman/listinfo/mrtrix-discussion</a>.
This way other users might also benefit...<br>
<br>
Hope this helps.</div>
<div>Cheers,</div>
<div><br>
</div>
<div>Donald.</div>
<div><br>
<br>
<div class="gmail_quote">On 16 June 2012 02:24, Langley, Jason Allen <span dir="ltr">
<<a href="mailto:jason.langley@emory.edu" target="_blank">jason.langley@emory.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Dear Donald,<br>
<br>
I'm having issues reading converted fraction images. My processing steps are as follows:
<br>
(1) Preprocessing and then fibre tracking using streamtrack<br>
(2) Creation of the fraction image from the tracks using tracks2prob<br>
(3) Conversion of the fraction image from .mif to .nii using mrconvert<br>
<br>
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.
<br>
<br>
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?
<br>
<br>
Thanks,<br>
Jason<br>
</div>
<br>
<hr>
<font color="Gray" face="Arial" size="1"><br>
This e-mail message (including any attachments) is for the sole use of<br>
the intended recipient(s) and may contain confidential and privileged<br>
information. If the reader of this message is not the intended<br>
recipient, you are hereby notified that any dissemination, distribution<br>
or copying of this message (including any attachments) is strictly<br>
prohibited.<br>
<br>
If you have received this message in error, please contact<br>
the sender by reply e-mail message and destroy all copies of the<br>
original message (including attachments).<br>
</font></div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Jacques-Donald Tournier (PhD)<br>
Brain Research Institute, Melbourne, Australia<br>
Tel: +61 (0)3 9035 7033<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Jacques-Donald Tournier (PhD)<br>
Brain Research Institute, Melbourne, Australia<br>
Tel: +61 (0)3 9035 7033<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Jacques-Donald Tournier (PhD)<br>
Brain Research Institute, Melbourne, Australia<br>
Tel: +61 (0)3 9035 7033<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
Jacques-Donald Tournier (PhD)<br>
Brain Research Institute, Melbourne, Australia<br>
Tel: +61 (0)3 9035 7033<br>
</div>
</div>
</div></div></div>
</div>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Jacques-Donald Tournier (PhD)<br>Brain Research Institute, Melbourne, Australia<br>Tel: +61 (0)3 9035 7033<br>