Package ptolemy.actor.lib.jai
Class JAIImageToken
- java.lang.Object
-
- ptolemy.data.Token
-
- ptolemy.data.ObjectToken
-
- ptolemy.data.ImageToken
-
- ptolemy.actor.lib.jai.JAIImageToken
-
public class JAIImageToken extends ImageToken
A token that contains a javax.media.jai.RenderedOp. This token is used when dealing with images in the Java Advanced Imaging (JAI) library. Because it extends ImageToken, it can be used with the standard image processing tools by simply calling asAWTImage().- Since:
- Ptolemy II 3.0
- Version:
- $Id$
- Author:
- James Yeh
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Constructor Summary
Constructors Constructor Description JAIImageToken(javax.media.jai.RenderedOp value)Construct a token with a specified RenderedOp.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tokenadd(Token rightArgument)Return a new token whose value is the sum of this token and the argument.java.awt.ImageasAWTImage()Convert a javax.media.jai.RenderedOp to a BufferedImage, a subclass of awt.Image, and return it.Tokendivide(Token rightArgument)Return a new token whose value is the division of this token and the argument.TypegetType()Return the type of this token.javax.media.jai.RenderedOpgetValue()Return the value of the token, a renderedop.Tokenmultiply(Token rightArgument)Return a new token whose value is the multiplication of this token and the argument.Tokensubtract(Token rightArgument)Return a new token whose value is the subtraction of this token from the argument.java.lang.StringtoString()Return a description of the token.-
Methods inherited from class ptolemy.data.ObjectToken
_isCloseTo, _isEqualTo, convert, equals, getValueClass, hashCode, isCloseTo, isEqualTo, object
-
Methods inherited from class ptolemy.data.Token
addReverse, divideReverse, isCloseTo, isNil, modulo, moduloReverse, multiplyReverse, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, one, pow, subtractReverse, zero, zeroReturnType
-
-
-
-
Method Detail
-
add
public Token add(Token rightArgument) throws IllegalActionException
Return a new token whose value is the sum of this token and the argument. The image size is the size of the intersection of the two images. The number of bands in the image is equal to the smallest number of bands of the two sources. The data type is the smallest data type to have sufficient range for both input data types.- Overrides:
addin classToken- Parameters:
rightArgument- The token to add to this token.- Returns:
- A new token containing the result.
- Throws:
IllegalActionException- If the data type is not supported.
-
asAWTImage
public java.awt.Image asAWTImage()
Convert a javax.media.jai.RenderedOp to a BufferedImage, a subclass of awt.Image, and return it.- Specified by:
asAWTImagein classImageToken- Returns:
- A bufferedImage that is a rendering of the internal image.
-
divide
public Token divide(Token rightArgument) throws IllegalActionException
Return a new token whose value is the division of this token and the argument. The image size is the size of the intersection of the two images. The number of bands in the image is equal to the smallest number of bands of the two sources. The data type is the bigger of the two input data types- Overrides:
dividein classToken- Parameters:
rightArgument- The token to divide this token by.- Returns:
- A new token containing the result.
- Throws:
IllegalActionException- If the data type is not supported.
-
getType
public Type getType()
Return the type of this token.- Overrides:
getTypein classObjectToken- Returns:
- BaseType.OBJECT
-
getValue
public javax.media.jai.RenderedOp getValue()
Return the value of the token, a renderedop.- Overrides:
getValuein classObjectToken- Returns:
- The RenderedOp in this token.
-
multiply
public Token multiply(Token rightArgument) throws IllegalActionException
Return a new token whose value is the multiplication of this token and the argument. The image size is the size of the intersection of the two images. The number of bands in the image is equal to the smallest number of bands of the two sources. The data type is the bigger of the two input data types- Overrides:
multiplyin classToken- Parameters:
rightArgument- The token to multiply this token by.- Returns:
- A new token containing the result.
- Throws:
IllegalActionException- If the data type is not supported.
-
subtract
public Token subtract(Token rightArgument) throws IllegalActionException
Return a new token whose value is the subtraction of this token from the argument. The image size is the size of the intersection of the two images. The number of bands in the image is equal to the smallest number of bands of the two sources. The data type is the smallest data type to have sufficient range for both input data types.- Overrides:
subtractin classToken- Parameters:
rightArgument- The token to subtract from this token.- Returns:
- A new token containing the result.
- Throws:
IllegalActionException- If the data type is not supported.
-
toString
public java.lang.String toString()
Return a description of the token. If possible, derived classes should override this method and return the value of this token as a string that can be parsed by the expression language to recover a token with the same value. Unfortunately, in this base class, we can only return the a partial description of the token.- Overrides:
toStringin classObjectToken- Returns:
- A string representation of a record that partially describes the token.
-
-