OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimPiecewiseRemapper.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 // License: LGPL
3 //
4 // See LICENSE.txt file in the top level directory for more details.
5 //
6 // Author: David Burken
7 //
8 // Description:
9 //
10 // Piecewise remapper class definition. Derived from ossimTableRemapper.
11 //
12 //----------------------------------------------------------------------------
13 // $Id$
14 
21 #include <ossim/base/ossimTrace.h>
23 #include <iomanip>
24 #include <iostream>
25 #include <limits>
26 #include <sstream>
27 
28 RTTI_DEF1(ossimPiecewiseRemapper, "ossimPiecewiseRemapper", ossimTableRemapper)
29 
30 
31 static const std::string REMAP_KW = "remap";
32 static const std::string REMAP_TYPE_KW = "remap_type";
33 
34 static ossimTrace traceDebug("ossimPiecewiseRemapper:debug");
35 
36 #ifdef OSSIM_ID_ENABLED
37 static const char OSSIM_ID[] = "$Id$";
38 #endif
39 
40 // Private container class for points.
42  :
43  m_set(0)
44 {
45 }
46 
48  :
49  m_set(obj.m_set)
50 {
51 }
52 
55 {
56  if ( this != &rhs )
57  {
58  m_set = rhs.m_set;
59  }
60  return *this;
61 }
62 
63 // Private container class for points.
65  :
66  m_remap(0)
67 {
68 }
69 
71  :
72  m_remap(obj.m_remap)
73 {
74 }
75 
78 {
79  if ( this != &rhs )
80  {
81  m_remap = rhs.m_remap;
82  }
83  return *this;
84 }
85 
87  const std::string& prefix,
88  ossim_uint32 band )
89 {
90  //---
91  // Band Remap set example:
92  // band0.remap0:((0, 127, 0, 127), (128, 255, 128, 382))
93  // band0.remap1:((0, 382, 0, 255))
94  //---
95 
96  // Clear the sets:
97  m_remap.clear();
98 
99  // Get the number of remaps for this band.
100  std::string keyBase = "band";
101  keyBase += ossimString::toString(band).string();
102  keyBase += ".";
103  keyBase += REMAP_KW;
104 
105  ossim_uint32 NUMBER_REMAPS = kwl.numberOf(prefix.c_str(), keyBase.c_str());
106  ossim_uint32 found = 0;
107  ossim_uint32 index = 0;
108 
109  // Loop to find band remaps. This allows for skipping indexes.
110  while ( found < NUMBER_REMAPS )
111  {
112  std::string key = keyBase + ossimString::toString(index).string();
113  std::string value = kwl.findKey( prefix, key );
114  if ( value.size() )
115  {
117  if ( initRemapSetFromString( value, set ) )
118  {
119  m_remap.push_back( set );
120  }
121  ++found;
122  }
123 
124  ++index;
125  if ( index > (NUMBER_REMAPS+100) )
126  {
127  break;
128  }
129  }
130 
131 } // End: ossimPiecewiseRemapper::ossimBandRemap::loadState
132 
134  ossimKeywordlist& kwl,
135  const std::string& prefix,
137  ossim_uint32 band ) const
138 {
139  //---
140  // Remap set:
141  // Remap set: "band0.remap0":
142  // band0.remap0:((0, 127, 0, 127), (128, 255, 128, 382))
143  // band0.remap1:((0, 382, 0, 255))
144  //---
145  ossim_uint32 remapIndex = 0;
146  std::vector<ossimRemapSet>::const_iterator i = m_remap.begin();
147  while ( i != m_remap.end() )
148  {
149  std::string key = "band";
150  key += ossimString::toString(band).string();
151  key += ".";
152  key += REMAP_KW;
153  key += ossimString::toString(remapIndex).string();
154  std::string value;
155  getRemapSetString( remapType, (*i), value );
156  kwl.addPair( prefix, key, value );
157  ++i;
158  ++remapIndex;
159  }
160 
161 } // End: ossimPiecewiseRemapper::ossimBandRemap::saveState
162 
164  const std::string& s, ossimPiecewiseRemapper::ossimRemapSet& set ) const
165 {
166  //---
167  // Example:
168  // ((0, 127, 0, 127), (128, 255, 128, 382))
169  //---
170 
171  bool result = false;
172 
173  if ( s.size() )
174  {
175  std::istringstream in( s );
176  char c;
177  ossim_float64 d;
178 
179  // Gobble the open '('
180  while ( !in.bad() && !in.eof() )
181  {
182  c = in.get();
183  if ( c == '(' ) break;
184  }
185 
186  // Main loop:
187  while( !in.bad() && !in.eof() )
188  {
189  c = in.get();
190 
191  if ( c == ')' ) // Possible end of quadruple...
192  {
193  // Gobble next comma:
194  while( !in.bad() && !in.eof() )
195  {
196  c = in.get();
197  if ( c == ',' )
198  {
199  break;
200  }
201  }
202  c = in.get();
203  }
204 
205  if ( (c == '(') || (c == ',') )
206  {
207  // Next string should be a number:
208  in >> d;
209  if ( in.good() )
210  {
211  set.m_set.push_back(d);
212  }
213  else
214  {
215  break;
216  }
217  }
218  }
219 
220  if ( set.m_set.size() )
221  {
222  result = true;
223  }
224  }
225 
226  if ( !result )
227  {
228  set.m_set.clear();
229  }
230 
231  return result;
232 
233 } // End: ossimPiecewiseRemapper::ossimBandRemap::initRemapSetFromString( ... )
234 
238  std::string& s ) const
239 {
240  if ( remapType == ossimPiecewiseRemapper::LINEAR_NATIVE )
241  {
242  getLinearRemapSetString( set, s );
243  }
244 }
245 
248  std::string& s ) const
249 {
250  //---
251  // Save in the form of:
252  // ((0, 127, 0, 127), (128, 255, 128, 382))
253  //---
254  s.clear();
255  if ( set.m_set.size() )
256  {
257  const ossim_uint32 TUPLES = set.m_set.size() / 4;
258  if ( TUPLES )
259  {
261  os << std::setprecision(15)
262  << "(";
263  for ( ossim_uint32 i = 0; i < TUPLES; ++i )
264  {
265  ossim_uint32 setIdx = i*4;
266  os << "("
267  << set.m_set[ setIdx ]
268  << ","
269  << set.m_set[ setIdx + 1 ]
270  << ","
271  << set.m_set[ setIdx + 2 ]
272  << ","
273  << set.m_set[ setIdx + 3 ]
274  << ")";
275  if ( i < (TUPLES-1) )
276  {
277  os << ","; // Comma between quadruples.
278  }
279  }
280  os << ")";
281  s = os.str();
282  }
283  }
284 
285 } // End: ossimPiecewiseRemapper::ossimBandRemap::getLinearRemapSetString( ... )
286 
288  :
289  ossimTableRemapper(), // base class
290  m_dirty(false),
292  m_bandRemap(0),
293  m_min(0),
294  m_max(0)
295 {
296  if (traceDebug())
297  {
299  << "ossimPiecewiseRemapper::ossimPiecewiseRemapper entered...\n";
300 #ifdef OSSIM_ID_ENABLED
302  << "OSSIM_ID: " << OSSIM_ID << "\n";
303 #endif
304  }
305 }
306 
308 {
309 }
310 
312 {
313  if (traceDebug())
314  {
316  << "ossimPiecewiseRemapper::initialize entered..." << endl;
317  }
318 
319  //---
320  // Call the base class initialize.
321  // Note: This will reset "theInputConnection" if it changed...
322  //---
324 
325  if (traceDebug())
326  {
328  << "ossimPiecewiseRemapper::initialize exited..." << endl;
329  }
330 }
331 
332 void ossimPiecewiseRemapper::setRemapType( const std::string& type )
333 {
334  if ( (type == "linear_native") ||
335  (ossimString(type).downcase() == "linear_native") )
336  {
338  }
339  else
340  {
342  }
343 }
344 
346  const ossimIrect& tileRect,
347  ossim_uint32 resLevel)
348 {
349  ossimRefPtr<ossimImageData> result = 0;
350 
351  if ( theInputConnection )
352  {
353  if ( m_dirty )
354  {
355  // Rebuild the table if dirty flag set:
356  buildTable();
357  }
358 
359  if ( theEnableFlag && theTable.size() )
360  {
361  //---
362  // Not bypassed and has a table...
363  // Base handles the rest...
364  //---
365  result = ossimTableRemapper::getTile(tileRect, resLevel);
366  }
367  else
368  {
369  // Fetch tile from pointer from the input source.
370  result = theInputConnection->getTile(tileRect, resLevel);
371  }
372  }
373 
374  return result;
375 }
376 
378  ossimPiecewiseRemapper::PiecewiseRemapType remapType, std::string& s ) const
379 {
380  if ( remapType == ossimPiecewiseRemapper::LINEAR_NATIVE )
381  {
382  s = "linear_native";
383  }
384  else
385  {
386  s = "unknown";
387  }
388 }
389 
391  const char* prefix)
392 {
393  static const char MODULE[] = "ossimPiecewiseRemapper::loadState";
394  if (traceDebug())
395  {
397  << MODULE << " Entered..." << "\nprefix: " << (prefix?prefix:"null") << endl;
398  }
399 
400  bool status = false;
401  std::string p = ( prefix ? prefix : "" );
402 
403  // Check type first before going on:
404  std::string key = ossimKeywordNames::TYPE_KW;
405  std::string value;
406  value = kwl.findKey( p, key );
407 
408  if ( value == "ossimPiecewiseRemapper" )
409  {
410  // Load the base class states...
411  status = ossimTableRemapper::loadState(kwl, prefix);
412 
413  if (status)
414  {
415  // Look for scalar type keyword.
416  // ossim_int32 st = ossimScalarTypeLut::instance()->getEntryNumber(kwl, p.c_str(), true);
417 
418  // Lookup table returns -1 if not found so check return...
419  // if ( (st != -1) && (st != OSSIM_SCALAR_UNKNOWN) )
420  // {
421  // m_outputScalarType = static_cast<ossimScalarType>(st);
422  //}
423 
424  // Remap type "remap_type":
425  value = kwl.findKey( p, REMAP_TYPE_KW );
426  if ( value.size() )
427  {
428  setRemapType( value );
429 
431  {
432  // Get the number of bands "number_bands":
433  ossim_uint32 bands = 0;
435  value = kwl.findKey( p, key );
436  if ( value.size() )
437  {
438  bands = ossimString(value).toUInt32();
439  }
440 
441  if ( bands )
442  {
443  // Start with clean remap set:
444  m_bandRemap.clear();
445  m_bandRemap.resize( bands );
446 
447  m_min.clear();
448  m_max.clear();
449 
450  // Loop through bands:
451  for ( ossim_uint32 band = 0; band < bands; ++band )
452  {
453  // Band remap:
454  m_bandRemap[band].loadState( kwl, p, band );
455 
456  // Min:
457  std::string keyBase = ossimKeywordNames::MIN_VALUE_KW;
458  keyBase += ".band";
459  key = keyBase + ossimString::toString(band).string();
460  value = kwl.findKey( p, key );
461  if ( value.size() )
462  {
463  m_min.push_back( ossimString(value).toFloat64() );
464  }
465 
466  // Max:
468  keyBase += ".band";
469  key = keyBase + ossimString::toString(band).string();
470  value = kwl.findKey( p, key );
471  if ( value.size() )
472  {
473  m_max.push_back( ossimString(value).toFloat64() );
474  }
475 
476  } // End: Band loop
477 
478  if ( m_bandRemap.size() && ( !m_min.size() || !m_max.size() ) )
479  {
480  initMinMax(); // Initialize from the m_reampSet tuples.
481  }
482  }
483  }
484  }
485 
486  if ( m_bandRemap.size() )
487  {
488  m_dirty = true;
489  }
490 
491  } // Matches: status = ossimTableRemapper::loadState(kwl, prefix); if (status){...
492  else
493  {
494  // Sets base: ossimSource::theEnableFlag
495  setEnableFlag(false);
496  }
497 
498 
499  // Tmp drb:
500  // initMinMax();
501 
502  } // Matches: if ( value == "ossimPiecewiseRemapper" )
503 
504  if (traceDebug())
505  {
506  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:\n";
508  ossimNotify(ossimNotifyLevel_DEBUG) << "\nExited..." << endl;
509  }
510  return status;
511 
512 } // End: ossimPiecewiseRemapper::loadState
513 
515  const char* prefix) const
516 {
517  bool result = false;
518 
519  const ossim_uint32 BANDS = getNumberOfOutputBands();
520 
522  ( m_bandRemap.size() == BANDS ) )
523  {
524  std::string p = ( prefix ? prefix : "" );
525 
526  // Bands:
527  std::string value = ossimString::toString(BANDS).string();
528  kwl.addPair( p, std::string(ossimKeywordNames::NUMBER_BANDS_KW), value );
529 
530  // Remap type:
532  kwl.addPair( p, REMAP_TYPE_KW, value );
533 
534  // Save the band remaps.
535  if ( m_bandRemap.size() == BANDS )
536  {
537  for ( ossim_uint32 band = 0; band < BANDS; ++band )
538  {
539  m_bandRemap[band].saveState( kwl, p, m_remapType, band );
540  }
541  }
542 
543  // Min/max values:
544  if ( ( m_min.size() == BANDS ) && ( m_max.size() == BANDS ) )
545  {
546  std::string minBase = ossimKeywordNames::MIN_VALUE_KW;
547  minBase += ".band";
548  std::string maxBase = ossimKeywordNames::MAX_VALUE_KW;
549  maxBase += ".band";
550 
551  for ( ossim_uint32 band = 0; band < BANDS; ++band )
552  {
553  // Min:
554  std::string key = minBase + ossimString::toString(band).string();
555  kwl.add( p.c_str(), key.c_str(), m_min[band] );
556 
557  // Max:
558  key = maxBase + ossimString::toString(band).string();
559  kwl.add( p.c_str(), key.c_str(), m_max[band] );
560  }
561  }
562 
563  // Base class:
564  result = ossimTableRemapper::saveState(kwl, prefix);
565  }
566 
567  return result;
568 }
569 
571 {
572  ossimKeywordlist kwl;
573  saveState( kwl, 0 );
574 
575  os << setiosflags(ios::fixed) << setprecision(15)
576  << "\nossimPiecewiseRemapper::print:\n"
577  << kwl
578  << "\n";
579 
580  return os;
581 }
582 
584 {
585  return ossimString("ossimPiecewiseRemapper");
586 }
587 
589 {
590  return ossimString("OSSIM Piecewise Remapper");
591 }
592 
594 {
595  return ossimString("Piecewise Remapper");
596 }
597 
599 {
601  if ( theEnableFlag && (band < m_min.size()) )
602  {
603  result = m_min[band];
604  }
605  return result;
606 }
607 
609 {
611  if ( theEnableFlag && (band < m_max.size()) )
612  {
613  result = m_max[band];
614  }
615  return result;
616 }
617 
619 {
620 #if 0
622  {
623  //---
624  // Each remap set holds a group of tuples for the band.
625  // Tuple format example: <min_in> <max_in> <min_out> <max_out>
626  //---
627  const ossim_uint32 BANDS = getNumberOfOutputBands();
628 
629  if ( m_bandRemap.size() == BANDS )
630  {
631  m_min.resize( BANDS );
632  m_max.resize( BANDS );
633 
634  // First time through:
635  for( ossim_uint32 band = 0; band < BANDS; ++band )
636  {
637  const ossim_uint32 TUPLES = m_bandRemap[band].m_set.size() / 4;
638  for ( ossim_uint32 tuple = 0; tuple < TUPLES; ++tuple )
639  {
640  //---
641  // Min: get min of "min_out" from sets.
642  // Max: get max of "max_out" from sets.
643  //---
644  if ( tuple == 0 )
645  {
646  m_min[band] = m_bandRemap[band].m_set[tuple*4+2];
647  m_max[band] = m_bandRemap[band].m_set[tuple*4+3];
648  }
649  else
650  {
651  if ( m_bandRemap[band].m_set[tuple*4+2] < m_min[band] )
652  {
653  m_min[band] = m_bandRemap[band].m_set[tuple*4+2];
654  }
655  if ( m_bandRemap[band].m_set[tuple*4+3] > m_max[band] )
656  {
657  m_max[band] = m_bandRemap[band].m_set[tuple*4+3];
658  }
659  }
660  }
661 
662  //---
663  // Clamp min to scalar min as this is used for getMinPixelValue.
664  // This will keep a remap of:
665  // ((0, 127, 0, 127), (128, 255, 128, 382))
666  // From having a min and null of 0...
667  //---
668  if ( m_outputScalarType != OSSIM_SCALAR_UNKNOWN )
669  {
670  if ( m_min[band] < ossim::defaultMin( m_outputScalarType ) )
671  {
672  m_min[band] = ossim::defaultMin( m_outputScalarType );
673  }
674  }
675 
676  } // End: band loop...
677  }
678  }
679  else
680  {
681  m_min.clear();
682  m_max.clear();
683  }
684 #endif
685 
686  // Disabled for now (drb)
687  m_min.clear();
688  m_max.clear();
689 
690 
691 } // End: ossimPiecewiseRemapper::initMinMax()
692 
694 {
695  const ossim_uint32 BANDS = getNumberOfOutputBands();
696  if ( BANDS && (m_bandRemap.size() == BANDS) &&
698  {
699  setupTable();
700 
701  if ( theTable.size() )
702  {
704  {
706  }
707  }
708  }
709  else
710  {
711  // No remaps:
712  theTable.clear();
713  }
714 
715  // Clear the dirty flag.
716  m_dirty = false;
717 
718 } // End: ossimPiecewiseRemapper::buildTable()
719 
721 {
722  switch ( getOutputScalarType() )
723  {
724  case OSSIM_UINT8:
725  {
727  break;
728  }
729  case OSSIM_USHORT11:
730  case OSSIM_USHORT12:
731  case OSSIM_USHORT13:
732  case OSSIM_USHORT14:
733  case OSSIM_USHORT15:
734  case OSSIM_UINT16:
735  {
737  break;
738  }
739  case OSSIM_SINT16:
740  {
742  break;
743  }
744  case OSSIM_UINT32:
745  {
747  break;
748  }
749  case OSSIM_SINT32:
750  {
752  break;
753  }
755  default:
756  {
757  if(traceDebug())
758  {
759  // Shouldn't hit this.
761  << "ossimHistogramRemapper::buildLinearNativeTable OSSIM_SCALAR_UNKNOWN!" << endl;
762  }
763  break;
764  }
765 
766  } // End of "switch (theTableType)"
767 
768 } // End: void ossimPiecewiseRemapper::buildLinearNativeTable()
769 
770 template <class T> void ossimPiecewiseRemapper::buildLinearNativeTable(T /* dummy */)
771 {
772  const ossim_uint32 BANDS = getNumberOfOutputBands();
773 
774  if ( BANDS && (m_bandRemap.size() == BANDS) && theTable.size() )
775  {
776  T* table = reinterpret_cast<T*>(&theTable.front());
777 
778  ossim_uint32 index = 0;
779 
780  bool isInteger = std::numeric_limits<T>::is_integer; // Flag to round or not.
781 
782  // Band loop:
783  for(ossim_uint32 band = 0; band < BANDS; ++band)
784  {
785  // First bin is always for null.
786  table[index++] = (T)getNullPixelValue(band);
787 
788  const ossim_float64 MIN_PIX = getMinPixelValue(band);
789  const ossim_float64 MAX_PIX = getMaxPixelValue(band);
790 
791  for( ossim_uint32 bin = 1; bin < theTableBinCount; ++bin )
792  {
793  ossim_float64 p = MIN_PIX + bin - 1;
794 
795 #if 0 /* Please keep for debug. (drb) */
796  cout << "\ninput pix[" << bin << "]: " << p << endl;
797 #endif
798 
799  // Loop through remaps:
800  std::vector<ossimRemapSet>::const_iterator i = m_bandRemap[band].m_remap.begin();
801  while ( i != m_bandRemap[band].m_remap.end() )
802  {
803  //---
804  // Each remap set holds a group of tuples for the band.
805  // Tuple format example: <min_in> <max_in> <min_out> <max_out>
806  //---
807  const ossim_uint32 TUPLES = (*i).m_set.size() / 4;
808  for ( ossim_uint32 set = 0; set < TUPLES; ++set )
809  {
810  // Range check it:
811  if ( ( p >= (*i).m_set[set*4] ) && // input min
812  ( p <= (*i).m_set[set*4+1] ) ) // input max
813  {
814  //---
815  // p = (p - output_min) * (output_max-output_min)/(input_max-input_min)
816  // + output_min;
817  //---
818  p = (p - (*i).m_set[set*4]) *
819  ((*i).m_set[set*4+3]-(*i).m_set[set*4+2]) /
820  ((*i).m_set[set*4+1]-(*i).m_set[set*4]) +
821  (*i).m_set[set*4];
822 
823 #if 0 /* Please keep for debug. (drb) */
824  cout << "remapp_pix[" << bin << "][" << set << "]: " << p << endl;
825 #endif
826  }
827 
828  } // End: TUPLE loop
829 
830  ++i; // Next remap.
831 
832  } // End: remap loop:
833 
834  if ( isInteger )
835  {
836  p = ossim::round<ossim_float64>(p); // Round to integer correctly.
837  }
838 
839 #if 0 /* Please keep for debug. (drb) */
840  cout << "output_pix[" << bin << "]: " << p << endl;
841 #endif
842 
843  // Assign to table with min/max clip:
844  table[bin] = (T)( ( p >= MIN_PIX ) ? ( ( p <= MAX_PIX ) ? p : MAX_PIX ) : MIN_PIX);
845 
846  } // End: bin loop
847 
848  } // End: band loop
849 
850  } // Matches: if ( theTable.size() )
851 
852 #if 0 /* Please leave for debug. (drb) */
854 #endif
855 
856 } // End: template <class T> void ossimPiecewiseRemapper::buildLinearNativeTable(T dummy)
857 
859 {
860  const ossim_uint32 BANDS = getNumberOfOutputBands();
861  if ( BANDS )
862  {
863  ossim_uint32 values_per_band = 0;
864  ossim_uint32 bytes_per_pixel = 0;
865 
866  switch (theOutputScalarType)
867  {
868  case OSSIM_UINT8:
869  values_per_band = 256; // 2 ^ 8
870  bytes_per_pixel = 1;
872  break;
873 
874  case OSSIM_USHORT11:
875  values_per_band = 2048; // 2 ^ 11
876  bytes_per_pixel = 2;
878  break;
879  case OSSIM_USHORT12:
880  values_per_band = 4096; // 2 ^ 12
881  bytes_per_pixel = 2;
883  break;
884  case OSSIM_USHORT13:
885  values_per_band = 8192; // 2 ^ 13
886  bytes_per_pixel = 2;
888  break;
889  case OSSIM_USHORT14:
890  values_per_band = 16384; // 2 ^ 14
891  bytes_per_pixel = 2;
893  break;
894  case OSSIM_USHORT15:
895  values_per_band = 32768; // 2 ^ 15
896  bytes_per_pixel = 2;
898  break;
899 
900  case OSSIM_UINT16:
901  case OSSIM_SINT16:
902  values_per_band = 65536; // 2 ^ 16
903  bytes_per_pixel = 2;
905  break;
906 
907  case OSSIM_UINT32:
908  case OSSIM_SINT32:
909  values_per_band = 65536; // 2 ^ 16
910  bytes_per_pixel = 4;
912  break;
913 
915  case OSSIM_FLOAT:
916  bytes_per_pixel = 4;
917  break;
918 
920  case OSSIM_DOUBLE:
921  bytes_per_pixel = 8;
923  break;
924 
925  default:
926  break;
927  }
928 
929  theTableBinCount = values_per_band;
930  theTableBandCount = BANDS;
931 
932  ossim_uint32 size_in_bytes = values_per_band * BANDS * bytes_per_pixel;
933  theTable.resize(size_in_bytes);
934  }
935 
936 } // End: ossimPiecwiseRemapper::getTableSize()
937 
938 // Private to disallow use...
940 : m_dirty(true),
941  m_remapType(UNKNOWN)
942 {
943 }
944 
945 // Private to disallow use...
947 {
948  return *this;
949 }
950 
951 
16 bit unsigned integer (15 bits used)
void getLinearRemapSetString(const ossimPiecewiseRemapper::ossimRemapSet &set, std::string &s) const
Gets a string from remap set.
static const char * MIN_VALUE_KW
virtual ostream & print(ostream &os) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
void buildLinearNativeTable()
Builds the linear native table.
RemapTableType theTableType
virtual double getMinPixelValue(ossim_uint32 band=0) const
ossim_uint32 numberOf(const char *str) const
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
vector< ossim_float64 > m_min
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
16 bit unsigned integer
virtual double getMaxPixelValue(ossim_uint32 band=0) const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tile_rect, ossim_uint32 resLevel=0)
void setRemapType(const std::string &type)
Sets remap type.
Represents serializable keyword/value map.
void getRemapTypeString(ossimPiecewiseRemapper::PiecewiseRemapType remapType, std::string &s) const
Gets a string from remap type.
bool theEnableFlag
Definition: ossimSource.h:62
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
void getLinearRemapSetString(const ossimPiecewiseRemapper::ossimRemapSet &set, std::string &s) const
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
PiecewiseRemapType m_remapType
void initMinMax()
Computes min/max from remaps in m_bandRemap.
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
static const char * MAX_VALUE_KW
void buildTable()
Builds the table.
std::vector< ossim_uint8 > theTable
vector< ossim_float64 > m_max
static ossimString toString(bool aValue)
Numeric to string methods.
virtual void initialize()
Initialization method.
16 bit signed integer
virtual ostream & print(ostream &os) const
Print method.
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
16 bit unsigned integer (14 bits used)
ossim_uint32 toUInt32() const
void saveState(ossimKeywordlist &kwl, const std::string &prefix, ossimPiecewiseRemapper::PiecewiseRemapType remapType, ossim_uint32 band) const
16 bit unsigned integer (13 bits used)
unsigned short ossim_uint16
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Saves the state to a keyword list.
32 bit unsigned integer
bool initRemapSetFromString(const std::string &s, ossimPiecewiseRemapper::ossimRemapSet &set) const
Initializes set from string.
ossimPiecewiseRemapper()
default constructor
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Loads (recreates) the state of an object from a keyword list.
static const char * TYPE_KW
std::vector< ossimPiecewiseRemapper::ossimBandRemap > m_bandRemap
virtual ossimString getClassName() const
virtual void initialize()
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
double ossim_float64
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
OSSIM_DLL double defaultMin(ossimScalarType scalarType)
Definition: ossimCommon.cpp:73
void getRemapSetString(ossimPiecewiseRemapper::PiecewiseRemapType remapType, const ossimPiecewiseRemapper::ossimRemapSet &set, std::string &s) const
Gets a string from remap set for type.
void loadState(const ossimKeywordlist &kwl, const std::string &prefix, ossim_uint32 band)
ossimPiecewiseRemapper & operator=(const ossimPiecewiseRemapper &hr)
(not allowed) assignment(operator=)
signed short ossim_sint16
32 bit signed integer
const ossimBandRemap & operator=(const ossimBandRemap &rhs)
ossimImageSource * theInputConnection
unsigned int ossim_uint32
32 bit normalized floating point
signed int ossim_sint32
virtual ossimString getLongName() const
static const char * NUMBER_BANDS_KW
virtual void setEnableFlag(bool flag)
Definition: ossimSource.cpp:99
void setupTable()
Initialized base class (ossimTableRemapper) values:
const ossimRemapSet & operator=(const ossimRemapSet &rhs)
return status
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
ossim_uint32 theTableBandCount
virtual ~ossimPiecewiseRemapper()
Protected virtual destructor.
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
ossimScalarType theOutputScalarType
bool m_dirty
Dirty flag to indicate table needs to be rebuilt.
ossim_uint32 theTableBinCount
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
8 bit unsigned integer
#define RTTI_DEF1(cls, name, b1)
Definition: ossimRtti.h:485
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
Get tile method.
32 bit floating point
This class provides piecewise linear remapping of input pixels to output pixels.
virtual ossimString getShortName() const
64 bit floating point
unsigned char ossim_uint8
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
const std::string & string() const
Definition: ossimString.h:414
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
16 bit unsigned integer (12 bits used)