Class BytePixArray
java.lang.Object
com.xinapse.image.PixArray
com.xinapse.image.BytePixArray
- Direct Known Subclasses:
RGBInterlacedPixArray, UBytePixArray
A representation of an array of signed byte pixels, with an intensity range -128 .. +127.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionint[]getHisto(int nbins) Computes a histogram of a BytePixArray.Basic pixel accessor method for images of any dimensionality.Gets/puts a single pixel value from/to this PixArray.getPutSlice(Object array, int slice, PixelOp op) Returns a 1-Dimensional array of type appropriate of the image pixel type, cast as an Object, with array indices [0 to (nRows * nCols)-1], representing the pixel intensity values for one slice of this image.longwrite(BufferedOutputStream s, ByteOrder byteOrder) Writes this BytePixArray object to a BufferedOutputStream.Methods inherited from class PixArray
__getPix, copyPix, getInstance, getInstance, getMinMax, newInstance
-
Method Details
-
write
Writes this BytePixArray object to a BufferedOutputStream. All pixels are written.- Specified by:
writein classPixArray- Parameters:
s- the BufferedOutputStream.byteOrder- is ignored.- Returns:
- the number of bytes written.
- Throws:
IOException- if the data cannot be written.
-
getHisto
Computes a histogram of a BytePixArray.- Specified by:
getHistoin classPixArray- Parameters:
nbins- the number of bins in the histogram.- Returns:
- an int[] of length 2 where the first element is the number of pixels of value false and the second element is the number of pixels of value true.
- 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
Description copied from class:PixArrayReturns a 1-Dimensional array of type appropriate of the image pixel type, 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 is 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 (PixelOp.GET or PixelOp.PUT).- Returns:
- a 1-dimensional array of the appropriate primitive type cast to an Object.
-
getPutPix
Description copied from class:PixArrayGets/puts a single pixel value from/to this PixArray. Returns a java Object of the appropriate class for the primitive pixel type, cast to an Object. This represents the pixel intensity value for the pixel indexed by each element of pixIdx.The
Classof pixel that must be supplied (for put operations), or that is returned (for get operations) is:
PixelDataType.BINARYimages - java.lang.Boolean.PixelDataType.BYTEimages - java.lang.Byte.PixelDataType.UBYTEimages - java.lang.Short.PixelDataType.RGB_INTERLACEDimages - java.awt.Color.PixelDataType.RGB_BY_PLANEimages - java.awt.Color.PixelDataType.COLOURPACKEDimages - java.awt.Color.PixelDataType.SHORTimages - java.lang.Short.PixelDataType.USHORTimages - java.lang.Integer.PixelDataType.INTimages - java.lang.Integer.PixelDataType.UINTimages - java.lang.Long.PixelDataType.FLOATimages - java.lang.Float.PixelDataType.COMPLEXimages - com.xinapse.image.Complex.PixelDataType.DOUBLEimages - java.lang.Double.PixelDataType.DOUBLECOMPLEXimages - com.xinapse.image.DoubleComplex.
- 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 (PixelOp.GET or PixelOp.PUT).- Returns:
- a pixel value for a get operation or the supplied pixel for a put operation.
-