|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.xinapse.filter.AbstractKernelFilter
com.xinapse.filter.FixedWeightsKernelFilter
public class FixedWeightsKernelFilter
A class for performing filtering of images based on a moving kernel of pixels with fixed weights within the kernel.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.xinapse.filter.SpatialFilter |
|---|
SpatialFilter.SpecifierPanel |
| Field Summary | |
|---|---|
protected float[][][] |
weights
The 3-D array of weights in the kernel. |
| Fields inherited from interface com.xinapse.filter.SpatialFilter |
|---|
N_DOTS |
| Constructor Summary | |
|---|---|
protected |
FixedWeightsKernelFilter()
Default constructor produces an identity FixedWeightsKernelFilter with kernel size 1x1x1 that has no effect when applied. |
|
FixedWeightsKernelFilter(float[][][] wts,
boolean normalise,
FilterBoundaryCondition boundaryCondition)
Constructs a 3-dimensional kernel-based filter with the given filter weights. |
|
FixedWeightsKernelFilter(float[][] wts,
boolean normalise,
FilterBoundaryCondition boundaryCondition)
Constructs a 2-dimensional kernel-based filter with the given filter weights. |
| Method Summary | |
|---|---|
void |
add(FixedWeightsKernelFilter filter)
Adds the weights from a FixedWeightsKernelFilter to the weights of this one. |
static FixedWeightsKernelFilter |
add(FixedWeightsKernelFilter filter1,
FixedWeightsKernelFilter filter2)
Adds the weights from two FixedWeightsKernelFilters to create a new FixedWeightsKernelFilter. |
FixedWeightsKernelFilter |
convolve(FixedWeightsKernelFilter filter)
Convolves this FixedWeightsKernelFilter with another FixedWeightsKernelFilter to create a new FixedWeightsKernelFilter. |
FixedWeightsKernelFilter |
copyResize(int[] newSize,
boolean normalise)
Copies a FixedWeightsKernelFilter, possibly resizing it, creating a new FixedWeightsKernelFilter. |
void |
filterInPlaceBinary(BitSet pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
Filter an array of binary pixel values "in place". |
void |
filterInPlaceByte(byte[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
Filter an array of signed byte pixel values "in place". |
void |
filterInPlaceDouble(double[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
Filter an array of double-precision pixel values "in place". |
void |
filterInPlaceFloat(float[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
Filter an array of floating-point pixel values "in place". |
void |
filterInPlaceInt(int[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
Filter an array of signed int pixel values "in place". |
void |
filterInPlaceLong(long[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
Filter an array of long pixel values "in place". |
void |
filterInPlaceShort(short[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
Filter an array of signed short pixel values "in place". |
void |
filterInPlaceUByte(byte[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
Filter an array of unsigned byte pixel values "in place". |
void |
filterInPlaceUInt(int[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
Filter an array of unsigned int pixel values "in place". |
void |
filterInPlaceUShort(short[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
Filter an array of unsigned short pixel values "in place". |
int |
getNKernelCols()
Returns the number of columns in the filter kernel. |
int |
getNKernelRows()
Returns the number of rows in the filter kernel. |
int |
getNKernelSlices()
Returns the number of slices in the filter kernel. |
void |
scale(float scaleFactor)
Scale all kernel weights by the given scaling factor. |
float |
sumWeights()
Returns the sum of all the weights for this FixedWeightsKernelFilter. |
java.lang.String |
toString()
Returns a java.lang.String describing this FixedWeightsKernelFilter. |
| Methods inherited from class com.xinapse.filter.AbstractKernelFilter |
|---|
filter, filter, filter, filterInPlace, filterInPlace, filterInPlace, filterInPlace, filterInPlace, filterInPlace, filterInPlace |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.xinapse.filter.SpatialFilter |
|---|
filter, filter, filterInPlace, filterInPlace, filterInPlace, filterInPlace |
| Field Detail |
|---|
protected final float[][][] weights
| Constructor Detail |
|---|
protected FixedWeightsKernelFilter()
public FixedWeightsKernelFilter(float[][] wts,
boolean normalise,
FilterBoundaryCondition boundaryCondition)
throws java.lang.IllegalArgumentException
wts - a two-dimensional array of weights. This array must have an odd number of
elements in each of the two dimensions. The centre of the weights kernel will be
centred on the pixel being filtered. The first index of the array refers to the
the row direction, and the second to the column direction.normalise - if true the weights will be normalised when constructing the
kernel. If the weights cannot be normalised, then this argument has no effect.boundaryCondition - the FilterBoundaryCondition to apply when this
filter is applied to an array of pixels.
java.lang.IllegalArgumentException - if the dimensions of the kernel weights array aren't
odd-numbered in each of the two dimensions.
public FixedWeightsKernelFilter(float[][][] wts,
boolean normalise,
FilterBoundaryCondition boundaryCondition)
throws java.lang.IllegalArgumentException
wts - a three-dimensional array of weights. This array must have an odd number of
elements in each of the three dimensions. The centre of the weights kernel will be
centred on the pixel being filtered. The first index of the array refers to the
slice direction, the second index to the row direction, and the third to the column
direction.normalise - if true the weights will be normalised when constructing the
kernel. If the weights cannot be normalised, then this argument has no effect.boundaryCondition - the FilterBoundaryCondition to apply when this
filter is applied to an array of pixels.
java.lang.IllegalArgumentException - if the dimensions of the kernel weights array aren't
odd-numbered in each of the three dimensions.| Method Detail |
|---|
public int getNKernelCols()
AbstractKernelFilter
getNKernelCols in class AbstractKernelFilterpublic int getNKernelRows()
AbstractKernelFilter
getNKernelRows in class AbstractKernelFilterpublic int getNKernelSlices()
AbstractKernelFilter
getNKernelSlices in class AbstractKernelFilterpublic void scale(float scaleFactor)
scaleFactor - the scaling factor for the weights.public float sumWeights()
public void add(FixedWeightsKernelFilter filter)
throws java.lang.IllegalArgumentException
filter - the FixedWeightsKernelFilter from which to add the weights.
java.lang.IllegalArgumentException - if the two filters do not have the same kernel
dimensions.
public static FixedWeightsKernelFilter add(FixedWeightsKernelFilter filter1,
FixedWeightsKernelFilter filter2)
throws java.lang.IllegalArgumentException
filter1 - the first FixedWeightsKernelFilter from which to add the weights.filter2 - the second FixedWeightsKernelFilter from which to add the weights.
java.lang.IllegalArgumentException - if the two filters do not have the same kernel
dimensions.
public FixedWeightsKernelFilter copyResize(int[] newSize,
boolean normalise)
throws java.lang.IllegalArgumentException
newSize - an array of length at least 3 that specifies the new kernel size.normalise - whether the resulting FixedWeightsKernelFilter should be normalised
(the sum of all weights should be unity).
java.lang.IllegalArgumentExceptionpublic FixedWeightsKernelFilter convolve(FixedWeightsKernelFilter filter)
filter - the FixedWeightsKernelFilter with which this FixedWeightsKernelFilter will be
convolved.
public void filterInPlaceBinary(BitSet pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
throws CancelledException
AbstractKernelFilter
filterInPlaceBinary in class AbstractKernelFilterpixels - the array of image pixel values.nCols - the number of image columnsnRows - the number of image rows.nSlices - the number of image slices.worker - the MonitorWorker that may be used to cancel the filter operation.verbose - whether verbose reporting to System.out is turned on.
CancelledException - if the filter operation is cancelled by the user or
programmatically.
public void filterInPlaceByte(byte[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
throws CancelledException
AbstractKernelFilter
filterInPlaceByte in class AbstractKernelFilterpixels - the array of image pixel values.nCols - the number of image columnsnRows - the number of image rows.nSlices - the number of image slices.worker - the MonitorWorker that may be used to cancel the filter operation.verbose - whether verbose reporting to System.out is turned on.
CancelledException - if the filter operation is cancelled by the user or
programmatically.
public void filterInPlaceUByte(byte[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
throws CancelledException
AbstractKernelFilter
filterInPlaceUByte in class AbstractKernelFilterpixels - the array of image pixel values.nCols - the number of image columnsnRows - the number of image rows.nSlices - the number of image slices.worker - the MonitorWorker that may be used to cancel the filter operation.verbose - whether verbose reporting to System.out is turned on.
CancelledException - if the filter operation is cancelled by the user or
programmatically.
public void filterInPlaceShort(short[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
throws CancelledException
AbstractKernelFilter
filterInPlaceShort in class AbstractKernelFilterpixels - the array of image pixel values.nCols - the number of image columnsnRows - the number of image rows.nSlices - the number of image slices.worker - the MonitorWorker that may be used to cancel the filter operation.verbose - whether verbose reporting to System.out is turned on.
CancelledException - if the filter operation is cancelled by the user or
programmatically.
public void filterInPlaceUShort(short[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
throws CancelledException
AbstractKernelFilter
filterInPlaceUShort in class AbstractKernelFilterpixels - the array of image pixel values.nCols - the number of image columnsnRows - the number of image rows.nSlices - the number of image slices.worker - the MonitorWorker that may be used to cancel the filter operation.verbose - whether verbose reporting to System.out is turned on.
CancelledException - if the filter operation is cancelled by the user or
programmatically.
public void filterInPlaceInt(int[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
throws CancelledException
AbstractKernelFilter
filterInPlaceInt in class AbstractKernelFilterpixels - the array of image pixel values.nCols - the number of image columnsnRows - the number of image rows.nSlices - the number of image slices.worker - the MonitorWorker that may be used to cancel the filter operation.verbose - whether verbose reporting to System.out is turned on.
CancelledException - if the filter operation is cancelled by the user or
programmatically.
public void filterInPlaceUInt(int[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
throws CancelledException
AbstractKernelFilter
filterInPlaceUInt in class AbstractKernelFilterpixels - the array of image pixel values.nCols - the number of image columnsnRows - the number of image rows.nSlices - the number of image slices.worker - the MonitorWorker that may be used to cancel the filter operation.verbose - whether verbose reporting to System.out is turned on.
CancelledException - if the filter operation is cancelled by the user or
programmatically.
public void filterInPlaceLong(long[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
throws CancelledException
AbstractKernelFilter
filterInPlaceLong in class AbstractKernelFilterpixels - the array of image pixel values.nCols - the number of image columnsnRows - the number of image rows.nSlices - the number of image slices.worker - the MonitorWorker that may be used to cancel the filter operation.verbose - whether verbose reporting to System.out is turned on.
CancelledException - if the filter operation is cancelled by the user or
programmatically.
public void filterInPlaceFloat(float[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
throws CancelledException
AbstractKernelFilter
filterInPlaceFloat in class AbstractKernelFilterpixels - the array of image pixel values.nCols - the number of image columnsnRows - the number of image rows.nSlices - the number of image slices.worker - the MonitorWorker that may be used to cancel the filter operation.verbose - whether verbose reporting to System.out is turned on.
CancelledException - if the filter operation is cancelled by the user or
programmatically.
public void filterInPlaceDouble(double[] pixels,
int nCols,
int nRows,
int nSlices,
MonitorWorker worker,
boolean verbose)
throws CancelledException
AbstractKernelFilter
filterInPlaceDouble in class AbstractKernelFilterpixels - the array of image pixel values.nCols - the number of image columnsnRows - the number of image rows.nSlices - the number of image slices.worker - the MonitorWorker that may be used to cancel the filter operation.verbose - whether verbose reporting to System.out is turned on.
CancelledException - if the filter operation is cancelled by the user or
programmatically.public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||