Class ShortPixArray
java.lang.Object
com.xinapse.image.PixArray
com.xinapse.image.ShortPixArray
- Direct Known Subclasses:
UShortPixArray
A representation of an array of signed short pixels.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionint[]getHisto(int nbins) Computes a histogram of a ShortPixArray.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 short, 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 a ShortPixArray object to a BufferedOutputStream.Methods inherited from class PixArray
__getPix, copyPix, getInstance, getInstance, getMinMax, newInstance
-
Method Details
-
write
Writes a ShortPixArray object to a BufferedOutputStream. All pixels are written.- Specified by:
writein classPixArray- Parameters:
s- the BufferedOutputStream.byteOrder- the ByteOrder of the data in the output stream.- Returns:
- the number of bytes written.
- Throws:
IOException- if the data cannot be written.
-
getHisto
Computes a histogram of a ShortPixArray. This works properly if the pixel intensity range is less than the number of bins requested: if not then all the high intensity pixels are put into the last histogram bin.- 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
Basic 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 (exclusive) of the image pixel array that is required to be accessed. 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 {6, 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 accessedhighIdx- contains indexes to the highest index of the image pixel array that is required to be accessedop- the type of operation (GET or PUT).- Returns:
- a 1-dimensional short array cast to an Object.
- Throws:
IllegalArgumentException- the class of the pix array is incorrect for this type of image.
-
getPutSlice
Returns a 1-Dimensional array of type short, 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 (GET or PUT).- Returns:
- a 1-dimensional short 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 Short 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.
-