Class GridRasterWrapper
- java.lang.Object
-
- org.openjump.core.rasterimage.sextante.rasterWrappers.GridRasterWrapper
-
public class GridRasterWrapper extends Object
Wrapper to convert org.openjump.core.rasterimage.sextante.OpenJUMPSextanteRasterLayer to 2D Array (Matrix) or to a 1D Array.- Author:
- Giuseppe Aruta [2018-05-18]
-
-
Constructor Summary
Constructors Constructor Description GridRasterWrapper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static WritableRaster
matrixToRaster(double[][] matrix)
Convert a double 2DArray (matrix) to java.awt.image.WritableRaster (single band)static Raster
matrixToRaster(double[][] matrix, SampleModel model)
Convert a 2DArray (Matrix) as double to java.awt.image.Raster, to band 0static Raster
matrixToRaster(double[][] matrix, SampleModel model, int band)
Convert a 2DArray (Matrix) as double to java.awt.image.Raster, defining the band numberstatic double[]
rasterToArray(OpenJUMPSextanteRasterLayer rstLayer)
Convert the first band of OpenJUMPSextanteRasterLayer to a 1D Array as double Useful for single banded rasterstatic double[]
rasterToArray(OpenJUMPSextanteRasterLayer rstLayer, double min, double max)
Convert the first band of of OpenJUMPSextanteRasterLayer to a 1D Array as double.static double[]
rasterToArray(OpenJUMPSextanteRasterLayer rstLayer, int band)
Convert the first band of OpenJUMPSextanteRasterLayer to a 1D Array as doublestatic double[]
rasterToArray(OpenJUMPSextanteRasterLayer rstLayer, int band, double min, double max)
Convert a band of OpenJUMPSextanteRasterLayer to a 1D Array as double.static double[][]
rasterToEmptyMatrix(OpenJUMPSextanteRasterLayer rstLayer, int band)
create an empty 2D Array from a OpenJUMPSextanteRasterLayerstatic double[][]
rasterToMatrix(Raster raster)
Convert a java.awt.image.Raster to 2DArray (Matrix) as doublestatic double[][]
rasterToMatrix(OpenJUMPSextanteRasterLayer rstLayer)
Convert the first band of OpenJUMPSextanteRasterLayer to a 2D Array as double Useful for single banded rasterstatic double[][]
rasterToMatrix(OpenJUMPSextanteRasterLayer rstLayer, int band)
Convert a OpenJUMPSextanteRasterLayer to a 2D Array as double
-
-
-
Method Detail
-
rasterToMatrix
public static double[][] rasterToMatrix(OpenJUMPSextanteRasterLayer rstLayer, int band)
Convert a OpenJUMPSextanteRasterLayer to a 2D Array as double- Parameters:
rstLayer
- OpenJUMP Sextante Raster Layerband
- (integer)- Returns:
- the matrix representing this Raster as a 2-dimensional double array
-
rasterToEmptyMatrix
public static double[][] rasterToEmptyMatrix(OpenJUMPSextanteRasterLayer rstLayer, int band)
create an empty 2D Array from a OpenJUMPSextanteRasterLayer- Parameters:
rstLayer
- OpenJUMP Sextante Raster Layerband
- (integer)- Returns:
- a 2-dimensional double array sized after this raster and filled with nodata values
-
rasterToMatrix
public static double[][] rasterToMatrix(OpenJUMPSextanteRasterLayer rstLayer)
Convert the first band of OpenJUMPSextanteRasterLayer to a 2D Array as double Useful for single banded raster- Parameters:
rstLayer
- OpenJUMP Sextante Raster Layer- Returns:
- the matrix representing this OpenJUMPSextanteRasterLayer as a 2-dimensional double array
-
rasterToArray
public static double[] rasterToArray(OpenJUMPSextanteRasterLayer rstLayer, int band)
Convert the first band of OpenJUMPSextanteRasterLayer to a 1D Array as double- Parameters:
rstLayer
- OpenJUMPSextanteRasterLayer to convert to a double arrayband
- the Raster band to export- Returns:
- a 1-dimensional double array containing all the OpenJUMPSextanteRasterLayer values contained in a band
-
rasterToArray
public static double[] rasterToArray(OpenJUMPSextanteRasterLayer rstLayer)
Convert the first band of OpenJUMPSextanteRasterLayer to a 1D Array as double Useful for single banded raster- Parameters:
rstLayer
- OpenJUMP Sextante Raster Layer- Returns:
- a 1-dimensional double array containing all OpenJUMPSextanteRasterLayer values contained in band 0
-
rasterToArray
public static double[] rasterToArray(OpenJUMPSextanteRasterLayer rstLayer, int band, double min, double max)
Convert a band of OpenJUMPSextanteRasterLayer to a 1D Array as double. Limit the array to min/max values- Parameters:
rstLayer
- OpenJUMP Sextante Raster Layerband
- the Raster band to analyzemin
- minimum value to copymax
- maximum value to copy- Returns:
- a 1-dimensional double array containing all the Raster values for this band which are strictly higher than min and lower than max
-
rasterToArray
public static double[] rasterToArray(OpenJUMPSextanteRasterLayer rstLayer, double min, double max)
Convert the first band of of OpenJUMPSextanteRasterLayer to a 1D Array as double. Limit the array to min/max values- Parameters:
rstLayer
- OpenJUMP Sextante Raster Layermin
- minimum value to copymax
- maximum value to copy- Returns:
- a 1-dimensional double array containing all the Raster values for band 0 which are strictly higher than min and lower than max
-
matrixToRaster
public static Raster matrixToRaster(double[][] matrix, SampleModel model)
Convert a 2DArray (Matrix) as double to java.awt.image.Raster, to band 0- Parameters:
matrix
- 2D Array as doublemodel
- Sample Model- Returns:
- java.awt.image.Raster
-
matrixToRaster
public static Raster matrixToRaster(double[][] matrix, SampleModel model, int band)
Convert a 2DArray (Matrix) as double to java.awt.image.Raster, defining the band number- Parameters:
matrix
- 2D Array as doublemodel
- Sample Modelband
- number- Returns:
- java.awt.image.Raster
-
rasterToMatrix
public static double[][] rasterToMatrix(Raster raster)
Convert a java.awt.image.Raster to 2DArray (Matrix) as double- Parameters:
raster
- input raster- Returns:
- 2DArray (Matrix) as double[][]
-
matrixToRaster
public static WritableRaster matrixToRaster(double[][] matrix)
Convert a double 2DArray (matrix) to java.awt.image.WritableRaster (single band)- Parameters:
matrix
- 2D double Array- Returns:
- WritableRaster
-
-