Data received and already converted without any errors... Looks like there is a problem with your system somewhere. Which version of MRtrix are you running? The current release is 0.2.10. Have you had any issues like this using MRtrix on different data sets? Do you have enough storage on your hard drive? Are you sure you have enough RAM to process the data (ideally at least 800MB)? Any if you're running on a Mac, maybe you'd consider installing MRtrix natively...? The latest version should compile cleanly on MacOSX, there are instructions in the documentation:<br>
<a href="http://www.brain.org.au/software/mrtrix/install/macosx.html">http://www.brain.org.au/software/mrtrix/install/macosx.html</a><div><br>Other than that, I'm out of ideas. You might want to try using a different flavour or version of Linux, since your mmap implementation seems buggy to me, but I'm not convinced that would necessarily solve the problem - mmap is such a critical part of the OS that I'd expect nothing to work if there was a bug in it...</div>
<div><br>Just one more thought: are these data stored on the host computer, and accessed within the VM via Virtualbox's shared network feature? If so, this could be a bug in VirtualBox's implementation of the backend necessary to support mmap(). Are you running the latest version of VirtualBox? What happens if you try to copy these data onto a folder within the VM's own virtual hard drive, and process them there?</div>
<div><br>Cheers,<br><br>Donald.<br><div class="yj6qo ajU" style="outline:none;padding:10px 0px;width:22px;margin:2px 0px 0px;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:16px;background-color:rgb(255,255,255)">
</div><br><div class="gmail_quote">On 31 July 2012 14:26, dti mic <span dir="ltr"><<a href="mailto:micdtiserver@gmail.com" target="_blank">micdtiserver@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Donald,<div><br></div><div>Yes, I am running a CentOS 6.1 on a VBox in my iMac. </div><div><br></div><div>I tried to modify the mmap.cpp as you suggested, rebuild, install and run the mrcovert again, the problem is still there and here is the output message from debug mode:</div>
<div><br></div><div><div class="im"><div>$ mrconvert P481210209_xyz_eddy_Ave.nii dwi.mif -debug</div></div><div class="im"><div>mrconvert [DEBUG]: reading key/value file "/etc/mrtrix.conf"...</div><div>mrconvert [INFO]: opening image "P481210209_xyz_eddy_Ave.nii"...</div>
<div>mrconvert [DEBUG]: preparing file "./P481210209_xyz_eddy_Ave.nii"</div></div><div>mrconvert: msize = 374976352 (in map() from lib/file/mmap.cpp: 92)</div><div>mrconvert: fd = 3 (in map() from lib/file/mmap.cpp: 93)</div>
<div>mrconvert: read_only = 1 (in map() from lib/file/mmap.cpp: 94)</div><div>mrconvert [DEBUG]: file "./P481210209_xyz_eddy_Ave.nii" mapped at 0x7f87f78ad000, size 374976352 (read-only)</div><div class="im"><div>
mrconvert [DEBUG]: sanitising transformation matrix...</div>
<div>mrconvert [DEBUG]: unmapping file "./P481210209_xyz_eddy_Ave.nii"</div><div>mrconvert [DEBUG]: setting up image "P481210209_xyz_eddy_Ave.nii"...</div><div>mrconvert [DEBUG]: sanitising transformation matrix...</div>
<div>mrconvert [DEBUG]: setting up data increments for "P481210209_xyz_eddy_Ave.nii"...</div><div>mrconvert [DEBUG]: data increments initialised with start = 0, stride = [ 1 105 18900 1512000 ]</div><div>mrconvert [DEBUG]: mapping image "P481210209_xyz_eddy_Ave.nii"...</div>
</div><div>mrconvert: msize = 374976352 (in map() from lib/file/mmap.cpp: 92)</div><div>mrconvert: fd = 3 (in map() from lib/file/mmap.cpp: 93)</div><div>mrconvert: read_only = 1 (in map() from lib/file/mmap.cpp: 94)</div>
<div>
mrconvert [DEBUG]: file "./P481210209_xyz_eddy_Ave.nii" mapped at 0x7f87f78ad000, size 374976352 (read-only)</div><div class="im"><div>mrconvert [DEBUG]: data mapper for image "P481210209_xyz_eddy_Ave.nii" mapped with segment size = 46872000</div>
<div>mrconvert [INFO]: creating image "dwi.mif"...</div><div>mrconvert [DEBUG]: preparing file "./dwi.mif"</div><div>mrconvert [DEBUG]: setting up image "./dwi.mif"...</div><div>mrconvert [DEBUG]: sanitising transformation matrix...</div>
<div>mrconvert [DEBUG]: setting up data increments for "./dwi.mif"...</div><div>mrconvert [DEBUG]: data increments initialised with start = 0, stride = [ 1 105 18900 1512000 ]</div><div>mrconvert [DEBUG]: mapping image "./dwi.mif"...</div>
</div><div>mrconvert: msize = 374976262 (in map() from lib/file/mmap.cpp: 92)</div><div>mrconvert: fd = 4 (in map() from lib/file/mmap.cpp: 93)</div><div>mrconvert: read_only = 0 (in map() from lib/file/mmap.cpp: 94)</div>
<div class="im"><div>
mrconvert: memory-mapping failed for file "./dwi.mif": Invalid argument</div><div>mrconvert [INFO]: closing image "P481210209_xyz_eddy_Ave.nii"...</div><div>mrconvert [DEBUG]: unmapping file "./P481210209_xyz_eddy_Ave.nii"</div>
<div>mrconvert [INFO]: closing image "./dwi.mif"...</div><div><br></div></div><div>Any idea of where I did wrong? </div><div><br></div><div>I am more than willing to send you my data directly. Before I do that, I have to make sure that it will not be found on the mrtrix mail list, right? Since this is a preliminary data and I am not authorised to make it public. I assume if I send it to your email account (<a href="mailto:d.tournier@brain.org.au" target="_blank">d.tournier@brain.org.au</a>) from my current email (<a href="mailto:micdtiserver@gmail.com" target="_blank">micdtiserver@gmail.com</a>), it will be to your eyes only?</div>
<div><br></div><div>Really appreciate your time and effort!</div><div><br></div><div>Bests</div><div><br></div><div>micdtisever</div><div><div class="h5"><br><div class="gmail_quote">2012/7/31 Donald Tournier <span dir="ltr"><<a href="mailto:d.tournier@brain.org.au" target="_blank">d.tournier@brain.org.au</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi again,</div><div><br></div><div>OK, I'm also stumped. Given that error message, your system doesn't like some of the arguments to the mmap() call. I can't think what it might not like, I've been through the documentation for mmap() and it should work fine (as it has done quite happily until now). Can I just confirm what OS this is running on? I'm assuming a 64-bit Linux system within a virtual machine (given the machine name on the command-line prompt), is this correct? And what flavour of Linux are you running, and in particular what kernel version? The output of "uname -a" and "lsb_release -a" should tell you all that information.</div>
<div><br></div><div>Otherwise, to try to debug this further, can you add the lines highlighted below to the file lib/file/mmap.cpp, at the specified position, re-build, re-install and run the modified mrconvert command again? </div>
<div><br></div><div><font face="courier new, monospace"> 84 if (!addr) throw 0;</font></div><div><font face="courier new, monospace"> 85 CloseHandle (handle);</font></div><div><font face="courier new, monospace"> 86 #else</font></div>
<div><font face="courier new, monospace"><b> VAR (msize);</b></font></div><div><font face="courier new, monospace"><b> VAR (fd);</b></font></div><div><font face="courier new, monospace"><b> VAR (read_only);</b></font></div>
<div><font face="courier new, monospace"> 87 addr = (void *) mmap((char*)0, msize, (read_only ? PROT_READ : PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0);</font></div><div><font face="courier new, monospace"> 88 if (addr == MAP_FAILED) throw 0;</font></div>
<div><font face="courier new, monospace"> 89 #endif</font></div><div><br>Of these, the only parameter that could realistically go wrong is msize being set to zero, but I can't figure out why that would happen. Maybe it would be simpler if you could send me the dataset...?</div>
<div><br></div><div>Cheers,</div><div><br></div><div>Donald.</div><div><div><div><br></div><div><br>On 31 July 2012 11:02, dti mic <span dir="ltr"><<a href="mailto:micdtiserver@gmail.com" target="_blank">micdtiserver@gmail.com</a>></span> wrote:</div>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Donald,<div><br></div><div>Thank you so much for the prompt response. I tried all your suggested commands and below please find the output of them:</div>
<div><br></div><div>1. $ mrinfo P481210209_xyz_eddy_Ave.nii (it is a mouse data, so the dimension and voxel size is way smaller than human, but I assume that should not be the reason of my failure in mrconvert?)<div>
************************************************</div><div>Image: "P481210209_xyz_eddy_Ave.nii"</div><div>************************************************</div><div> Format: NIfTI-1.1</div>
<div> Dimensions: 105 x 180 x 80 x 31</div><div> Voxel size: 0.1 x 0.1 x 0.1 x 1</div><div> Dimension labels: 0. left->right (mm)</div><div> 1. posterior->anterior (mm)</div><div>
2. inferior->superior (mm)</div><div> 3. undefined (?)</div><div> Data type: 64 bit float (little endian)</div><div> Data layout: [ +0 +1 +2 +3 ]</div><div> Data scaling: offset = 0, multiplier = 1</div>
<div> Comments: FSL4.1</div><div> Transform: 1 0 0 0</div><div> 0 1 0 0</div><div> 0 0 1 0</div>
<div> 0 0 0 1</div><div><br></div><div>2. $ mrconvert P481210209_xyz_eddy_Ave.nii dwi.mif -debug (Please kindly note that I have successfully worked through all the steps with the same input image in a FSL pipeline, including both tensor estimation and tractography).</div>
<div>mrconvert [DEBUG]: reading key/value file "/etc/mrtrix.conf"...</div><div>mrconvert [INFO]: opening image "P481210209_xyz_eddy_Ave.nii"...</div><div>mrconvert [DEBUG]: preparing file "./P481210209_xyz_eddy_Ave.nii"</div>
<div>mrconvert [DEBUG]: file "./P481210209_xyz_eddy_Ave.nii" mapped at 0x7fcacb920000, size 374976352 (read-only)</div><div>mrconvert [DEBUG]: sanitising transformation matrix...</div><div>mrconvert [DEBUG]: unmapping file "./P481210209_xyz_eddy_Ave.nii"</div>
<div>mrconvert [DEBUG]: setting up image "P481210209_xyz_eddy_Ave.nii"...</div><div>mrconvert [DEBUG]: sanitising transformation matrix...</div><div>mrconvert [DEBUG]: setting up data increments for "P481210209_xyz_eddy_Ave.nii"...</div>
<div>mrconvert [DEBUG]: data increments initialised with start = 0, stride = [ 1 105 18900 1512000 ]</div><div>mrconvert [DEBUG]: mapping image "P481210209_xyz_eddy_Ave.nii"...</div><div>mrconvert [DEBUG]: file "./P481210209_xyz_eddy_Ave.nii" mapped at 0x7fcacb920000, size 374976352 (read-only)</div>
<div>mrconvert [DEBUG]: data mapper for image "P481210209_xyz_eddy_Ave.nii" mapped with segment size = 46872000</div><div>mrconvert [INFO]: creating image "dwi.mif"...</div><div>mrconvert [DEBUG]: preparing file "./dwi.mif"</div>
<div>mrconvert [DEBUG]: setting up image "./dwi.mif"...</div><div>mrconvert [DEBUG]: sanitising transformation matrix...</div><div>mrconvert [DEBUG]: setting up data increments for "./dwi.mif"...</div>
<div>mrconvert [DEBUG]: data increments initialised with start = 0, stride = [ 1 105 18900 1512000 ]</div><div>mrconvert [DEBUG]: mapping image "./dwi.mif"...</div><div><div>mrconvert: memory-mapping failed for file "./dwi.mif": Invalid argument</div>
</div><div>mrconvert [INFO]: closing image "P481210209_xyz_eddy_Ave.nii"...</div><div>mrconvert [DEBUG]: unmapping file "./P481210209_xyz_eddy_Ave.nii"</div><div>mrconvert [INFO]: closing image "./dwi.mif"...</div>
<div><br></div><div>3. $ ls -l dwi.mif</div><div>-rwxrwx---. 1 root vboxsf 374976262 Jul 31 10:54 dwi.mif</div><div><br></div><div>Honestly, I can not tell what is wrong from the above information and your help will be highly appreciated!</div>
<div><br></div><div>Please kindly note that the input image (P481210209_xyz_eddy_Ave.nii) I provide to mrconvert is a output from previous processing steps (dcm2nii, Eddy_current from FSL and averaged multiple B0 image by fslmaths etc.). I really want to start mrtrix from this point on. That is why I did not feed mrtrix with the original raw dicom.</div>
<div><br></div><div>Many thanks again!</div><div><br></div><div>micdtiserver</div><div><div><br><div class="gmail_quote">2012/7/31 Donald Tournier <span dir="ltr"><<a href="mailto:d.tournier@brain.org.au" target="_blank">d.tournier@brain.org.au</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div><br></div><div>This is indeed weird. The only reason I can think of why this might happen is that the output dwi.mif file is somehow created with the wrong filesize. One possible issue might be that one of the dimensions is set to zero, which would cause the data size to be zero. But then I'm pretty sure MRtrix checks all of that. Maybe in the first instance you could post the output of:<br>
</div><div><br></div><div><font face="courier new, monospace">$ mrinfo P481210209_xyz_eddy_Ave.nii</font></div><div><br></div><div>You could also provide the output of the failing command with the -debug option:</div><div>
<br></div><div><font face="courier new, monospace">$ mrconvert P481210209_xyz_eddy_Ave.nii dwi.mif -debug</font></div><div><br></div><div>and provide a full listing for the output file (which I assume does get created?):</div>
<div><br></div><div><font face="courier new, monospace">$ ls -l dwi.mif</font></div><div><br>That should already provide some clues as to what is going on. If that doesn't help, you could always send me the file if you're comfortable with that.</div>
<div><br></div><div>Cheers,</div><div><br></div><div>Donald.</div><div><br><br><br><div class="gmail_quote"><div><div>On 30 July 2012 17:08, dti mic <span dir="ltr"><<a href="mailto:micdtiserver@gmail.com" target="_blank">micdtiserver@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Dear MRtrix,<div><br></div><div>I am trying to convert a 4D dwi data set in NIFTI format (converted from DICOM using dcm2nii) into mif image. The error message I got is:</div>
<div><br></div><div>"mrconvert: memory-mapping failed for file "./dwi.mif": Invalid argument". The input image (the name of which is "P481210209_xyz_eddy_Ave.nii", a little bit long and wired I know) in nii format can be well accessed by FSL and MRIcron or MRIcron. Any idea of what I can do to fix this issue? Should I try some more options in the mrconvert command?</div>
<div><br></div><div>Many thanks for your help in advance!</div><div><br></div><div><br></div>
<br></div></div>_______________________________________________<br>
Mrtrix-discussion mailing list<br>
<a href="mailto:Mrtrix-discussion@www.nitrc.org" target="_blank">Mrtrix-discussion@www.nitrc.org</a><br>
<a href="http://www.nitrc.org/mailman/listinfo/mrtrix-discussion" target="_blank">http://www.nitrc.org/mailman/listinfo/mrtrix-discussion</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Jacques-Donald Tournier (PhD)<br>Brain Research Institute, Melbourne, Australia<br>Tel: <a href="tel:%2B61%20%280%293%209035%207033" value="+61390357033" target="_blank">+61 (0)3 9035 7033</a><br>
</font></span></div>
</blockquote></div><br></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: <a href="tel:%2B61%20%280%293%209035%207033" value="+61390357033" target="_blank">+61 (0)3 9035 7033</a><br>
</div></div></blockquote></div><br></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>