OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNBandLutDataObject.h
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2005 Garrett Potts
3 //
4 // LICENSE: MIT See top level license file.
5 //
6 // Author: Garrett Potts
7 //
8 //*************************************************************************
9 // $Id: ossimNBandLutDataObject.h 19732 2011-06-06 22:24:54Z dburken $
10 #ifndef ossimNBandLutDataObject_HEADER
11 #define ossimNBandLutDataObject_HEADER 1
12 
13 #include <ossim/base/ossimObject.h>
15 #include <iostream>
16 #include <map>
17 
260 {
261 public:
262 
264 
266  const ossimNBandLutDataObject& lut);
270  ossimNBandLutDataObject(ossim_uint32 numberOfEntries=0,
271  ossim_uint32 numberOfBands=0,
272  ossimScalarType bandScalarType = OSSIM_UINT8,
273  ossim_int32 nullPixelIndex=-1);
275  ossimObject* dup()const
276  {
277  return new ossimNBandLutDataObject(*this);
278  }
279  void create(ossim_uint32 numberOfEntries,
280  ossim_uint32 numberOfBands=3);
282  {
283  if(theLut)
284  {
285  return &theLut[idx*theNumberOfBands];
286  }
287 
288  return 0;
289  }
291  {
292  if(theLut)
293  {
294  return &theLut[idx*theNumberOfBands];
295  }
296 
297  return 0;
298  }
300  {
301  if(theLut)
302  {
303  return &theLut[idx*theNumberOfBands];
304  }
305 
306  return 0;
307  }
309  {
310  if(theLut)
311  {
312  return &theLut[idx*theNumberOfBands];
313  }
314 
315  return 0;
316  }
317  const LUT_ENTRY_TYPE* operator[](double normalizedIndex)const
318  {
319  int idx = int(normalizedIndex*theNumberOfEntries);
320  if (idx < 0)
321  {
322  idx = 0;
323  }
324  return (*this)[idx];
325  }
326 
332  LUT_ENTRY_TYPE* operator[](double normalizedIndex)
333  {
334  ossim_uint32 idx = int(normalizedIndex*(theNumberOfEntries-1));
335  if (idx >= theNumberOfEntries)
336  {
337  idx = theNumberOfEntries-1;
338  }
339  return (*this)[idx];
340  }
341 
342  bool hasNullPixelIndex()const
343  {
344  return (theNullPixelIndex >= 0);
345  }
354  void getMinMax(ossim_uint32 band,
355  LUT_ENTRY_TYPE& minValue,
356  LUT_ENTRY_TYPE& maxValue);
357 
364  ossim_int32 getFirstNullAlphaIndex() const;
365 
372  void setNullPixelIndex(ossim_int32 idx){theNullPixelIndex = idx;}
373 
379  ossim_int32 getNullPixelIndex()const{return theNullPixelIndex;}
380 
384  ossim_uint32 getNumberOfBands()const{return theNumberOfBands;}
385 
389  ossim_uint32 getNumberOfEntries()const{return theNumberOfEntries;}
390 
399  ossim_uint32 findIndex(ossim_int32* values) const;
400 
412  ossim_uint32 findIndex(ossim_int32* values, ossim_uint32 size) const;
413 
417  void clearLut();
424 
431  bool operator ==(const ossimNBandLutDataObject& lut)const;
432 
436  bool open(const ossimFilename& lutFile);
437 
462  virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=0)const;
463 
464  std::vector<ossimString> getEntryLabels(ossim_uint32 band);
465 
466  void setEntryLables(ossim_uint32 band, std::vector<ossimString> entryLabels);
467 
468 
475  virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=0);
476 protected:
477  virtual ~ossimNBandLutDataObject();
478 
484  std::map<ossim_uint32, std::vector<ossimString> > m_entryLabels;
485 
486 TYPE_DATA
487 };
488 
489 #endif
ossim_uint32 getNumberOfBands() const
LUT_ENTRY_TYPE * operator[](ossim_int32 idx)
Represents serializable keyword/value map.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Definition: ossimObject.cpp:95
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
friend OSSIMDLLEXPORT std::ostream & operator<<(std::ostream &out, const ossimObject &obj)
const LUT_ENTRY_TYPE * operator[](ossim_int32 idx) const
std::map< ossim_uint32, std::vector< ossimString > > m_entryLabels
yy_size_t size
#define TYPE_DATA
Definition: ossimRtti.h:339
ossim_uint32 getNumberOfEntries() const
unsigned int ossim_uint32
LUT_ENTRY_TYPE * operator[](ossim_uint32 idx)
const LUT_ENTRY_TYPE * operator[](ossim_uint32 idx) const
bool operator==(const ossimRefPtr< _Tp1 > &__a, const ossimRefPtr< _Tp2 > &__b) noexcept
Definition: ossimRefPtr.h:101
ossimScalarType
ossimReferenced & operator=(const ossimReferenced &)
#define OSSIM_DLL
LUT_ENTRY_TYPE * operator[](double normalizedIndex)
void setNullPixelIndex(ossim_int32 idx)
Allows you to specify which entry is to be designated as an invalid entry.
const LUT_ENTRY_TYPE * operator[](double normalizedIndex) const
class ossimNBandLutDataObject
ossim_int32 getNullPixelIndex() const
8 bit unsigned integer
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
int ossim_int32