DataSourcesRaster


Supported with:
Library dependencies: System, SystemUI, Geometry, Display, Server, Output, Geodatabase, GISClient, ArcWeb, DataSourcesFile, DataSourcesGDB, DataSourcesOleDB

Additional library information: Contents, Object Model Diagram

The DataSourcesRaster library contains raster related classes in three categories:
  1. Classes that access raster data from various data sources including file systems, personal geodatabases, file geodatabases, and ArcSDE geodatabases;
  2. Classes that perform geodata transformation and pixel filtering; and
  3. Classes used for raster mosaicking, raster loading, and other miscellaneous classes.
 
The PixelFilter, GeodataXform, PixelResampler, PixelReader and MosaicOperator classes can be instantiated. Classes used for renderering raster data are located in Carto library.

The objects that implement this functionality are grouped into a number of library subsystems. These library subsystems are:

Raster Data Access classes

Raster data consists of a rectangular array of equally spaced cells, which taken as a whole represent thematic, spectral, or picture data. Raster data can represent everything from qualities of a land surface, such as elevation or vegetation, to satellite images, scanned maps, and photographs.
 
ArcGIS supports file-based raster data such as GRID, TIFF, ERDAS® IMAGINE®, and JPEG etc. It also supports raster data in geodatabases including File Geodatabase, Personal Geodatabase and ArcSDE Geodatabase. Regardless of the various data sources, two data types are used to represent raster data: raster datasets and raster catalogs.
 
A raster dataset represents one or multiple arrays of pixels as well as their associated information that are stored as a particular raster format in a storage media, such as file system or geodatabases. A raster catalog represents a collection of raster datasets. Stored as a special type of feature class in geodatabases, a raster catalog is used to manage the raster datasets as well as their associated footprints as a single entity.
 
A raster dataset consists of one or more raster bands. Each band in a dataset may contain the statistics and histogram of the pixel values. A raster dataset may also contain pyramids, a stack of down resample pixels stored in the dataset and used for fast display of large raster datasets.
 
A single band raster dataset may contain a color map consisting of a set of colors (red, green and blue) used in displaying the pixels and a raster attribute table that stores extra information about the pixels such as land use type, soil type and so on.
 
As a type of geodataset, a raster dataset may contain a geodata transformation and a spatial reference. The geodata transformation defines how the pixels will be transformed during access and a spatial reference defines the coordinate system of the pixels that are mapped to.
 
If the pixels or cells of a raster dataset have missing information, those cells are called NoData cells. A file based raster dataset uses a NoData value to represent NoData, while a geodatabase raster dataset uses a bit mask to represent NoData. 

Workspace


 
A Workspace is a repository that stores geodatasets. For raster data, a Workspace can be a raster workspace (or a directory) for file-based raster data, an Access workspace for raster data in Personal Geodatabase, a File geodatabase workspace, or an ArcSDE workspace
 
To access raster data, first create a Workspace, then use IRasterWorkspace2 or IRasterWorkspaceEx interface. A Workspace must be initiated from a workspace factory. The RasterWorkspaceFactory class is used to initialize a raster workspace. The AccessWorkspaceFactory class is used to initialize an Access workspace. The FileGDBWorkspaceFactory class is used to initialize a File geodatabase workspace. The SdeWorkspaceFactory class is used to initialize an ArcSDE workspace. The following functions create workspaces from difference sources, and these functions will be used through-out the whole overview.
 
This function opens a raster workspace from a given directory.
 

