public class ImageUtilities extends Object
Constructor and Description |
---|
ImageUtilities() |
Modifier and Type | Method and Description |
---|---|
static TiledImage |
createConstantImage(int minx,
int miny,
int width,
int height,
int tileWidth,
int tileHeight,
Number[] values)
Creates a new TiledImage object with one or more bands of constant value.
|
static TiledImage |
createConstantImage(int minx,
int miny,
int width,
int height,
Number value)
Creates a new TiledImage object with a single band of constant value.
|
static TiledImage |
createConstantImage(int minx,
int miny,
int width,
int height,
Number[] values)
Creates a new TiledImage object with one or more bands of constant value.
|
static TiledImage |
createConstantImage(int width,
int height,
Number value)
Creates a new TiledImage object with a single band of constant value.
|
static TiledImage |
createConstantImage(int width,
int height,
Number[] values)
Creates a new TiledImage object with one or more bands of constant value.
|
static RenderedImage |
createDisplayImage(RenderedImage dataImg,
Map<Integer,Color> colourTable)
Creates a proxy RGB display image for the given data image.
|
static TiledImage |
createImageFromArray(Number[] array,
int width,
int height)
Creates a new single-band TiledImage with the provided values.
|
static Color[] |
createRampColours(int numColours)
Create a set of colours using a simple colour ramp algorithm in the HSB colour space.
|
static Color[] |
createRampColours(int numColours,
float saturation,
float brightness)
Create a set of colours using a simple colour ramp algorithm in the HSB colour space.
|
static Color[] |
createRampColours(int numColours,
float startHue,
float endHue,
float saturation,
float brightness)
Create a set of colours using a simple colour ramp algorithm in the HSB colour space.
|
static void |
fillBackground(WritableRaster raster,
Rectangle rect,
double[] backgroundValues)
Fill the specified rectangle of
raster with the provided background values. |
static List<RenderedImage> |
getBandsAsImages(RenderedImage img)
Get the bands of a multi-band image as a list of single-band images.
|
static List<RenderedImage> |
getBandsAsImages(RenderedImage img,
Collection<Integer> bandIndices)
Get the specified bands of a multi-band image as a list of single-band images.
|
static boolean |
isBinary(SampleModel sm)
Check whether a
SampleModel represents a binary data set, i.e., a single band of data with one bit per pixel packed into a
MultiPixelPackedSampleModel . |
static boolean |
isCLibAvailable()
Tells me whether or not the native libraries for JAI/ImageIO are active or not.
|
static boolean |
isInteger(Class<?> type)
Deprecated.
Moved to
Classes . |
static boolean |
isMediaLibAvailable()
Tells me whether or not the native libraries for JAI are active or not.
|
static double |
next(double f)
Finds the least double greater than f.
|
static double |
previous(double f)
Finds the greatest double less than f.
|
static double |
rool(Class type,
double value,
int amount)
Returns the next or previous representable number.
|
public static boolean isMediaLibAvailable()
false
in case the JAI native libs are not in the path, true
otherwise.public static boolean isCLibAvailable()
false
in case the JAI/ImageIO native libs are not in the path, true
otherwise.public static double rool(Class type, double value, int amount) throws IllegalArgumentException
amount
is equals to 0
, then this method returns the value
unchanged. Otherwise, The operation performed depends on the specified type
:
If the type
is Double
, then this method is equivalent to invoking previous(double)
if amount
is equals to
-1
, or invoking next(double)
if amount
is equals to +1
. If amount
is smaller than -1
or
greater than +1
, then this method invokes previous(double)
or next(double)
in a loop for abs(amount)
times.
If the type
is Float
, then this method is equivalent to invoking #previous(float)
if amount
is equals to
-1
, or invoking #next(float)
if amount
is equals to +1
. If amount
is smaller than -1
or greater
than +1
, then this method invokes #previous(float)
or #next(float)
in a loop for abs(amount)
times.
If the type
is an integer, then invoking this method is equivalent to computing value + amount
.
type
- The type. Should be the class of Double
, Float
, Long
, Integer
, Short
or Byte
.value
- The number to rool.amount
- -1 to return the previous representable number, +1 to return the next representable number, or 0 to return the number with no
change.double
.IllegalArgumentException
- if type
is not one of supported types.@Deprecated public static boolean isInteger(Class<?> type)
Classes
.public static double next(double f)
NaN
, returns same value.ChoiceFormat.nextDouble(double)
public static double previous(double f)
NaN
, returns same value.ChoiceFormat.previousDouble(double)
public static void fillBackground(WritableRaster raster, Rectangle rect, double[] backgroundValues)
raster
with the provided background values. Suppose the raster is initialized to 0. Thus, for
binary data, if the provided background values are 0, do nothing.public static boolean isBinary(SampleModel sm)
SampleModel
represents a binary data set, i.e., a single band of data with one bit per pixel packed into a
MultiPixelPackedSampleModel
.public static TiledImage createConstantImage(int width, int height, Number value)
value
.width
- image width in pixelsheight
- image height in pixelsvalue
- the constant value to fill the imagepublic static TiledImage createConstantImage(int minx, int miny, int width, int height, Number value)
value
.minx
- minimum image X ordinateminy
- minimum image Y ordinatewidth
- image width in pixelsheight
- image height in pixelsvalue
- the constant value to fill the imagepublic static TiledImage createConstantImage(int width, int height, Number[] values)
Number
class used.width
- image width in pixelsheight
- image height in pixelsvalues
- array of values (must contain at least one element)public static TiledImage createConstantImage(int minx, int miny, int width, int height, Number[] values)
Number
class used.minx
- minimum image X ordinateminy
- minimum image Y ordinatewidth
- image width in pixelsheight
- image height in pixelsvalues
- array of values (must contain at least one element)public static TiledImage createConstantImage(int minx, int miny, int width, int height, int tileWidth, int tileHeight, Number[] values)
Number
class used.minx
- minimum image X ordinateminy
- minimum image Y ordinatewidth
- image widthheight
- image heighttileWidth
- width of image tilestileHeight
- height of image tilesvalues
- array of values (must contain at least one element)public static TiledImage createImageFromArray(Number[] array, int width, int height)
array
argument must be of length width
x height
.array
- a 1D array of values for the imagewidth
- image widthheight
- image heightpublic static Color[] createRampColours(int numColours)
numColours
- number of colours requiredpublic static Color[] createRampColours(int numColours, float saturation, float brightness)
numColours
- number of colours requiredsaturation
- the saturation of all colours (between 0 and 1)brightness
- the brightness of all colours (between 0 and 1)public static Color[] createRampColours(int numColours, float startHue, float endHue, float saturation, float brightness)
numColours
- number of colours requiredstartHue
- the starting hueendHue
- the ending huesaturation
- the saturation of all coloursbrightness
- the brightness of all colourspublic static RenderedImage createDisplayImage(RenderedImage dataImg, Map<Integer,Color> colourTable)
dataImg
- the data imagecolourTable
- a lookup table giving colours for each data image valuepublic static List<RenderedImage> getBandsAsImages(RenderedImage img)
img
- the multi-band imagepublic static List<RenderedImage> getBandsAsImages(RenderedImage img, Collection<Integer> bandIndices)
img
- the multi-band imagebandIndices
- a Collection of Integer indices in the range 0 <= i < number of bandsCopyright © 2006–2018 GeoSolutions. All rights reserved.