'itk' has no attribute 'structure_preserving_color_normalization_filter'

The Python 3.8 script below fails with:
AttributeError: module ‘itk’ has no attribute ‘structure_preserving_color_normalization_filter’

# https://www.kitware.com/new-insight-toolkit-itk-module-for-structure-preserving-color-normalization/

import itk

# downloaded to current directory from links given above
input_image_filename = 'Hard.png'
reference_image_filename = 'Easy1.png'

input_image = itk.imread(input_image_filename)
reference_image = itk.imread(reference_image_filename)

eager_normalized_image = itk.structure_preserving_color_normalization_filter(
    input_image,
    reference_image,
    color_index_suppressed_by_hematoxylin=0,
    color_index_suppressed_by_eosin=1)

itk.imwrite(eager_normalized_image, output_image_filename)

Is there a way to correct this attempt at using itk’s H&E color normalization in the simplest case?

Cheers,
Jon

Did you “pip install itk-spcn”?

1 Like

Nope. Thanks. Now I just get errors I’ve handled before having to do with type mismatches to/from my numpy/medical image data