@ALDAOperator(genericExecutionMode=SWING, level=APPLICATION, allowBatchMode=false) public class LabelImageEditor extends MTBOperator implements MouseListener, MouseMotionListener, ActionListener
The editor supports removing regions by one-click operations. Images can
be relabeled and open contour branches be removed. Also holes within
regions, i.e., background sections and small regions completely surrounded
by another region, can be eliminated.
Short gaps in boundaries can be closed by drawing free-hand lines
by mouse.
To enhance the display of an image the contrast of region labels can be
improved by shifting dark labels into a higher interval of gray-scale
values increasing the difference (contrast) to the black background.
Modifier and Type | Field and Description |
---|---|
private MTBImageByte |
activeImage
Image currently under processing.
|
private ij.ImagePlus |
activePlus
Reference to currently active image.
|
private ij.process.ImageProcessor |
activeProcessor
Reference to processor of currently active image
activePlus . |
private boolean |
calledFirstTime
Flag to ensure that callback only works once the operator has been called.
|
private String |
currentFile
Full path name of currently active image file.
|
private boolean |
finished
Flag to indicate if operations are finished.
|
private ij.gui.ImageCanvas |
ic
Image canvas for displaying image and interacting.
|
private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString |
inputDir
Image directory to process.
|
private String |
inputRegExp
Optional file filter.
|
private String |
internalOutputDir
Internal variable of output dir (to avoid modifying parameter).
|
private int |
lastLabel
Stores the last clicked label for transfer in memory mode.
|
private Point2D.Double |
lastPathPoint
Local helper variable in drawing new boundaries,
stores last point of current path.
|
private ij.process.ImageProcessor |
lastProcessor
Reference to last processor before last action.
|
private JFrame |
mainFrame
Main window frame.
|
private boolean |
memoryMode
In memory mode labels can be transferred from one region to another.
|
private MTBImage |
originalImage
Original image currently under processing.
|
private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString |
outputDir
Optional output directory.
|
private boolean |
scanPath
Local flag to indicate if we are currently tracing a path
for a new piece of boundary.
|
private boolean |
stillActive
Flag to indicate if process is still active.
|
Constructor and Description |
---|
LabelImageEditor()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e) |
private void |
callbackInputDir()
Callback function called in case of changes of parameter
inputDir . |
private void |
initMainFrame()
Initialize the main window on opening the first image.
|
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
protected void |
operate() |
private void |
optimizeContrast(ij.process.ImageProcessor ip)
Optimize visibility by shifting labels into
upper part of gray-scale range.
|
private void |
saveFile()
Saves the current processing result.
|
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 Directory", required=true, direction=IN, description="Input directory.", dataIOOrder=0, callback="callbackInputDir", paramModificationMode=MODIFIES_VALUES_ONLY) private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString inputDir
@Parameter(label="File Filter", required=false, direction=IN, description="Regular expression to filter input files.", dataIOOrder=0) private String inputRegExp
@Parameter(label="Output Directory", required=false, direction=IN, description="Output directory.", dataIOOrder=1) private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString outputDir
If left unset results are saved to input directory.
private JFrame mainFrame
private ij.gui.ImageCanvas ic
private MTBImage originalImage
private MTBImageByte activeImage
private ij.ImagePlus activePlus
private ij.process.ImageProcessor activeProcessor
activePlus
.private ij.process.ImageProcessor lastProcessor
activePlus
.private boolean stillActive
private String currentFile
private boolean finished
private String internalOutputDir
private boolean calledFirstTime
private boolean memoryMode
private int lastLabel
private boolean scanPath
private Point2D.Double lastPathPoint
public LabelImageEditor() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown if construction fails.protected void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
private void initMainFrame()
private void optimizeContrast(ij.process.ImageProcessor ip)
ip
- Image processor to process.private void saveFile()
private void callbackInputDir()
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.