[ITK] [ITK-users] SimpleITK Anaconda Issue

Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] zivrafael.yaniv at nih.gov
Tue Sep 1 13:16:27 EDT 2015


Hello Tassilo,

My guess with regard to the exception is that the glob is returning a list of files where each file contains a 3D image. The SimpleITK ReadImage function is overloaded. It will work with a single file (2D or 3D) - returns a 2D or 3D image as appropriate, and with a list of files (2D) which are slices from a 3D image - returns the 3D image.

To debug your code I would suggest trying to read data using explicit file names and files that contain data for which you know the dimensionality (2D or 3D).

       hope this helps
                Ziv

From: Tassilo Klein <tjklein at gmail.com<mailto:tjklein at gmail.com>>
Date: Tuesday, September 1, 2015 at 12:15 PM
To: Kayhan Batmanghelich <batmanghelich at gmail.com<mailto:batmanghelich at gmail.com>>
Cc: "insight-users at itk.org<mailto:insight-users at itk.org>" <insight-users at itk.org<mailto:insight-users at itk.org>>
Subject: Re: [ITK-users] [ITK] SimpleITK Anaconda Issue

Sure, this this already. Same thing.

On Tue, Sep 1, 2015 at 12:13 PM, Kayhan Batmanghelich <batmanghelich at gmail.com<mailto:batmanghelich at gmail.com>> wrote:
Tassilo,

Can you do test this, instead of glob which produce a lit of file, specify one file and try the ReadImage on one specific file and see if it works or not.

Thanks,
Kayhan

On Tue, Sep 1, 2015 at 12:02 PM, Tassilo Klein <tjklein at gmail.com<mailto:tjklein at gmail.com>> wrote:
Hi,

well, it doesn't work for me. I am just trying to load a Nifti (.nii) image:


dwiImg = sitk.ReadImage(glob.glob(dataPath+'/*DWI*/*.nii'))

when getting the error. Reinstallation didn't help either. There is nothing special about these files. It's MRIs.


home/tjklein/anaconda/envs/sitkpy/lib/python2.7/site-packages/SimpleITK/SimpleITK.py in ReadImage(*args)   7726    7727     """
-> 7728     return _SimpleITK.ReadImage(*args)   7729 class HashImageFilter(ProcessObject):   7730     """

RuntimeError: Exception thrown in SimpleITK ReadImage: /home/blowekamp/anaconda/conda-bld/work/Code/IO/src/sitkImageSeriesReader.cxx:143:
sitk::ERROR: The file in the series have unsupported 3 dimensions.


Thanks,
 Tassilo

On Sat, Aug 29, 2015 at 11:12 AM, Bradley Lowekamp <blowekamp at mail.nih.gov<mailto:blowekamp at mail.nih.gov>> wrote:
Hello,

That is great you got SimpleITK up and running by following those updated instructions for Anaconda.

Could you describe what you are trying to do and have a snippet of code?

Brad

On Aug 28, 2015, at 6:52 PM, Tassilo Klein <tjklein at gmail.com<mailto:tjklein at gmail.com>> wrote:

Thanks Ziv,

I forgot to activate the environment before.

After following the steps, now I get a different error when trying to load an image, which worked some time before:


/home/tjklein/anaconda/envs/sitkpy3/lib/python2.7/site-packages/SimpleITK/SimpleITK.py in ReadImage(*args)   7726    7727     """
-> 7728     return _SimpleITK.ReadImage(*args)   7729 class HashImageFilter(ProcessObject):   7730     """

RuntimeError: Exception thrown in SimpleITK ReadImage: /home/blowekamp/anaconda/conda-bld/work/Code/IO/src/sitkImageSeriesReader.cxx:143:
sitk::ERROR: The file in the series have unsupported 3 dimensions.



On Thu, Aug 27, 2015 at 5:10 PM, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] <zivrafael.yaniv at nih.gov<mailto:zivrafael.yaniv at nih.gov>> wrote:
Hi Tassilo,

Did you downgrade to libpng1.5 after creating the virtual environment? This is what I suggested in the thread you cited and was the solution at the time.  It no longer works because anaconda upgraded additional packages.

When you create the virtual environment with libpng set to 1.5 (conda create -n sitkpy anaconda libpng=1.5) all of the dependent packages are downgraded to work with this version of libpng and then you will not have this issue. The three steps are given in the FAQ that I pointed you to - I am assuming here you did not follow that solution, it is pasted below for your convenience:

