com.esri.arcgis.datasourcesraster
Class PixelBlock

java.lang.Object
  extended by com.esri.arcgis.datasourcesraster.PixelBlock
All Implemented Interfaces:
IPixelBlock2, IPixelBlock3, IPixelBlock, com.esri.arcgis.interop.RemoteObjRef, Serializable

public class PixelBlock
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IPixelBlock, IPixelBlock2, IPixelBlock3

ESRI PixelBlock, a container of pixel data.

Description

The PixelBlock object contains a pixel array that can be read from a raster or a raster band. The PixelBlock object is designed to handle generic pixel arrays from any raster data source. This means it must be able to handle single and multiband data, as well as support different pixel types. To support different pixel types, the PixelBlock transports pixels in a SafeArray, which has the ability to contain many different data types. To support multiple bands, or planes, of raster data, the PixelBlock provides a separate array for each band in the raster.

You can get the pixel data from the pixel block, modify the pixel values, and write the pixel block with the modified pixel values to a raster band. If the pixel block is created from a Raster, the modified pixel block can be written to raster dataset using IRasterEdit::Write.

The PixelBlock object can be created from both Raster and RasterBand. In addition, a RasterCursor can also create the PixelBlock object. A PixelBlock that is created for use with one object may not be usable with another object because of the way the PixelBlock is initialized.

The PixelBlock can be created in any size, but after it is created, its size cannot be changed. For small rasters, the PixelBlock can be the size of the entire dataset, which can usually be held in memory at one time.
Larger rasters can be read in as smaller pieces by creating a smaller PixelBlock and reading portions of the raster sequentially.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

See Also:
Serialized Form

Constructor Summary
PixelBlock(Object obj)
          Construct a PixelBlock using a reference to such an object returned from ArcGIS Engine or Server.
 
Method Summary
 void clear(int plane)
          Clears a given plane (sets to NoData).
 boolean equals(Object o)
          Compare this object with another
 int getBytesPerPixel()
          The number of bytes per pixel for the PixelBlock.
 int getHeight()
          The height of the PixelBlock in pixels.
 Object getNoDataMask(int plane)
          The NoData mask for a specified plane.
 Object getNoDataMaskByRef(int plane)
          The NoData mask for a specified plane.
 Object getNoDataMaskVal(int plane, int x, int y)
          Gets the NoData mask value for a specified pixel.
 Object getPixelData(int plane)
          An array of pixels for a specified plane.
 Object getPixelDataByRef(int plane)
          A pointer to an array of pixels for a specified plane.
 int getPixelType(int plane)
          The pixel type of the PixelBlock.
 int getPlanes()
          The number of pixel arrays contained in the PixelBlock.
 Object getSafeArray(int plane)
          A variant SafeArray of pixels for a specified plane.
 Object getSafeArrayByRef(int plane)
          A variant SafeArray of pixels for a specified plane.
 Object getVal(int plane, int x, int y)
          The value for a specified pixel.
 int getWidth()
          The width of the PixelBlock in pixels.
 int hashCode()
          the hashcode for this object
 boolean hasNoData(int plane)
          Checks if this PixelBlock contains NoData.
 void mask(Object noData)
          Generates NoData Mask using a given NoData value.
 void setNoDataMask(int plane, Object pVal)
          The NoData mask for a specified plane.
 void setPixelData(int plane, Object pVal)
          An array of pixels for a specified plane.
 void setPixelType(int plane, int val)
          The pixel type of the PixelBlock.
 void setSafeArray(int plane, Object val)
          A variant SafeArray of pixels for a specified plane.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

PixelBlock

public PixelBlock(Object obj)
           throws IOException
Construct a PixelBlock using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to PixelBlock.
Casting to this class from the return value of a method will not work, as this class represents an abstract class in ArcObjects.
*
PixelBlock o = (PixelBlock)obj; // will not work

PixelBlock o = new PixelBlock(obj); // Use this constructor instead
* @param obj an object returned from ArcGIS Engine or Server

Throws:
IOException - if there are interop problems PixelBlock thePixelBlock = (PixelBlock) obj;
Method Detail

equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

getPlanes

public int getPlanes()
              throws IOException,
                     AutomationException
The number of pixel arrays contained in the PixelBlock.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getPlanes in interface IPixelBlock2
Specified by:
getPlanes in interface IPixelBlock3
Specified by:
getPlanes in interface IPixelBlock
Returns:
The val
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getWidth

public int getWidth()
             throws IOException,
                    AutomationException
The width of the PixelBlock in pixels.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getWidth in interface IPixelBlock2
Specified by:
getWidth in interface IPixelBlock3
Specified by:
getWidth in interface IPixelBlock
Returns:
The val
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getHeight

public int getHeight()
              throws IOException,
                     AutomationException
The height of the PixelBlock in pixels.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getHeight in interface IPixelBlock2
Specified by:
getHeight in interface IPixelBlock3
Specified by:
getHeight in interface IPixelBlock
Returns:
The val
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getPixelType

