skyview.geometry.sampler
Class ClipSampler

java.lang.Object
  extended by skyview.geometry.Sampler
      extended by skyview.geometry.sampler.ClipSampler
All Implemented Interfaces:
java.io.Serializable, Component

public class ClipSampler
extends Sampler

The class implements a fast flux conserving resampling based on the Sutherland-Hodgman clipping algorithm.

Consider an original image of data in some projection and a new map of an overlapping region with some projection, coordinate system, etc. Assume that the flux within a given pixel in the original image is constant over the area of the pixel. The flux within each pixel in the new map should be the integral of the flux in the region occupied by each pixel in the map.

The instance methods of this class are not thread-safe, however it is possible to generate a separate ClipSampler object for each thread to resample the same input image.

Developed by Tom McGlynn, NASA/GSFC October 3, 2002

See Also:
Serialized Form

Field Summary
protected  double drizzArea
          Drizzle Area
protected  double drizzOffset
          Drizzle offset
 
Fields inherited from class skyview.geometry.Sampler
bounds, inDepth, inHeight, inImage, inWidth, outDepth, outHeight, outImage, outWidth, trans
 
Constructor Summary
ClipSampler()
           
 
Method Summary
 java.lang.String getDescription()
          Get the description of this component.
 java.lang.String getName()
          Get the name of this component.
protected static void printVert(int n, double[] x, double[] y, java.lang.String label)
          Debugging routine that prints a list of vertices.
 void sample(int pix)
          Find the value in the input data to put in the output data.
 void samplePixel(int pix, double[] x, double[] y)
          Sample a single map pixel.
 void setDrizzle(double drizzle)
          Set the drizzle factor for sampling
 void setIntensive(boolean intensive)
           
 void setOutput(Image outImage)
          Set the output image for the sampling
 double weight()
          Return the weight associated with the last sampling.
 
Methods inherited from class skyview.geometry.Sampler
factory, setBounds, setInput, setOrder, setTransform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

drizzOffset

protected double drizzOffset
Drizzle offset


drizzArea

protected double drizzArea
Drizzle Area

Constructor Detail

ClipSampler

public ClipSampler()
Method Detail

setOutput

public void setOutput(Image outImage)
Description copied from class: Sampler
Set the output image for the sampling

Overrides:
setOutput in class Sampler

getName

public java.lang.String getName()
Description copied from interface: Component
Get the name of this component.


getDescription

public java.lang.String getDescription()
Description copied from interface: Component
Get the description of this component.


setIntensive

public void setIntensive(boolean intensive)

setDrizzle

public void setDrizzle(double drizzle)
Set the drizzle factor for sampling

Parameters:
drizzle - The drizzle factor should range from 0 to 1 and indicates the length of the side of the pixel inside the original image pixel in which the flux is assumed to be contained.

printVert

protected static void printVert(int n,
                                double[] x,
                                double[] y,
                                java.lang.String label)
Debugging routine that prints a list of vertices.

Parameters:
n - The number of vertices in the polygon
x - X coordinates
y - Y coordinates

sample

public void sample(int pix)
Description copied from class: Sampler
Find the value in the input data to put in the output data. The output array defined in a previous setOutput call is updated.

Specified by:
sample in class Sampler
Parameters:
pix - The index into the output array.

weight

public double weight()
Return the weight associated with the last sampling. For the ClipSampler, the weight can be associated with the 'area' of the pixel.


samplePixel

public void samplePixel(int pix,
                        double[] x,
                        double[] y)
Sample a single map pixel.

Parameters:
x - The x values of the corners of the pixel [4]
y - The y values of the corners of the pixel [4]