Adds a new Regions.positionable() static method that takes any RandomAccessibleInterval<BooleanType> and makes it an PositionableIterableRegion.
The PositionableIterableRegion is Positionable. It can be moved around, for example to Regions.sample() an image with the region positioned on different locations.
The PositionableIterableRegion has a PosionableLocalizable origin() that can be used to change the center of the region. The origin is the relative offset of the position to the minimum. For example if a positionable (bitmask) region is made from a BitType image with a circular pattern, then it is more natural if the region position refers to the center of the pattern instead of the upper left corner of the BitType image. This can be achieved by positioning the origin.
Assume a region is created from a 9x9 bitmask. The region initially has min=(0,0), max=(8,8), position=(0,0). Because both position and min are (0,0), initially origin=(0,0). Now assume the origin is moved to the center of the bitmask using origin().setPosition(new int[]{4,4}). After this, min=(-4,-4), max=(4,4), position=(0,0), and origin=(4,4). region.setPosition() can now be used to put the center of the mask on some pixel. Then Regions.sample() can be used to overlay the region on a target image, and iterate the target pixels under the positioned region.
(This is part one of a framework that will allow to do Neighborhoods-like operations using arbitrary masks. Ultimately, the current Neighborhoods will be integrated into the same framework.)
Adds a new
Regions.positionable()
static method that takes anyRandomAccessibleInterval<BooleanType>
and makes it anPositionableIterableRegion
.The
PositionableIterableRegion
isPositionable
. It can be moved around, for example toRegions.sample()
an image with the region positioned on different locations.The
PositionableIterableRegion
has aPosionableLocalizable origin()
that can be used to change the center of the region. The origin is the relative offset of the position to the minimum. For example if a positionable (bitmask) region is made from aBitType
image with a circular pattern, then it is more natural if the region position refers to the center of the pattern instead of the upper left corner of theBitType
image. This can be achieved by positioning the origin. Assume a region is created from a 9x9 bitmask. The region initially hasmin=(0,0), max=(8,8), position=(0,0)
. Because bothposition
andmin
are(0,0)
, initiallyorigin=(0,0)
. Now assume the origin is moved to the center of the bitmask usingorigin().setPosition(new int[]{4,4})
. After this,min=(-4,-4), max=(4,4), position=(0,0)
, andorigin=(4,4)
.region.setPosition()
can now be used to put the center of the mask on some pixel. ThenRegions.sample()
can be used to overlay the region on a target image, and iterate the target pixels under the positioned region.(This is part one of a framework that will allow to do
Neighborhoods
-like operations using arbitrary masks. Ultimately, the currentNeighborhoods
will be integrated into the same framework.)