Not a structure-aware algorithm, but it does a good job of eliminating worms in highlight and shadow areas. Source paper: https://www.imaging.org/common/uploaded%20files/pdfs/Papers/1999/RP-0-93/1787.pdf