adams.data.jai.flattener
Class PixelClassifications

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.data.image.AbstractImageFlattener<BufferedImageContainer>
              extended by adams.data.jai.flattener.AbstractJAIFlattener
                  extended by adams.data.jai.flattener.PixelClassifications
All Implemented Interfaces:
CleanUpHandler, Debuggable, Destroyable, OptionHandler, SizeOfHandler, Serializable, Comparable

public class PixelClassifications
extends AbstractJAIFlattener

Generates an instance for each pixel classification that is stored in the image's report.
Pixel classifications are generated with the adams.flow.transformer.PixelSelector transformer, using the adams.flow.transformer.pixelselector.AddClassification action.

Valid options are:

-D <int> (property: debugLevel)
    The greater the number the more additional info the scheme may output to 
    the console (0 = off).
    default: 0
    minimum: 0
 
-field <adams.data.report.Field> [-field ...] (property: fields)
    The fields to add to the output.
    default: 
 
-notes <adams.core.base.BaseString> [-notes ...] (property: notes)
    The notes to add as attributes to the generated data, eg 'PROCESS INFORMATION'
    .
    default: 
 
-width <int> (property: width)
    The width of the crop rectangle.
    default: 100
    minimum: 1
 
-height <int> (property: height)
    The height of the crop rectangle.
    default: 75
    minimum: 1
 
-anchor <TOP_LEFT|TOP_RIGHT|CENTER|BOTTOM_LEFT|BOTTOM_RIGHT> (property: anchor)
    Defines where to anchor the position on the crop rectangle.
    default: TOP_LEFT
 
-separate-rgb (property: separateRGB)
    Whether to output the RGB values as separate attributes or a single combined 
    one.
 

Version:
$Revision: 4805 $
Author:
fracpete (fracpete at waikato dot ac dot nz), Dale (dale at cs dot waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
protected  Crop.Anchor m_Anchor
          where to anchor the position on the rectangle.
protected  int m_Height
          the height of the crop rectangle.
protected  boolean m_SeparateRGB
          whether to output the RGB values in separate attributes.
protected  int m_Width
          the width of the crop rectangle.
 
Fields inherited from class adams.data.image.AbstractImageFlattener
m_Fields, m_Header, m_Notes
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
PixelClassifications()
           
 
Method Summary
 String anchorTipText()
          Returns the tip text for this property.
 Instances createHeader(BufferedImageContainer img)
          Creates the header from a template image.
 void defineOptions()
          Adds options to the internal list of options.
 Instance[] doFlatten(BufferedImageContainer img)
          Performs the actual flattening of the image.
 Crop.Anchor getAnchor()
          Returns where to anchor the position on the rectangle.
protected  Integer[] getClassificationIndices(BufferedImageContainer img)
          Returns the classification indices.
 int getHeight()
          Returns the height of the crop rectangle.
protected  Point getPixelLocation(BufferedImageContainer img, int index)
          Returns the pixel location to paint.
 boolean getSeparateRGB()
          Returns the setup name.
 int getWidth()
          Returns the width of the crop rectangle.
 String globalInfo()
          Returns a string describing the object.
 String heightTipText()
          Returns the tip text for this property.
 String separateRGBTipText()
          Returns the tip text for this property.
 void setAnchor(Crop.Anchor value)
          Sets where to anchor the position on the rectangle.
 void setHeight(int value)
          Sets the height of the crop rectangle.
 void setSeparateRGB(boolean value)
          Sets whether to separate the RGB values or not.
 void setWidth(int value)
          Sets the width of the crop rectangle.
 String widthTipText()
          Returns the tip text for this property.
 
Methods inherited from class adams.data.jai.flattener.AbstractJAIFlattener
forCommandLine, forName, getFlatteners
 
Methods inherited from class adams.data.image.AbstractImageFlattener
checkImage, cleanUp, compareTo, destroy, equals, fieldsTipText, flatten, getFields, getNotes, newArray, notesTipText, postProcessHeader, postProcessInstance, reset, setFields, setNotes, shallowCopy, shallowCopy
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, initialize, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_Width

protected int m_Width
the width of the crop rectangle.


m_Height

protected int m_Height
the height of the crop rectangle.


m_Anchor

protected Crop.Anchor m_Anchor
where to anchor the position on the rectangle.


m_SeparateRGB

protected boolean m_SeparateRGB
whether to output the RGB values in separate attributes.

Constructor Detail

PixelClassifications

public PixelClassifications()
Method Detail

globalInfo

public String globalInfo()
Returns a string describing the object.

Specified by:
globalInfo in class AbstractOptionHandler
Returns:
a description suitable for displaying in the gui

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractImageFlattener<BufferedImageContainer>

setWidth

public void setWidth(int value)
Sets the width of the crop rectangle.

Parameters:
value - the width

getWidth

public int getWidth()
Returns the width of the crop rectangle.

Returns:
the width

widthTipText

public String widthTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the gui

setHeight

public void setHeight(int value)
Sets the height of the crop rectangle.

Parameters:
value - the height

getHeight

public int getHeight()
Returns the height of the crop rectangle.

Returns:
the height

heightTipText

public String heightTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the gui

setAnchor

public void setAnchor(Crop.Anchor value)
Sets where to anchor the position on the rectangle.

Parameters:
value - the anchor

getAnchor

public Crop.Anchor getAnchor()
Returns where to anchor the position on the rectangle.

Returns:
the anchor

anchorTipText

public String anchorTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the gui

setSeparateRGB

public void setSeparateRGB(boolean value)
Sets whether to separate the RGB values or not.

Parameters:
value - if true then the RGB values are output as separate values

getSeparateRGB

public boolean getSeparateRGB()
Returns the setup name.

Returns:
the name

separateRGBTipText

public String separateRGBTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the gui

createHeader

public Instances createHeader(BufferedImageContainer img)
Creates the header from a template image.

Specified by:
createHeader in class AbstractImageFlattener<BufferedImageContainer>
Parameters:
img - the image to act as a template
Returns:
the generated header

getClassificationIndices

protected Integer[] getClassificationIndices(BufferedImageContainer img)
Returns the classification indices.

Parameters:
img - the current image to process
Returns:
the indices

getPixelLocation

protected Point getPixelLocation(BufferedImageContainer img,
                                 int index)
Returns the pixel location to paint.

Parameters:
img - the current image to process
index - the pixel location
Returns:
the location, null if none found

doFlatten

public Instance[] doFlatten(BufferedImageContainer img)
Performs the actual flattening of the image.

Specified by:
doFlatten in class AbstractImageFlattener<BufferedImageContainer>
Parameters:
img - the image to process
Returns:
the generated array
See Also:
AbstractImageFlattener.m_Header


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.