Package org.apache.sis.image
Class Visualization.Builder
java.lang.Object
org.apache.sis.image.Visualization.Builder
- Enclosing class:
- Visualization
Builds an image where all sample values are indices of colors in an
IndexColorModel
.
If the given image stores sample values as unsigned bytes or short integers, then those values
are used as-is (they are not copied or converted). Otherwise Visualization
will convert
sample values to unsigned bytes in order to enable the use of IndexColorModel
.
This builder accepts two kinds of input:
- Non-null
sourceBands
andImageProcessor.getCategoryColors()
. - Non-null
rangesAndColors
.
Resampling
Visualization
can optionally be combined with a ResampledImage
operation.
This can be done by providing a non-null value to the toSource
argument.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Rectangle
Pixel coordinates of the visualization image, ornull
if same assource
image.The colors to use for given categories of sample values, ornull
is unspecified.private ColorModel
Color model ofVisualization
image.private org.opengis.referencing.operation.MathTransform1D[]
Transfer functions to apply on each band of the source image.(package private) Number[]
Values to use for pixels in this image that cannot be mapped to pixels in source image.(package private) Interpolation
Object to use for performing interpolations.(package private) ImageLayout
Computer of tile size.private static final int
Number of bands of the image to create.(package private) javax.measure.Quantity<?>[]
Values of "org.apache.sis.PositionalAccuracy" property, ornull
if none.private Collection<Map.Entry<NumberRange<?>,
Color[]>> Colors to apply for range of sample values in source image, ornull
if none.private SampleModel
Sample model ofVisualization
image.private RenderedImage
Image to be resampled and converted.private List<SampleDimension>
Description ofsource
bands, ornull
if none.private org.opengis.referencing.operation.MathTransform
Conversion from pixel coordinates of visualization image to pixel coordinates ofsource
image.private static final int
Band to make visible. -
Constructor Summary
ConstructorsConstructorDescriptionBuilder
(RenderedImage source, Collection<Map.Entry<NumberRange<?>, Color[]>> rangesAndColors) Creates a builder for a visualization image with colors specified for range of values.Builder
(Rectangle bounds, RenderedImage source, org.opengis.referencing.operation.MathTransform toSource, List<SampleDimension> sourceBands) Creates a builder for a visualization image with colors inferred from sample dimensions. -
Method Summary
Modifier and TypeMethodDescription(package private) RenderedImage
create
(ImageProcessor processor) Returns an image where all sample values are indices of colors in anIndexColorModel
.
-
Field Details
-
NUM_BANDS
private static final int NUM_BANDSNumber of bands of the image to create.- See Also:
-
VISIBLE_BAND
private static final int VISIBLE_BANDBand to make visible.- See Also:
-
bounds
Pixel coordinates of the visualization image, ornull
if same assource
image. -
source
Image to be resampled and converted. -
toSource
private org.opengis.referencing.operation.MathTransform toSourceConversion from pixel coordinates of visualization image to pixel coordinates ofsource
image. -
sourceBands
Description ofsource
bands, ornull
if none. -
rangesAndColors
Colors to apply for range of sample values in source image, ornull
if none. -
layout
ImageLayout layoutComputer of tile size. -
interpolation
Interpolation interpolationObject to use for performing interpolations. -
categoryColors
The colors to use for given categories of sample values, ornull
is unspecified. -
fillValues
Number[] fillValuesValues to use for pixels in this image that cannot be mapped to pixels in source image. -
positionalAccuracyHints
javax.measure.Quantity<?>[] positionalAccuracyHintsValues of "org.apache.sis.PositionalAccuracy" property, ornull
if none. -
converters
private org.opengis.referencing.operation.MathTransform1D[] convertersTransfer functions to apply on each band of the source image. -
sampleModel
Sample model ofVisualization
image. -
colorModel
Color model ofVisualization
image.
-
-
Constructor Details
-
Builder
Builder(Rectangle bounds, RenderedImage source, org.opengis.referencing.operation.MathTransform toSource, List<SampleDimension> sourceBands) Creates a builder for a visualization image with colors inferred from sample dimensions.- Parameters:
bounds
- desired domain of pixel coordinates, ornull
if same assource
image.source
- the image for which to replace the color model.toSource
- pixel coordinates conversion tosource
image, ornull
if none.sourceBands
- description ofsource
bands.
-
Builder
Builder(RenderedImage source, Collection<Map.Entry<NumberRange<?>, Color[]>> rangesAndColors) Creates a builder for a visualization image with colors specified for range of values. Current version assumes that target image bounds are the same than source image bounds and that there is no change of pixel coordinates, but this is not a real restriction. Thebounds
andtoSource
arguments could be added back in the future if useful.- Parameters:
source
- the image for which to replace the color model.rangesAndColors
- range of sample values in source image associated to colors to apply.
-
-
Method Details
-
create
RenderedImage create(ImageProcessor processor) throws org.opengis.referencing.operation.NoninvertibleTransformException Returns an image where all sample values are indices of colors in anIndexColorModel
. If the source image stores sample values as unsigned bytes or short integers, then those values are used as-is (they are not copied or converted). Otherwise this operation will convert sample values to unsigned bytes in order to enable the use ofIndexColorModel
.The resulting image is suitable for visualization but should not be used for computational purposes. There is no guarantee about the number of bands in returned image and the formulas used for converting floating point values to integer values.
Resampling
This operation can optionally be combined with aResampledImage
operation. This can be done by providing a non-null value to thetoSource
field.- Parameters:
processor
- the processor invoking this constructor.- Returns:
- resampled and recolored image for visualization purposes only.
- Throws:
org.opengis.referencing.operation.NoninvertibleTransformException
- if sample values in source image cannot be converted to sample values in the recolored image.
-