Changes between Version 7 and Version 8 of rfc15_nodatabitmask
- Timestamp:
- Aug 21, 2007, 8:09:06 AM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
rfc15_nodatabitmask
v7 v8 1 = RFC 14: NullMasks =1 = RFC 14: Band Masks = 2 2 3 3 Author: Frank Warmerdam[[BR]] … … 7 7 == Summary == 8 8 9 Some 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 null masks through the GDAL API .9 Some 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 null masks through the GDAL API, while moving to a uniform means of representing other kinds of masking (nodata values, and alpha bands). 10 10 11 The 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 nodatamasks are represented as GDT_Byte bands with a value of zero indicating nodata and non-zero values indicating valid data. Normally the value 255 will be used for valid data pixels.11 The 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 masks are represented as GDT_Byte bands with a value of zero indicating nodata and non-zero values indicating valid data. Normally the value 255 will be used for valid data pixels. 12 12 13 13 == API == … … 16 16 17 17 {{{ 18 GDALRasterBand *Get NullMask();19 int Get NullMaskFlags();18 GDALRasterBand *GetMaskBand(); 19 int GetMaskFlags(); 20 20 }}} 21 21 22 Note that the !Get NullMask() should always return a GDALRasterBand mask, even if it is only an all 255 mask with the type indicating "all valid".22 Note that the !GetMaskBand() should always return a GDALRasterBand mask, even if it is only an all 255 mask with the flags indicating GNMF_ALL_VALID. 23 23 24 The !Get NullMaskFlags() method returns an ORed set of status flags with the following available definitions that may be extended in the future:24 The !GetMaskFlags() method returns an bitwise OR-ed set of status flags with the following available definitions that may be extended in the future: 25 25 26 26 * GNMF_ALL_VALID(0x01): There are no invalid pixels, all mask values will be 255. When used this will normally be the only flag set. … … 28 28 * GNMF_ALPHA(0x04): The mask band is actually an alpha band and may have values other than 0 and 255. 29 29 30 Note that the !GetNullMask() should always return a GDALRasterBand mask, even if it is only an all 255 mask with the flag GNMF_ALL_VALID set.31 32 30 == Default Implementation == 33 31 34 The GDALRasterBand class will include a default implementation of !Get NullMask() that returns one of three default implementations.32 The GDALRasterBand class will include a default implementation of !GetMaskBand() that returns one of three default implementations. 35 33 36 34 * If the band has a nodata value set, an instance of the new GDALNodataMaskRasterBand class will be returned. !GetNullMaskFlags() will return zero (no flags set). … … 38 36 * If neither of the above apply, an instance of the new GDALAllValidRasterBand class will be returned that has 255 values for all pixels. The null flags will return GNMF_ALL_VALID. 39 37 38 The GDALRasterBand will include a protected poMask instance variable and a bOwnMask flag. The first call to the default !GetMaskBand() will result in creation of the GDALNodataMaskRasterBand, GDALAllValidMaskRasterBand and their assignment to poMask with bOwnMask set TRUE. If an alpha band is identified for use, it will be assigned to poMask and bOwnMask set to FALSE. The GDALRasterBand class will take care of deleting the poMask if set and bOwnMask is true in the destructor. Derived band classes may safely use the poMask and bOwnMask flag similarly as long as the semantics are maintained. 39 40 40 == Alpha Bands == 41 41 42 When a dataset has a normal GDT_Byte alpha (transparency) band that applies, it should be returned as the null mask, but the !Get NullMaskFlags() method should include GNMF_ALPHA. For processing purposes any value other than 0 should be treated as valid data, though some algorithms will treat values between 1 and 254 as partially transparent.42 When a dataset has a normal GDT_Byte alpha (transparency) band that applies, it should be returned as the null mask, but the !GetMaskFlags() method should include GNMF_ALPHA. For processing purposes any value other than 0 should be treated as valid data, though some algorithms will treat values between 1 and 254 as partially transparent. 43 43 44 44 == Drivers Updated == … … 63 63 == SWIG Implications == 64 64 65 The !Get NullMask() and !GetNullMaskFlags() 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.65 The !GetMaskBand() and !GetMaskFlags() methods (and corrsponding defines) will need to be added. The mask should work like a normal raster band for swig purposes so minimal special work should be required. 66 66 67 67 == Testing ==