58 vector<ossim_uint8*>::iterator iter =
m_buffers.begin();
74 static const char MODULE[] =
"ossimBitMaskTileSource::open()";
86 if (!fileStream.good())
89 int num_res_levels = 0;
91 fileStream >> magic_number;
96 for (
int r=0; r<num_res_levels; r++)
99 fileStream >> buffer_size.
x >> buffer_size.
y;
111 << MODULE <<
" ERROR:\nInput file <"<<
theImageFile<<
"> has no header information and " 112 "no valid source image has been provided. Cannot process mask" << std::endl;
123 ossimIpt buffer_size ((image_size.
x+7)/8, image_size.
y);
124 for (
int r=0; r<num_res_levels; r++)
127 buffer_size.
x = (buffer_size.
x+1)/2;
128 buffer_size.
y = (buffer_size.
y+1)/2;
135 << MODULE <<
" ERROR:\nInput file <"<<
theImageFile<<
"> is not recognized or has invalid " 136 "header information." << std::endl;
143 for (
int r=0; r<num_res_levels; ++r)
151 fileStream.read((
char*)buffer,
size);
152 if (fileStream.fail())
155 << MODULE <<
" ERROR:" 156 <<
"\nError encountered reading mask file <" <<
theImageFile <<
">"<<std::endl;
201 static const ossim_uint8 MASK_BITS[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
240 ossim_uint32 tile_index = 0, mask_index = 0, start_bit=0;
253 for (
int y=ul.y; (
y<=lr.y)&&(
y<image_size.y);
y++)
255 mask_index =
y*num_mask_cols + ul.x/8;
256 start_bit = ul.x % 8;
257 for (
int x=ul.x;
x<=lr.x;)
259 if (
x < image_size.x)
262 for (
ossim_uint32 mask_bit=start_bit; mask_bit<8; ++mask_bit)
264 if (maskbuf[mask_index] & MASK_BITS[mask_bit])
265 tilebuf[tile_index++] = 255;
267 tilebuf[tile_index++] = 0;
271 if ((
x >= image_size.x) || (
x>lr.x))
281 tilebuf[tile_index++] = 0;
361 decimation = decimation/2.0;
virtual ossim_uint32 getWidth() const
virtual bool isSourceEnabled() const
RTTI_DEF1_INST(ossimGeneralRasterTileSource, "ossimGeneralRasterTileSource", ossimImageHandler) static ossimTrace traceDebug("ossimGeneralRasterTileSource for(ossim_uint32 i=0;i< aList.size();++i)
ossimFilename theImageFile
virtual void setImageRectangle(const ossimIrect &rect)
RTTI_DEF1_INST(ossimBitMaskTileSource, "ossimBitMaskTileSource", ossimImageHandler)
virtual void setWidthHeight(ossim_uint32 w, ossim_uint32 h)
vector< ossimIpt > m_bufferSizes
ossim_uint32 m_startingResLevel
std::basic_ifstream< char > ifstream
Class for char input file streams.
std::vector< ossimDpt > theDecimationFactors
static const char * MASK_FILE_MAGIC_NUMBER
ossim_uint32 height() const
ossimRefPtr< ossimImageHandler > m_handler
For backward compatibility with older mask format ("Ming Mask"), provide for associating the mask wit...
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tile_rect, ossim_uint32 rLevel=0)
Return a tile of masks.
const ossimIpt & ul() const
virtual ossim_uint32 getHeight() const
bool isSupportedExtension()
Returns true if this handler recognizes the file name extension as an OSSIM raster mask file...
vector< ossim_uint8 * > m_buffers
virtual void initialize()
Initialize the data buffer.
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.
bool completely_within(const ossimIrect &rect) const
static ossimImageDataFactory * instance()
vector< ossimIpt > m_bufferSizes
virtual ossimDataObjectStatus validate() const
os2<< "> n<< " > nendobj n
virtual void close()
Deletes the overview and clears the valid image vertices.
unsigned int ossim_uint32
const char * chars() const
For backward compatibility.
virtual ~ossimBitMaskTileSource()
This is the image handler for providing mask pixels to an ossimMaskFilter object. ...
virtual bool open()
Pure virtual open.
void setAssociatedMaskWriter(ossimBitMaskWriter *maskWriter)
This class can be used during overview generation, in which case there will be a simultaneous mask wr...
const ossimIpt & lr() const
virtual void close()
Deletes the overview and clears the valid image vertices.
Class for computing a mask from an input image source and writing the mask file to disk...
virtual ossimIrect getImageRectangle(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossim_uint32 width() const
virtual void makeBlank()
Initializes data to null pixel values.
ossimRefPtr< ossimImageData > m_tile
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
There is no geometry associated with a mask file – it is pixel-for-pixel mapped to an image file...
This class defines an abstract Handler which all image handlers(loaders) should derive from...
ossimRefPtr< ossimBitMaskWriter > m_maskWriter
This class can be used during overview generation, in which case there will be a simultaneous mask wr...
virtual ossim_uint32 getNumberOfDecimationLevels() const
Overrides base class implementation.
virtual const void * getBuf() const
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 res_level=0) const
Pure virtual, derived classes must implement.
virtual void establishDecimationFactors()
Overrides base class implementation.
virtual ossim_uint32 getNumberOfLines(ossim_uint32 res_level=0) const
Pure virtual, derived classes must implement.
virtual bool isOpen() const
Derived classes must implement this method to be concrete.
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
Returns zero-based bounding rectangle of the image.
vector< ossim_uint8 * > m_buffers
virtual bool isValidRLevel(ossim_uint32 res_level) const
Determines if the passed in reslution level is valid.
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_uint32 theStartingResLevel
theStartingResLevel If set to something other than zero(default) this is indicative that the reader i...
void setAssociatedImageHandler(ossimImageHandler *handler)
For backward compatibility with older mask format ("Ming Mask"), provide for associating the mask wit...