org.jaitools.jiffle.runtime
Interface JiffleDirectRuntime

All Superinterfaces:
JiffleRuntime
All Known Implementing Classes:
AbstractDirectRuntime

public interface JiffleDirectRuntime
extends JiffleRuntime

Defines methods implemented by runtime classes adopting the direct evaluation model. In this model, the runtime object writes values to the destination image(s) directly within its evaluate(double, double) method. It also provides an evaluateAll(JiffleProgressListener) method.

Since:
0.1
Version:
$Id: JiffleDirectRuntime.java 1653 2011-06-16 10:23:02Z michael.bedward $
Author:
Michael Bedward

Method Summary
 void evaluate(double x, double y)
          Evaluates the script for the given world position.
 void evaluateAll(JiffleProgressListener pl)
          Evaluates the script for all pixel locations within the world bounds.
 java.util.Map<java.lang.String,java.awt.image.RenderedImage> getImages()
          Gets the images used by this object and returns them as a Map with variable names as keys and images as values.
 double readFromImage(java.lang.String srcImageName, double x, double y, int band)
          Gets a value from a source image for a given world position and image band.
 void setDefaultBounds()
          Sets default bounds for the processing area.
 void setDestinationImage(java.lang.String varName, java.awt.image.WritableRenderedImage image)
          Associates a variable name with a destination image.
 void setDestinationImage(java.lang.String varName, java.awt.image.WritableRenderedImage image, CoordinateTransform tr)
          Associates a variable name with a destination image and coordinate transform.
 void setSourceImage(java.lang.String varName, java.awt.image.RenderedImage image)
          Associates a variable name with a source image.
 void setSourceImage(java.lang.String varName, java.awt.image.RenderedImage image, CoordinateTransform tr)
          Associates a variable name with a source image and coordinate transform.
 void writeToImage(java.lang.String destImageName, double x, double y, int band, double value)
          Writes a value to a destination image for a given world position and image band.
 
Methods inherited from interface org.jaitools.jiffle.runtime.JiffleRuntime
getDestinationVarNames, getHeight, getMaxX, getMaxY, getMinX, getMinY, getNumPixels, getSourceVarNames, getVar, getVarNames, getWidth, getXRes, getYRes, isWorldSet, setDefaultTransform, setImageParams, setVar, setWorldByNumPixels, setWorldByResolution
 

Method Detail

setDestinationImage

void setDestinationImage(java.lang.String varName,
                         java.awt.image.WritableRenderedImage image,
                         CoordinateTransform tr)
                         throws JiffleException
Associates a variable name with a destination image and coordinate transform. The transform defines how to convert from processing area coordinates to image (pixel) coordinates. If tr is null the default identify transform will be used.

Note that Jiffle uses rounding to reduce the transformed coordinates to integers.

Parameters:
varName - script variable representing the destination image
image - writable image
tr - transform for processing area to image coordinates
Throws:
JiffleException - if the world bounds and resolution have not been set previously

setDestinationImage

void setDestinationImage(java.lang.String varName,
                         java.awt.image.WritableRenderedImage image)
Associates a variable name with a destination image. Equivalent to:

 setDestinationImage(varName, image, null)
 
This convenience method is defined in the interface because it will be commonly when working directly with image coordinates.

Parameters:
varName - script variable representing the destination image
image - writable image

setSourceImage

void setSourceImage(java.lang.String varName,
                    java.awt.image.RenderedImage image,
                    CoordinateTransform tr)
                    throws JiffleException
Associates a variable name with a source image and coordinate transform. The transform defines how to convert from processing area coordinates to image (pixel) coordinates. If tr is null the default identify transform will be used.

Note that Jiffle uses rounding to reduce the transformed coordinates to integers.

Parameters:
varName - script variable representing the source image
image - writable image
tr - transform for processing area to image coordinates
Throws:
JiffleException - if the world bounds and resolution have not been set previously

setSourceImage

void setSourceImage(java.lang.String varName,
                    java.awt.image.RenderedImage image)
Associates a variable name with a source image. Equivalent to:

 setSourceImage(varName, image, null)
 
This convenience method is defined in the interface because it will be commonly when working directly with image coordinates.

Parameters:
varName - script variable representing the source image
image - writable image

setDefaultBounds

void setDefaultBounds()
Sets default bounds for the processing area. These are the bounds of the first destination image or, if there are no destination images, the bounds of the first source image, where first means first added to the run-time object's list of images.


evaluate

void evaluate(double x,
              double y)
Evaluates the script for the given world position.

Parameters:
x - world position X ordinate
y - world position Y ordinate

evaluateAll

void evaluateAll(JiffleProgressListener pl)
Evaluates the script for all pixel locations within the world bounds.

Parameters:
pl - an optional progress listener (may be null

readFromImage

double readFromImage(java.lang.String srcImageName,
                     double x,
                     double y,
                     int band)
Gets a value from a source image for a given world position and image band.

Parameters:
srcImageName - the source image
x - source X ordinate in world units
y - source Y ordinate in world units
band - source band
Returns:
image value

writeToImage

void writeToImage(java.lang.String destImageName,
                  double x,
                  double y,
                  int band,
                  double value)
Writes a value to a destination image for a given world position and image band.

Parameters:
destImageName -
x - destination X ordinate in world units
y - destination Y ordinate in world units
band - destination band
value - the value to write

getImages

java.util.Map<java.lang.String,java.awt.image.RenderedImage> getImages()
Gets the images used by this object and returns them as a Map with variable names as keys and images as values.

Returns:
images keyed by variable name


Copyright © 2011. All Rights Reserved.