conda create -n sitkpy anaconda libpng=1.5
conda install -c https://conda.binstar.org/simpleitk/channel/main SimpleITK
conda install libpng=1.5

If you followed this set of instructions and it doesn't work, let us know and we will try to recreate the problem and find a solution.

          regards
              Ziv

________________________________
From: Tassilo Klein [tjklein at gmail.com<mailto:tjklein at gmail.com>]
Sent: Thursday, August 27, 2015 4:56 PM
To: Yaniv, Ziv Rafael (NIH/NLM/LHC) [C]
Cc: insight-users at itk.org<mailto:insight-users at itk.org>
Subject: Re: [ITK-users] SimpleITK Anaconda Issue

Hi Ziv,

thanks. yes, that's what I did but then I get these  errors:


/home/tjklein/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py in <module>()     56 import matplotlib     57 from matplotlib import afm---> 58 from matplotlib import ft2font     59 from matplotlib import rcParams, get_cachedir     60 from matplotlib.cbook import is_string_likeImportError: libpng16.so.16: cannot open shared object file: No such file or directory

On Thu, Aug 27, 2015 at 3:55 PM, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] <zivrafael.yaniv at nih.gov<mailto:zivrafael.yaniv at nih.gov>> wrote:
Hello Tassilo,

Please follow the instructions found in our FAQ 'I am using the binary distribution of SimpleITK for Anaconda, why do I get an error about libpng?' found here: http://www.itk.org/Wiki/SimpleITK/FAQ

We are working on a more permanent solution for our next release.

               regards
                      Ziv

________________________________
From: Tassilo Klein [tjklein at gmail.com<mailto:tjklein at gmail.com>]
Sent: Thursday, August 27, 2015 3:42 PM
To: insight-users at itk.org<mailto:insight-users at itk.org>
Subject: [ITK-users] SimpleITK Anaconda Issue

Hi,

I have issues getting my SimpleITK running on a Linux machine.

I used to get errors:

http://public.kitware.com/pipermail/community/2015-May/009117.html


ImportError: libpng15.so.15: cannot open shared object file: No such


Then I took an earlier version of libpng as mentioned here:

http://public.kitware.com/pipermail/community/2015-May/009120.html

conda install libpng=1.5.13


But then I get the following error:


/home/tjklein/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py in <module>()     32 import matplotlib.artist as martist     33 import matplotlib.cbook as cbook---> 34 import matplotlib.collections as collections     35 import matplotlib.colors as colors     36 import matplotlib.contour as contour/home/tjklein/anaconda/lib/python2.7/site-packages/matplotlib/collections.py in <module>()     25 import matplotlib.artist as artist     26 from matplotlib.artist import allow_rasterization---> 27 import matplotlib.backend_bases as backend_bases     28 import matplotlib.path as mpath     29 from matplotlib import _path/home/tjklein/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py in <module>()     54      55 import matplotlib.tight_bbox as tight_bbox---> 56 import matplotlib.textpath as textpath     57 from matplotlib.path import Path     58 from matplotlib.cbook import mplDeprecation/home/tjklein/anaconda/lib/python2.7/site-packages/matplotlib/textpath.py in <module>()     17 from matplotlib.path import Path     18 from matplotlib import rcParams---> 19 import matplotlib.font_manager as font_manager     20 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING     21 from matplotlib.ft2font import LOAD_TARGET_LIGHT/home/tjklein/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py in <module>()     56 import matplotlib     57 from matplotlib import afm---> 58 from matplotlib import ft2font     59 from matplotlib import rcParams, get_cachedir     60 from matplotlib.cbook import is_string_likeImportError: libpng16.so.16: cannot open shared object file: No such file or directory


Any idea?

Best,
 Tassilo


_____________________________________
Powered by www.kitware.com<http://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://public.kitware.com/mailman/listinfo/insight-users



_____________________________________
Powered by www.kitware.com<http://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://public.kitware.com/mailman/listinfo/insight-users

_______________________________________________
Community mailing list
Community at itk.org<mailto:Community at itk.org>
http://public.kitware.com/mailman/listinfo/community



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150901/28e180ee/attachment-0001.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://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list