Closed ctrueden closed 5 years ago
@ctrueden Thank you for your work on this (and cleaning up some of my tests)!
Add methods to
GeomMaths
to compareLocalizable
andRealLocalizable
positions. (Maybe these should go intonet.imglib2.util.Util
? What do others think?)
I think these methods should go in net.imglib2.util.Util
, because they seem more general than GeomMaths
.
Aside from that though, I think these changes are wonderful and (pending a decision on the above) are good to merge. Thoughts @tpietzsch?
Thanks for reviewing, @awalter17. I filed imglib/imglib2#211 to add the locationsEqual
methods to Util
in ImgLib2 core. @tpietzsch If you like it, we can leave this PR here until it is merged and released and then update the PR accordingly. Or if not, close it and I'll put those methods wherever you deem best.
Rebased over the latest master. I also added a commit cleaning up the GeomMasks
javadoc. And I removed the GeomMaths.locationsEqual
methods in favor of Util.locationsEqual
from imglib/imglib2#211. This PR depends on imglib/imglib2#211 being merged and released first.
The build on master
failed because of a typo in the javadoc here: @Link
-> @link
Fixed with 07f5716162c1c95f81389a9d8df9819d17f227d7
This branch makes the following improvements:
Polygon2D
andPolyline
common API is now inherited fromPolyshape
interface.WritablePolygon2D
andWritablePolyline
common API is now inherited fromWritablePolyshape
interface. TheWritablePolygon2D#addVertex(int, double[])
method is deprecated in favor ofWritablePolyshape#addVertex(int, RealLocalizable)
.DefaultWritablePolygon2D#addVertex
,DefaultWritablePolyline#addVertex
andDefaultWritableRealPointCollection#addPoint
now update the bounds based on the new point only, avoiding an O(n) bounds rebuild. (RealPointSampleListWritableRealPointCollection
did not suffer from this issue.)WritablePolyshape
gained anaddVertices
method for adding many vertices at once. This bulk operation enables the default implementations to perform better, expanding their internal storage once as appropriate, rather than doing repeated incremental expansions.GeomMaths
to compareLocalizable
andRealLocalizable
positions. (Maybe these should go intonet.imglib2.util.Util
? What do others think?)WritablePolygon2DTest
code has been improved a bit.Note that
WritableRealPointCollection
still does not haveaddPoints
orremovePoints
methods; I considered doing them as part of this PR, but I have no immediate use case, so I've held off for now.With these changes, it will be more feasible to pass
WritablePolyshape
objects as outputs into which calculated points can be injected. In particular, it will become feasible to recast ImageJ Ops's geometry operations such asgeom.convexHull(Polygon2D)
as computer ops rather than function ops.