public int getPixelType(int plane)
                 throws IOException,
                        AutomationException
The pixel type of the PixelBlock.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getPixelType in interface IPixelBlock2
Specified by:
getPixelType in interface IPixelBlock3
Specified by:
getPixelType in interface IPixelBlock
Parameters:
plane - The plane (in)
Returns:
A com.esri.arcgis.geodatabase.rstPixelType constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setPixelType

public void setPixelType(int plane,
                         int val)
                  throws IOException,
                         AutomationException
The pixel type of the PixelBlock.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
setPixelType in interface IPixelBlock2
Specified by:
setPixelType in interface IPixelBlock3
Specified by:
setPixelType in interface IPixelBlock
Parameters:
plane - The plane (in)
val - A com.esri.arcgis.geodatabase.rstPixelType constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getBytesPerPixel

public int getBytesPerPixel()
                     throws IOException,
                            AutomationException
The number of bytes per pixel for the PixelBlock.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getBytesPerPixel in interface IPixelBlock2
Specified by:
getBytesPerPixel in interface IPixelBlock3
Specified by:
getBytesPerPixel in interface IPixelBlock
Returns:
The val
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getSafeArray

public Object getSafeArray(int plane)
                    throws IOException,
                           AutomationException
A variant SafeArray of pixels for a specified plane.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getSafeArray in interface IPixelBlock
Parameters:
plane - The plane (in)
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setSafeArray

public void setSafeArray(int plane,
                         Object val)
                  throws IOException,
                         AutomationException
A variant SafeArray of pixels for a specified plane.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
setSafeArray in interface IPixelBlock
Parameters:
plane - The plane (in)
val - A Variant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getVal

public Object getVal(int plane,
                     int x,
                     int y)
              throws IOException,
                     AutomationException
The value for a specified pixel.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getVal in interface IPixelBlock2
Specified by:
getVal in interface IPixelBlock3
Specified by:
getVal in interface IPixelBlock
Parameters:
plane - The plane (in)
x - The x (in)
y - The y (in)
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getSafeArrayByRef

public Object getSafeArrayByRef(int plane)
                         throws IOException,
                                AutomationException
A variant SafeArray of pixels for a specified plane.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getSafeArrayByRef in interface IPixelBlock2
Parameters:
plane - The plane (in)
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getPixelData

public Object getPixelData(int plane)
                    throws IOException,
                           AutomationException
An array of pixels for a specified plane.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getPixelData in interface IPixelBlock3
Parameters:
plane - The plane (in)
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setPixelData

public void setPixelData(int plane,
                         Object pVal)
                  throws IOException,
                         AutomationException
An array of pixels for a specified plane.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
setPixelData in interface IPixelBlock3
Parameters:
plane - The plane (in)
pVal - A Variant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getPixelDataByRef

public Object getPixelDataByRef(int plane)
                         throws IOException,
                                AutomationException
A pointer to an array of pixels for a specified plane.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getPixelDataByRef in interface IPixelBlock3
Parameters:
plane - The plane (in)
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setNoDataMask

public void setNoDataMask(int plane,
                          Object pVal)
                   throws IOException,
                          AutomationException
The NoData mask for a specified plane.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
setNoDataMask in interface IPixelBlock3
Parameters:
plane - The plane (in)
pVal - A Variant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getNoDataMask

public Object getNoDataMask(int plane)
                     throws IOException,
                            AutomationException
The NoData mask for a specified plane.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getNoDataMask in interface IPixelBlock3
Parameters:
plane - The plane (in)
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getNoDataMaskByRef

public Object getNoDataMaskByRef(int plane)
                          throws IOException,
                                 AutomationException
The NoData mask for a specified plane.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getNoDataMaskByRef in interface IPixelBlock3
Parameters:
plane - The plane (in)
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getNoDataMaskVal

public Object getNoDataMaskVal(int plane,
                               int x,
                               int y)
                        throws IOException,
                               AutomationException
Gets the NoData mask value for a specified pixel.

Description

The GetNoDataMaskVal property allows you to identify whether a specific pixel is NoData or not. Value 1 means this corresponding pixel has a value and 0 means this corresponding pixel is NoData

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getNoDataMaskVal in interface IPixelBlock3
Parameters:
plane - The plane (in)
x - The x (in)
y - The y (in)
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

hasNoData

public boolean hasNoData(int plane)
                  throws IOException,
                         AutomationException
Checks if this PixelBlock contains NoData.

Description

The HasNoData property indicates whether the PixelBlock has NoData or not. True means it has NoData.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
hasNoData in interface IPixelBlock3
Parameters:
plane - The plane (in)
Returns:
The hasNoData
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

clear

public void clear(int plane)
           throws IOException,
                  AutomationException
Clears a given plane (sets to NoData).

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
clear in interface IPixelBlock3
Parameters:
plane - The plane (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

mask

public void mask(Object noData)
          throws IOException,
                 AutomationException
Generates NoData Mask using a given NoData value.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
mask in interface IPixelBlock3
Parameters:
noData - A Variant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.