Changes between Version 1 and Version 2 of rfc15_nodatabitmask


Ignore:
Timestamp:
Aug 9, 2007, 1:09:47 PM (17 years ago)
Author:
warmerdam
Comment:

rewrite for GetNullMask().

Legend:

Unmodified
Added
Removed
Modified
  • rfc15_nodatabitmask

    v1 v2  
    1 = RFC 14: NoData Bitmasks =
     1= RFC 14: Null Masks =
    22
    33Author: Frank Warmerdam[[BR]]
     
    99Some file formats support a concept of a bitmask to identify pixels that are not valid data.  This can be particularly valuable with byte image formats where a nodata pixel value can not be used because all pixel values have a valid meaning.  This RFC tries to formalize a way of recognising and accessing such nodata bitmasks through the GDAL API.
    1010
    11 == 
     11The basic approach is to treat such masks as raster bands, but not regular raster bands on the datasource.  Instead they are freestanding raster bands in a manner similar to the overview raster band objects.  The nodata masks are represented as GDT_Byte bands with a value of zero indicating nodata and 255 indicating valid data.  Intermediate values do not normally occur but in they future they might be interpreted as a confidence value or alpha transparency values.
     12
     13== API ==
     14
     15GDALRasterBand is extended with the following methods:
    1216
    1317{{{
    14     virtual CPLErr BitmaskIO( GDALRWFlag, int, int, int, int,
    15                               GByte *, int, int, GDALDataType,
    16                               int, int *, int, int, int );
     18    GDALRasterBand *GetNullMask();
     19    GDALNullMaskType GetNullMaskType();
    1720}}}
    1821
     22Note that the GetNullMask() should always return a GDALRasterBand mask, even if it is only an all 255 mask with thetype
     23
     24The GDALNullMaskType enumeration has the following values:
     25
     26 * GDALNMTAllValid: There are no invalid pixels, all mask values will be 255.
     27 * GDALNMTPerBand: The mask band is meaningful and is unique to this band (other bands may have masks with different areas of validity)
     28 * GDALNMTPerDataset: The mask band is meaningful and is shared between all bands on this dataset.
     29
     30Note that the GetNullMask() should always return a GDALRasterBand mask, even if it is only an all 255 mask with the type set to GDALNMTAllValid.
     31
     32== Default Implementation ==
     33
     34The GDALRasterBand class will include a default implementation of GetNullMask() that returns one of two default implementations.  The first default implement is a GDALNMTAllValid band that returns all 255.  The second default implementation would return a mask computed by reading the imagery data and comparing it to the nodata value.  The nodata based one would be used when the base band has a nodata value.   
     35
     36== Drivers Updated ==
     37
     38These drivers will be updated:
     39
     40 * JPEG Driver: support the "zlib compressed mask appended to the file" approach used by a few data providers.
     41 * GRASS Driver: updated to support handling null values as masks. 
     42
     43Possibly updated:
     44 * HDF4 Driver: This driver might possibly be updated to return real mask if we can figure out a way. 
     45 * SDE Driver: This driver might be updated if Howard has sufficient time and enthusiasm.
    1946
    2047== Implementation Plan ==
     
    2451== SWIG Implications ==
    2552 
     53The GetNullMask() and GetNullMaskType() methods (and corrsponding defines) will need to be added.  The bitmask should work like a normal raster band for swig purposes so minimal special work should be required.
    2654
    2755== Testing ==
     56
     57== Issues ==
     58
     59I'm tempted to change GetNullMaskType() into GetNullMaskFlags() and have the result be an or-ed set of flags.  It would allow us to differentiate mask bands auto generated from nodata, and add special interpretations in the future, like is-alpha or is-confidence.
     60
     61 * I haven't filled in how creation of masks works.
     62 * I haven't talked about bitmask-via-spill file possibilities for the PAM subsystem.