@ALDAOperator(genericExecutionMode=ALL, level=APPLICATION) public class ConvexHullExtraction extends MTBOperator
Modifier and Type | Class and Description |
---|---|
static class |
ConvexHullExtraction.InputType
Type of input to work on.
|
Modifier and Type | Field and Description |
---|---|
private Vector<Point2D.Double[]> |
convexHulls |
private Boolean |
eightconnected
Use 8-connectedness in component labeling (only active if
inType
is InputType.IMAGE ). |
private MTBImage |
hullImage |
private Boolean |
individually
Process each component individually (only active if
inType is
InputType.IMAGE ). |
private MTBImage |
inImg |
private MTBRegion2DSet |
inRegions
Set of input regions.
|
private ConvexHullExtraction.InputType |
inType
Input type.
|
Constructor and Description |
---|
ConvexHullExtraction() |
ConvexHullExtraction(MTBImage img) |
ConvexHullExtraction(MTBImage img,
boolean indiv,
boolean eightconnect) |
Modifier and Type | Method and Description |
---|---|
private void |
draw(Point2D.Double[] hullPoints) |
private void |
extractHullsOnRegions(MTBRegion2DSet regs) |
Vector<Point2D.Double[]> |
getResultingConvexHulls()
Get set of extracted convex hulls.
|
MTBImage |
getResultingHullImage()
Get image with convex hulls plotted.
|
private int |
indexOfLowestPoint(Point2D.Double[] points) |
private int |
indexOfRightmostPoint(Point2D.Double[] points,
Point2D.Double q) |
private void |
inputTypeChanged()
Callback routine to change parameters on change of input type.
|
private boolean |
isFurther(Point2D.Double p,
Point2D.Double q) |
private boolean |
isLess(Point2D.Double p,
Point2D.Double q) |
private Point2D.Double[] |
jarvisMarch(Point2D.Double[] points)
Jarvis march convex hull computation
|
void |
operate() |
private Point2D.Double |
relTo(Point2D.Double p,
Point2D.Double q) |
void |
setEightconnected(boolean flag)
Set which neighborhood to use for labeling components.
|
void |
setIndividually(boolean flag)
Set how to treat the components, individually or as a whole.
|
void |
setInputImage(MTBImage img)
Set input image (if
inType is InputType.IMAGE ). |
void |
setInputRegions(MTBRegion2DSet regs)
Set input regions (if
inType is InputType.REGIONS ). |
void |
setInputType(ConvexHullExtraction.InputType t)
Specify input image type.
|
private void |
swap(Point2D.Double[] points,
int i,
int j)
exchange point with index i and point with index j
|
readResolve
addOperatorExecutionProgressEventListener, addParameter, addParameter, addParameterUnconditioned, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getDocumentation, getHidingMode, getInactiveParameterNames, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterDescriptorUnconditioned, getParameterNames, getParameterUnconditioned, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, hasInOutParameters, hasParameter, isAnnotatedParameter, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, removeParameter, runOp, runOp, runOp, setConstructionMode, setConstructionMode, setConstructionMode, setHidingMode, setName, setParameter, setParameterUnconditioned, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
@Parameter(label="Input Type", required=true, supplemental=false, dataIOOrder=0, callback="inputTypeChanged", direction=IN, description="Type of input data.", paramModificationMode=MODIFIES_INTERFACE) private ConvexHullExtraction.InputType inType
@Parameter(label="input image", required=true, dataIOOrder=1, direction=IN, supplemental=false, description="input image") private transient MTBImage inImg
@Parameter(label="Input Regions", required=true, dataIOOrder=2, direction=IN, supplemental=false, description="Input regions.") private transient MTBRegion2DSet inRegions
@Parameter(label="individually", required=false, direction=IN, supplemental=false, description="treat objects individually") private Boolean individually
inType
is
InputType.IMAGE
).@Parameter(label="objects are eightconnected", required=false, direction=IN, supplemental=false, description="are foreground objects 8-connected (else 4-connected)") private Boolean eightconnected
inType
is InputType.IMAGE
).@Parameter(label="convexHulls", required=true, direction=OUT, supplemental=false, description="vertices of convex hulls") private Vector<Point2D.Double[]> convexHulls
@Parameter(label="image containing convex hulls", required=true, direction=OUT, supplemental=true, description="image with convex hulls painted") private transient MTBImage hullImage
public ConvexHullExtraction() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public ConvexHullExtraction(MTBImage img) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
img
- input imagede.unihalle.informatik.Alida.exceptions.ALDOperatorException
public ConvexHullExtraction(MTBImage img, boolean indiv, boolean eightconnect) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
img
- input imageindiv
- should convex hull be computed for every single connected componenteightconnect
- is foreground 8-connectedde.unihalle.informatik.Alida.exceptions.ALDOperatorException
public void setInputType(ConvexHullExtraction.InputType t)
t
- Type of input.public void setInputImage(MTBImage img)
inType
is InputType.IMAGE
).img
- Image to process.public void setInputRegions(MTBRegion2DSet regs)
inType
is InputType.REGIONS
).img
- Set of regions to process.public void setIndividually(boolean flag)
Parameter is only active if inType
is InputType.IMAGE
.
flag
- If true, each component is processed independently.public void setEightconnected(boolean flag)
Parameter is only active if inType
is InputType.IMAGE
.
flag
- If true, 8-neighborhood is used, otherwise 4-neighborhood.public void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
public Vector<Point2D.Double[]> getResultingConvexHulls()
public MTBImage getResultingHullImage()
private void extractHullsOnRegions(MTBRegion2DSet regs) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
private Point2D.Double[] jarvisMarch(Point2D.Double[] points)
points
- points for which a convex hull should be computedprivate int indexOfLowestPoint(Point2D.Double[] points)
points
- private int indexOfRightmostPoint(Point2D.Double[] points, Point2D.Double q)
points
- q
- private void swap(Point2D.Double[] points, int i, int j)
points
- i
- j
- private Point2D.Double relTo(Point2D.Double p, Point2D.Double q)
p
- q
- private boolean isLess(Point2D.Double p, Point2D.Double q)
p
- q
- private boolean isFurther(Point2D.Double p, Point2D.Double q)
p
- q
- private void draw(Point2D.Double[] hullPoints) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
private void inputTypeChanged()
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.