NASA World Wind WMS

gov.nasa.worldwind.servers.wms.utilities
Class WaveletCodec

java.lang.Object
  extended by gov.nasa.worldwind.servers.wms.utilities.WaveletCodec

public class WaveletCodec
extends Object


Nested Class Summary
static class WaveletCodec.EncodingType
           
 
Field Summary
static String WVT_EXT
          A suggested filename extension for wavelet-encodings.
 
Constructor Summary
WaveletCodec()
           
 
Method Summary
static WaveletCodec encode(BufferedImage image)
          Creates a wavelet encoding from the given BufferedImage.
 int getResolutionX()
          Returns the resolution of this wavelet encoding.
 int getResolutionY()
          Returns the resolution of this wavelet encoding.
static boolean isPowerOfTwo(int value)
          Convenience method for testing is a value is a power of two.
static WaveletCodec loadFully(File file)
          Loads a previously persisted wavelet encoding from the given file.
static WaveletCodec loadPartially(File file, int resolution)
          Partially loads a previously persisted wavelet encoding from the given file, upto the given resolution.
static double logBase2(double value)
          Convenience method to compute the log-2 of a value.
static int nearestPowerOfTwo(int resolution)
          Returns a resolution value that is the nearest power of 2 greater than or equal to the given value.
 BufferedImage reconstruct(int resolution)
          Reconstructs an image from this wavelet encoding at the given resolution.
 void save(File file)
          Saves this wavelet encoding to the given File.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WVT_EXT

public static final String WVT_EXT
A suggested filename extension for wavelet-encodings.

See Also:
Constant Field Values
Constructor Detail

WaveletCodec

public WaveletCodec()
Method Detail

encode

public static WaveletCodec encode(BufferedImage image)
                           throws IllegalArgumentException
Creates a wavelet encoding from the given BufferedImage. The image must have dimensions that are a power of 2. If the incoming image has at least 3 bands, the first three are assumed to be RGB channels. If only one-band, it is assumed to be grayscale. The SampleModel component-type must be BYTE.

Parameters:
image -
Returns:
Throws:
IllegalArgumentException

getResolutionX

public int getResolutionX()
Returns the resolution of this wavelet encoding.

Returns:
resolution

getResolutionY

public int getResolutionY()
Returns the resolution of this wavelet encoding.

Returns:
resolution

isPowerOfTwo

public static boolean isPowerOfTwo(int value)
Convenience method for testing is a value is a power of two.

Parameters:
value -
Returns:

loadFully

public static WaveletCodec loadFully(File file)
                              throws IOException
Loads a previously persisted wavelet encoding from the given file.

Parameters:
file -
Returns:
Throws:
IOException

loadPartially

public static WaveletCodec loadPartially(File file,
                                         int resolution)
                                  throws IOException,
                                         IllegalArgumentException
Partially loads a previously persisted wavelet encoding from the given file, upto the given resolution.

Parameters:
file -
resolution -
Returns:
Throws:
IOException
IllegalArgumentException

logBase2

public static double logBase2(double value)
Convenience method to compute the log-2 of a value.

Parameters:
value -
Returns:

nearestPowerOfTwo

public static int nearestPowerOfTwo(int resolution)
Returns a resolution value that is the nearest power of 2 greater than or equal to the given value.

Parameters:
resolution -
Returns:
power of two resolution

reconstruct

public BufferedImage reconstruct(int resolution)
                          throws IllegalArgumentException
Reconstructs an image from this wavelet encoding at the given resolution. The specified resolution must be a power of two, and must be less than or equal to the resolution of the encoding. This reconstruction algorithm was hinted at in: "Principles of Digital Image Synthesis" Andrew Glassner 1995, pp. 296

Parameters:
resolution -
Returns:
reconstructed image.
Throws:
IllegalArgumentException

save

public void save(File file)
          throws IOException
Saves this wavelet encoding to the given File.

Parameters:
file -
Throws:
IOException

NASA World Wind WMS