InsightSoftwareConsortium / ITKColorNormalization

Structure preserving color normalization on H&E images using a reference image
Apache License 2.0
18 stars 5 forks source link

BUG: DistinguishersToColors now matches to hematoxylin and eosin #30

Closed Leengit closed 2 years ago

Leengit commented 2 years ago

A bug report indicated an exception thrown for Hematoxylin and Eosin are getting mixed up; failed when it should not have. Further investigation indicated that an earlier exception should have been thrown for The image to be normalized could not be processed; does it have white, blue, and pink pixels?. That was triggered because the same distinguisher was best at suppressing both the color suppressed by hematoxylin and the color suppressed by eosin. The proper behavior is that the distinguishers assigned to these stains should be distinct.

The fix has a new approach for matching distinguishers with stains. Specifically, when considering only the 2-dimensional plane that is the colors that are suppressed by hematoxylin and eosin, the angle of each distinguisher suppression vector can be measured in that plane. The assignment of distinguisher to stain is based upon which distinguisher is closer in angle to that stain's axis.