adams.data.jai.transformer
Class Resize

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.data.image.AbstractImageTransformer<BufferedImageContainer>
              extended by adams.data.jai.transformer.AbstractJAITransformer
                  extended by adams.data.jai.transformer.Resize
All Implemented Interfaces:
CleanUpHandler, Debuggable, Destroyable, OptionHandler, SizeOfHandler, Serializable, Comparable

public class Resize
extends AbstractJAITransformer

Resizes the image to predefined width and height.

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
 
-width <int> (property: width)
    The width to resize the image to; use -1 to use original width.
    default: -1
    minimum: -1
 
-height <int> (property: height)
    The height to resize the image to; use -1 to use original height.
    default: -1
    minimum: -1
 
-interpolation-type <NEAREST|BILINEAR|BICUBIC|BICUBIC2> (property: interpolationType)
    The type of interpolation to perform.
    default: BICUBIC
 
-num-subsample-bits <int> (property: numSubsampleBits)
    The number of bits to use for precision when subsampling.
    default: 8
    minimum: 1
 

Version:
$Revision: 4787 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Nested Class Summary
static class Resize.InterpolationType
          Type of interpolaction.
 
Field Summary
protected  int m_Height
          the new height.
protected  Resize.InterpolationType m_InterpolationType
          the type of interpolation to perform.
protected  int m_NumSubsampleBits
          the number of subsample bits.
protected  int m_Width
          the new width.
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
Resize()
           
 
Method Summary
 void defineOptions()
          Adds options to the internal list of options.
protected  BufferedImageContainer[] doTransform(BufferedImageContainer img)
          Performs no transformation at all, just returns the input.
 int getHeight()
          Returns the height to resize to.
 Resize.InterpolationType getInterpolationType()
          Returns the type of interpolation in use.
 int getNumSubsampleBits()
          Returns the precision for subsampling in bits.
 int getWidth()
          Returns the width to resize to.
 String globalInfo()
          Returns a string describing the object.
 String heightTipText()
          Returns the tip text for this property.
 String interpolationTypeTipText()
          Returns the tip text for this property.
 String numSubsampleBitsTipText()
          Returns the tip text for this property.
 void setHeight(int value)
          Sets the height to resize to.
 void setInterpolationType(Resize.InterpolationType value)
          Sets the type of interpolation to use.
 void setNumSubsampleBits(int value)
          Sets the precision for subsampling in bits.
 void setWidth(int value)
          Sets the width to resize to.
 String widthTipText()
          Returns the tip text for this property.
 
Methods inherited from class adams.data.jai.transformer.AbstractJAITransformer
forCommandLine, forName, getTransformations
 
Methods inherited from class adams.data.image.AbstractImageTransformer
checkImage, cleanUp, compareTo, destroy, equals, shallowCopy, shallowCopy, transform
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, initialize, isDebugOn, newOptionManager, reset, 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 new width.


m_Height

protected int m_Height
the new height.


m_InterpolationType

protected Resize.InterpolationType m_InterpolationType
the type of interpolation to perform.


m_NumSubsampleBits

protected int m_NumSubsampleBits
the number of subsample bits.

Constructor Detail

Resize

public Resize()
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 AbstractOptionHandler

setWidth

public void setWidth(int value)
Sets the width to resize to.

Parameters:
value - the width, -1 uses original width

getWidth

public int getWidth()
Returns the width to resize to.

Returns:
the width, -1 if original width is used

widthTipText

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

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setHeight

public void setHeight(int value)
Sets the height to resize to.

Parameters:
value - the height, -1 uses original height

getHeight

public int getHeight()
Returns the height to resize to.

Returns:
the height, -1 if original height is used

heightTipText

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

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setInterpolationType

public void setInterpolationType(Resize.InterpolationType value)
Sets the type of interpolation to use.

Parameters:
value - the type

getInterpolationType

public Resize.InterpolationType getInterpolationType()
Returns the type of interpolation in use.

Returns:
the type

interpolationTypeTipText

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

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setNumSubsampleBits

public void setNumSubsampleBits(int value)
Sets the precision for subsampling in bits.

Parameters:
value - the number of bits

getNumSubsampleBits

public int getNumSubsampleBits()
Returns the precision for subsampling in bits.

Returns:
the number of bits

numSubsampleBitsTipText

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

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

doTransform

protected BufferedImageContainer[] doTransform(BufferedImageContainer img)
Performs no transformation at all, just returns the input.

Specified by:
doTransform in class AbstractImageTransformer<BufferedImageContainer>
Parameters:
img - the image to process (can be modified, since it is a copy)
Returns:
the copy of the image


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