imglib / imglib2-roi

Regions of interest (ROIs) and labelings for ImgLib2
Other
8 stars 8 forks source link

Improve mask equality semantics #43

Closed ctrueden closed 5 years ago

ctrueden commented 5 years ago

Each mask now has a type, accessible via the maskType() method, identifying which kind of ROI it is intended to be. A class is returned, and the default behavior is to return the concrete class of the object. Geometric mask types set their type to their associated geometric mask interface -- the following types are currently defined: Box, Line, PointMask, Polygon2D, Polyline, RealPointCollection and SuperEllipsoid. (Ellipsoid and Sphere are simply special cases of SuperEllipsoid, with the same equality semantics.)

Each mask type has its own equality semantics. Static utility methods are provided in the associated interfaces for computing hashCode and equals for the built-in geometric mask types. And the implementing class hierarchies now lean on these utility methods rather than recapitulating the logic.

RealPointCollection now has a size() method, for efficient equality testing.

ctrueden commented 5 years ago

Should be ready for review and merge any time.

ctrueden commented 5 years ago

@tpietzsch I know we are in crunch time, but if you merge this, I can include it in the impending big component roll-out.