Class 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 Detail

      • JAIImageToken

        public JAIImageToken​(javax.media.jai.RenderedOp value)
        Construct a token with a specified RenderedOp.
        Parameters:
        value - The RenderedOp with which to construct the JAIImageToken.
    • 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:
        add in class Token
        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:
        asAWTImage in class ImageToken
        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:
        divide in class Token
        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:
        getType in class ObjectToken
        Returns:
        BaseType.OBJECT
      • getValue

        public javax.media.jai.RenderedOp getValue()
        Return the value of the token, a renderedop.
        Overrides:
        getValue in class ObjectToken
        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:
        multiply in class Token
        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:
        subtract in class Token
        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:
        toString in class ObjectToken
        Returns:
        A string representation of a record that partially describes the token.