@ALDAOperator(genericExecutionMode=NONE, level=STANDARD) public class DistinctColorListGenerator extends MTBOperator
The list is generated by sampling from the hue color circle. The circle is partitioned by equally sized sampling points according to the number of colors the list should finally contain. Each color is transformed to RGB color space and added to the list.
If the number of colors requested is even the circle is directly sampled with the given number, if the number is odd (for simplicity of sampling) the number is internally increased by one, i.e., an even number of partitions is generated, and the first N-1 colors are sampled and returned in the list.
For ensuring maximal differences between subsequent colors the list is filled as follows. We start with a hue angle of zero (red) and traverse the sampling points along the circle in order of increasing hue angles from 0 to 180 degrees. Between each two sampling points p1 and p2 the color of the sampling point on the circle opposit to p1 is inserted into the list which is most different from p1 and p2.
Modifier and Type | Field and Description |
---|---|
protected int |
nColors
Number of colors to generate.
|
private Color[] |
resultList
Color list.
|
Constructor and Description |
---|
DistinctColorListGenerator()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Color[] |
getColorList()
Returns color list.
|
protected void |
operate()
This method does the actual work.
|
void |
setColorNumber(int n)
Set number of colors.
|
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="Number of Colors", required=true, dataIOOrder=1, direction=IN, description="Number of colors.") protected int nColors
@Parameter(label="Resulting Color List", direction=OUT, description="Color list.") private transient Color[] resultList
public DistinctColorListGenerator() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
public Color[] getColorList()
public void setColorNumber(int n)
n
- Number of colors.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
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.