Package mil.nga.tiff
Class Rasters
- java.lang.Object
-
- mil.nga.tiff.Rasters
-
public class Rasters extends Object
Raster image values- Author:
- osbornb
-
-
Constructor Summary
Constructors Constructor Description Rasters(int width, int height, int[] bitsPerSamples, int[] sampleFormats)
Constructor Creates Rasters object where one bits per sample and sample format is provided for each sampleRasters(int width, int height, int[] bitsPerSamples, int[] sampleFormats, ByteOrder order)
Constructor Creates Rasters object where one bits per sample and sample format is provided for each sampleRasters(int width, int height, int samplesPerPixel, int bitsPerSample, int sampleFormat)
Constructor Creates Rasters object where given bits per sample and sample format is used for each sampleRasters(int width, int height, int samplesPerPixel, int bitsPerSample, int sampleFormat, ByteOrder order)
Constructor Creates Rasters object where given bits per sample and sample format is used for each sampleRasters(int width, int height, int samplesPerPixel, FieldType fieldType)
Constructor Creates Rasters object where given field type used for each sample.Rasters(int width, int height, int samplesPerPixel, FieldType fieldType, ByteOrder order)
Constructor Creates Rasters object where given field type used for each sample.Rasters(int width, int height, FieldType[] fieldTypes)
ConstructorRasters(int width, int height, FieldType[] fieldTypes, ByteBuffer interleaveValues)
ConstructorRasters(int width, int height, FieldType[] fieldTypes, ByteBuffer[] sampleValues)
ConstructorRasters(int width, int height, FieldType[] fieldTypes, ByteBuffer[] sampleValues, ByteBuffer interleaveValues)
ConstructorRasters(int width, int height, FieldType[] fieldTypes, ByteOrder order)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addToInterleave(int sampleIndex, int coordinate, Number value)
Add a value to the interleaved resultsvoid
addToSample(int sampleIndex, int coordinate, Number value)
Add a value to the sample resultsint
calculateRowsPerStrip(int planarConfiguration)
Calculate the rows per strip to writeint
calculateRowsPerStrip(int planarConfiguration, int maxBytesPerStrip)
Calculate the rows per strip to writeList<Integer>
getBitsPerSample()
Get the bits per sampleFieldType[]
getFieldTypes()
Returns field typesNumber
getFirstPixelSample(int x, int y)
Get the first pixel sample value, useful for single sample pixels (grayscale)int
getHeight()
Get the height of pixelsint
getInterleaveIndex(int x, int y)
Get the interleave index locationByteBuffer
getInterleaveValues()
Get the results stored as interleaved pixel samplesint
getNumPixels()
Return the number of pixelsNumber[]
getPixel(int x, int y)
Get the pixel sample valuesbyte[]
getPixelRow(int y, ByteOrder newOrder)
Returns byte array of pixel row.Number
getPixelSample(int sample, int x, int y)
Get a pixel sample valueList<Integer>
getSampleFormat()
Returns list of sample types constants Returns list of sample types constants (SAMPLE_FORMAT_UNSIGNED_INT, SAMPLE_FORMAT_SIGNED_INT or SAMPLE_FORMAT_FLOAT) for each sample in sample list @see getFieldTypes().int
getSampleIndex(int x, int y)
Get the sample index locationbyte[]
getSampleRow(int y, int sample, ByteOrder newOrder)
Returns byte array of sample row.int
getSamplesPerPixel()
Get the number of samples per pixelByteBuffer[]
getSampleValues()
Get the results stored by samplesint
getWidth()
Get the width of pixelsboolean
hasInterleaveValues()
True if the results are stored interleavedboolean
hasSampleValues()
True if the results are stored by samplesvoid
setFirstPixelSample(int x, int y, Number value)
Set the first pixel sample value, useful for single sample pixels (grayscale)void
setInterleaveValues(ByteBuffer interleaveValues)
Set the results stored as interleaved pixel samplesvoid
setPixel(int x, int y, Number[] values)
Set the pixel sample valuesvoid
setPixelSample(int sample, int x, int y, Number value)
Set a pixel sample valuevoid
setSampleValues(ByteBuffer[] sampleValues)
Set the results stored by samplesint
size()
Size in bytes of the imageint
sizePixel()
Size in bytes of a pixel
-
-
-
Constructor Detail
-
Rasters
public Rasters(int width, int height, FieldType[] fieldTypes, ByteBuffer[] sampleValues)
Constructor- Parameters:
width
- width of pixelsheight
- height of pixelsfieldTypes
- field type for each samplesampleValues
- empty sample values buffer array- Since:
- 2.0.0
-
Rasters
public Rasters(int width, int height, FieldType[] fieldTypes, ByteBuffer interleaveValues)
Constructor- Parameters:
width
- width of pixelsheight
- height of pixelsfieldTypes
- field type for each sampleinterleaveValues
- empty interleaved values buffer- Since:
- 2.0.0
-
Rasters
public Rasters(int width, int height, FieldType[] fieldTypes, ByteBuffer[] sampleValues, ByteBuffer interleaveValues)
Constructor- Parameters:
width
- width of pixelsheight
- height of pixelsfieldTypes
- Field type for each samplesampleValues
- empty sample values buffer arrayinterleaveValues
- empty interleaved values buffer- Since:
- 2.0.0
-
Rasters
public Rasters(int width, int height, int samplesPerPixel, FieldType fieldType)
Constructor Creates Rasters object where given field type used for each sample.- Parameters:
width
- width of pixelsheight
- height of pixelssamplesPerPixel
- number of samples per pixelfieldType
- type of field for each sample- Since:
- 2.0.0
-
Rasters
public Rasters(int width, int height, int samplesPerPixel, FieldType fieldType, ByteOrder order)
Constructor Creates Rasters object where given field type used for each sample.- Parameters:
width
- width of pixelsheight
- height of pixelssamplesPerPixel
- number of samples per pixelfieldType
- type of field for each sampleorder
- byte order- Since:
- 2.0.0
-
Rasters
public Rasters(int width, int height, int[] bitsPerSamples, int[] sampleFormats)
Constructor Creates Rasters object where one bits per sample and sample format is provided for each sample- Parameters:
width
- width of pixelsheight
- height of pixelsbitsPerSamples
- bits per samplessampleFormats
- sample formats- Since:
- 2.0.0
-
Rasters
public Rasters(int width, int height, int[] bitsPerSamples, int[] sampleFormats, ByteOrder order)
Constructor Creates Rasters object where one bits per sample and sample format is provided for each sample- Parameters:
width
- width of pixelsheight
- height of pixelsbitsPerSamples
- bits per samplessampleFormats
- sample formatsorder
- byte order- Since:
- 2.0.0
-
Rasters
public Rasters(int width, int height, int samplesPerPixel, int bitsPerSample, int sampleFormat)
Constructor Creates Rasters object where given bits per sample and sample format is used for each sample- Parameters:
width
- width of pixelsheight
- height of pixelssamplesPerPixel
- number of samples per pixelbitsPerSample
- bits per each samplesampleFormat
- format for each sample- Since:
- 2.0.0
-
Rasters
public Rasters(int width, int height, int samplesPerPixel, int bitsPerSample, int sampleFormat, ByteOrder order)
Constructor Creates Rasters object where given bits per sample and sample format is used for each sample- Parameters:
width
- width of pixelsheight
- height of pixelssamplesPerPixel
- number of samples per pixelbitsPerSample
- bits per each samplesampleFormat
- format for each sampleorder
- byte order- Since:
- 2.0.0
-
Rasters
public Rasters(int width, int height, FieldType[] fieldTypes)
Constructor- Parameters:
width
- width of pixelsheight
- height of pixelsfieldTypes
- field types per sample- Since:
- 2.0.0
-
-
Method Detail
-
hasSampleValues
public boolean hasSampleValues()
True if the results are stored by samples- Returns:
- true if results exist
-
hasInterleaveValues
public boolean hasInterleaveValues()
True if the results are stored interleaved- Returns:
- true if results exist
-
addToSample
public void addToSample(int sampleIndex, int coordinate, Number value)
Add a value to the sample results- Parameters:
sampleIndex
- sample indexcoordinate
- coordinate locationvalue
- value
-
addToInterleave
public void addToInterleave(int sampleIndex, int coordinate, Number value)
Add a value to the interleaved results- Parameters:
sampleIndex
- sample indexcoordinate
- coordinate locationvalue
- value- Since:
- 2.0.0
-
getWidth
public int getWidth()
Get the width of pixels- Returns:
- width
-
getHeight
public int getHeight()
Get the height of pixels- Returns:
- height
-
getNumPixels
public int getNumPixels()
Return the number of pixels- Returns:
- number of pixels
-
getSamplesPerPixel
public int getSamplesPerPixel()
Get the number of samples per pixel- Returns:
- samples per pixel
-
getBitsPerSample
public List<Integer> getBitsPerSample()
Get the bits per sample- Returns:
- bits per sample
-
getSampleFormat
public List<Integer> getSampleFormat()
Returns list of sample types constants Returns list of sample types constants (SAMPLE_FORMAT_UNSIGNED_INT, SAMPLE_FORMAT_SIGNED_INT or SAMPLE_FORMAT_FLOAT) for each sample in sample list @see getFieldTypes(). @seeTiffConstants
- Returns:
- list of sample type constants
- Since:
- 2.0.0
-
getSampleValues
public ByteBuffer[] getSampleValues()
Get the results stored by samples- Returns:
- sample values
- Since:
- 2.0.0
-
setSampleValues
public void setSampleValues(ByteBuffer[] sampleValues)
Set the results stored by samples- Parameters:
sampleValues
- sample values- Since:
- 2.0.0
-
getInterleaveValues
public ByteBuffer getInterleaveValues()
Get the results stored as interleaved pixel samples- Returns:
- interleaved values
- Since:
- 2.0.0
-
setInterleaveValues
public void setInterleaveValues(ByteBuffer interleaveValues)
Set the results stored as interleaved pixel samples- Parameters:
interleaveValues
- interleaved values- Since:
- 2.0.0
-
getPixel
public Number[] getPixel(int x, int y)
Get the pixel sample values- Parameters:
x
- x coordinate (>= 0 && <getWidth()
)y
- y coordinate (>= 0 && <getHeight()
)- Returns:
- pixel sample values
-
setPixel
public void setPixel(int x, int y, Number[] values)
Set the pixel sample values- Parameters:
x
- x coordinate (>= 0 && <getWidth()
)y
- y coordinate (>= 0 && <getHeight()
)values
- pixel values
-
getPixelRow
public byte[] getPixelRow(int y, ByteOrder newOrder)
Returns byte array of pixel row.- Parameters:
y
- Row indexnewOrder
- Desired byte order of result byte array- Returns:
- Byte array of pixel row
- Since:
- 2.0.0
-
getSampleRow
public byte[] getSampleRow(int y, int sample, ByteOrder newOrder)
Returns byte array of sample row.- Parameters:
y
- Row indexsample
- Sample indexnewOrder
- Desired byte order of resulting byte array- Returns:
- Byte array of sample row
- Since:
- 2.0.0
-
getPixelSample
public Number getPixelSample(int sample, int x, int y)
Get a pixel sample value- Parameters:
sample
- sample index (>= 0 && <getSamplesPerPixel()
)x
- x coordinate (>= 0 && <getWidth()
)y
- y coordinate (>= 0 && <getHeight()
)- Returns:
- pixel sample
-
setPixelSample
public void setPixelSample(int sample, int x, int y, Number value)
Set a pixel sample value- Parameters:
sample
- sample index (>= 0 && <getSamplesPerPixel()
)x
- x coordinate (>= 0 && <getWidth()
)y
- y coordinate (>= 0 && <getHeight()
)value
- pixel value
-
getFirstPixelSample
public Number getFirstPixelSample(int x, int y)
Get the first pixel sample value, useful for single sample pixels (grayscale)- Parameters:
x
- x coordinate (>= 0 && <getWidth()
)y
- y coordinate (>= 0 && <getHeight()
)- Returns:
- first pixel sample
-
setFirstPixelSample
public void setFirstPixelSample(int x, int y, Number value)
Set the first pixel sample value, useful for single sample pixels (grayscale)- Parameters:
x
- x coordinate (>= 0 && <getWidth()
)y
- y coordinate (>= 0 && <getHeight()
)value
- pixel value
-
getSampleIndex
public int getSampleIndex(int x, int y)
Get the sample index location- Parameters:
x
- x coordinatey
- y coordinate- Returns:
- sample index
-
getInterleaveIndex
public int getInterleaveIndex(int x, int y)
Get the interleave index location- Parameters:
x
- x coordinatey
- y coordinate- Returns:
- interleave index
-
size
public int size()
Size in bytes of the image- Returns:
- bytes
-
sizePixel
public int sizePixel()
Size in bytes of a pixel- Returns:
- bytes
-
calculateRowsPerStrip
public int calculateRowsPerStrip(int planarConfiguration)
Calculate the rows per strip to write- Parameters:
planarConfiguration
- chunky or planar- Returns:
- rows per strip
-
calculateRowsPerStrip
public int calculateRowsPerStrip(int planarConfiguration, int maxBytesPerStrip)
Calculate the rows per strip to write- Parameters:
planarConfiguration
- chunky or planarmaxBytesPerStrip
- attempted max bytes per strip- Returns:
- rows per strip
-
getFieldTypes
public FieldType[] getFieldTypes()
Returns field types- Returns:
- field types
- Since:
- 2.0.0
-
-