[C#]
IRasterWorkspace OpenRasterWorkspace(string filePath)
{
  IWorkspaceFactory wsFactory = new RasterWorkspaceFactoryClass ();
  IRasterWorkspace ws = (IRasterWorkspace)wsFactory.OpenFromFile(filePath, 0);
  return ws;
}
The following function opens a File geodatabase workspace.
[C#]
IRasterWorkspaceEx OpenFileGDBWorkspace(string filePath)
{
  IWorkspaceFactory wsFactory = new FileGDBWorkspaceFactoryClass();
  IRasterWorkspaceEx ws = (IRasterWorkspaceEx)wsFactory.OpenFromFile(filePath, 0);
  return ws;
}
The following function opens an ArcSDE workspace by passing the connection information.
[C#]
IRasterWorkspaceEx OpenSDEWorkspace(string sServer,String sInstance, String sDB, String sUser, String sPasswd, String sVersion)
{
  IWorkspaceFactory wsFactory = new SdeWorkspaceFactoryClass();
  IPropertySet sdeConnection = new PropertySetClass();
  sdeConnection.SetProperty ("Server", sServer);
  sdeConnection.SetProperty ("Instance", sInstance);
  sdeConnection.SetProperty("Database", sDB);
  sdeConnection.SetProperty ("User", sUser);
  sdeConnection.SetProperty ("Password", sPasswd);
  sdeConnection.SetProperty ("Version", sVersion);
  IRasterWorkspaceEx ws = (IRasterWorkspaceEx)wsFactory.Open(sdeConnection, 0);
  return ws;
}
Two interfaces of the Workspace class provide access to RasterDataset and RasterCatalog classes. IRasterWorkspace2 is used to open and create a RasterDataset only; while IRasterWorkspaceEx is used to open and create both a RasterDataset and a RasterCatalog in geodatabases. Because of the different storage media, there are some variations in the ways of creating a RasterDataset in different workspaces. However once created, a RasterDataset behaves the same except for some minor differences.
 
The code below opens an Imagine file in a given directory.

[C#]
//open a raster dataset from a file system
IRasterWorkspace ws = OpenRasterWorkspace (@"d:\data");
IRasterDataset rasterDataset = ws.OpenRasterDataset("airphoto.img");
This code snippet opens a raster dataset and a raster catalog from a geodatabase.
[C#]
//open a raster catalog from a File geodatabase workspace
IRasterWorkspaceEx wsFGDB = OpenFileGDBWorkspace(@"d:\data\fgdb_images.gdb");
IRasterCatalog rasterCatalog = wsFGDB.OpenRasterCatalog("RedlandImages");

//open a raster dataset from an SDE workspace
IRasterWorkspaceEx wsSDE = OpenSDEWorkspace("myserver", "5151", "myuser", "mydatabase", "mypassws", "SDE.DEFAULT");
IRasterDataset rasterdataset1 = wsSDE.OpenRasterDataset("airphoto");
Creating raster datasets in various workspaces requires specifying the properties of the raster data to be created as well as the properties of the storage.
Raster in ArcSDE geodatabase is stored as a set of DBMS tables that are used to manage the pixel values, pyramids, and other auxilary information. The pixels of raster data are devided into small tiles and each tile is stored as a binary large object (BLOB) in a row of the block table. The raster column in the the business table defines the propertes of the raster dataset and the geometry column defines properties of the footprint of the raster dataset. File geodatabase raster has a similar implementation as ArcSDE geodatabase. The only difference is that raster is stored as a set of FGDB tables in file system instead of in a relational geodatabase.
 
IRasterWorkspaceEx is used to create a raster dataset and a raster catalog in a geodatabase. When creating data in a geodatabase, RasterDef can be used to set the properties of the raster field and RasterStorageDef can be used to specify the storage properties such as tile size, cell size, pyramid origin, and compression, etc.
Since raster data in a personal geodatabase is implemented by converting it to an Imagine file format and managed internally within the personal geodatabase, only some of the raster storage properties apply to personal geodatabase such as cell size and compression.
Creating a geodatabase raster dataset using IRasterWorkspaceEx initially creates an empty raster dataset. This empty raster dataset, with no dimension, is basically a placeholder for the specified properties of the raster dataset and can be populated by mosaicking from other raster data or alternatively, writting using PixelBlock.
 
To create a raster dataset using IRasterWorkspace2, the origin, number of bands, pixel type, width, and height of the raster dataset must be specified along with other required parameters. The raster dataset created has a specified dimension and a default pixel value. The default pixel value is normally the max value of the specified pixel type and can be populated by writing pixel blocks. If IRasterWorkspace2 is used to create a geodatabase raster dataset, the default storage parameters will be used. The example below creates an Imagine file with a dimension of 1024 x 1024 and a cell size of 30 meters.

[C#]
IRasterWorkspace2 ws = (IRasterWorkspace2)OpenRasterWorkspace(@"d:\data");
IPoint origin = new PointClass();
origin.PutCoords(100, 100);
ISpatialReference sr = new UnknownCoordinateSystemClass();
IRasterDataset newRaster = ws.CreateRasterDataset("myimage.img", "IMAGINE Image", origin, 1024, 1024, 30, 30, 1, rstPixelType.PT_UCHAR, sr, true);
 

Raster datasets

The RasterDataset represents a raster dataset stored in a storage media, a file system, a geodatabase or in memory. A RasterDataset is a file RasterDataset if it is opened from a file system or a Personal geodatabase, or is a database RasterDataset if it is opened from a File geodatabase or an ArcSDE geodatabase. A raster dataset in an unmanaged raster catalog, where raster datasets are stored in file system, is also a file RasterDataset. ArcGIS 9.2 allows to create an in-memory RasterDataset where the pixels are stored in memory, this type of raster dataset has the characteristics of a file RasterDataset. Regardless of the data source it is coming from, a RasterDataset behaves the same except for some minor differences.
 
As a type of Dataset, the RasterDataset performs basic dataset management functions such as copy, rename, and delete. It can also be used to examine dataset properties such as raster format and compression type by using IRasterDataset interface.
 
A RasterDataset is a type of Geodataset and supports IGeoDataset and IGeoDataset2 interface. A RasterDataset has an extent, a spatial reference and a geodata transformation (GeodataXform). The geodata transformation is stored as special metadata of the raster dataset and is used to transform the pixels to the current extent and spatial reference. Normally, the geodata transformation is an IdentityXform which does not transformation pixels. In some cases, such as raw images with RPC (Rational Polynomial Coefficients) information or a raster dataset created using IRasterGeometryProc::Register method (e.g. using the Georeferencing tool in ArcMap), those raster datasets contain a GeodataXform, an RPCXform and a PolynomialXform respectively.
 
The extent and spatial reference of a raster dataset are the extent and spatial reference after the geodata transformation is applied to the dataset and they can be retrieved using the IGeoDataset interface. The extent and spatial reference before a transformation is applied are called native extent and native spatial reference. The native extent and native spatial reference can be retrieved from IGeoDataset2 interface. The following code shows the use of this interface.

[C#]
void GetDatasetXform(IRasterDataset rasterDataset)
{
  //get the xform
  IGeoDataset2 geoDataset = (IGeoDataset2)rasterDataset;
  IGeodataXform xform = geoDataset.GeodataXform;

  //get the native extent
  IEnvelope nativeExtent = geoDataset.NativeExtent;

  //get the native spatial reference
  ISpatialReference nativeSR = geoDataset.NativeSpatialReference;
}
The spatial reference as well as the geodata transformation of a raster dataset can be altered using the IGeoDatasetSchemaEdit2 interface.
 
The IRasterDataset2 interface is used to build, add, and delete a raster table on a RasterDataset.
 
The IRasterDatasetEdit interface is used to add and remove a colormap of a raster dataset. You can also merge pixels from another raster dataset to the current raster dataset through IRasterDatasetEdit::Mosaic method.
 
IRasterDataset::PrecalculateStats is used to calculate the statistics of a raster dataset at the full resolution. IRasterDatasetEdit::ComputeStas, which applies to a database RasterDataset only, is used to calculate raster statistics on a pyramid layer, e.g. skipping some pixels in the calculation. Calculating statistics on a pyramid layer reduces the computation time at the expense of providing less accurate statistics.
 
You can build pyramids for a raster dataset. When IRasterPyramid interface is used to build pyramids for a file RasterDataset, the resampling method used is determined automatically by the system based on the data representation type. If the data type is thematic, nearest neighbor resampling will be used; otherwise, bilinear resampling will be used. The IRasterPyramid2 interface is used for creating raster pyramids by specifying a resampling method. This interface is mostly useful for a database RasterDataset.
 
ISaveAs is used to perform format conversion. The supported writable formats in ArcGIS 9.2 are GRID, TIFF, Imagine, JEPG2000, JPEG, PNG, BMP, GIF, PCI, PCRaster, X11 Pixelmap, HDF4, Idrisi RST and geodatabases. It can also be written to an in-memory raster dataset. The code snippet below saves a raster dataset to an IMAGINE format.

[C#]
void SaveAs(IRasterDataset rasterDataset)
{
  ISaveAs saveAs = (ISaveAs)rasterDataset;
  IWorkspace ws = (IWorkspace)OpenRasterWorkspace(@"d:\data");
  saveAs.SaveAs("mygrid", ws, "GRID");
}
ISaveAs2 , new at ArcGIS 9.2, can be used to specify the storage properties during saveas, such as tile size, compression type, etc. The example below saves to a raster dataset in File geodatabase with 64 x 64 tile size and a JPEG2000 compression.
[C#]
void SaveAsWithCompression(IRasterDataset rasterDataset)
{
  ISaveAs2 saveAs = (ISaveAs2)rasterDataset;

  //set the storage property
  IRasterStorageDef2 storageDef= (IRasterStorageDef2) new RasterStorageDefClass();
  storageDef.CompressionType = esriRasterCompressionType.esriRasterCompressionJPEG2000;
  storageDef.CompressionQuality = 30;
  storageDef.Tiled = true;
  storageDef.TileHeight = 64;
  storageDef.TileWidth = 64;

  //set output workspace
  IWorkspace ws = (IWorkspace)OpenFileGDBWorkspace(@"d:\data\fgdb.gdb");
  saveAs.SaveAsRasterDataset("compressedRaster", ws, "GDB", storageDef);
}
A RasterDataset is composed of one or more persistent raster bands. You can get a RasterBand through an IRasterBandCollection::Item method. Other methods of the IRasterBandCollection interface, such as adding or removing bands, have no effect on the RasterDataset. The IRasterBandCollection::SaveAs plays the same role as ISaveAs::SaveAs.
 
The RasterDataset class can be used to initiate a Raster (see Raster section). Besides being accessed through a workspace, RasterDataset may also be retrieved from a RasterBand using the RasterDataset property. To access the RasterDataset from a Raster, first access a band from the Raster, then obtain a reference to the dataset from the band. This technique is shown here:

[C#]
void GetRasterDataset(IRaster raster)
{
  IRasterBandCollection bandCol = (IRasterBandCollection)raster;
  IRasterBand rasterBand = bandCol.Item(0);
  IRasterDataset rasterDataset = rasterBand.RasterDataset;
}
 

Raster bands

The RasterBand class represents an existing band of a raster dataset. You can access a RasterBand of a Raster or a RasterDataset. Regardless of whether it is derived from the static RasterDataset or the transient Raster, the RasterBand always represents a static band of raster data.
 
The IRasterband interface provides access to the raster color map, raster histogram, statistics, and the raster attribute table if they exist. The code snippet below accesses a raster color map.

[C#]
void GetColormap(IRasterDataset rasterDataset)
{
  IRasterBandCollection bandCol = (IRasterBandCollection)rasterDataset;
  IRasterBand rasterBand = bandCol.Item(0);
  IRasterColormap rasterColormap = rasterBand.Colormap;

  IRaster2 raster = (IRaster2)rasterDataset.CreateDefaultRaster();
  rasterColormap = raster.Colormap;
}
A raster band contains pixel values, which can be accessed through the IRawPixels interface or through Raster class using IRasterEdit interface. The properties of the IRasterProps interface on RasterBand supports read-only with an exception of NoDataValue which is used in writing pixel blocks.
 
A file-based RasterBand also supports the IRasterTransaction interface which is used to manage the transaction of pixel editing.

Raster attribute table, raster color map, and raster statistics

A raster attribute table is a generic Table that stores additional information about the pixels besides pixel values, such as soil type, land use type etc. A raster attribute table is stored as a .dbf file with the same name of the dataset for file-based raster data, except for storing as a VAT for a grid, and as an internal table for raster data in geodatabases.
 
A raster attribute table is loosely coupled with the raster dataset (except a grid VAT). You can build a raster table for a single band raster dataset using IRasterDataset2, open a raster attribute table from a RasterBand using IRasterband::AttributeTable or a Raster using IRaster2::AttributeTable, edit the table just like you edit any generic table, and set the table to the raster dataset. Assuming that pRasterDataset is known, the code below opens a raster attribute table from a Raster.

[C#]
void RasterAttributeTable(IRaster raster)
{
 IRaster2 raster = (IRaster2)raster;
 ITable rasterTable = raster.AttributeTable;
}
The code below opens a raster attribute table from a raster band.
[C#]
void RasterAttributeTable(IRasterDataset rasterDataset)
{
  IRasterBandCollection bandCol = (IRasterBandCollection)rasterDataset;
  IRasterBand rasterBand = bandCol.Item(0);
  ITable rasterTable = rasterBand.AttributeTable;
}
RasterStatistics class represents the statistical information of the pixel values of a raster band. It is not creatable and can be retrieved from a RasterBand. The IRasterStatistics interface can be used to calculate the statistics of a raster band with some special settings, for example it allows to ignore certain pixels by setting the pixel values using IgnoreValue property, or skip some rows and columns by setting the skip factors in the calculation. The code below gets a RasterStatistics from a RasterBand and retrieves statistics information.
[C#]
void CalculateStats(IRasterDataset rasterDataset)
{
  IRasterBandCollection bandCollection = (IRasterBandCollection)rasterDataset;
  IRasterBand rasterBand = bandCollection.Item(0);
  IRasterStatistics rasterStats = rasterBand.Statistics;

  rasterStats.SkipFactorX = 100;
  rasterStats.SkipFactorY = 100;
  rasterStats.Recalculate();
}
RasterHistograms class represents the histogram information of the pixel values of a raster band. It is not creatable and can be retrieved from a RasterBand using IRasterBand::Histogram method.
 
The RasterColormap class contains a collection of colors that are represented in a red, green and blue form. It can be created, retrieved from a RasterBand using IRasterBand::Colormap or retrieved from a Raster using IRaster2::Colormap. You can also set the colormap of a dataset through IRasterDatasetEdit interface.

Raster

The Raster class, in contrast to the static RasterDataset and RasterBand classes, is transient in nature and can be modified without affecting the source data. This allows the Raster to represent what you want, as you may set a transformation or a pixel filter on a raster, specify a projection, extent, and other properties without actually changing the raster dataset. If you want to persist change, the modified Raster can be saved to another raster dataset using ISaveAs interface.
 
Although Raster is always transient in nature, it must be associated with one or more raster bands, which provide a source for data to be read through the raster. As such, the Raster is most easily understood as a vehicle to provide resampling, transformation, and data type conversion from one or more raster bands to a desired output coordinate system.

Create a Raster

A Raster can be created from a RasterDataset in two ways.
  1. The IRasterDataset2::CreateFullRaster method creates a Raster with all the properties from the raster dataset, such as number of bands, width and height of the raster dataset.
  2. The IRasterDataset::CreateDefaultRaster method creates a Raster that has a square cell size and contains only three raster bands even if the dataset has more than three bands. The three bands are the default bands used in the raster RGB renderer and are determined by the settings for default raster behavior made on the RasterDefaultsEnv class in the Carto library.

[C#]
void CreateRaster(IRasterDataset rasterDataset)
{
  //create a default raster
  IRaster raster = rasterDataset.CreateDefaultRaster();

  //create a raster with all bands
  IRasterDataset2 rasterDataset2 = (IRasterDataset2)rasterDataset;
  IRaster raster2 = rasterDataset2.CreateFullRaster();
}
A Raster may be obtained from a RasterLayer, a class in the esriCarto library.
 
A Raster is also creatable. Creating a Raster results in an empty raster that is not useful until one or more bands are placed into the raster, providing data for the raster to read. Creating a new raster and populating it with the desired bands provides flexibility. Any time a band is added or removed from a raster, its default settings for spatial reference, extent, and cell size may be changed, and these default settings will be applied to the Raster if they have not been previously set by the user.

[C#]
void CreateRaster(IRasterDataset rasterDataset)
{
  //create an empty raster and append bands
  IRasterBandCollection newRaster = new RasterClass();
  newRaster.AppendBands((IRasterBandCollection)rasterDataset);
}
Set raster properties
 
IRasterProps is an important interface that is used to get and set the properties of the Raster, such as extent, width, height, spatial reference, pixel type, NoData value, etc. Resampling occurs when the Raster is changed geometrically such as setting an extent, a spatial reference or a geodata transformation. In this case, IRaster::ResampleMethod can be used to specify the resampling method and it will be applied during SaveAs or raster display. The code below projects the Raster by setting a new spatial reference and calling SaveAs. To project a raster with a specified datum transformation, IRaster2::GeoTransformations should be used.

[C#]
void SetRasterProperties(IRaster raster, ISpatialReference sr, IWorkspace ws)
{
  IRasterProps rasterProps = (IRasterProps)raster;
  rasterProps.SpatialReference = sr;
  raster.ResampleMethod = rstResamplingTypes.RSP_BilinearInterpolation;

  ISaveAs saveAs = (ISaveAs)raster;
  saveAs.SaveAs("projectedimage.tif", ws, "TIFF");
}
You can get the cell size of a Raster. However, setting a cell size to a Raster should be done by adjusting the width, height, and extent of the Raster. If the height and/or width are changed, the cell size of the Raster will be re-calculated by using the new height and width to divide the current raster extent. In this case, it will most likely result in a Raster with non-square cell size. You can SaveAs a Raster with square cell size by specifying a pre-calculated height and width.
 
Set transformations on Raster
A Raster can be transformed geometrically by setting a GeodataXfrom using IRaster2. To save a transformed raster, the user must transform the extent and cell size using the GeodataXform of the Raster and set the transformed extent and cell size on the Raster.

[C#]
void SetAndSaveAsXform(IRaster2 raster, IGeodataXform xform, IWorkspace ws)
{
  //get the extent and cell size of the raster
  IRasterProps rasterProps = (IRasterProps)raster;
  IEnvelope extent = rasterProps.Extent;
  IPnt cellSize = rasterProps.MeanCellSize();
  double xCell = cellSize.X;
  double yCell = cellSize.Y;

  //set the geodataXform
  raster.GeodataXform = xform;

  //transform cell size first, then extent. The sequence matters
  xform.TransformCellsize(esriTransformDirection.esriTransformForward, ref xCell, ref yCell, extent);
  xform.TransformExtent(esriTransformDirection.esriTransformForward, extent);

  //put the transformed extent and cell size on raster
  rasterProps.Extent = extent;
  rasterProps.Width = (int)(extent.Width /xCell);
  rasterProps.Height = (int)(extent.Width / yCell);

  //Save the transformed image out
  ISaveAs saveAs = (ISaveAs)raster;
  saveAs.SaveAs(@"c:\temp\result.img", null, "IMAGINE Image");
}
The MapToPixel and PixelToMap methods are used to perform a transformation between pixel and map space. you can get the column and row in pixel space by passing x and y coordinates in map space and vice versa. The GetPixelValue can be used to identify a pixel value on a Raster by specifying the column and row of the pixel. The code below identifies a pixel value of the first band by passing in the x and y coordinates in map space.
[C#]
void IdentifyOnRaster(IRaster raster, double xmap, double ymap)
{
  IRaster2 raster2 = (IRaster2)raster;
  int col = raster2.ToPixelColumn(xmap);
  int row = raster2.ToPixelRow(ymap);
  double idValue = (double)raster2.GetPixelValue(0, col, row);
}
The Raster can be transformed radiometrically by setting a PixelFilter using the IPixelOperation interface. Example below sets a low pass filter on a Raster.
[C#]
void SetFilter(IRaster raster)
{
  //create the filter
  IStockConvolutionFilter pixelFilter = new RasterConvolutionFilterClass();
  pixelFilter.Type = esriRasterFilterTypeEnum.esriRasterFilterSmoothing3x3;

  //set the filter to raster
  IPixelOperation pixelOperation = (IPixelOperation)raster;
  pixelOperation.PixelFilter = (IPixelFilter)pixelFilter;
}
Editing and Displaying a Raster
 
The pixel values of the Raster can be modified and written directly to the raster bands of the raster dataset using the IRasterEdit interface (See Pixel blocks section for more detail). A Raster can be displayed using a RasterLayer class and various raster renderer objects in the Carto library. 

Pixel blocks

A PixelBlock class is a container for pixel arrays. It has the properties of width, height, pixel type and number of planes. Each plane is a pixel array corresponding to one raster band. The PixelBlock class is designed to handle generic pixel arrays from any raster data source. To support different pixel types, the PixelBlock transports pixels in a SafeArray, which has the ability to contain many different data types.
 
The PixelBlock class is used to read, modify, and write pixel values or a portion of pixel values of the raster data. To work with a pixel block, first create a PixelBlock from a Raster using IRaster::CreatePixelBlock method. This will initialize the size and other properties of the pixel block. Next use IRaster::Read method to read pixel values into the pixel block, then use IPixelBlock3::PixelData or PixelDataByRef to get or modify pixel values of the pixel block. The IRasterEdit interface can be used to write the pixel block to the raster dataset.  

[C#]
void UsingPixelBlock(IRaster raster)
{
  //create a pixel block using the size provided by the system
  IRaster2 raster2 = (IRaster2)raster;
  IPixelBlock pixelBlock = raster2.CreateCursorEx(null).PixelBlock;
  int w = pixelBlock.Width;
  int h = pixelBlock.Height;
  //read the first pixel block
  IPnt topleftCorner = new PntClass();
  topleftCorner.SetCoords(0, 0);
  raster.Read(topleftCorner, pixelBlock);
  //modify one pixel value at location w-1 and h-1 (assume the raster has a pixel type of uchar)
  IPixelBlock3 pixelBlock3 = (IPixelBlock3)pixelBlock;
  System.Array pixels = (System.Array)pixelBlock3.get_PixelData(0);
  pixels.SetValue(Convert.ToByte (10), w - 1, h - 1);
  pixelBlock3.set_PixelData(0, pixels);
  //write the modified pixel block to the raster dataset
  IRasterEdit rasterEdit = (IRasterEdit)raster;
  rasterEdit.Write(topleftCorner, pixelBlock);
}
For a small raster dataset, the size of the pixel block can be the size of the entire dataset, which can usually be held in memory at one time. When working with large raster data, the best practice is to divide the raster into small pixel blocks and perform reading and writing pixels block by block using the RasterCursor class.
 
The IRaster::CreateCursor method provides a simple way to create a RasterCursor based on a pixel block that has the width of the whole raster and a heigh of 128. The IRaster2::CreateCursorEx method allows you to create a raster cursor with a user specified pixel block size or system provided pixel block size (pass nothing to the pixel block size).
 
NoData
Some pixels in a raster dataset might have missing information, and these pixels or cells are called NoData. For a file-based RasterDataset, NoData is stored as a value, called NoData value, in the raster dataset. The pixels that have the same value as the NoData value are NoData pixels. For a database RasterDataset, NoData pixels are stored as a bit mask, a two dimensional array of 0s and 1s, where 0 represents that the corresponding pixel is a NoData pixel.
 
IRasterProps::NoDataValue can be used to get and set the NoData value on a Raster. The NoData value will be utilized in saving (SaveAs) to a new dataset.
 
IRasterProps::NoDataValue can also be used to get and set the NoData value on a RasterBand. The NoData value will be utilized in writing pixel blocks to the raster dataset with IRasterEdit or IRawPixels interface. For mask based NoData, the IPixelBlock3::Mask method should be used to set NoData when writing pixel blocks. The following example sets the NoData value on a Raster and saves it to a new raster dataset.

[C#]
void SaveAsRasterWithNoData(IRaster raster)
{
  //set Nodata
  IRasterProps rasterProps = (IRasterProps)raster;
  rasterProps.NoDataValue = 255;

  //or set different nodata value for each band
  int[] nodata = { 255, 255, 236 };
  rasterProps.NoDataValue = nodata;

  //Save out
  ISaveAs saveAs = (ISaveAs)raster;
  saveAs.SaveAs(@"c:\temp\nodata.img", null, "IMAGINE Image");
}
 

Raster catalogs

 
RasterCatalog, a special type of FeatureClass in geodatabases, manages a collection of raster datasets as one entity. It has a Name field that stores the name of the raster dataset, a Geometry field that stores the footprint (bounding box) of the raster dataset, and a Raster field that stores the pixel values of the raster dataset. It may also contain any other fields such as metadata field, text field, etc. Only one Raster field is allowed in a raster catalog.
 
The Raster field of a raster catalog has a spatial reference, defined by RasterDef, which serves as a default for loading raster datasets that have unknown spatial reference. In ArcGIS 9.2, the raster datasets inside a raster catalog are allowed to store their own spatial references and geodata transformations.
 
In addition to defining the spatial reference for the raster field, RasterDef also defines how the raster values are managed in the raster catalog. A managed raster catalog stores raster value internally inside the raster catalog. An unmanaged raster catalog stores only the paths to the raster datasets, and those raster datasets may reside in file system. A raster catalog in an enterprise geodatabase is always managed.
 
The footprints of the raster datasets stored in the Geometry field are automatically managed, populated and spatially indexed by the geodatabase. The spatial reference (the projected or geographic coordinate system, the coordinate domain and the coordinate precision) and the spatial index of the geometry field can be set using a GeometryDef class.
The value stored in the Raster field is called a RasterValue. A RasterValue contains a RasterDataset and a RasterStorageDef that describes how the RasterDataset is stored in the geodatabase. You can specify the tile size, cell size, origin of the raster dataset. You can also define the compression type as well as the resampling method for pyramids building.
As a subclass of FeatureClass, the RasterCatalog consists of rows. Each row is a RasterCatalogItem, which is a type of Feature. A RasterCatalog operates the same way as a FeatureClass when accessing or updating the raster datasets in the RasterCatalog (e.g., enumeration of the raster datasets in a RasterCatalog is accomplished by acquiring a standard FeatureCursor on the RasterCatalog). Insert and update can be achieved by an insert cursor or an update cursor.
 
To create a raster catalog, first create an empty raster catalog with defined fields, and then add rows that contain raster values to the raster catalog. The following code snippet shows a way of loading a raster dataset to a raster catalog and retrieve a raster dataset inside a raster catalog.

[C#]
void AddRasterToRasterCatalog(IRasterDataset rasterDataset, IRasterCatalog rasterCatalog)
{
  IFeatureClass fClass = (IFeatureClass)rasterCatalog;
  IFeature feature = fClass.CreateFeature();

  //create a raster value
  IRasterValue rasterValue = new RasterValueClass();
  rasterValue.RasterDataset = rasterDataset;

  feature.set_Value(rasterCatalog.NameFieldIndex, rasterValue);
  feature.Store();
}
The code below shows how to get the raster dataset stored in first row in a raster catalog:
[C#]
void GetRasterDataset(IRasterCatalog rasterCatalog, int index)
{
  IFeatureClass fClass = (IFeatureClass)rasterCatalog;
  IRasterCatalogItem catalogItem = (IRasterCatalogItem)fClass.GetFeature(index);
  IRasterDataset rasterDataset = catalogItem.RasterDataset;
}
A RasterCatalog can be displayed using the GdbRasterCatalogLayer, a class in esriCarto library.

Geodata Transformation and Pixel Filtering

 

Geodata transformations

A geodata transformation is a mathematical operation that is used to perform geometric transformations for geodatasets such as raster datasets. ArcGIS 9.2 supports many geodata transformations including coordinate transformation (re-projection), polynomial transformation, rubber sheeting (Adjust) transformation, Spline transformation, RPC (Rational Polynomial Coefficients) transformation and so on. The geodata transformations are represented as an abstract class, GeodataXform, and 10 concrete geodata transformation classes (Xform), which include AdjustXform, SplineXform, RPCXform, PolynomialXform, CoordinateXform, ApproximationXform, GCSShiftXform, GeometricXform, CompositeXform, and IdentityXform. The user can also create a custom Xform by implementing interfaces of the GeodataXform abstract class.
All GeodataXforms can have an output spatial reference that defines the spatial reference of the data after being transformed (e.g. in output space). The domains of GeodataXforms, if they exist, are also defined in the output space. All GeodataXforms perform point (IPointCollection or WKSPoint) transformation, extent (IEnvelope) transformation and cell size transformation in forward and backward directions. To transform raster data, the RasterXformer, discussed at the end of this section, provides the mechanism behind the scenes by calling PixelReader, PixelResampler and IRasterXform. The IRasterXform interface is used for those geodata transformations that need raster specific information to optimize the operations. Therefore, creating a custom geodata transformation to work with raster data should implement the IRasterxform interface.
 
The following code snippet transforms a collection of points. Note that the point collection, extent and cell size are transformed by reference, for example, the input and output use the same variable.

[C#]
void TransformPoints(IGeodataXform xform,  IPointCollection points, IEnvelope extent, ref double xcell, ref double ycell)
{
  xform.TransformPoints(esriTransformDirection.esriTransformForward, points);
  xform.TransformExtent(esriTransformDirection.esriTransformForward, extent);
  xform.TransformCellsize(esriTransformDirection.esriTransformForward, ref xcell, ref ycell, extent);
}
A GeodataXform is stored as a metadata of the raster dataset and can be modified using IGeodataSchemaEdit2::AlterGeodataTransformation (see raster dataset section). The GeodataXform of a raster dataset will be applied to transform the pixels on-the-fly during raster layer display. You can also set a GeodataXform on a Raster and persist the transformed Raster using ISaveAs (see more information in the Raster section). SaveAs a RasterDataset will not apply the GeodataXform to the pixels, but will persist the GeodataXform with the output raster dataset.

PolynomialXform

The PolynomialXform performs transformation using a polynomial, which is built based on a LSF (Least Square Fitting) algorithm. A PolynomialXform can be defined in two ways. One is to use two sets of control points, one being source and one being target, to construct the polynomial of an order of 1,2, or 3. The minimum number of the non-correlated control points required for this method must be 3, 6, and 10 respectively. The other way is to set the polynomial coefficients directly using the IPolynomialXform::DefineFromCoefficients if the polynomial coefficients are known.
 
A polynomial transformation is an approximate transformation and the IPolynomialXform interface provides two ways to calculate the system residuals and RMS. One is based on the control points using GetSystemResidual and GetSystemRMS methods; and the other is based on a set of check points using CheckResidualRMS method. Assuming pSourcePoints and pTargetPoints are known source and target control point collections, the code snippet below creates a polynomial xform.

[C#]
IPolynomialXform  Polynomial(IPointCollection fromPoints, IPointCollection toPoints)
{
  IPolynomialXform polyXform = new PolynomialXformClass();
  polyXform.DefineFromControlPoints(fromPoints, toPoints, 2);
  return polyXform;
}
SplineXform
 
The SplineXform class performs a geodata transformation using a Spline function, a piecewise polynomial that maintains continuity and smoothness between adjacent polynomials. It transforms the source control points exactly to the target control points, while the points or pixels that are away from the control points are not always guaranteed to have higher accuracy. Spline transformation is useful when the control points are very important and required to be registered precisely. Adding more control points can increase an overall accuracy of the Spline transformation. A SplineXform can be created from two sets of control points using the DefineFromControlPoint method of ISplineXform interface.

AdjustXform

The AdjustXform, also called a rubber sheeting transformation, is built upon an algorithm that combines a polynomial transformation and a TIN interpolation technique. Adjust transformation first performs a polynomial transformation using two sets of control points, then adjusts the control points locally to better match the target control points using a TIN interpolation technique. Comparing to the PolynomialXform and SplineXform, AdjustXform has both the characteristics of global optimization (because of the use of LSF algorithm) and local accurate approximation of the control points. Assuming pSourcePoints and pTargetPoints are known source and target control point collections, code snippet below creates an AdjustXform using IAdjustXform interface.

[C#]
void AdjustXform(IPointCollection fromPoints, IPointCollection toPoints)
{
  //create adjust xform using control points
  IAdjustXform xform = new AdjustXformClass();
  xform.DefineFromControlPoints(fromPoints, toPoints);
  xform.PolynomialApproximation = 2;
  //use interpolation to do the adjustment
  xform.NaturalNeighbor = true;
}
ApproximateXform
 
The ApproximateXform is used to perform an approximate transformation of a GeodataXform to achieve a better performance and it is mainly for those GeodataXforms that are computationally expensive such as CoordinateXform, AdjustXform, etc. An ApproximateXform has an associated GeodataXform, a user defined point grid (or mesh) and a tolerance. ApproximateXform approximates its base GeodataXform by applying the true transformation only on the coarse mesh, and performing bilinear interpolation for between points. It guarantees the approximation error does not exceed the specified tolerance. The Code below creates an ApproximateXform using IApproximateXform and IGeodataXformApproximation interfaces.

[C#]
void CreateApproximationXform(IGeodataXform xform)
{
  IApproximationXform appXform = new ApproximationXformClass();
  appXform.GeodataXform = xform;
  IGeodataXformApproximation gdApproximation = (IGeodataXformApproximation)appXform;
  gdApproximation.Tolerance = 0.5;
  gdApproximation.GridSize = 32;
}
CoordinateXform
 
The CoordinateXform class is a coordinate transformation that transforms data from one projection system to another. To create a CoordinateXform, you need to specify the output spatial reference and the input spatial reference. If the IGeodataXformApproximation interface is used, the CoordinateXform will perform an approximation of the coordinate transformation using a bilinear approximation mesh algorithm; otherwise it transforms points using a point-to-point projection. Raster projection in ArcGIS 9.2 is implemented using this approximation technique, which projects raster data based on a 16x16 mesh. Code below transforms a collection of points from one spatial reference to another using ICoordinateXform2 interface.

[C#]
void CoordinateXform(ISpatialReference sourceSR, ISpatialReference targetSR, IPointCollection points)
{
  //create coordinate xfrom and set spatial reference
  ICoordinateXform2 coorXform = (ICoordinateXform2 ) new CoordinateXform() ;
  coorXform.InputSpatialReference = sourceSR;
  coorXform.SpatialReference = targetSR;
  //define the approximation parameters
  IGeodataXformApproximation gdApproximation = (IGeodataXformApproximation)coorXform;
  gdApproximation.Approximation = true;
  gdApproximation.GridSize = 16;
  //unit is in the input space
  gdApproximation.Tolerance = 15;
  //transform
  coorXform.TransformPoints(esriTransformDirection.esriTransformForward, points);
}
RPCXform
 
Some image products delivered from satellite image companies such as Digital Globe or Space Imaging contain RPC (Rational Polynomial Coefficients) information within the image data. The RPC, represented as 92 parameters, defines the transformation to be used for image registration. The RPCXform class is used to support RPC transformation and image orthorectification.
 
To create an RPCXform, besides setting the 92 coefficients using IRPCXform, you must also set the forward transformation since RPC only defines the reverse transformation (ground to image). The ISensorXform interface is used to set the elevation information to perform image orthorectification.

Other GeodataXforms

GCSShiftXform is used to perform transformation from a non-standard GCS coordinate (0 to 360) to a standard GCS (–180 to 180). For example, if your world image comes in a coordinate system of (0,360, -90 , 90), the GCSShiftXform can be used to transform your image to (-180, 180, -90,90).
 
The GeometricXform is a geodata transformation based on the transformation classes defined in the Geometry library (AffineTransformation2D, ProjectiveTransformation2D, etc.). It is a wrapper of these classes and allows these classes to be incorporated in the geodata transformation pipeline.
 
The IdentityXform class is an identity coordinate transformation that has no effect on coordinates and is used purely to associate or change the spatial reference of the data. A raster dataset created from RasterGeometryProc::Rectify has an identity transformation, while a raster dataset created from RasterGeometryProc::Register has a polynomial transformation.
 
The CompositeXform consists of a set of ordered xforms and it is used to manage the xform list. For example to add, remove, or get a geodata xform. The sequence of the transformation being applied is from bottom to top for forward transformation, and top to bottom for reverse transformation.
 
 
To transform raster data with these geodata xforms, the RasterXformer class plays a critical role behind the scenes. A RasterXformer contains a GeodataXform, a PixelResampler, and a PixelReader. It also contains the logic to drive these three components to perform raster transformations. Raster transformation is a reverse transformation. For a given extent (Envelope) in the output space, the RasterXformer first rasterizes it into pixels, then reverse transforms the pixels into the input space using the GeodataXform. Finally it resamples the pixels, provided by the PixelReader, in the input space using the PixelResampler. If an approximation is used in the transformation, only pixels on a predefined mesh will be reversely transformed to the input space, and the values of the pixels inside the mesh will be interpolated.
 
The default pixel reader used by the RasterXformer is a SimplePixelReader, and it provides input pixels, either from a Raster or from raw pixel read by implementing a call back function using the IRawPixelReader interface. If the input pixels are not coming from a Raster, IRasterXformer2 can be used to dynamically transform pixels, such as on-fly-projected pixels from ArcIMS layer. In this case, the developer is responsible for setting up a custom PixelReader.
 
The default pixel resampler used by the RasterXformer is a SimplePixelResampler, which supports four types of resampling methods (Nearest Neighbor, Bilinear Resampling, Cubic Convolution, and Majority). You can modify the properties of the SimplePixelResampler. The following example sets the cubic convolution parameter to be –0.5.

[C#]
void SetCubicResamplingFactor(IRaster raster)
{
  //Get the xfromer
  IRaster2 raster2 = (IRaster2)raster;
  IRasterXformer xformer = raster2.RasterXformer;
  //set the resampling method and factor (-3, 0)
  raster.ResampleMethod = rstResamplingTypes.RSP_CubicConvolution;
  ISimplePixelResampler resampler = (ISimplePixelResampler)xformer.PixelResampler;
  resampler.CubicConvolutionParameter = -0.5;
}
 

Pixel Filters

 
The pixel filter classes perform radiometric transformation which transforms pixel values. The PixelFilter, an abstract class, supports the IPixelFilter and IPixelFilter2 interfaces and is implemented by seven pixel filter classes: RasterConvolutionFilter, PanSharpeningFilter, BackgroundFilter, ColormapFilter, LutFilter, MultibandFilter, RemapFilter, and a PixelFilterCollection class which allows you to define more than one pixel filter operations on a pixel block. You can also create a custom filter by implementing the IPixelFilter interface.
 
The PanSharpeningFilter class, new at ArcGIS 9.2, is used to perform image enhancement using various panchromatic sharpening techniques . Panchromatic sharpening uses a higher-resolution panchromatic image (or raster band) to fuse with a co-registered lower-resolution multiband raster dataset. The result of this will produce a multiband raster dataset with the resolution of the panchromatic raster where the two rasters fully overlap. IPansharpeningFilter is used to create a PansharpeningFilter class, setting a panchromatic raster and specifying a pan-sharpening type.
 
ArcGIS 9.2 provides four pan-sharpening methods:
  1. Mean
  2. Brovey
  3. HIS
  4. ESRI
 
Each of these methods is based on the following general model:
 
A pixel value of a Pan image is considered a weighted average of red, green, blue, and (optional) infrared components:
 
    P = R*RW + G*GW + B*BW + I*IW
    1 = RW + GW + BW + IW
 
In this model, RW, GW, BW, and IW (>0) are weights for red, green, blue, and infrared components. P, R, G, B, and I (as well as P', R', G', I') represent the input and output pixel values of the panchromatic, red, green, blue and Infrared bands respectively.
 
Brovey method
    DNF = (P-IW*I)/(RW*R+GW*G+BW*B)
    R' = R*DNF
    G' = G*DNF
    B' = B*DNF
    I' = I*DNF
 
IHS method
    RGBToHSI(R, G, B, H, S, INTENSITY)
    INTENSITY = P-I*IW
    HSIToRGB(H, S, INTENSITY, R', G', B')
 
 
ESRI method
    WA (Weighted average) = R*RW + G*GW + B* BW + + I*IW /(RW+GW+BW+IW)
    ADJ (Adjusted value) = P- WA
    R' = R+ADJ
    G' = G+ADJ
    B' = B+ADJ
    I' = I+ADJ
 
 
Mean method
    R' = 0.5 * (R + P)
    G' = 0.5 * (G + P)
    B' = 0.5 * (B + P)
 
The RasterConvolutionFilter class is used to perform various pixel filtering techniques to enhance image. The IStockConvolutionFilterinterface provides access to many existing convolution filters such as low pass filter, high pass filter, etc. The IRasterConvolutionFilter interface allows you to create your own convolution filter by defining a kernel. Code snippet below creates a convolution filter with a 3x3 kernel.

[C#]
IPixelFilter  FilterKernel()
{
  IRasterConvolutionFilter filter = new RasterConvolutionFilterClass();
  double[] kernel = {  -1, -1, -1 ,  2, 2, 2 ,  -1, -1, -1  };
  filter.PutCoefficients(ref kernel);
  return (IPixelFilter)filter;
}
The pixel filter can be set on a Raster, and the pixel values of the raster will be transformed by the pixel filter when saving out to a raster dataset or sending to the display. The code example below creates a 3x3 filter and applies it to a Raster.
[C#]
void SetPixelFilterOnRaster(IRaster raster)
{
  IStockConvolutionFilter filter = (IStockConvolutionFilter)new RasterConvolutionFilterClass();
  filter.Type = esriRasterFilterTypeEnum.esriRasterFilterSmoothing3x3;
  IPixelOperation pixelOp = (IPixelOperation)raster;
  pixelOp.PixelFilter = (IPixelFilter) filter;
}

Raster Data Loading and Other Miscellaneous Objects

This part includes classes used for mosaicking raster datasets, loading raster datasets and raster catalogs, and conversion. It also contains other miscellaneous objects.

Raster mosaicking

MosaicRaster and RasterLoader classes are used to mosaic raster data.
MosaicRaster mosaics a collection of raster datasets and saves the result to a new seamless raster dataset. MosaicRaster also takes a raster catalog as an input, and mosaics all raster datasets or a portion of raster datasets in a raster catalog, defined by a WHERE clause, into a single raster dataset. You can control how the overlapped pixels are resolved by specifying MosaicOperatorType or by creating a custom operator by implementing the MosaicOperator class. You can also control the output color map for mosaicking color mapped raster datasets.
 
The MosaicRaster class supports the IRasterProps interface which allows you to control the properties of the output raster dataset such as pixel type, cell size, NoData etc. By default, the output raster takes the properties from the first raster to be mosaicked except taking the union of extents of all rasters. The MosaicRaster class also supports the ISaveAs interface, allowing you to create a mosaic output to a file-based raster or to a raster dataset in geodatabase. The example below creates one seamless raster dataset from a subset of raster datasets in a raster catalog.
 
This example below creates one seamless raster dataset from a subset of raster datasets in a raster catalog:

[C#]
void MosaicRasterCatalog(IRasterWorkspaceEx ws)
{
  //open a raster catalog
  IRasterCatalog rasterCatalog = ws.OpenRasterCatalog("images");

  //mosaic a raster catalog with whereclause
  IMosaicRaster mosaicRaster = new MosaicRasterClass();
  mosaicRaster.RasterCatalog = rasterCatalog;
  mosaicRaster.WhereClause = "state = 'CA'";

  //save the result
  ISaveAs saveAs = (ISaveAs)mosaicRaster;
  saveAs.SaveAs("mosaicresult", (IWorkspace)ws, "GDB");
}
And the code below mosaic two rasters to geodatabase:
[C#]
void Mosaic2(IRasterWorkspaceEx ws, IRaster raster1, IRaster raster2)
{
 IRasterCollection rasterCollection = (IRasterCollection) new MosaicRasterClass ();
 rasterCollection.Append (raster1);
 rasterCollection.Append (raster2);

 //save the result
 ISaveAs saveAs = (ISaveAs)rasterCollection;
 saveAs.SaveAs("mosaicresult", (IWorkspace)ws, "GDB");
}
The RasterLoader class is used to mosaic raster data, in any format, to an existing raster dataset. This method works if the existing raster datasets are in any of the supported writable formats, but it works better for ArcSDE or File geodatabase raster datasets. This RasterLoader allows you to specify certain properties during data loading such a background value to be ignored, the output color map , and etc. This class extends the functionality of IRasterDatasetEdit::Mosaic by allowing to specify more properties for mosaicking operation.
 
MosaicColormapMode sets the operation mode for color map manipulation.
 
Background sets the background value of the input raster to be ignored when loading.
 
Foreground, set to 255, instructs the loader to load 1 bit raster into an 8 bit raster dataset in order to achieve better display effect.
 
PixelAlignmentTolerance sets the tolerance for resampling 

Raster catalog loader

In ArcGIS 9.2, two loader classes are available to facilitate raster catalog loading. They are RasterCatalogLoader and DrLoader (Distributed Rastercatalog Loader). The RasterCatalogLoader is a class for loading a set of raster datasets or a directory of raster datasets to a geodatabase raster catalog. Since ArcGIS 9.2 supports persisting transformation with raster datasets in a raster catalog, and allows the spatial references of the raster datasets to be different from the spatial reference of the raster column, the IRasterCatalogLoader interface can be used to load these raster datasets to a geodatabase raster catalog with options of either applying the transformation and/or re-projection to the output dataset during the loading or persisting the transformation and/or spatial reference as the properties of the raster dataset.
 
Assuming a directory contains images of UTM Zone 16 and UTM Zone 17, the following code loads those images to a raster catalog by preserving their original spatial reference. Setting Projected to be true will project the images to the spatial reference defined in the raster field.

[C#]
void RasterCatalogLoader(IPropertySet propertySet)
{
  //set the storage
  IRasterStorageDef storage= new RasterStorageDefClass();
  storage.CompressionType = esriRasterCompressionType.esriRasterCompressionLZ77;

  //set the loader
  IRasterCatalogLoader loader = new RasterCatalogLoaderClass();
  loader.ConnectionProperties = propertySet;
  loader.StorageDef = storage;
  loader.Projected = false;

  loader.Load("state_catalog", @"\c:\data", null);
}
When creating a raster catalog of RPC images, you can set IRasterStorageDef::Transformed to be false to persist the RPCXform with the raster datasets during the loading.
 
DrLoader is used to load raster datasets or a directory of raster datasets to a raster catalog. It is designed for the ArcGIS server environment where there are multiple containers. DrLoader distributes the loading tasks to all the worker machines to reduce loading time through parallel loading.

RasterGeometryProc

The RasterGeometryProc class is used to perform polynomial transformations such as flip, rotate, warp, etc. It can also project rasters from one spatial reference to another. The RasterGeometryProc is built based on the PolynomialXform class, but provides easy to use methods for end users.
 
The RasterGeometryProc manipulates only Raster class, not RasterBand or RasterDataset. This is because the Raster is transient, as are the effects of the RasterGeometryProc. This means that any transformation will also go away when the Raster goes out of scope.
 
To keep the transformed data for later use, you must persist the transformation using Register or Rectify method. Register persists the transformation into the auxiliary file associated with the input dataset, which prevents the need for resampling. Rectify persists the transformed Raster into a new file. Alternatively you can use ISaveAs to save to a new raster dataset. If used on a Raster contained within a RasterLayer, processing performed by this class will be visible when the display is refreshed. Utilizing IRasterGeometryProc interface, the code below rotates a raster based on the center of the raster and persists the transformation to the same dataset.

[C#]
 
void Rotate(IRaster raster)
{
  IRasterGeometryProc rasterGP = new RasterGeometryProcClass();
  rasterGP.Rotate(null, 45, raster);
  rasterGP.Register(raster);
}
The ProjectFast method projects a raster to a new projection with a specified cell size. In ArcGIS 9.2, raster projection is built upon a point-to-point approximation algorithm that performs fast and accurate re-projection of raster data. The algorithm projects pixels on a predefined 16x16 mesh using a point-to-point projection. It then transforms the pixels inside the mesh using a bilinear interpolation technique if the error on a sub mesh is within a tolerance of half pixel, otherwise it projects the rest pixels using a point-to-point projection. Since pixels on a sub mesh will also be projected using point-to-point projection during the estimation of the interpolation accuracy, the algorithm performs point-to-point projection on a finer grid mesh and results in a much higher accuracy than the default half-pixel tolerance.
 
When more than one domains is involved in the raster datasets such as raster datasets with Cube projection, Fuller projection or projection with non-zero central meridian, the algorithm will divide the output space into contiguous domains by overlaying input and output domains and project pixels in each domain. This algorithm maintains the integrity of the raster dataset and guarantees that there is not discontinuity in the output raster dataset.  

Color map to RGB conversion

The RasterColormapToRGB class is used to convert between a raster dataset that contains a color map and a three-band raster dataset.
 
The following example converts a color mapped raster dataset (pRasterDataset) into a RGB raster dataset.

[C#]
 
void ColormapToRGB(IRasterDataset rasterDataset)
{
  IRasterColormapToRGBConversion converter = new RasterColormapToRGBConverterClass();
  IRaster raster = converter.CreateRGBRaster(rasterDataset);
  ISaveAs saveAs = (ISaveAs)raster;
  IWorkspace = (IWorkspace)OpenRasterWorkspace(@"c:\temp");
  saveAs.SaveAs("rgbraster.img", ws, "IMAGINE Image");
}
 

Other miscellaneous classes

RasterCatalogTable is a legacy class used to represent a table based raster catalog, and SdeRasterCatalogTable is used for the 8.x style raster catalogs.
 
The RasterDomainExtractor class extracts a polygon boundary, from a raster, along the borders of pixels that are not NoData (value pixels).
 
RasterPicture can load a raster into a Picture control.
 
UniqueValues, StatsHistogram, RasterCalcStatsHistogram, and RasterCalcUniqueValues are helper classes for raster renderers, which are in Carto library.
 
DERasterDataset, DERasterBand and other data element classes are used in scripting language when geoprocessing.