[ITK] [ITK-users] matplotlib bug with SimpleITK

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Jul 30 10:10:22 EDT 2015


Hello,


1) Easiest way to get a SciPy stack.

Unfortunately, this is different depending on depending on the operating system, and even architecture, additionally it has changed though time too.

It sounds like you are using Python 64 on windows. I use those same packages provided by the third party.  However, for windows 32 those packages and available on pipy, and pip install works.

You may want to look into providers of the python distributions for scientific computing such as Anaconda or Canopy. Additionally linux package managers work quite well for getting a non-cutting edge version of the SciPy stack.

http://www.itk.org/Wiki/SimpleITK/FAQ#I_am_using_the_binary_distribution_of_SimpleITK_for_Anaconda.2C_why_do_I_get_an_error_about_libpng.3F

2) Don't worry about the SCALE_UNKNOW

We should update the image in the the notebook repository. Did you know the classic "cthead1.png" file in ITK, is actually an RGB image?

3) Why can I see Image in matplotlib

I have no idea. I don't know how you are running that code. I don't know what matplotlib backend you are using. I don't know if you are trying to view a RGB or a gray scale image or apply a color map. It could be as simple as a intensity scaling issue.

Matplotlib is nice to render results inline in notebooks to share. But to do really work with 3D images an external viewer is needed. This sitk::Show command defaults to ImageJ, but can easily be reconfigured to work with 3D Slicer or ITK SNAP.


HTH,
Brad

On Jul 29, 2015, at 5:10 PM, Audette, Michel A. <maudette at odu.edu> wrote:

> Dear ITK users, 
> 
> I'm trying to set up a project with SimpleITK's Python interface for high school-level researchers. I've had to use some Python resources available at Christoph Gohlke's website because I had the C++ compilation error (error: Unable to find vcvarsall.bat) when I tried the usual pip installation route. I felt that I had no choice but to use his .whl files for numpy and matplotlib at http://www.lfd.uci.edu/~gohlke/pythonlibs/ . 
> 
> However, I now am seeing the following bug... 
>>>> import SimpleITK as sitk
>>>> from pylab import *
>>>> image1 = sitk.ReadImage("C:\Python27\InsightSoftwareConsortium-SimpleITK-Notebooks\Data\cthead1.jpg")
>>>> nda = sitk.GetArrayFromImage(image1)
>>>> imshow(nda)
> <matplotlib.image.AxesImage object at 0x0000000005DE0320>
> (no display)
> 
> Matplotlib seems to be doing something, but produces no display. 
> 
> (Btw, the software was complaining when I tried to use this set of instructions with cthead1.png: PNGImageIO was giving me two warnings related to SCALE_UNKNOWN detected... )
> 
> Can anyone suggest a solution that will allow me to run the Pythonic Image tutorial in the SimpleITK Notebooks website? 
> 
> Thanks for your kind support. 
> 
> Michel
> Michel Audette, Ph.D.
> Assistant Professor,
> Department of Modeling, Simulation and Visualization Engineering,
> Old Dominion University,
> Norfolk, VA.
> _____________________________________
> 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

_____________________________________
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