it.geosolutions.util
Class KakaduUtilities

Object
  extended by KakaduUtilities

public class KakaduUtilities
extends Object

Class with utility methods.

Author:
Daniele Romagnoli, GeoSolutions, Simone Giannecchini, GeoSolutions

Method Summary
static void computeRegions(Rectangle sourceBounds, Dimension destSize, ImageWriteParam param)
          Compute the source region and destination dimensions taking any parameter settings into account.
static int[] findOptimalResolutionInfo(int sourceDWTLevels, int newSubSamplingFactor)
          Find the optimal subsampling factor, given a specified subsampling factor as input parameter, as well as the number of DWT levels which may be discarded.
static List<ImageReaderWriterSpi> getJDKImageReaderWriterSPI(ServiceRegistry registry, String formatName, boolean isReader)
           
static void initializeKakaduMessagesManagement()
          Initializing kakadu messages as stated in the KduRender.java example
static boolean isKakaduAvailable()
          Returns true if the Kakadu native library has been loaded.
static void loadKakadu()
          Forces loading of Kakadu libs.
static BufferedImage subsampleImage(ColorModel cm, BufferedImage bi, int destinationWidth, int destinationHeight, int interpolationType)
          Transforms the provided BufferedImage and returns a new one in compliance with the required destination bimage properties, adopting the specified interpolation algorithm
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findOptimalResolutionInfo

public static int[] findOptimalResolutionInfo(int sourceDWTLevels,
                                              int newSubSamplingFactor)
Find the optimal subsampling factor, given a specified subsampling factor as input parameter, as well as the number of DWT levels which may be discarded. Let iSS be the input subsampling factor and let L be the number of available source DWT levels. The optimal subsampling factor is oSS = 2^level, where: level is not greater than L, and oSS is not greater than iSS.

Parameters:
sourceDWTLevels - the number of DWT levels in the source image
newSubSamplingFactor - the specified subsampling factor for which we need to find an optimal subsampling factor
Returns:
an int array containing the optimalSubSamplingFactor as first element, and the number of levels to be discarded as second element

initializeKakaduMessagesManagement

public static void initializeKakaduMessagesManagement()
Initializing kakadu messages as stated in the KduRender.java example


getJDKImageReaderWriterSPI

public static List<ImageReaderWriterSpi> getJDKImageReaderWriterSPI(ServiceRegistry registry,
                                                                    String formatName,
                                                                    boolean isReader)

subsampleImage

public static BufferedImage subsampleImage(ColorModel cm,
                                           BufferedImage bi,
                                           int destinationWidth,
                                           int destinationHeight,
                                           int interpolationType)
Transforms the provided BufferedImage and returns a new one in compliance with the required destination bimage properties, adopting the specified interpolation algorithm

Parameters:
cm - the ColorModel to be used in the warping
bi - the original BufferedImage
destinationRegion.width - the required destination image width
destinationRegion.height - the required destination image height
interpolationType - the specified interpolation type
Returns:
a BufferedImage having size = destinationRegion.width*destinationRegion.height which is the result of the WarpAffineresu.

isKakaduAvailable

public static boolean isKakaduAvailable()
Returns true if the Kakadu native library has been loaded. false otherwise.

Returns:
true only if the Kakadu native library has been loaded.

loadKakadu

public static void loadKakadu()
Forces loading of Kakadu libs.


computeRegions

public static void computeRegions(Rectangle sourceBounds,
                                  Dimension destSize,
                                  ImageWriteParam param)
Compute the source region and destination dimensions taking any parameter settings into account.



Copyright © 2006-2010 GeoSolutions. All Rights Reserved.