[ITK Community] [Insight-users] Problems with SCIFIO

Michka Popoff michkapopoff at gmail.com
Fri Feb 21 04:38:03 EST 2014


To hide the warnings I found some code on the web to catch the stderr and to hide it. Here is my code for ITK : https://gist.github.com/iMichka/9131352
We are currently working on fixing these warnings.

Ideally they should be triggered with the python warnings module, were it is much easier to enable/disable warnings.
I am currently cleaning up a little bit ITK’s python code, I’ll try to replace the sys stderr warnings with http://docs.python.org/2/library/warnings.html
This won’t happen until the next ITK release so you’ll have to go with my solution for the moment.

Michka


On 21 févr. 2014, at 10:22, Sami Koho <sami.koho at gmail.com> wrote:

> Hi Matt & Bradley,
> 
> I am currently reviewing these patches. My intention is to build ITK with the patches enabled one by one and see whether they help. Now that I have built the library around 10 times in a week I noticed that every time I change the source code or change something in the cmakecache.txt, the whole Python wrapping gets rebuilt from the start (whereas on the C++ side only the modified modules get updated). Is this the normal behavior? It takes quite a bit of time to start from the "beginning" every time.
> 
> Another question related to the Python wrapping: is there a way for suppressing the Warning messages that appear when using ITK? I know that in Python in general one can ignore certain types of warnings, but I don't know how to block the ones from ITK. 
> 
> Best,
> 
> Sami
> 
> 
> On Wed, Feb 19, 2014 at 5:28 PM, Matt McCormick <matt.mccormick at kitware.com> wrote:
> Hi Sami,
> 
> Please review [1] this patch [2], which may also fix your problem (I
> have not tested it for your case where it is installed) and this patch
> [3], which should also fix the issue by wrapping the SCIFIO module.
> 
> Thanks,
> Matt
> 
> [1] http://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySoftwareProcess/PerformAGerritReview/index.html
> 
> [2] http://review.source.kitware.com/#/c/14492/
> 
> [3] http://review.source.kitware.com/#/c/14493/
> 
> On Wed, Feb 19, 2014 at 6:19 AM, Sami Koho <sami.koho at gmail.com> wrote:
> > Hello Bradley,
> >
> > here is what ldd gives:
> >
> > sami at PAM-deb:~/Programming/Build/ITK451$ ldd
> > /usr/local/lib/libitkSCIFIO-4.5.so.1
> >     linux-vdso.so.1 =>  (0x00007fff9c1ff000)
> >     libITKIOImageBase-4.5.so.1 => /usr/local/lib/libITKIOImageBase-4.5.so.1
> > (0x00007fc93f7fc000)
> >     libITKCommon-4.5.so.1 => /usr/local/lib/libITKCommon-4.5.so.1
> > (0x00007fc93f530000)
> >     libitksys-4.5.so.1 => /usr/local/lib/libitksys-4.5.so.1
> > (0x00007fc93f2eb000)
> >     libITKVNLInstantiation-4.5.so.1 =>
> > /usr/local/lib/libITKVNLInstantiation-4.5.so.1 (0x00007fc93f059000)
> >     libitkvnl_algo-4.5.so.1 => /usr/local/lib/libitkvnl_algo-4.5.so.1
> > (0x00007fc93ede5000)
> >     libitkv3p_lsqr-4.5.so.1 => /usr/local/lib/libitkv3p_lsqr-4.5.so.1
> > (0x00007fc93ebdf000)
> >     libitkvnl-4.5.so.1 => /usr/local/lib/libitkvnl-4.5.so.1
> > (0x00007fc93e5cf000)
> >     libitkvcl-4.5.so.1 => /usr/local/lib/libitkvcl-4.5.so.1
> > (0x00007fc93e3cd000)
> >     libitkv3p_netlib-4.5.so.1 => /usr/local/lib/libitkv3p_netlib-4.5.so.1
> > (0x00007fc93e0d2000)
> >     libitkdouble-conversion-4.5.so.1 =>
> > /usr/local/lib/libitkdouble-conversion-4.5.so.1 (0x00007fc93dec7000)
> >     libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
> > (0x00007fc93dcab000)
> >     libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc93daa6000)
> >     libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc93d824000)
> >     libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> > (0x00007fc93d51d000)
> >     libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
> > (0x00007fc93d306000)
> >     libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc93cf7b000)
> >     /lib64/ld-linux-x86-64.so.2 (0x00007fc93fc5a000)
> >
> > I will comment on the tests tomorrow, as I did not build the testing modules
> > previously (usually saves me a lot of time when compiling)
> >
> > Best,
> >
> > Sami
> >
> >
> >
> > On Tue, Feb 18, 2014 at 3:48 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>
> > wrote:
> >>
> >> Hello,
> >>
> >> What is the output of "ldd /usr/local/libitkSCIFIO-4.5.so.1"?
> >>
> >> Do all the ITK tests pass? If you run WrapITK out of the build directory
> >> does it work?
> >>
> >> Brad
> >>
> >> On Feb 18, 2014, at 6:16 AM, Sami Koho <sami.koho at gmail.com> wrote:
> >>
> >> Hello again,
> >>
> >> I finally had some time to dedicate to this SCIFIO problem. Just to make
> >> sure that I did not do anything stupid, I made a clean build of the whole
> >> ITK (with the new 4.5.1 version), with SCIFIO module enabled. Then I removed
> >> my old installation from /usr/local/lib - by manually deleting the .so
> >> files, the ITK4.5 directory and the cmake directory containing some ITK
> >> files - after which I installed my new build of the ITK4.5.1. I still have
> >> the same problem:
> >>
> >> Traceback (most recent call last):
> >>   File "itk_image_load_test.py", line 13, in <module>
> >>     image = itkutils.itk_read_image(image_path, image_type='IUC2')
> >>   File
> >> "/usr/local/lib/python2.7/dist-packages/iocbio/io/itk_io_utilites.py", line
> >> 18, in itk_read_image
> >>     itk_image_reader = getattr(itk.ImageFileReader, image_type).New()
> >>   File "/usr/local/lib/ITK-4.5/Python/itkLazy.py", line 37, in
> >> __getattribute__
> >>     itkBase.LoadModule(module, namespace)
> >>   File "/usr/local/lib/ITK-4.5/Python/itkBase.py", line 95, in LoadModule
> >>     LoadModule(dep, namespace)
> >>   File "/usr/local/lib/ITK-4.5/Python/itkBase.py", line 103, in LoadModule
> >>     if not swigModuleName in sys.modules: module =
> >> loader.load(swigModuleName)
> >>   File "/usr/local/lib/ITK-4.5/Python/itkBase.py", line 214, in load
> >>     return imp.load_module(name, fp, pathname, description)
> >>   File "/usr/local/lib/ITK-4.5/Python/ITKCommonPython.py", line 30, in
> >> <module>
> >>     _ITKCommonPython = swig_import_helper()
> >>   File "/usr/local/lib/ITK-4.5/Python/ITKCommonPython.py", line 26, in
> >> swig_import_helper
> >>     _mod = imp.load_module('_ITKCommonPython', fp, pathname, description)
> >> ImportError: libitkSCIFIO-4.5.so.1: cannot open shared object file: No
> >> such file or directory
> >>
> >> Yet, as I reported last time around, the libitkSCIFIO-4.5.so.1 is there in
> >> /usr/local/lib with all the other ITK shared object files. Is there
> >> something I may still be doing wrong, or is this a bug?
> >>
> >> I will just have to use ITK without SCIFIO for now...
> >>
> >> Best,
> >>
> >> Sami
> >>
> >>
> >>
> >> On Fri, Feb 14, 2014 at 8:41 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>
> >> wrote:
> >>>
> >>> Hello Sami,
> >>>
> >>> This sounds like an installation issue.
> >>>
> >>> Did you reinstall ITK w/ WrapITK after rebuilding? Are you running out of
> >>> the build directory? Where is the libitkSCIFIO-4.5.so.1 file?
> >>>
> >>> Brad
> >>>
> >>> On Feb 14, 2014, at 4:00 AM, Sami Koho <sami.koho at gmail.com> wrote:
> >>>
> >>> Hello,
> >>>
> >>> I have been having some problems with reading my image data with ITK. My
> >>> images are microscope images, originally from a Leica confocal, saved as 3D
> >>> tiff volumes in ImageJ. When I open such a file with ITK (version 4.5), I
> >>> get a complaint about unknown tags and lose all my metadata (such as voxel
> >>> size information). SImilarly. when I save a tiff file with ITK, I seem to
> >>> lose all the metadata - at least ImageJ does not understand it.
> >>>
> >>> I ended up installing MetaImage plugin to ImageJ, allowing me to export
> >>> to mhd format, which seems to work, for reading data into my ITK application
> >>> at least. I still have problems showing the results in ImageJ, as the voxel
> >>> sizes go wrong on save.
> >>>
> >>> Last night I compiled ITK with SCIFIO module enabled, as I thought that
> >>> this would make handling microscope images a bit more easy. Everything
> >>> compiled nicely, but now I get a following error:
> >>>
> >>> python rescaling_test.py psf_red.tif
> >>> Traceback (most recent call last):
> >>>   File "rescaling_test.py", line 18, in <module>
> >>>     image = itkio.itk_read_image(image_path)
> >>>   File
> >>> "/usr/local/lib/python2.7/dist-packages/iocbio/io/itk_io_utilites.py", line
> >>> 18, in itk_read_image
> >>>     itk_image_reader = getattr(itk.ImageFileReader, image_type).New()
> >>>   File "/usr/local/lib/ITK-4.5/Python/itkLazy.py", line 37, in
> >>> __getattribute__
> >>>     itkBase.LoadModule(module, namespace)
> >>>   File "/usr/local/lib/ITK-4.5/Python/itkBase.py", line 95, in LoadModule
> >>>     LoadModule(dep, namespace)
> >>>   File "/usr/local/lib/ITK-4.5/Python/itkBase.py", line 103, in
> >>> LoadModule
> >>>     if not swigModuleName in sys.modules: module =
> >>> loader.load(swigModuleName)
> >>>   File "/usr/local/lib/ITK-4.5/Python/itkBase.py", line 214, in load
> >>>     return imp.load_module(name, fp, pathname, description)
> >>>   File "/usr/local/lib/ITK-4.5/Python/ITKCommonPython.py", line 30, in
> >>> <module>
> >>>     _ITKCommonPython = swig_import_helper()
> >>>   File "/usr/local/lib/ITK-4.5/Python/ITKCommonPython.py", line 26, in
> >>> swig_import_helper
> >>>     _mod = imp.load_module('_ITKCommonPython', fp, pathname, description)
> >>> ImportError: libitkSCIFIO-4.5.so.1: cannot open shared object file: No
> >>> such file or directory
> >>>
> >>> I am using ITK on 64bit Debian Wheezy (with Python wrapping). I checked,
> >>> and there is a file called  libitkSCIFIO-4.5.so.1 in /usr/local/lib. Does
> >>> someone have an idea, what is going wrong here?
> >>>
> >>> Best,
> >>>
> >>> Sami
> >>>
> >>> _____________________________________
> >>> Powered by www.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
> >>>
> >>>
> >>
> >>
> >
> >
> > _____________________________________
> > Powered by www.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
> >
> 
> _____________________________________
> Powered by www.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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140221/45fcd73d/attachment-0002.html>
-------------- next part --------------
_____________________________________
Powered by www.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


More information about the Community mailing list