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
sourceBandsandImageProcessor.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 RectanglePixel coordinates of the visualization image, ornullif same assourceimage.The colors to use for given categories of sample values, ornullis unspecified.private ColorModelColor model ofVisualizationimage.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) InterpolationObject to use for performing interpolations.(package private) ImageLayoutComputer of tile size.private static final intNumber of bands of the image to create.(package private) javax.measure.Quantity<?>[]Values of "org.apache.sis.PositionalAccuracy" property, ornullif none.private Collection<Map.Entry<NumberRange<?>,Color[]>> Colors to apply for range of sample values in source image, ornullif none.private SampleModelSample model ofVisualizationimage.private RenderedImageImage to be resampled and converted.private List<SampleDimension>Description ofsourcebands, ornullif none.private org.opengis.referencing.operation.MathTransformConversion from pixel coordinates of visualization image to pixel coordinates ofsourceimage.private static final intBand 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) RenderedImagecreate(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, ornullif same assourceimage. -
source
Image to be resampled and converted. -
toSource
private org.opengis.referencing.operation.MathTransform toSourceConversion from pixel coordinates of visualization image to pixel coordinates ofsourceimage. -
sourceBands
Description ofsourcebands, ornullif none. -
rangesAndColors
Colors to apply for range of sample values in source image, ornullif 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, ornullis 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, ornullif none. -
converters
private org.opengis.referencing.operation.MathTransform1D[] convertersTransfer functions to apply on each band of the source image. -
sampleModel
Sample model ofVisualizationimage. -
colorModel
Color model ofVisualizationimage.
-
-
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, ornullif same assourceimage.source- the image for which to replace the color model.toSource- pixel coordinates conversion tosourceimage, ornullif none.sourceBands- description ofsourcebands.
-
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. TheboundsandtoSourcearguments 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 aResampledImageoperation. This can be done by providing a non-null value to thetoSourcefield.- 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.
-