ij.process
Class DownsizeTable
java.lang.Object
ij.process.DownsizeTable
public class DownsizeTable
- extends java.lang.Object
A table for easier downsizing by convolution with a kernel.
Supports the interpolation methods of ImageProcessor: none, bilinear, bicubic
Convention used: The left edges of the first pixel are the same for source and destination.
E.g. when downsizing by a factor of 2, pixel 0 of the destination
takes the space of pixels 0 and 1 of the source.
Example for use: Downsizing row 0 of 'pixels' from 'roi.width' to 'destinationWidth'.
The input range is given by the roi rectangle.
Output is written to row 0 of 'pixels2' (width: 'destinationWidth')
DownSizeTable dt = new DownSizeTable(width, roi.x, roi.width, destinationWidth, ImageProcessor.BICUBIC);
int tablePointer = 0;
for (int srcPoint=dt.srcStart, srcPoint<=dt.srcEnd; srcPoint++) {
float v = pixels[srcPoint];
for (int i=0; i
Field Summary |
int[] |
indices
For each source point between srcStart and srcEnd, indices of destination
points where the data should be added. |
int |
kernelSize
Number of kernel points per source data point |
int |
srcEnd
index of the last point of the source data that should be accessed |
int |
srcStart
index of the first point of the source data that should be accessed |
float[] |
weights
For each source point, weights for adding it to the destination point
given in the corresponding element of 'indices' |
Method Summary |
protected float |
kernel(double x)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
kernelSize
public final int kernelSize
- Number of kernel points per source data point
srcStart
public final int srcStart
- index of the first point of the source data that should be accessed
srcEnd
public final int srcEnd
- index of the last point of the source data that should be accessed
indices
public final int[] indices
- For each source point between srcStart and srcEnd, indices of destination
points where the data should be added.
Arranged in blocks of 'kernelSize' points. E.g. for kernelSize=2, array
elements 0,1 are for point srcStart, 2,3 for point srcStart+1, etc.
weights
public final float[] weights
- For each source point, weights for adding it to the destination point
given in the corresponding element of 'indices'
kernel
protected float kernel(double x)