The length of remote sensing pixel value is constrained by a predefined pixel value type. It is an unchangeable property for each remote sensing image and saving an unsupported value to a image may cause unpredictable errors like application crash or information loss resulted from implicit data type conversion.
If you are developing application based on ArcObject, you could know the pixel type of a raster layer simply with following code.
1 | IRasterLayer rasterLayer = (IRasterLayer)layer; |
You can find a full list and detailed explanation of ArcObject raster pixel types in this page.
Not every raster pixel types has a corresponding C# value type. So I make a list for those pixels types having relative in C# so that we can make correct conversion while developing.
ArcMap Pixel Type | Description | Corresponding C# Data Type | Supported |
---|---|---|---|
PT_UNKNOWN | unknown | No | |
PT_U1 | 1 bit | No | |
PT_U2 | 2 bit | No | |
PT_U4 | 4 bit | No | |
PT_UCHAR | unsigned 8 bit integer | Byte | Yes |
PT_CHAR | 8 bit integer | SByte | Yes |
PT_USHORT | unsigned 16 bit integer | UInt16 | Yes |
PT_SHORT | 16 bit integer | Int16 | Yes |
PT_ULONG | unsigned 32 bit integer | UInt32 | Yes |
PT_LONG | 32 bit integer | Int32 | Yes |
PT_FLOAT | single precision floating point | Single | Yes |
PT_DOUBLE | double precision floating point | Double | Yes |
PT_COMPLEX | single precision complex | No | |
PT_DCOMPLEX | double precision complex | No | |
PT_CSHORT | short integer complex | No | |
PT_CLONG | long integer complex | No |
Based on this table, I write a function to wrap the conversion from C# data type to valid ArcObject pixel value type. I use it in my project ArcMap Raster Edit Suite and it work pretty well.
1 | /// <summary> |