[Mrtrix-discussion] Question about convert from nii to mif
Donald Tournier
d.tournier at brain.org.au
Mon Jul 30 22:24:12 PDT 2012
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:
http://www.brain.org.au/software/mrtrix/install/macosx.html
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...
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?
Cheers,
Donald.
On 31 July 2012 14:26, dti mic <micdtiserver at gmail.com> wrote:
> Dear Donald,
>
> Yes, I am running a CentOS 6.1 on a VBox in my iMac.
>
> 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:
>
> $ mrconvert P481210209_xyz_eddy_Ave.nii dwi.mif -debug
> mrconvert [DEBUG]: reading key/value file "/etc/mrtrix.conf"...
> mrconvert [INFO]: opening image "P481210209_xyz_eddy_Ave.nii"...
> mrconvert [DEBUG]: preparing file "./P481210209_xyz_eddy_Ave.nii"
> mrconvert: msize = 374976352 (in map() from lib/file/mmap.cpp: 92)
> mrconvert: fd = 3 (in map() from lib/file/mmap.cpp: 93)
> mrconvert: read_only = 1 (in map() from lib/file/mmap.cpp: 94)
> mrconvert [DEBUG]: file "./P481210209_xyz_eddy_Ave.nii" mapped at
> 0x7f87f78ad000, size 374976352 (read-only)
> mrconvert [DEBUG]: sanitising transformation matrix...
> mrconvert [DEBUG]: unmapping file "./P481210209_xyz_eddy_Ave.nii"
> mrconvert [DEBUG]: setting up image "P481210209_xyz_eddy_Ave.nii"...
> mrconvert [DEBUG]: sanitising transformation matrix...
> mrconvert [DEBUG]: setting up data increments for
> "P481210209_xyz_eddy_Ave.nii"...
> mrconvert [DEBUG]: data increments initialised with start = 0, stride = [
> 1 105 18900 1512000 ]
> mrconvert [DEBUG]: mapping image "P481210209_xyz_eddy_Ave.nii"...
> mrconvert: msize = 374976352 (in map() from lib/file/mmap.cpp: 92)
> mrconvert: fd = 3 (in map() from lib/file/mmap.cpp: 93)
> mrconvert: read_only = 1 (in map() from lib/file/mmap.cpp: 94)
> mrconvert [DEBUG]: file "./P481210209_xyz_eddy_Ave.nii" mapped at
> 0x7f87f78ad000, size 374976352 (read-only)
> mrconvert [DEBUG]: data mapper for image "P481210209_xyz_eddy_Ave.nii"
> mapped with segment size = 46872000
> mrconvert [INFO]: creating image "dwi.mif"...
> mrconvert [DEBUG]: preparing file "./dwi.mif"
> mrconvert [DEBUG]: setting up image "./dwi.mif"...
> mrconvert [DEBUG]: sanitising transformation matrix...
> mrconvert [DEBUG]: setting up data increments for "./dwi.mif"...
> mrconvert [DEBUG]: data increments initialised with start = 0, stride = [
> 1 105 18900 1512000 ]
> mrconvert [DEBUG]: mapping image "./dwi.mif"...
> mrconvert: msize = 374976262 (in map() from lib/file/mmap.cpp: 92)
> mrconvert: fd = 4 (in map() from lib/file/mmap.cpp: 93)
> mrconvert: read_only = 0 (in map() from lib/file/mmap.cpp: 94)
> mrconvert: memory-mapping failed for file "./dwi.mif": Invalid argument
> mrconvert [INFO]: closing image "P481210209_xyz_eddy_Ave.nii"...
> mrconvert [DEBUG]: unmapping file "./P481210209_xyz_eddy_Ave.nii"
> mrconvert [INFO]: closing image "./dwi.mif"...
>
> Any idea of where I did wrong?
>
> 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 (d.tournier at brain.org.au)
> from my current email (micdtiserver at gmail.com), it will be to your eyes
> only?
>
> Really appreciate your time and effort!
>
> Bests
>
> micdtisever
>
> 2012/7/31 Donald Tournier <d.tournier at brain.org.au>
>
>> Hi again,
>>
>> 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.
>>
>> 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?
>>
>> 84 if (!addr) throw 0;
>> 85 CloseHandle (handle);
>> 86 #else
>> * VAR (msize);*
>> * VAR (fd);*
>> * VAR (read_only);*
>> 87 addr = (void *) mmap((char*)0, msize, (read_only ? PROT_READ
>> : PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0);
>> 88 if (addr == MAP_FAILED) throw 0;
>> 89 #endif
>>
>> 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...?
>>
>> Cheers,
>>
>> Donald.
>>
>>
>> On 31 July 2012 11:02, dti mic <micdtiserver at gmail.com> wrote:
>>
>>> Dear Donald,
>>>
>>> Thank you so much for the prompt response. I tried all your suggested
>>> commands and below please find the output of them:
>>>
>>> 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?)
>>> ************************************************
>>> Image: "P481210209_xyz_eddy_Ave.nii"
>>> ************************************************
>>> Format: NIfTI-1.1
>>> Dimensions: 105 x 180 x 80 x 31
>>> Voxel size: 0.1 x 0.1 x 0.1 x 1
>>> Dimension labels: 0. left->right (mm)
>>> 1. posterior->anterior (mm)
>>> 2. inferior->superior (mm)
>>> 3. undefined (?)
>>> Data type: 64 bit float (little endian)
>>> Data layout: [ +0 +1 +2 +3 ]
>>> Data scaling: offset = 0, multiplier = 1
>>> Comments: FSL4.1
>>> Transform: 1 0 0 0
>>> 0 1 0 0
>>> 0 0 1 0
>>> 0 0 0 1
>>>
>>> 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).
>>> mrconvert [DEBUG]: reading key/value file "/etc/mrtrix.conf"...
>>> mrconvert [INFO]: opening image "P481210209_xyz_eddy_Ave.nii"...
>>> mrconvert [DEBUG]: preparing file "./P481210209_xyz_eddy_Ave.nii"
>>> mrconvert [DEBUG]: file "./P481210209_xyz_eddy_Ave.nii" mapped at
>>> 0x7fcacb920000, size 374976352 (read-only)
>>> mrconvert [DEBUG]: sanitising transformation matrix...
>>> mrconvert [DEBUG]: unmapping file "./P481210209_xyz_eddy_Ave.nii"
>>> mrconvert [DEBUG]: setting up image "P481210209_xyz_eddy_Ave.nii"...
>>> mrconvert [DEBUG]: sanitising transformation matrix...
>>> mrconvert [DEBUG]: setting up data increments for
>>> "P481210209_xyz_eddy_Ave.nii"...
>>> mrconvert [DEBUG]: data increments initialised with start = 0, stride =
>>> [ 1 105 18900 1512000 ]
>>> mrconvert [DEBUG]: mapping image "P481210209_xyz_eddy_Ave.nii"...
>>> mrconvert [DEBUG]: file "./P481210209_xyz_eddy_Ave.nii" mapped at
>>> 0x7fcacb920000, size 374976352 (read-only)
>>> mrconvert [DEBUG]: data mapper for image "P481210209_xyz_eddy_Ave.nii"
>>> mapped with segment size = 46872000
>>> mrconvert [INFO]: creating image "dwi.mif"...
>>> mrconvert [DEBUG]: preparing file "./dwi.mif"
>>> mrconvert [DEBUG]: setting up image "./dwi.mif"...
>>> mrconvert [DEBUG]: sanitising transformation matrix...
>>> mrconvert [DEBUG]: setting up data increments for "./dwi.mif"...
>>> mrconvert [DEBUG]: data increments initialised with start = 0, stride =
>>> [ 1 105 18900 1512000 ]
>>> mrconvert [DEBUG]: mapping image "./dwi.mif"...
>>> mrconvert: memory-mapping failed for file "./dwi.mif": Invalid argument
>>> mrconvert [INFO]: closing image "P481210209_xyz_eddy_Ave.nii"...
>>> mrconvert [DEBUG]: unmapping file "./P481210209_xyz_eddy_Ave.nii"
>>> mrconvert [INFO]: closing image "./dwi.mif"...
>>>
>>> 3. $ ls -l dwi.mif
>>> -rwxrwx---. 1 root vboxsf 374976262 Jul 31 10:54 dwi.mif
>>>
>>> Honestly, I can not tell what is wrong from the above information and
>>> your help will be highly appreciated!
>>>
>>> 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.
>>>
>>> Many thanks again!
>>>
>>> micdtiserver
>>>
>>> 2012/7/31 Donald Tournier <d.tournier at brain.org.au>
>>>
>>>> Hi,
>>>>
>>>> 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:
>>>>
>>>> $ mrinfo P481210209_xyz_eddy_Ave.nii
>>>>
>>>> You could also provide the output of the failing command with the
>>>> -debug option:
>>>>
>>>> $ mrconvert P481210209_xyz_eddy_Ave.nii dwi.mif -debug
>>>>
>>>> and provide a full listing for the output file (which I assume does get
>>>> created?):
>>>>
>>>> $ ls -l dwi.mif
>>>>
>>>> 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.
>>>>
>>>> Cheers,
>>>>
>>>> Donald.
>>>>
>>>>
>>>>
>>>> On 30 July 2012 17:08, dti mic <micdtiserver at gmail.com> wrote:
>>>>
>>>>> Dear MRtrix,
>>>>>
>>>>> 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:
>>>>>
>>>>> "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?
>>>>>
>>>>> Many thanks for your help in advance!
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mrtrix-discussion mailing list
>>>>> 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/20120731/da1d0ae6/attachment-0001.html
More information about the Mrtrix-discussion
mailing list