Package net.algart.matrices.scanning
Class ContainingMainBoundaryFinder
java.lang.Object
net.algart.matrices.Abstract2DProcessor
net.algart.matrices.scanning.ContainingMainBoundaryFinder
-
Method Summary
Modifier and TypeMethodDescriptionbuildAroundRectangle
(Matrix<? extends UpdatableBitArray> result, Matrix<? extends BitArray> source, IRectangularArea rectangle) void
clear()
void
clearBitsOutside
(Matrix<? extends UpdatableBitArray> result) clearOutsideRectangle
(Matrix<? extends UpdatableBitArray> result, Matrix<? extends BitArray> source, IRectangularArea rectangle) fillAtRectangle
(Matrix<? extends UpdatableBitArray> result, Matrix<? extends BitArray> source, IRectangularArea rectangle) void
fillBitsInside
(Matrix<? extends UpdatableBitArray> result) void
fillInside
(Matrix<? extends UpdatablePArray> result, double filler) Fills all pixels inside the main boundary, found by the last call offind(long x, long y)
method, with the specified filler.void
fillOutside
(Matrix<? extends UpdatablePArray> result, double filler) Fills all pixels outside the main boundary, found by the last call offind(long x, long y)
method, with the specified filler.long
find
(long x, long y) Finds main boundary in the source binary matrix, passed tonewInstance(Matrix)
orsetMatrix(Matrix)
method, containing the specified position (x,y), and stores it inside this object.Finds minimal rectangle, containing the main boundary, found by the last call offind(long x, long y)
method.void
boolean
static ContainingMainBoundaryFinder
newInstance
(long[] dimensions) static ContainingMainBoundaryFinder
newInstance
(long dimX, long dimY) static ContainingMainBoundaryFinder
newInstance
(Matrix<? extends BitArray> matrix) scanner()
setClearBoundary
(boolean clearBoundary) setConnectivityType
(ConnectivityType connectivityType) Methods inherited from class net.algart.matrices.Abstract2DProcessor
checkCompatibility, dimX, dimY, elementType, matrixSize, nextLineOffset, previousLineOffset, rem, rem
-
Method Details
-
newInstance
-
newInstance
-
newInstance
-
getMatrix
-
setMatrix
-
getConnectivityType
-
setConnectivityType
-
isClearBoundary
public boolean isClearBoundary() -
setClearBoundary
-
fillAtRectangle
public IPoint fillAtRectangle(Matrix<? extends UpdatableBitArray> result, Matrix<? extends BitArray> source, IRectangularArea rectangle) -
clearOutsideRectangle
public IPoint clearOutsideRectangle(Matrix<? extends UpdatableBitArray> result, Matrix<? extends BitArray> source, IRectangularArea rectangle) -
buildAroundRectangle
public IPoint buildAroundRectangle(Matrix<? extends UpdatableBitArray> result, Matrix<? extends BitArray> source, IRectangularArea rectangle) -
find
public long find(long x, long y) Finds main boundary in the source binary matrix, passed tonewInstance(Matrix)
orsetMatrix(Matrix)
method, containing the specified position (x,y), and stores it inside this object.Returns the x-coordinate x' of the pixel of this main boundary, so that x'<=x and (x',y) belongs to this boundary. You can trace this boundary again starting from position (x',y), X_MINUS pixel side. If the given position is outside any main boundary, returns -1.
- Parameters:
x
- x-coordinate. Note that it must be actually int value in current implementation (this class does not support matrices with a width ≥Integer.MAX_VALUE).y
- y-coordinate.- Returns:
- -1 if this point is outside all main boundaries; x-coordinate of the left pixel of some main boundary, where this point is inside (its y-coordinate is the same as the argument).
- Throws:
IndexOutOfBoundsException
- if these coordinates are out of the source matrix.
-
fillBitsInside
-
clearBitsOutside
-
fillInside
Fills all pixels inside the main boundary, found by the last call offind(long x, long y)
method, with the specified filler. Does nothing if the point (x,y), passed to that method, lies outside any main boundaries.- Parameters:
result
- matrix to fill.filler
- value to fill.- Throws:
IllegalStateException
- iffind(long, long)
was not called yet.
-
fillOutside
Fills all pixels outside the main boundary, found by the last call offind(long x, long y)
method, with the specified filler. Fills all matrix if the point (x,y), passed to that method, lies outside any main boundaries.- Parameters:
result
- matrix to fill.filler
- value to fill.- Throws:
IllegalStateException
- iffind(long, long)
was not called yet.
-
findContainingRectangle
Finds minimal rectangle, containing the main boundary, found by the last call offind(long x, long y)
method. Returns null if the point (x,y), passed to that method, lies outside any main boundaries.- Returns:
- Minimal rectangle, containing the main boundary, or null if there is no containing boundary.
- Throws:
IllegalStateException
- iffind(long, long)
was not called yet.
-
clear
public void clear() -
scanner
-
freeResources
public void freeResources()
-