[Mrtrix-discussion] Inputing own SH coefficents .img file

Donald Tournier d.tournier at brain.org.au
Wed Sep 11 05:58:10 PDT 2013


Hi Evan,

Looks like the file you are generating in Matlab is too small to contain
all the data. As you've already noticed, the original size of the dataset
is close to 48MB, whereas your file is only about 3MB - I'm guessing it's
only one volume out of the 15 required for a lmax 4 file. Not sure why
MRtrix didn't catch and report the discrepancy rather than crash, I thought
I'd put in checks for that... In any case, your data file is much smaller
than expected based on the image header, and this will mean that any
attempt to read data past the end of the file will cause an invalid memory
access.

Hope that helps.

Cheers,
Donald.
 On 11 Sep 2013 06:00, "Evan Schwab" <eschwab3 at jhu.edu> wrote:

> Hi,
>
> Thank you very much in advance.  I am trying to visualize my own ODFs with
> my own calculated coefficients for the SH basis.  I create an analyze file
> and try to mrconvert to a .mif file but I get a segmentation fault. Can you
> please help me to understand what I'm doing wrong? My debugging process and
> output is outlined below.
>
> Thanks so much,
>
> Evan
>
>
> To debug I did the following:
>
> 1) I first generate a CSD4.mif file properly by csdeconv.
> 2) I mrconvert the CSD4.mif to CSD4.img
> 3) I read the analyze file into matlab and replace the .img with my own 4D
> coefficient matrix. For debugging purposes I use here a matrix of all zeros.
> 4) Then I write this new matrix as a analyze file with the same header
> information as before.
> 5) I mrconvert my .img file to a new .mif file (using the -debug flag)
>
> I get the following output:
>
> $ mrconvert -info -debug CSD4_clsArray.img CSD4_clsArray.mif
> mrconvert [DEBUG]: reading key/value file "/etc/mrtrix.conf"...
> mrconvert [INFO]: opening image "CSD4_clsArray.img"...
> mrconvert [DEBUG]: preparing file "./CSD4_clsArray.hdr"
> mrconvert [DEBUG]: file "./CSD4_clsArray.hdr" mapped at 0x7feb2e267000,
> size 348 (read-only)
> mrconvert [INFO]: assuming Analyse images are encoded left to right
> mrconvert [DEBUG]: preparing file "./CSD4_clsArray.img"
> mrconvert [DEBUG]: unmapping file "./CSD4_clsArray.hdr"
> mrconvert [DEBUG]: setting up image "CSD4_clsArray.img"...
> mrconvert [DEBUG]: sanitising transformation matrix...
> mrconvert [DEBUG]: setting up data increments for "CSD4_clsArray.img"...
> mrconvert [DEBUG]: data increments initialised with start = 0, stride = [
> 1 112 12544 815360 ]
> mrconvert [DEBUG]: mapping image "CSD4_clsArray.img"...
> mrconvert [DEBUG]: file "./CSD4_clsArray.img" mapped at 0x7feb2b206000,
> size 3261440 (read-only)
> mrconvert [DEBUG]: data mapper for image "CSD4_clsArray.img" mapped with
> segment size = 12230400 (optimised)
> mrconvert [INFO]: creating image "CSD4_clsArray.mif"...
> mrconvert [DEBUG]: preparing file "./CSD4_clsArray.mif"
> mrconvert [DEBUG]: setting up image "./CSD4_clsArray.mif"...
> mrconvert [DEBUG]: sanitising transformation matrix...
> mrconvert [DEBUG]: setting up data increments for "./CSD4_clsArray.mif"...
> mrconvert [DEBUG]: data increments initialised with start = 0, stride = [
> 1 112 12544 815360 ]
> mrconvert [DEBUG]: mapping image "./CSD4_clsArray.mif"...
> mrconvert [DEBUG]: file "./CSD4_clsArray.mif" mapped at 0x7feb2835e000,
> size 48921913 (read-write)
> mrconvert [DEBUG]: data mapper for image "./CSD4_clsArray.mif" mapped with
> segment size = 12230400 (optimised)
>
>
> As well I have the output when I mrconvert the original CSD4.img back to
> .mif and the only difference is the line I have labeled as (********)
> related to the size of the file.
>
> $ mrconvert -info -debug CSD4.img CSD42.mif
> mrconvert [DEBUG]: reading key/value file "/etc/mrtrix.conf"...
> mrconvert [INFO]: opening image "CSD4.img"...
> mrconvert [DEBUG]: preparing file "./CSD4.hdr"
> mrconvert [DEBUG]: file "./CSD4.hdr" mapped at 0x7f5bcdc81000, size 348
> (read-only)
> mrconvert [INFO]: assuming Analyse images are encoded left to right
> mrconvert [DEBUG]: preparing file "./CSD4.img"
> mrconvert [DEBUG]: unmapping file "./CSD4.hdr"
> mrconvert [DEBUG]: setting up image "CSD4.img"...
> mrconvert [DEBUG]: sanitising transformation matrix...
> mrconvert [DEBUG]: setting up data increments for "CSD4.img"...
> mrconvert [DEBUG]: data increments initialised with start = 0, stride = [
> 1 112 12544 815360 ]
> mrconvert [DEBUG]: mapping image "CSD4.img"...
> (********) mrconvert [DEBUG]: file "./CSD4.img" mapped at 0x7f5bc8095000,
> size 48921600 (read-only)
> mrconvert [DEBUG]: data mapper for image "CSD4.img" mapped with segment
> size = 12230400 (optimised)
> mrconvert [INFO]: creating image "CSD42.mif"...
> mrconvert [DEBUG]: preparing file "./CSD42.mif"
> mrconvert [DEBUG]: setting up image "./CSD42.mif"...
> mrconvert [DEBUG]: sanitising transformation matrix...
> mrconvert [DEBUG]: setting up data increments for "./CSD42.mif"...
> mrconvert [DEBUG]: data increments initialised with start = 0, stride = [
> 1 112 12544 815360 ]
> mrconvert [DEBUG]: mapping image "./CSD42.mif"...
> mrconvert [DEBUG]: file "./CSD42.mif" mapped at 0x7f5bc51ed000, size
> 48921913 (read-write)
> mrconvert [DEBUG]: data mapper for image "./CSD42.mif" mapped with segment
> size = 12230400 (optimised)
> mrconvert: copying data... 100%
> mrconvert [INFO]: closing image "CSD4.img"...
> mrconvert [DEBUG]: unmapping file "./CSD4.img"
> mrconvert [INFO]: closing image "./CSD42.mif"...
> mrconvert [DEBUG]: unmapping file "./CSD42.mif"
>
>
> _______________________________________________
> Mrtrix-discussion mailing list
> Mrtrix-discussion at www.nitrc.org
> http://www.nitrc.org/mailman/listinfo/mrtrix-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.nitrc.org/pipermail/mrtrix-discussion/attachments/20130911/3d70c94a/attachment-0001.html


More information about the Mrtrix-discussion mailing list