[Insight-users] MINC 1/2 external module

Vladimir S. FONOV vladimir.fonov at gmail.com
Mon Apr 2 17:18:19 EDT 2012


Hello Steven,

I think I have fixed this bug , also I have separated minc4itk from main 
minc library (for now). So, now to compile one will have to compile minc 
and then separately include minc4itk:

git clone git://github.com/vfonov/minc.git , checkout minc4itk  , 
configure with cmake

And then insert minc4itk module in Modules/External ( 
git://github.com/vfonov/minc4itk.git ) , you will have to specify 
location of the installed minc library ( i.e <prefix>/lib )

I have also added itkMincTransformIO to read and write xfm files using 
TransformFactory mechanism.  Currently only AffineTransform<double,3> 
and DisplacementFieldTransform<double,3> are supported.

Also, one need to update CMake/UseITK.cmake

In line "foreach (ImageFormat  Nifti Nrrd Gipl HDF5 )" add Minc so it 
becomes foreach (ImageFormat  Nifti Nrrd Gipl HDF5 Minc)
and also in "foreach (TransformFormat  Matlab Txt HDF5)" also add Minc


On 12-04-02 04:55 PM, Steven Mocking wrote:
> Hi Vladimir,
>
> Thanks for your efforts. Definitely looking forward to using MINC with
> ITK and decided to give it a try today, but get compiler errors:
>
> InsightToolkit-4.1.0/Modules/External/minc/volume_io/Prog_utils/time.c:
> In function 'current_cpu_seconds':
> InsightToolkit-4.1.0/Modules/External/minc/volume_io/Prog_utils/time.c:85:
> error: expected '=', ',', ';', 'asm' or '__attribute__' before 'first'
> InsightToolkit-4.1.0/Modules/External/minc/volume_io/Prog_utils/time.c:85:
> error: 'first' undeclared (first use in this function)
> InsightToolkit-4.1.0/Modules/External/minc/volume_io/Prog_utils/time.c:85:
> error: (Each undeclared identifier is reported only once
> InsightToolkit-4.1.0/Modules/External/minc/volume_io/Prog_utils/time.c:85:
> error: for each function it appears in.)
> InsightToolkit-4.1.0/Modules/External/minc/volume_io/Prog_utils/time.c:86:
> error: 'clock_t' undeclared (first use in this function)
> InsightToolkit-4.1.0/Modules/External/minc/volume_io/Prog_utils/time.c:86:
> error: expected ';' before 'current'
> InsightToolkit-4.1.0/Modules/External/minc/volume_io/Prog_utils/time.c:97:
> error: 'current' undeclared (first use in this function)
> make[2]: ***
> [Modules/External/minc/CMakeFiles/ITKIOMINC.dir/volume_io/Prog_utils/time.c.o]
> Error 1
> make[1]: *** [Modules/External/minc/CMakeFiles/ITKIOMINC.dir/all] Error 2
> make: *** [all] Error 2
>
> It seems like time.h is not getting included because HAVE_SYS_TIME_H and
> HAVE_UNISTD_H are defined, but TIME_WITH_SYS_TIME is not, even though my
> system has both sys/time.h and time.h. If I comment out the
> pre-processing directives so that both get included the code compiles
> with warnings:
>
> InsightToolkit-4.1.0/Modules/External/minc/test/../ezminc/minc_io_exceptions.h:
> In constructor 'minc::generic_error::generic_error(const char*, int,
> const char*, int)':
> InsightToolkit-4.1.0/Modules/External/minc/test/../ezminc/minc_io_exceptions.h:31:
> warning: declaration of 'code' shadows a member of 'this'
> InsightToolkit-4.1.0/Modules/External/minc/test/../ezminc/minc_io_exceptions.h:31:
> warning: declaration of 'msg' shadows a member of 'this'
> InsightToolkit-4.1.0/Modules/External/minc/test/../ezminc/minc_io_exceptions.h:31:
> warning: declaration of 'line' shadows a member of 'this'
> InsightToolkit-4.1.0/Modules/External/minc/test/../ezminc/minc_io_exceptions.h:31:
> warning: declaration of 'file' shadows a member of 'this'
> InsightToolkit-4.1.0/Modules/External/minc/test/itkMINCImageIOTest.cxx:
> At global scope:
> InsightToolkit-4.1.0/Modules/External/minc/test/itkMINCImageIOTest.cxx:44:
> warning: 'void RandomPix(vnl_random&, double&)' defined but not used
>
> Unfortunately linking fails (full text in attachment):
>
> ../../../../lib/libITKIOMINC-4.1.a(minc_1_rw.cpp.o): In function
> `minc::minc_1_writer::open(char const*, std::vector<minc::dim_info,
> std::allocator<minc::dim_info> > const&, int, nc_type, int)':
> minc_1_rw.cpp:(.text+0x2633): undefined reference to `H5Iget_type'
> ../../../../lib/libITKIOMINC-4.1.a(minc_1_rw.cpp.o): In function
> `minc::minc_1_reader::open(char const*, bool, bool, bool)':
> minc_1_rw.cpp:(.text+0x2c15): undefined reference to `H5Iget_type'
> ../../../../lib/libITKIOMINC-4.1.a(netcdf_convenience.c.o): In function
> `miclose':
> netcdf_convenience.c:(.text+0x1300): undefined reference to `H5Iget_type'
> ../../../../lib/libITKIOMINC-4.1.a(netcdf_convenience.c.o): In function
> `miopen':
> netcdf_convenience.c:(.text+0x18f1): undefined reference to
> `H5check_version'
> netcdf_convenience.c:(.text+0x1929): undefined reference to
> `H5check_version'
> ../../../../lib/libITKIOMINC-4.1.a(hdf_convenience.c.o): In function
> `hdf_access':
> hdf_convenience.c:(.text+0x50): undefined reference to `H5Eauto_is_v2'
> hdf_convenience.c:(.text+0x69): undefined reference to `H5Eget_auto2'
> hdf_convenience.c:(.text+0x74): undefined reference to `H5Eset_auto2'
> ... <snip hundreds of lines> ...
>
> Regards,
> Steven
>
> On 03/21/12 17:20, Vladimir S. FONOV wrote:
>> Hello Everybody,
>>
>>
>> I have managed to create an External module for ITKv4 to add MINC1 and
>> MINC2 io support.
>>
>> Unfortunately installation requires tweaking CMake/UseITK.cmake
>>
>> So, for those who are interested in trying it out:
>> after obtaining sources of ITKv4, apply provided patch ( it adds minc
>> file format to the list of recognized formats) and clone minc into
>> external module directory:
>>
>>
>> patch < add_minc_file_format.patch
>> cd Modules/External/
>> git clone git://github.com/vfonov/minc.git
>>
>>
>> To compile you would need to have netcdf library installed in the
>> system, module will use HDF5 bundled with ITK.
>>
>> As you can see the whole minc project is inserted as a module, if you
>> think that it would be better idea to have only ITK - wrapper
>> interface in the module let me know.
>>
>>
>>
>> _____________________________________
>> Powered bywww.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.php
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>
> The information in this e-mail is intended only for the person to whom it is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you
> in error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>


-- 
Best regards,

Vladimir S. FONOV ~ vladimir <dot> fonov <at> gmail <dot> com


More information about the Insight-users mailing list