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

Donald Tournier d.tournier at brain.org.au
Sun Mar 18 05:11:16 PDT 2012


Hi Markus,

This latest error you're getting is pretty strange. It looks like mrview
requires libfreetype version >= 14.0.0, which is exactly what is installed
(as you checked with otool), but for some strange reason it gets version
10.0.0 when launched within matlab.

I have no idea how that can happen, and I'm not familiar enough with MacOSX
have any sensible suggestions. The only thing I can think of is that there
may be different versions of the library installed (maybe the older one is
part of the matlab install?), and somehow the wrong one gets loaded. What
does system('otool -L mrview') report?

Cheers,

Donald.


On 9 March 2012 23:47, Markus Gschwind <markus.gschwind at gmail.com> wrote:

> Dear Donald,
>
> I am sorry to get back to that problem once more.
>
> Before this update, I could call mrview like any other mrtrix tool from
> within MATLAB via te 'system' command.
>
> Now there is an error of dylib
>
> >>  system('mrview')
> dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
>   Referenced from: /usr/local/bin/mrview
>   Reason: Incompatible library version: mrview requires version 14.0.0 or
> later, but libfreetype.6.dylib provides version 10.0.0
> mrview: Trace/breakpoint trap
>
> ans =
>
>    133
>
>
> However the dylib is actually there:
>
>
> >> system('otool -L /usr/X11/lib/libfreetype.6.dylib')
> /usr/X11/lib/libfreetype.6.dylib:
>  /usr/X11/lib/libfreetype.6.dylib (compatibility version 14.0.0, current
> version 14.2.0)
> /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
>  /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version
> 1.0.5)
> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
> (compatibility version 1.0.0, current version 44.0.0)
>  /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices
> (compatibility version 1.0.0, current version 38.0.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
> 125.2.11)
>  /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
> (compatibility version 150.0.0, current version 550.44.0)
>
> ans =
>
>      0
>
>
> It seems that mrview references to an old dylib version? How could I fix
> that?
>
> Thank you so much!
>
> Markus
>
>
> 2012/3/9 Markus Gschwind <markus.gschwind at gmail.com>
>
>> Dear Donald!
>>
>> Sorry for the delayed answer.
>>
>> Thank you very much! I did now as you proposed
>>
>> "./build clean && ./build && sudo ./build install".
>>
>> and indeed this fixed the problem!
>>
>> Thank you again for your help, very much appreciated!!
>> Best, Markus
>>
>>
>>
>> 2012/3/9 Donald Tournier <d.tournier at brain.org.au>
>>
>>> Hi Markus,
>>>
>>> I was just looking through your previous email, and there was something
>>> in the command-line log that looks like it might explain your problem:
>>>
>>>  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$
>>>>
>>>
>>> Looks like the ./build command did nothing, when if should at the very
>>> least redo the library link stage. So the ./build install would simply copy
>>> over the existing library, assuming it was built as part of a previous
>>> unpatched install, and that library would therefore not have support for
>>> GZ. Easy to fix that, if you simply do "./build clean && ./build && sudo
>>> ./build install".
>>>
>>> Hope that fixes the problem...
>>> Cheers,
>>>
>>> Donald.
>>>
>>>
>>>>
>>>>
>>>>
>>>> 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/20120318/f305156c/attachment-0001.html


More information about the Mrtrix-discussion mailing list