[Mrtrix-discussion] support for MIF & NIfTI GZ compression

Donald Tournier d.tournier at brain.org.au
Tue Mar 6 22:48:31 PST 2012


Hi Markus,

I had a go at installing the patch on a Snow Leopard machine here, and it
seems to mostly work OK for me. I did have an issue writing back a
compressed MRtrix (.mif) file, which I'll investigate further when I have a
minute, but otherwise it seemed to load compressed nifti files OK...

Maybe you could post the entire command-line session from extraction of the
original MRtrix install, through the patching process, building and
install, up to running a failing command? I'm really struggling to see how
the code could report an unknown format, and given that this aspect works
fine on a system here, I just want to rule out any other issues first.

Cheers,

Donald.


On 7 March 2012 16:57, Markus Gschwind <markus.gschwind at gmail.com> wrote:

> Dear Donald,
>
> I think I did a complete new reinstall, and then added the new patch.
>
> The -version option gives this:
>
> MacBook Pro$ mrview -version
> mrview 0.2.10 (revision 327)
>   Author: J-Donald Tournier (d.tournier at brain.org.au)
>   Copyright 2008 Brain Research Institute, Melbourne, Australia
>   using MRtrix 0.2.10, glib 2.28.8, GSL 1.15 (build Mar  5 2012)
>
>
> And here is the -debug option
>
> $ mrinfo -debug CONT_dti_FA_space_bin.nii.gz
> mrinfo [DEBUG]: reading key/value file "/etc/mrtrix.conf"...
> mrinfo [INFO]: opening image "CONT_dti_FA_space_bin.nii.gz"...
> mrinfo: unknown format for image "./CONT_dti_FA_space_bin.nii.gz"
> mrinfo: error opening image "CONT_dti_FA_space_bin.nii.gz"
> mrinfo [INFO]: closing image "CONT_dti_FA_space_bin.nii.gz"...
>
>
> $ mrview -info -debug CONT_dti_FA_space_bin.nii.gz
> mrview [DEBUG]: reading key/value file "/etc/mrtrix.conf"...
>
> (process:3026): Gtk-WARNING **: Locale not supported by C library.
> Using the fallback 'C' locale.
> Xlib:  extension "RANDR" missing on display "/tmp/launch-29bcMY/org.x:0".
> mrview [INFO]: opening image "CONT_dti_FA_space_bin.nii.gz"...
> mrview: unknown format for image "./CONT_dti_FA_space_bin.nii.gz"
> mrview: error opening image "CONT_dti_FA_space_bin.nii.gz"
> mrview [INFO]: closing image "CONT_dti_FA_space_bin.nii.gz"...
>
>
> Thanks for your help!!
>  Markus
>
> 2012/3/6 Donald Tournier <d.tournier at brain.org.au>
>
>> Hi Markus,
>>
>> Glad to hear it compiled OK on the mac. Your remaining issue is a bit
>> unexpected though. Are you sure you're running the latest version? What
>> does 'mrconvert -version' report? Maybe you're having a similar issue to
>> this one:
>> http://www.nitrc.org/pipermail/mrtrix-discussion/2012-February/000369.html ?
>> If not, then I'm a bit puzzled. Maybe running the command with the -debug
>> option would give a bit more information to try to figure out what is going
>> on...
>>
>> Cheers,
>>
>> Donald.
>>
>>
>> On 7 March 2012 08:39, Markus Gschwind <markus.gschwind at gmail.com> wrote:
>>
>>> Dear all!
>>>
>>> Thanks for the help in debugging!
>>>
>>> I have now installed the new patch of Donald.
>>>
>>> Markus-Gschwinds-MacBook-Pro:mrtrix-0.2.10 markus$ tar xvfj
>>> mrtrix-patch-GZ.tar.bz2
>>> x build
>>> x lib/image/format/list.cpp
>>> x lib/image/format/mrtrix.cpp
>>> x lib/image/format/nifti1.cpp
>>> x lib/image/mapper.cpp
>>> x lib/image/mapper.h
>>> x lib/image/object.cpp
>>> x lib/image/object.h
>>> x sysconf/linux.py
>>> x sysconf/darwin.py
>>> x sysconf/windows.py
>>> Markus-Gschwinds-MacBook-Pro:mrtrix-0.2.10 markus$ ./build
>>> Markus-Gschwinds-MacBook-Pro:mrtrix-0.2.10 markus$ sudo ./build install
>>> installing executables to "/usr/local/mrtrix/bin" and dynamic library to
>>> "/usr/local/mrtrix/lib"... ok
>>> creating symbolic links to executables in "/usr/local/bin" and to
>>> dynamic library in "/usr/local/lib"... ok
>>> configuration file already exists - leaving as-is
>>> Markus-Gschwinds-MacBook-Pro:mrtrix-0.2.10 markus$
>>>
>>>
>>>
>>> However, there seems still to be a problem:
>>>
>>> Markus-Gschwinds-MacBook-Pro:CONT markus$ mrinfo
>>> CONT_dti_FA_space_bin.nii.gz
>>> mrinfo: unknown format for image "./CONT_dti_FA_space_bin.nii.gz"
>>> mrinfo: error opening image "CONT_dti_FA_space_bin.nii.gz"
>>>
>>>
>>>
>>> Markus-Gschwinds-MacBook-Pro:CONT markus$ mrview
>>> CONT_dti_FA_space_bin.nii.gz
>>>
>>> (process:377): Gtk-WARNING **: Locale not supported by C library.
>>>  Using the fallback 'C' locale.
>>> Xlib:  extension "RANDR" missing on display "/tmp/launch-29bcMY/org.x:0".
>>> mrview: unknown format for image "./CONT_dti_FA_space_bin.nii.gz"
>>> mrview: error opening image "CONT_dti_FA_space_bin.nii.gz"
>>>
>>>
>>> Thanks!
>>>
>>> Markus
>>>
>>>
>>> 2012/3/6 Donald Tournier <d.tournier at brain.org.au>
>>>
>>>> Hi Markus,
>>>>
>>>> Ian is spot on, the -lz flags is missing in the library link command,
>>>> which for some reason isn't a problem on Linux. It's a simple fix: in the
>>>> build script, change line 315 to read:
>>>>
>>>>  '$obj$': [ item for item in self.deps ] + pkg (pkgconfig_glib, 'libs')
>>>> + ld_flags_gsl + ld_flags_zlib,
>>>>
>>>> (i.e. add " + ld_flags_zlib"). I'm attaching a new version of the patch
>>>> with the fix included for those who were about to try it out...
>>>>
>>>> Cheers,
>>>>
>>>> Donald.
>>>>
>>>>
>>>> On 6 March 2012 21:59, Ian Malone <i.malone at ucl.ac.uk> wrote:
>>>>
>>>>> **
>>>>> It looks like zlib isn't getting linked, though the patch does have
>>>>> the flag for it, maybe try './build clean' first? Don't have a Mac to test
>>>>> on I'm afraid.
>>>>>
>>>>> Markus Gschwind wrote:
>>>>>
>>>>> Dear Donald!
>>>>>
>>>>>  That is a brilliant idea! Thanks, I  have been waiting for this and
>>>>> it definitively facilitates work flow!
>>>>>
>>>>>  However when ./build, I get the following error on MacOSX Snow
>>>>> Leopard:
>>>>>
>>>>>  Markus-Gschwinds-MacBook-Pro:mrtrix-0.2.10 markus$ ./build
>>>>> [CC] cmd/dir2amp.o
>>>>> [CC] cmd/streamtrack.o
>>>>> [CC] cmd/gen_unit_warp.o
>>>>> [CC] src/dwi/tractography/tracker/sd_prob.o
>>>>> [CC] cmd/import_tracks.o
>>>>> [CC] src/dwi/tractography/tracker/base.o
>>>>> [CC] src/mrview/sidebar/orientation_plot.o
>>>>> [CC] cmd/mrabs.o
>>>>> [CC] src/mrview/sidebar/overlay.o
>>>>> [CC] src/mrview/dialog/opengl.o
>>>>> [CC] cmd/gendir.o
>>>>> [CC] src/mrview/sidebar/screen_capture.o
>>>>> [CC] src/dwi/tractography/file.o
>>>>> [CC] src/dwi/SH.o
>>>>> [CC] cmd/tensor2ADC.o
>>>>> [CC] lib/image/format/mri.o
>>>>>  [CC] cmd/dwi2tensor.o
>>>>> [CC] src/mrview/sidebar/tractography.o
>>>>> [CC] src/mrview/display_area.o
>>>>> [CC] src/mrview/image.o
>>>>> [CC] src/mrview/mode/base.o
>>>>> [CC] lib/image/format/list.o
>>>>> [CC] lib/image/format/xds.o
>>>>> [CC] src/histogram.o
>>>>> [CC] src/mrview/sidebar/tractography/track_list.o
>>>>> [CC] src/mrview/slice.o
>>>>> [CC] cmd/disp_profile.o
>>>>> [CC] lib/file/dicom/mapper.o
>>>>> [CC] cmd/resample_tracks.o
>>>>> [CC] cmd/tracks2prob.o
>>>>> [CC] lib/image/object.o
>>>>> [CC] src/mrview/dialog/error.o
>>>>> [CC] cmd/dwi2SH.o
>>>>> [CC] cmd/mrtransform.o
>>>>> [CC] cmd/gen_ROI.o
>>>>> [CC] cmd/csdeconv.o
>>>>> [CC] cmd/mradd.o
>>>>> [CC] cmd/sample_tracks.o
>>>>> [CC] src/dwi/tractography/tracker/dt_stream.o
>>>>> [CC] src/min_max.o
>>>>> [CC] cmd/erode.o
>>>>> [CC] cmd/filter_tracks.o
>>>>> [CC] cmd/mrcat.o
>>>>> [CC] src/mrview/sidebar/tractography/roi_list.o
>>>>> [CC] lib/image/interp.o
>>>>> [CC] lib/image/format/nifti1.o
>>>>> [CC] cmd/sdeconv.o
>>>>> [CC] lib/image/format/analyse.o
>>>>> [CC] lib/image/mapper.o
>>>>> [CC] cmd/read_ximg.o
>>>>> [CC] cmd/gen_WM_mask.o
>>>>> [CC] cmd/tensor_metric.o
>>>>> [CC] lib/image/fft.o
>>>>> [CC] cmd/mrmult.o
>>>>> [CC] src/mrview/sidebar/main.o
>>>>> [CC] cmd/normalise_tracks.o
>>>>> [CC] cmd/mrinfo.o
>>>>> [CC] cmd/mrconvert.o
>>>>> [CC] cmd/dicom_filename.o
>>>>> [CC] cmd/tensor2FA.o
>>>>> [CC] cmd/track_info.o
>>>>> [CC] cmd/truncate_tracks.o
>>>>> [CC] lib/mrtrix.o
>>>>> [CC] src/mrview/window.o
>>>>> [CC] src/mrview/sidebar/roi_analysis.o
>>>>> [CC] cmd/tracks2vtk.o
>>>>> [CC] src/mrview/pane.o
>>>>> [CC] lib/args.o
>>>>> [CC] src/dialog/file.o
>>>>> [CC] cmd/threshold.o
>>>>> [CC] lib/app.o
>>>>> [CC] src/mrview/mode/normal.o
>>>>> [CC] cmd/median3D.o
>>>>> [CC] src/mrview/sidebar/tractography/track_list_item.o
>>>>> [CC] cmd/estimate_response.o
>>>>> [CC] cmd/select_tracks.o
>>>>> [CC] cmd/read_dicom.o
>>>>> [CC] cmd/mrview.o
>>>>> [CC] cmd/find_SH_peaks.o
>>>>> [CC] cmd/mrstats.o
>>>>> [CC] cmd/average.o
>>>>> [CC] src/dwi/tractography/mds.o
>>>>> [CC] src/mrview/dialog/properties.o
>>>>> [CC] src/mrview/sidebar/roi_analysis/roi_list.o
>>>>> [CC] cmd/tensor2vector.o
>>>>> [CC] lib/image/format/mrtrix.o
>>>>> [CC] src/dwi/tractography/tracker/sd_stream.o
>>>>> [CC] lib/image/format/dicom.o
>>>>> [LD] lib/libmrtrix-0_2_10.dylib
>>>>>
>>>>>
>>>>>  ERROR: [LD] lib/libmrtrix-0_2_10.dylib
>>>>>
>>>>>  g++ -shared lib/math/vector.o lib/math/matrix.o
>>>>> lib/image/format/analyse.o lib/file/dicom/quick_scan.o
>>>>> lib/image/format/list.o lib/file/dicom/image.o lib/file/config.o
>>>>> lib/point.o lib/image/name_parser.o lib/image/format/xds.o lib/data_type.o
>>>>> lib/args.o lib/file/dicom/patient.o lib/file/dicom/tree.o lib/image/fft.o
>>>>> lib/image/header.o lib/file/dicom/mapper.o lib/file/dicom/select_cmdline.o
>>>>> lib/math/linalg.o lib/file/dicom/study.o lib/file/dicom/element.o
>>>>> lib/file/mmap.o lib/image/format/nifti1.o lib/file/dicom/dict.o
>>>>> lib/image/format/mrtrix.o lib/image/format/base.o lib/image/axis.o
>>>>> lib/image/interp.o lib/image/mapper.o lib/file/dicom/series.o lib/mrtrix.o
>>>>> lib/image/format/mri.o lib/image/object.o lib/image/format/dicom.o
>>>>> lib/app.o lib/file/key_value.o -L/usr/local/Cellar/glibmm/2.22.2/lib
>>>>> -L/usr/local/Cellar/glib/2.28.8/lib
>>>>> -L/usr/local/Cellar/libsigc++/2.2.10/lib -L/usr/local/Cellar/gettext/
>>>>> 0.18.1.1/lib -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lgthread-2.0
>>>>> -lglib-2.0 -lintl -lgsl -lgslcblas -o lib/libmrtrix-0_2_10.dylib
>>>>>
>>>>>  failed with output:
>>>>>
>>>>>  Undefined symbols for architecture x86_64:
>>>>>   "_gzopen", referenced from:
>>>>>       MR::Image::Mapper::gunzip(std::basic_string<char,
>>>>> std::char_traits<char>, std::allocator<char> > const&, char const*)in
>>>>> mapper.o
>>>>>   "_gzread", referenced from:
>>>>>       MR::Image::Mapper::gunzip(std::basic_string<char,
>>>>> std::char_traits<char>, std::allocator<char> > const&, char const*)in
>>>>> mapper.o
>>>>>   "_gzclose", referenced from:
>>>>>       MR::Image::Mapper::gunzip(std::basic_string<char,
>>>>> std::char_traits<char>, std::allocator<char> > const&, char const*)in
>>>>> mapper.o
>>>>>       MR::Image::Mapper::gzip(std::basic_string<char,
>>>>> std::char_traits<char>, std::allocator<char> > const&,
>>>>> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>>>>> const&)in mapper.o
>>>>>   "_gzdopen", referenced from:
>>>>>       MR::Image::Mapper::gzip(std::basic_string<char,
>>>>> std::char_traits<char>, std::allocator<char> > const&,
>>>>> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>>>>> const&)in mapper.o
>>>>>   "_gzwrite", referenced from:
>>>>>       MR::Image::Mapper::gzip(std::basic_string<char,
>>>>> std::char_traits<char>, std::allocator<char> > const&,
>>>>> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>>>>> const&)in mapper.o
>>>>> ld: symbol(s) not found for architecture x86_64
>>>>> collect2: ld returned 1 exit status
>>>>>
>>>>>
>>>>>  the following ./build install
>>>>> gives an error too:
>>>>>
>>>>>  Markus-Gschwinds-MacBook-Pro:mrtrix-0.2.10 markus$ sudo ./build
>>>>> install
>>>>> Password:
>>>>> installing executables to "/usr/local/mrtrix/bin" and dynamic library
>>>>> to "/usr/local/mrtrix/lib"...
>>>>> Traceback (most recent call last):
>>>>>   File "./build", line 914, in <module>
>>>>>     apply_recursive (install, os.path.join (lib_dir, libname),
>>>>> os.path.join (dest_lib, libname))
>>>>>   File "./build", line 736, in apply_recursive
>>>>>     action (source, destination)
>>>>>   File "./build", line 753, in install
>>>>>     shutil.copy (source, destination)
>>>>>   File
>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shutil.py",
>>>>> line 88, in copy
>>>>>     copyfile(src, dst)
>>>>>   File
>>>>> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shutil.py",
>>>>> line 52, in copyfile
>>>>>     fsrc = open(src, 'rb')
>>>>> IOError: [Errno 2] No such file or directory:
>>>>> 'lib/libmrtrix-0_2_10.dylib'
>>>>>
>>>>>
>>>>>
>>>>>  What should I do to make it work?
>>>>>
>>>>>  Thanks in advance!
>>>>> Best wishes,
>>>>> Markus
>>>>>
>>>>> 2012/3/5 Donald Tournier <d.tournier at brain.org.au>
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>>  Many of you may be interested in being able to read & write
>>>>>> compressed NIfTI images (.nii.gz) directly within MRtrix. Here is a patch
>>>>>> to do just this, and to also read/write compressed MRtrix format (.mif.gz),
>>>>>> thanks to Chris Adamson (unfortunately just too late for the last release).
>>>>>> This patch is to be applied to the current 0.2.10 release version, with the
>>>>>> following instructions (edit as appropriate):
>>>>>>
>>>>>>  $ cd mrtrix-0.2.10
>>>>>> $ tar xvfj mrtrix-patch-GZ.tar.bz2
>>>>>> $ ./build
>>>>>> $ sudo ./build install
>>>>>>
>>>>>>  Note that this patch hasn't been thoroughly tested, although it
>>>>>> seems to work fine. It's also only been tested on Linux, so may or may not
>>>>>> work on other platforms - if anyone is willing to try it out, I'd be
>>>>>> interested to hear about it.
>>>>>>
>>>>>>  Hope this proves useful!
>>>>>> Cheers,
>>>>>>
>>>>>>  Donald
>>>>>>
>>>>>>
>>>>>>  --
>>>>>> Jacques-Donald Tournier (PhD)
>>>>>> Brain Research Institute, Melbourne, Australia
>>>>>> Tel: +61 (0)3 9035 7033
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mrtrix-discussion mailing list
>>>>>> Mrtrix-discussion at www.nitrc.org
>>>>>> http://www.nitrc.org/mailman/listinfo/mrtrix-discussion
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>  -
>>>>>
>>>>> ------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> Mrtrix-discussion mailing listMrtrix-discussion at www.nitrc.orghttp://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/20120307/99373ca0/attachment-0001.html


More information about the Mrtrix-discussion mailing list