[Gdal-dev] Nodata bitmasks / null processing
Simon Perkins
sy at perkins.net
Tue Aug 7 14:01:22 EDT 2007
Frank Warmerdam wrote:
> Simon Perkins wrote:
>> So, would the default implementation return a universal RasterBand
>> derived class that implements IReadBlock() and IWriteBlock() in terms
>> of the underlying format RasterIO() method in conjunction with NODATA
>> values?
>
> Simon,
>
> I think this is quite plausible, with the default implementation of
> GetBitmask() returning NULL if there is no nodata value set.
That's reasonable. It could also just return a bitmask containing all
ones so that code doesn't have to handle this special case. Then we
could have a separate method "HasBitmask()" (or the BitmaskType() method
mentioned below) so that code that wants to optimize this case out can
do so. Don't have a strong feeling.
>> One thing though - if the GetBitmask() method is a RasterBand method,
>> then presumably invoking that method on a RasterBand returned by
>> GetBitmask() wouldn't make sense. Either this could just raise some
>> kind of error. Or we could make GetBitmask() a method of the Dataset
>> instead.
>
> It is up to the drivers creating custom classes for their GetBitmask()
> result to ensure those don't in turn return bitmasks, and don't have
> a nodata value set on them.
>
> I think GetBitmask() being a method on GDALRasterBand, instead of
> the dataset is important as it clearly establishes the association.
That's reasonable.
> I am wondering, a bit how we would represent the case where there is
> one nodata bitmask for a whole dataset. That it, one mask applying
> to all bands. Perhaps all bands just return the same object?
Since users might be deleting the Bitmask RasterBand when they're done
with it, it probably shouldn't be _exactly_ the same object, but it
could be a copy of a stub that shares a lot of the underlying state /
cache, etc. Might be worth adding a method "BitmaskType()" method
returning NONE, ONE_PER_DATASET, or ONE_PER_BAND , or similar. This
would also subsume the "HasBitmask()" method.
Cheers,
Simon
More information about the Gdal-dev
mailing list