0

I am working with different threshold algorithms from SKimage, and when I go to import certain packages I get an error, but have no problem with others. For example:

from skimage.filter import threshold_adaptive, threshold_isodata returns the traceback: ImportError: cannot import name threshold_isodata. I am using python 2.7, and following the documentation found here: http://scikit-image.org/docs/dev/api/skimage.filter.html#skimage.filter.threshold_isodata

Specifically, I'm hoping to use threshold_isodata and threshold_yen. Does anybody have suggestions for how to solve this error? Alternatively, are there other packages that use the same algorithm?

rifkinni
  • 21
  • 5
  • Which version are you using? `threshold_yen` was released in v0.9 and `threshold_isodata` is only available in the master repo (i.e. not officially released). The website defaults to the development docs. For official releases the doc path looks like http://scikit-image.org/docs/0.9.x/ – Tony S Yu May 24 '14 at 20:45
  • I'm running windows, so I'm using the distribution found here http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-image. It is version 0.9.3. This explains why isodata would not be working but doesn't explain yen. – rifkinni May 25 '14 at 14:35

1 Answers1

2

As mentioned in a comment, threshold_isodata is only available in the master repo (i.e. not officially released in v0.9), hence the import error.

It turns out that threshold_yen wasn't properly imported into the filter subpackage in version 0.9. (This has been fixed in master.) Until v0.10 is released, you should import threshold_yen as follows:

from skimage.filter.thresholding import threshold_yen

EDIT: Note that this question and answer are specific to very old versions of scikit-image. The skimage.filter module was renamed skimage.filters in v0.11

Tony S Yu
  • 3,003
  • 30
  • 40