|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.MiToBo.core.operator.MTBOperator
de.unihalle.informatik.MiToBo.drawing.DrawRegion2DSet
@ALDAOperator(genericExecutionMode=ALL) public class DrawRegion2DSet
A class to visualize 2D regions. Background is always 0, regions can be drawn in different ways. Five kinds of region images can be created or drawn to an existing image:
LABEL_IMAGE: draw gray value image where regions are labeled by their index in the set + 1 ID_IMAGE: draw gray value image where regions are labeled by their region id (see MTBRegion2D.id) MASK_IMAGE: draw a mask image with equal gray values for all regions COLOR_IMAGE: draw a mask with colored regions TRANSPARENT_IMAGE: draw a mask with colored regions, but the regions are transparent to show the underlying intensity structure of the given target image
Constructors take the kind of image and the regions to be drawn as well as an eventual target image. Default configurations are set by the constructors. Use the different get/set methods to specify nondefault parameters like color, grayvalue etc.
Be sure to set the xMin, xMax, yMin, yMax values of the input MTBRegion2DSet, because these values are used to determine the image size!!
Nested Class Summary | |
---|---|
static class |
DrawRegion2DSet.DrawType
Type of image to be drawn: LABEL_IMAGE: draw gray value image where regions are labeled by their index in the set + 1 ID_IMAGE: draw gray value image where regions are labeled by their region id (see MTBRegion2D.id) MASK_IMAGE: draw a mask image with equal gray values for all regions COLOR_IMAGE: draw a mask with colored regions TRANSPARENT_IMAGE: draw a mask with colored regions, but the regions are transparent to show the underlying intensity structure of the given target image |
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode |
Field Summary | |
---|---|
private java.awt.Color |
color
|
private DrawRegion2DSet.DrawType |
drawType
|
private java.lang.Double |
grayValue
|
private MTBImage.MTBImageType |
imageType
|
private MTBRegion2DSet |
inputRegions
|
private java.util.Random |
random
|
private MTBImage |
resultImage
|
private MTBImage |
targetImage
|
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
completeDAG, name, portHashAccess, verbose, versionProvider |
Constructor Summary | |
---|---|
DrawRegion2DSet()
Default constructor where NO parameters are set. |
|
DrawRegion2DSet(DrawRegion2DSet.DrawType dtype,
MTBRegion2DSet regions)
Simple constructor to create the most common region image types: see DrawType dtype = COLOR_IMAGE: Mask image with randomly colored regions dtype = MASK_IMAGE: Mask image of type MTB_BYTE, where regions have value 255 dtype = LABEL_IMAGE: Label image of type MTB_INT dtype = ID_IMAGE: ID image of type MTB_INT dtype = TRANSPARENT_IMAGE: Image with transparent randomly colored regions, needs a RGB target image to work |
|
DrawRegion2DSet(DrawRegion2DSet.DrawType dtype,
MTBRegion2DSet regions,
MTBImage targetimage)
Simple constructor to draw the most common region image types to a given image: dtype = COLOR_IMAGE: Mask image with randomly colored regions dtype = MASK_IMAGE: Mask image of type MTB_BYTE, where regions have value 255 dtype = LABEL_IMAGE: Label image of type MTB_INT dtype = ID_IMAGE: ID image of type MTB_INT dtype = TRANSPARENT_IMAGE: Image with transparent randomly colored regions, needs a RGB target image to work |
Method Summary | |
---|---|
protected int |
color2int(java.awt.Color c)
|
java.awt.Color |
getColor()
Get the uniform color of the regions in a color image (COLOR_IMAGE only). |
DrawRegion2DSet.DrawType |
getDrawType()
Get the kind of region image drawn by the operator |
java.lang.Double |
getGrayValue()
Get the gray value of the regions in a mask image (MASK_IMAGE only). |
MTBImage.MTBImageType |
getImageType()
Get the datatype of the resulting image |
MTBRegion2DSet |
getInputRegions()
Get the regions that have to be drawn |
java.util.Random |
getRandom()
Get the random number generator which is responsable to draw each region in a random color (COLOR_IMAGE only). |
MTBImage |
getResultImage()
Get the resulting region image. |
MTBImage |
getTargetImage()
Get the target image to which the regions are drawn, if one was specified. |
protected java.awt.Color |
int2Color(int color)
|
protected void |
operate()
|
protected int |
randomColor(java.util.Random r)
|
void |
setColor(java.awt.Color c)
Set the uniform color of the regions in a color image (COLOR_IMAGE only). |
void |
setDrawType(DrawRegion2DSet.DrawType dtype)
Set the kind of region image to be drawn |
void |
setGrayValue(java.lang.Double value)
Set the gray value of the regions in a mask image (MASK_IMAGE only). |
void |
setImageType(MTBImage.MTBImageType type)
Set the resulting image's datatype. |
void |
setInputRegions(MTBRegion2DSet regions)
Set the input regions to be drawn |
void |
setRandom(java.util.Random r)
Set a random number generator to draw each region in a random color (COLOR_IMAGE only). |
protected void |
setResultImage(MTBImage image)
Set the resulting image. |
void |
setTargetImage(MTBImage targetimage)
Specify a target image to which the regions are drawn, specify 'null' to create a new image |
void |
validateCustom()
|
Methods inherited from class de.unihalle.informatik.MiToBo.core.operator.MTBOperator |
---|
readResolve |
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
deserializeFromXmlFile, fieldContained, getALDPortHashAccessKey, getConstructionMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, isConfigured, parametersToXmlObject, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, runOp, runOp, runOp, serializeToXmlFile, setConstructionMode, setName, setParameter, setParametersFromXml, setParametersFromXml, setVerbose, toStringVerbose, unconfiguredItems, validate, validateGeneric, writeHistory, writeHistory, writeHistory, writeParametersToXml |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Parameter(label="Color", required=false, direction=IN, mode=STANDARD, dataIOOrder=4, description="A color used to paint all regions") private java.awt.Color color
@Parameter(label="Draw type", required=true, direction=IN, mode=STANDARD, dataIOOrder=2, description="The type of image to be drawn") private DrawRegion2DSet.DrawType drawType
@Parameter(label="Gray value", required=false, direction=IN, mode=STANDARD, dataIOOrder=3, description="A gray value used to paint all regions") private java.lang.Double grayValue
@Parameter(label="Output-image type", required=true, direction=IN, mode=STANDARD, dataIOOrder=6, description="The datatype of the output image") private MTBImage.MTBImageType imageType
@Parameter(label="Input regions", required=true, direction=IN, mode=STANDARD, dataIOOrder=1, description="Regions to draw to image") private MTBRegion2DSet inputRegions
@Parameter(label="Random generator", required=false, direction=IN, mode=STANDARD, dataIOOrder=5, description="a random generator generate a random color for each region") private java.util.Random random
@Parameter(label="Result image", required=true, direction=OUT, mode=STANDARD, dataIOOrder=1, description="Result image") private MTBImage resultImage
@Parameter(label="Target image", required=false, direction=IN, mode=STANDARD, dataIOOrder=7, description="Draw regions to this target image") private MTBImage targetImage
Constructor Detail |
---|
public DrawRegion2DSet() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public DrawRegion2DSet(DrawRegion2DSet.DrawType dtype, MTBRegion2DSet regions) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
dtype
- drawing typeregions
- a set of regions (set xMin,xMax,yMin,yMax which are used to determine image size)
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public DrawRegion2DSet(DrawRegion2DSet.DrawType dtype, MTBRegion2DSet regions, MTBImage targetimage) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
dtype
- drawing typeregions
- a set of regionstargetimage
- target image to draw the regions to
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Method Detail |
---|
protected int color2int(java.awt.Color c)
public java.awt.Color getColor()
public DrawRegion2DSet.DrawType getDrawType()
public java.lang.Double getGrayValue()
public MTBImage.MTBImageType getImageType()
public MTBRegion2DSet getInputRegions()
public java.util.Random getRandom()
public MTBImage getResultImage()
public MTBImage getTargetImage()
protected java.awt.Color int2Color(int color)
protected 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
protected int randomColor(java.util.Random r)
public void setColor(java.awt.Color c)
public void setDrawType(DrawRegion2DSet.DrawType dtype)
dtype
- see DrawTypepublic void setGrayValue(java.lang.Double value)
public void setImageType(MTBImage.MTBImageType type)
type
- result image typepublic void setInputRegions(MTBRegion2DSet regions)
public void setRandom(java.util.Random r)
protected void setResultImage(MTBImage image)
public void setTargetImage(MTBImage targetimage)
public void validateCustom() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
validateCustom
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |