Package ij.process
Class DownsizeTable
java.lang.Object
ij.process.DownsizeTable
public class DownsizeTable extends 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
Fields Modifier and Type Field Description 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 pointint
srcEnd
index of the last point of the source data that should be accessedint
srcStart
index of the first point of the source data that should be accessedfloat[]
weights
For each source point, weights for adding it to the destination point given in the corresponding element of 'indices' -
Method Summary
Modifier and Type Method Description protected float
kernel(double x)
-
Field Details
-
kernelSize
public final int kernelSizeNumber of kernel points per source data point -
srcStart
public final int srcStartindex of the first point of the source data that should be accessed -
srcEnd
public final int srcEndindex of the last point of the source data that should be accessed -
indices
public final int[] indicesFor 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[] weightsFor each source point, weights for adding it to the destination point given in the corresponding element of 'indices'
-
-
Method Details
-
kernel
protected float kernel(double x)
-