rifkinni
rifkinni

Reputation: 21

Import threshold_yen and threshold_isodata from skimage.filter

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?

Upvotes: 0

Views: 1669

Answers (1)

Tony S Yu
Tony S Yu

Reputation: 3163

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

Upvotes: 2

Related Questions