@ALDAOperator(genericExecutionMode=ALL, level=APPLICATION, shortDescription="Implements region growing for xylem segmentation.") public class XylemGrower extends MTBOperator
Prerequisite is HS[X]-image (hue, saturation, intensity/value/brightness) as the input and some thresholds to control the growing process and an initial segmentation of xylem regions supplied as a binary image.
All three channels of the hs[x] image are assume to be a byte image and values
in the range 0 - 255
.
The initial regions are eroded to get seed regions, where we
determine the mean-value of the hue and/or saturation and/or I/V/B-channel.
Subsequently the region are grown via region growing. We compare each pixel of the
contour of those seed regions with the pixel of the background beside them,
either in a 4-neighbourhood or an 8-neighbourhood.
This is repeated until the list of uninspected pixel is not empty.
Afterwards we may do some post processing. E.G. calculate gradient
informations on the found regions to split regions who contain more then one
xylem.
Modifier and Type | Class and Description |
---|---|
static class |
XylemGrower.GrowingMode
The region growing modus.
|
private class |
XylemGrower.GrowingRegion2D
This class is responsible for the growing of a single
MTBRegion2D which is the result of the preprocessing steps.
|
static class |
XylemGrower.Neighbourhood
The kind of neighbourhood to inspect a pixel.
|
static class |
XylemGrower.SortMode
Sort Mode for different MTBRegion2D's.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_erodeSize
Default size of the structuring element to erode the image
|
static double |
DEFAULT_hueThresh
Default hue threshold
|
static XylemGrower.GrowingMode |
DEFAULT_linkageMode
Default linkage mode for growing
|
static int |
DEFAULT_minAreaPostProcessing
Minimum area of a region in post processing.
|
static int |
DEFAULT_minAreaSeedRegions
Default minimum area for a region to be further eroded
|
static XylemGrower.Neighbourhood |
DEFAULT_neighbourhood
Default neighborhood for growing
|
static int |
DEFAULT_openingSESize
Default size of structuring element for opening (post processing)
|
static double |
DEFAULT_satThresh
Default saturation threshold
|
static double |
DEFAULT_xThresh
Default intensity threshold
|
private int |
erodeSize
The size of the structuring element for erosion to compute seed regions.
|
private MTBImageByte |
grownRegions
Resulting regions from growing.
|
private double |
hueThresh
The hue threshold.
|
private MTBImageByte |
initialSegmentation
Initial segmentation of xylem regions.
|
private XylemGrower.GrowingMode |
linkageMode
The algorithm we use to link new pixels to the region.
|
private static int |
MIN_SE_SIZE
Minimum size of an SE.
|
private int |
minAreaPostProcessing
The minimum size of a
MTBRegion2D to not be removed (after
opening the grown regions). |
private int |
minAreaSeedRegions
The minimum size of a
MTBRegion2D to further erode when computing seed regions. |
private XylemGrower.Neighbourhood |
neighbourhood
The neighbourhood mode to inspect new pixel.
|
private int |
openingSESize
The minimum size of a
MTBRegion2D before erosion. |
private MTBTableModel |
resultsTable
A table containing information for each region
|
private MTBImageByte |
resultXylemRegions
Final xylem regions after post processing.
|
private double |
satThresh
The saturation threshold.
|
private MTBImageByte |
seedRegions
The seed regions as a binary image after the final erosion.
|
private int |
sizeX |
private int |
sizeY |
private double |
xThresh
The Intensity/Brightness/Value threshold.
|
private MTBImageByte |
xylemHsxImage
HS(X)-Color Channel Image.
|
Constructor and Description |
---|
XylemGrower()
Default Constructor.
|
XylemGrower(MTBImageByte binaryImage,
MTBImageByte hsxImage,
XylemGrower.GrowingMode linkageMode) |
Modifier and Type | Method and Description |
---|---|
private List<MTBRegion2D> |
createSeedRegions(MTBImageByte imageToErode,
int minimumPixelPerArea,
int sizeOfStructuringElement)
Create seed regions from the intial segmentation.
|
private void |
deleteRegionFromImage(MTBImageByte prelabeledImage,
MTBRegion2D regionToClear)
Set pixels of the points contained in the given region to
0(zero) . |
(package private) static MTBImage |
erodeImageWithCircle(MTBImage image,
int sizeOfSE)
Erode an image of type
MTBImageByte . |
String |
getDocumentation() |
int |
getErodeSize()
The size of the eroding element.
|
MTBImageByte |
getGrownRegions()
Returns a
MTBImageByte image after growing. |
double |
getHueThresh()
Return the treshold for the hue channel.
|
MTBImage |
getInitialSegmentation() |
XylemGrower.GrowingMode |
getLinkageMode() |
int |
getminAreaSeedRegions() |
int |
getMinRegionArea() |
XylemGrower.Neighbourhood |
getNeighbourhood() |
int |
getOpeningSESize() |
MTBTableModel |
getResultsTable() |
MTBImageByte |
getResultXylemRegions()
Return the binary image after the post processing of the grown region
image.
|
double |
getSatTresh() |
MTBImageByte |
getSeedRegions() |
double |
getXThresh()
The Intensity/Brighntness/Value-Parameter (depending on the used input
image type).
|
MTBImage |
getXylemImage()
Return the Hue/Saturation/{Intensity|Brightness|Value}-
MTBImage . |
(package private) static MTBRegion2DSet |
labelComponentsOfImage(MTBImage image)
Label a MTBImage.
|
private MTBTableModel |
makeTable(MTBRegion2DSet regionSet,
MTBImage labelImg,
int imgWidth,
int imgHeight)
create results table
|
private static MTBImage |
openByteImageWithCircle(MTBImage image,
int sizeOfSE)
Open an image of type
MTBImageByte . |
protected void |
operate()
|
private MTBImageByte |
postProcessAfterGrowing(MTBImageByte grownRegionBinImage)
Here we do some morphological operations to the shape of the regions from
the region growing of XylemGrower.
|
static String |
printReadabeTimeInfo(long cTime) |
private static boolean |
regionTouchesBoundary(MTBRegion2D region2D,
int width,
int height)
Test whether a region is located at, i.e. touches, the boundary of the image.
|
private void |
relabelRegion(MTBImageByte preLabeledImage,
MTBRegion2D region)
Set the unique id of the given region to the pixel value found at the
coordinate of the first pixel in the region on the pre labeled
MTBImageByte . |
private static MTBImage |
removeSmallComponents(MTBImageByte image,
int minimalArea)
Remove small componentes from an image of type
MTBImageByte . |
void |
setErodSize(int size)
Set the size of the eroding element in pixel.
|
void |
setGrownRegions(MTBImageByte imageByte) |
void |
setHueThresh(double hueThresh) |
void |
setInitalSegmentation(MTBImageByte image) |
void |
setLinkageMode(XylemGrower.GrowingMode linkageMode) |
void |
setminAreaSeedRegions(int minAreaSeedRegions) |
void |
setMinRegionArea(int minAreaPostProcessing) |
void |
setNeighbourhood(XylemGrower.Neighbourhood nb) |
void |
setOpeningSESize(int size) |
void |
setResultsTable(MTBTableModel resultsTable) |
void |
setSatTresh(double satTresh) |
void |
setSeedImage(MTBImageByte seedRegions) |
void |
setXThresh(double xThresh)
Set the Intensity/Brighntness/Value-Parameter (depending on the used
input image type).
|
void |
setXylemImage(MTBImageByte hsxMTBImage)
Set the Hue/Saturation/{Intensity|Brightness|Value}-
MTBImage . |
void |
setXylemResultRegions(MTBImageByte regions)
Set the binary image after the morphological processing on the grown
region image.
|
private static Collection<MTBRegion2D> |
sortRegionSetBy(MTBRegion2DSet regionSet,
XylemGrower.SortMode sortMode) |
void |
validateCustom() |
readResolve
addOperatorExecutionProgressEventListener, addParameter, addParameter, addParameterUnconditioned, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, 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, validateGeneric, writeHistory, writeHistory, writeHistory
public static final int DEFAULT_erodeSize
public static final int DEFAULT_minAreaSeedRegions
public static final XylemGrower.GrowingMode DEFAULT_linkageMode
public static final double DEFAULT_hueThresh
public static final double DEFAULT_satThresh
public static final double DEFAULT_xThresh
public static final XylemGrower.Neighbourhood DEFAULT_neighbourhood
public static final int DEFAULT_openingSESize
public static final int DEFAULT_minAreaPostProcessing
private static final int MIN_SE_SIZE
@Parameter(label="XylemImageHSX", required=true, dataIOOrder=0, direction=IN, description="Xylem image as HSX-image") private transient MTBImageByte xylemHsxImage
@Parameter(label="Inital segmentation", required=true, dataIOOrder=1, direction=IN, description="Initial segmentation as a binary image") private transient MTBImageByte initialSegmentation
@Parameter(label="SizeErosion", required=false, dataIOOrder=3, direction=IN, description="Size of structuring element for ersion to compute seed regions", mode=ADVANCED) private int erodeSize
ErodeMode
is
set to Dynamic, you should use a small
size. Otherwise use a size >= 20.@Parameter(label="MinAreaToErode", required=false, dataIOOrder=3, direction=IN, description="Minimal size of a region for further erosion of seed regions", mode=ADVANCED) private int minAreaSeedRegions
MTBRegion2D
to further erode when computing seed regions.@Parameter(label="The growing mode", required=true, dataIOOrder=5, direction=IN, description="The method for growing the region") private XylemGrower.GrowingMode linkageMode
@Parameter(label="HueThreshold", required=true, dataIOOrder=6, direction=IN, description="Hue channel threshold") private double hueThresh
@Parameter(label="SaturationThreshold", required=true, dataIOOrder=7, direction=IN, description="Saturation channel threshold") private double satThresh
@Parameter(label="XThreshold", required=true, dataIOOrder=8, direction=IN, description="Intensity channel threshold") private double xThresh
@Parameter(label="Neighbourhood used", required=false, dataIOOrder=9, direction=IN, description="The neighbourhood for the pixel to visit", mode=ADVANCED) private XylemGrower.Neighbourhood neighbourhood
@Parameter(label="SizeOpening (post processing)", required=true, dataIOOrder=10, direction=IN, description="Size of SE for opening (post processing)") private int openingSESize
MTBRegion2D
before erosion.@Parameter(label="MinArea (post processing)", required=true, dataIOOrder=11, direction=IN, description="Minimal area of a region (post processing of growing)") private int minAreaPostProcessing
MTBRegion2D
to not be removed (after
opening the grown regions).@Parameter(label="Resulting Xylem Regions", dataIOOrder=1, direction=OUT, description="Final xylem regions after post processing") private transient MTBImageByte resultXylemRegions
@Parameter(label="results table", required=true, direction=OUT, dataIOOrder=2, supplemental=false, description="table containing the resulting values") private MTBTableModel resultsTable
@Parameter(label="Seed Regions", required=true, supplemental=true, direction=OUT, dataIOOrder=4, description="Seed regions from erosion") private MTBImageByte seedRegions
@Parameter(label="GrownRegions", required=true, dataIOOrder=5, supplemental=true, direction=OUT, description="regions from growing") private transient MTBImageByte grownRegions
private int sizeX
private int sizeY
public XylemGrower() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public XylemGrower(MTBImageByte binaryImage, MTBImageByte hsxImage, XylemGrower.GrowingMode linkageMode) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
binaryImage
- hsxImage
- linkageMode
- de.unihalle.informatik.Alida.exceptions.ALDOperatorException
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
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
private MTBTableModel makeTable(MTBRegion2DSet regionSet, MTBImage labelImg, int imgWidth, int imgHeight)
labelImg
- sizeY2
- sizeX2
- ppRSet
- private MTBImageByte postProcessAfterGrowing(MTBImageByte grownRegionBinImage) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
grownRegionBinImage
- de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
private void deleteRegionFromImage(MTBImageByte prelabeledImage, MTBRegion2D regionToClear)
0(zero)
.
prelabeledImage
- The MTBImageByte
image with prelabeled
regions in it.regionToClear
- The MTBRegion2D
region do delete from the
prelabeledImage
.private List<MTBRegion2D> createSeedRegions(MTBImageByte imageToErode, int minimumPixelPerArea, int sizeOfStructuringElement) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
regionsBeforeErodeSet
- The regions after the opening.regionsAfterErodeSet
- The regions after the following erosion.MTBRegion2DSet
of the possible erased regions.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
labelComponentsOfImage(de.unihalle.informatik.MiToBo.core.datatypes.images.MTBImage)
,
#erodeImage(de.unihalle.informatik.MiToBo.core.datatypes.images.MTBImage,
int)
,
relabelRegion(de.unihalle.informatik.MiToBo.core.datatypes.images.MTBImageByte,
de.unihalle.informatik.MiToBo.core.datatypes.MTBRegion2D)
static MTBImage erodeImageWithCircle(MTBImage image, int sizeOfSE) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
MTBImageByte
.image
- The MTBImage
to erode.sizeOfSE
- The size of the structuring element ( >= 1 )MTBImage
image.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
private static MTBImage openByteImageWithCircle(MTBImage image, int sizeOfSE) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
MTBImageByte
.image
- sizeOfSE
- de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
private static MTBImage removeSmallComponents(MTBImageByte image, int minimalArea) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
MTBImageByte
.image
- minimalArea
- de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
private static boolean regionTouchesBoundary(MTBRegion2D region2D, int width, int height)
region2D
- width
- height
- static MTBRegion2DSet labelComponentsOfImage(MTBImage image) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
image
- The MTBImage
to label.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
LabelComponentsSequential
private void relabelRegion(MTBImageByte preLabeledImage, MTBRegion2D region)
MTBImageByte
.
preLabeledImage
- The MTBImageByte
image we fetch the wished
id from.region
- The MTBRegion2D
region to set the found id
to.private static Collection<MTBRegion2D> sortRegionSetBy(MTBRegion2DSet regionSet, XylemGrower.SortMode sortMode)
regionSet
- sortMode
- public static String printReadabeTimeInfo(long cTime)
public MTBImage getInitialSegmentation()
public void setInitalSegmentation(MTBImageByte image)
image
- public void setErodSize(int size)
size
- The site of the structuring element used for erosion in
pixel.public int getErodeSize()
public MTBImage getXylemImage()
MTBImage
.
public void setXylemImage(MTBImageByte hsxMTBImage)
MTBImage
.
hsxMTBImage
- public MTBImageByte getResultXylemRegions()
public void setXylemResultRegions(MTBImageByte regions)
regions
- public MTBTableModel getResultsTable()
public void setResultsTable(MTBTableModel resultsTable)
resultsTable
- the resultsTable to setpublic double getHueThresh()
public void setHueThresh(double hueThresh)
hueThresh
- public XylemGrower.GrowingMode getLinkageMode()
public void setLinkageMode(XylemGrower.GrowingMode linkageMode)
linkageMode
- public int getminAreaSeedRegions()
public void setminAreaSeedRegions(int minAreaSeedRegions)
minAreaSeedRegions
- public XylemGrower.Neighbourhood getNeighbourhood()
public void setNeighbourhood(XylemGrower.Neighbourhood nb)
nb
- public MTBImageByte getGrownRegions()
MTBImageByte
image after growing.
public void setGrownRegions(MTBImageByte imageByte)
imageByte
- public double getSatTresh()
public void setSatTresh(double satTresh)
satTresh
- public MTBImageByte getSeedRegions()
public void setSeedImage(MTBImageByte seedRegions)
seedRegions
- public double getXThresh()
public void setXThresh(double xThresh)
xThresh
- The threshold for the intensity/brightness/value.public int getOpeningSESize()
public void setOpeningSESize(int size)
size
- public int getMinRegionArea()
public void setMinRegionArea(int minAreaPostProcessing)
public String getDocumentation()
getDocumentation
in class de.unihalle.informatik.Alida.operator.ALDOperator
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.