org.jplot2d.data
Class ImageDataBuffer
- java.lang.Object
-
- org.jplot2d.data.ImageDataBuffer
-
- Direct Known Subclasses:
- ByteDataBuffer, DoubleDataBuffer, FloatDataBuffer, IntDataBuffer, ShortDataBuffer
public abstract class ImageDataBuffer extends java.lang.ObjectWarp a band of image data. The data can be in a array, a 2d array , or a nio Buffer. The ImageDataBuffer can optionally take an offset, so that data in an existing array can be used even if the interesting data doesn't start at array location zero. It can also associate with an ImageMaskBuffer, to determines whether a element is valid or not.
-
-
Constructor Summary
Constructors Constructor and Description ImageDataBuffer(ImageMaskBuffer mask)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract double[]calcMinMax(int w, int h)Calculate the min and max value in the given rectangle for this data buffer, and return them in a double array.abstract doublecountValid(int w, int h)Count the number of valid values in the given rectangle for this data buffer.abstract bytegetByte(int x, int y)Returns the sample for the pixel located at (x,y) as a double.abstract doublegetDouble(int x, int y)Returns the sample for the pixel located at (x,y) as a double.abstract floatgetFloat(int x, int y)Returns the sample for the pixel located at (x,y) as a double.abstract intgetInt(int x, int y)Returns the sample for the pixel located at (x,y) as a double.abstract shortgetShort(int x, int y)Returns the sample for the pixel located at (x,y) as a double.booleanhasMasks()booleanisMasked(int x, int y)A boolean that determines for the associated element whether the value is valid or not.
-
-
-
Constructor Detail
-
ImageDataBuffer
public ImageDataBuffer(ImageMaskBuffer mask)
-
-
Method Detail
-
hasMasks
public boolean hasMasks()
-
isMasked
public boolean isMasked(int x, int y)A boolean that determines for the associated element whether the value is valid or not. When an element of the mask is False, the corresponding element is valid and is said to be unmasked. When an element of the mask is True, the corresponding element is said to be masked (invalid).- Parameters:
x- The X coordinate of the pixel locationy- The Y coordinate of the pixel location- Returns:
- an boolean
-
getByte
public abstract byte getByte(int x, int y)Returns the sample for the pixel located at (x,y) as a double.- Parameters:
x- The X coordinate of the pixel locationy- The Y coordinate of the pixel location- Returns:
- the sample for the specified pixel
-
getShort
public abstract short getShort(int x, int y)Returns the sample for the pixel located at (x,y) as a double.- Parameters:
x- The X coordinate of the pixel locationy- The Y coordinate of the pixel location- Returns:
- the sample for the specified pixel
-
getInt
public abstract int getInt(int x, int y)Returns the sample for the pixel located at (x,y) as a double.- Parameters:
x- The X coordinate of the pixel locationy- The Y coordinate of the pixel location- Returns:
- the sample for the specified pixel
-
getFloat
public abstract float getFloat(int x, int y)Returns the sample for the pixel located at (x,y) as a double.- Parameters:
x- The X coordinate of the pixel locationy- The Y coordinate of the pixel location- Returns:
- the sample for the specified pixel
-
getDouble
public abstract double getDouble(int x, int y)Returns the sample for the pixel located at (x,y) as a double.- Parameters:
x- The X coordinate of the pixel locationy- The Y coordinate of the pixel location- Returns:
- the sample for the specified pixel
-
countValid
public abstract double countValid(int w, int h)Count the number of valid values in the given rectangle for this data buffer. For double and float data, NaN, POSITIVE_INFINITY and NEGATIVE_INFINITY are considered as invalid.- Parameters:
w- the width of the given rectangleh- the height of the given rectangle- Returns:
- the number of valid values
-
calcMinMax
public abstract double[] calcMinMax(int w, int h)Calculate the min and max value in the given rectangle for this data buffer, and return them in a double array. For double and float data, NaN, POSITIVE_INFINITY and NEGATIVE_INFINITY are considered as invalid and ignored.- Parameters:
w- the width of the given rectangleh- the height of the given rectangle- Returns:
- the min and max values
-
-
DMelt 3.0 © DataMelt by jWork.ORG