Class DoublePixArray
java.lang.Object
com.xinapse.image.PixArray
com.xinapse.image.DoublePixArray
- Direct Known Subclasses:
DoubleComplexPixArray
A representation of an array of double-precision pixels.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionint[]getHisto(int nbins) Computes a histogram of a DoublePixArray.Basic pixel accessor method for images of any dimensionality.Gets/puts a single pixel value from/to an an image.getPutSlice(Object array, int slice, PixelOp op) Returns a 1-Dimensional array of type int, cast as an Object, with array indices [0 to (nRows * nCols)-1], representing the pixel intensity values for one slice of this image.static voidsincInterpolate(double[] origIntensities, double[] regriddedIntensities, float[] gridPt) Sinc interpolate a set of pixel intensities onto a new set of grid points.longwrite(BufferedOutputStream s, ByteOrder byteOrder) Writes an DoublePixArray object to a BufferedOutputStream.Methods inherited from class PixArray
__getPix, copyPix, getInstance, getInstance, getMinMax, newInstance
-
Method Details
-
write
Writes an DoublePixArray object to a BufferedOutputStream. All pixels are written.- Specified by:
writein classPixArray- Parameters:
s- the BufferedOutputStream.byteOrder- the ByteOrder of the data in the input stream.- Returns:
- the number of bytes written.
- Throws:
IOException- if the data cannot be written.
-
getHisto
Computes a histogram of a DoublePixArray. This works properly if the pixel intensity range is less than the number of bins requested; if not then a InvalidImageException is thrown.- Specified by:
getHistoin classPixArray- Parameters:
nbins- the number of bins in the histogram.- Returns:
- an int[] of length 2 where first element is the number of pixels of intensity min pixel, and the bins are in steps of 1 intensity init.
- Throws:
InvalidImageException- if the histogram can't be computed.
-
getPutPix
Description copied from class:PixArrayBasic pixel accessor method for images of any dimensionality. The int[] lowIdx contains indexes to the lowest index of the image pixel array that is required to be accessed, and highIdx indexes to the highest index of the image pixel array that is required to be accessed (exclusive). Only image dimensions from lowIdx to highIdx are accessed. For example, if you have a 10-slice 256x256 3-dimensional image and want the pixel values for just slices 2 to 5, then lowIdx would have values {2, 0, 0} and highIdx would have values {5, 255, 255}.- Specified by:
getPutPixin classPixArray- Parameters:
arrayToReuse- for get operations is an array to put pixels values in; for put operations contains the pixel values to put.lowIdx- contains indexes to the lowest index of the image pixel array that is required to be accessed (inclusive).highIdx- contains indexes to the highest index of the image pixel array that is required to be accessed (exclusive).op- the type of operation (PixelOp.GET or PixelOp.PUT).- Returns:
- a 1-dimensional array of the appropriate type cast to an Object.
-
getPutSlice
Returns a 1-Dimensional array of type int, cast as an Object, with array indices [0 to (nRows * nCols)-1], representing the pixel intensity values for one slice of this image. Applicable only to images with dimensionality of 2 or greater. If the image has dimensionality of greater than three, then this routine pretends that the image contains a just one multi-slice image, where in fact it contains series of multi-slice images - one for each of the extra dimensions. These can be accessed by providing a slice-number argument appropriate for the dimensionality of the image. For example, if the image is 4-dimensional with dimensions 10, 20, 256, 256, then this consists of ten 3-D images each with 20 slices of 256x256 pixels. This routine pretends that thus is a 3-D image with 10x20 (=200) slices, so any slice from 0-199 could be accessed.- Specified by:
getPutSlicein classPixArray- Parameters:
array- for get operations is an array to put pixels values in; for put operations contains the pixel values to put.slice- the slice number.op- the type of operation (GET or PUT).- Returns:
- a 1-dimensional int array cast to an Object.
- Throws:
IllegalArgumentException- if the requested pixel values cannot be put or got.
-
getPutPix
Gets/puts a single pixel value from/to an an image. Returns a java.lang.Double cast to Object corresponding to the picture primitve type. This represents the pixel intensity value for the pixel indexed by each element of pixIdx.- Specified by:
getPutPixin classPixArray- Parameters:
pix- a pixel value for a put operation or null for a get operation.pixIdx- an array of length at least nDim with elements 0 to nDim-1 equal to the index in that image dimension.op- the type of operation (GET or PUT).- Returns:
- a pixel value for a get operation or the supplied pixel for a put operation.
- Throws:
IllegalArgumentException- if the pixIdx is bad.
-
sincInterpolate
public static void sincInterpolate(double[] origIntensities, double[] regriddedIntensities, float[] gridPt) Sinc interpolate a set of pixel intensities onto a new set of grid points. The original grid points are assumed to be 0, 1, 2, 3, 4,...etc.- Parameters:
origIntensities- contains the pixel intensities of the input grid.regriddedIntensities- contains the pixel intensities in the resampled grid.gridPt- specifies the grid points of the pixels sample locations in the resampled grid.
-