org.jaitools.imageutils
Class ImageUtils

java.lang.Object
  extended by org.jaitools.imageutils.ImageUtils

public class ImageUtils
extends Object

Provides static utility methods for some common image-related tasks.

Since:
1.0
Version:
$Id$
Author:
Michael Bedward

Constructor Summary
ImageUtils()
           
 
Method Summary
static javax.media.jai.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 javax.media.jai.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 javax.media.jai.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 javax.media.jai.TiledImage createConstantImage(int width, int height, Number value)
          Creates a new TiledImage object with a single band of constant value.
static javax.media.jai.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 javax.media.jai.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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageUtils

public ImageUtils()
Method Detail

createConstantImage

public static javax.media.jai.TiledImage createConstantImage(int width,
                                                             int height,
                                                             Number value)
Creates a new TiledImage object with a single band of constant value. The data type of the image corresponds to the class of value.

Parameters:
width - image width in pixels
height - image height in pixels
value - the constant value to fill the image
Returns:
a new TiledImage object

createConstantImage

public static javax.media.jai.TiledImage createConstantImage(int minx,
                                                             int miny,
                                                             int width,
                                                             int height,
                                                             Number value)
Creates a new TiledImage object with a single band of constant value. The data type of the image corresponds to the class of value.

Parameters:
minx - minimum image X ordinate
miny - minimum image Y ordinate
width - image width in pixels
height - image height in pixels
value - the constant value to fill the image
Returns:
a new TiledImage object

createConstantImage

public static javax.media.jai.TiledImage createConstantImage(int width,
                                                             int height,
                                                             Number[] values)
Creates a new TiledImage object with one or more bands of constant value. The number of bands in the output image corresponds to the length of the input values array and the data type of the image corresponds to the Number class used.

Parameters:
width - image width in pixels
height - image height in pixels
values - array of values (must contain at least one element)
Returns:
a new TiledImage object

createConstantImage

public static javax.media.jai.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. The number of bands in the output image corresponds to the length of the input values array and the data type of the image corresponds to the Number class used.

Parameters:
minx - minimum image X ordinate
miny - minimum image Y ordinate
width - image width in pixels
height - image height in pixels
values - array of values (must contain at least one element)
Returns:
a new TiledImage object

createConstantImage

public static javax.media.jai.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. The number of bands in the output image corresponds to the length of the input values array and the data type of the image corresponds to the Number class used.

Parameters:
minx - minimum image X ordinate
miny - minimum image Y ordinate
width - image width
height - image height
tileWidth - width of image tiles
tileHeight - height of image tiles
values - array of values (must contain at least one element)
Returns:
a new TiledImage object

createImageFromArray

public static javax.media.jai.TiledImage createImageFromArray(Number[] array,
                                                              int width,
                                                              int height)
Creates a new single-band TiledImage with the provided values. The array argument must be of length width x height.

Parameters:
array - a 1D array of values for the image
width - image width
height - image height
Returns:
the new image

createRampColours

public static Color[] createRampColours(int numColours)
Create a set of colours using a simple colour ramp algorithm in the HSB colour space.

Parameters:
numColours - number of colours required
Returns:
an array of colours sampled from the HSB space.

createRampColours

public 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.

Parameters:
numColours - number of colours required
saturation - the saturation of all colours (between 0 and 1)
brightness - the brightness of all colours (between 0 and 1)
Returns:
an array of colours sampled from the HSB space between the start and end hues

createRampColours

public 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. All float arguments should be values between 0 and 1.

Parameters:
numColours - number of colours required
startHue - the starting hue
endHue - the ending hue
saturation - the saturation of all colours
brightness - the brightness of all colours
Returns:
an array of colours sampled from the HSB space between the start and end hues

createDisplayImage

public static RenderedImage createDisplayImage(RenderedImage dataImg,
                                               Map<Integer,Color> colourTable)
Creates a proxy RGB display image for the given data image. The data image should be of integral data type. Only the first band of multi-band images will be used.

Parameters:
dataImg - the data image
colourTable - a lookup table giving colours for each data image value
Returns:
a new RGB image

getBandsAsImages

public static List<RenderedImage> getBandsAsImages(RenderedImage img)
Get the bands of a multi-band image as a list of single-band images. This can be used, for example, to separate the result image returned by the KernelStats operator into separate result images.

Parameters:
img - the multi-band image
Returns:
a List of new single-band images

getBandsAsImages

public 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. This can be used, for example, to separate the result image returned by the KernelStats operator into separate result images.

Parameters:
img - the multi-band image
bandIndices - a Collection of Integer indices in the range 0 <= i < number of bands
Returns:
a List of new single-band images


Copyright © 2009-2013. All Rights Reserved.