OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimShorelineTool.cpp
Go to the documentation of this file.
1 //**************************************************************************************************
2 //
3 // OSSIM Open Source Geospatial Data Processing Library
4 // See top level LICENSE.txt file for license information
5 //
6 //**************************************************************************************************
7 
9 #include <ossim/init/ossimInit.h>
11 #include <ossim/base/ossimCommon.h>
12 #include <ossim/base/ossimGrect.h>
29 #include <ossim/ossimVersion.h>
31 #include <fstream>
32 
33 static const string COLOR_CODING_KW = "color_coding";
34 static const string SMOOTHING_KW = "smoothing";
35 static const string THRESHOLD_KW = "threshold";
36 static const string TMODE_KW = "tmode";
37 static const string TOLERANCE_KW = "tolerance";
38 static const string ALGORITHM_KW = "algorithm";
39 static const ossimFilename DUMMY_OUTPUT_FILENAME = "@@NEVER_USE_THIS@@";
40 static const ossimFilename TEMP_INDEX_FILENAME = "temp_shoreline_index.tif";
41 static const ossimFilename TEMP_THRESHOLD_FILENAME = "temp_shoreline_threshold.tif";
42 static const ossimFilename TEMP_MASK_FILENAME = "temp_shoreline_mask.tif";
43 
45  "Computes bitmap of water versus land areas in an input image.";
46 
47 using namespace std;
48 
50 : m_waterValue (0),
51  m_marginalValue (128),
52  m_landValue (255),
53  m_sensor ("ls8"),
54  m_threshold (-1.0), // Flags auto-thresholding
55  m_tolerance(0.0),
56  m_algorithm(NDWI),
57  m_thresholdMode(SIGMA),
58  m_smoothing(0),
59  m_noVector(false)
60 {
61 }
62 
64 {
65 }
66 
68 {
69  // Add global usage options.
71 
72  // Set the general usage:
74  ossimString usageString = ap.getApplicationName();
75  usageString += " shoreline [options] [<output-vector-filename>]";
76  au->setCommandLineUsage(usageString);
77  au->setDescription("Computes vector shoreline from raster imagery. The vectors are output "
78  "in GeoJSON format. If an output filename is specified, the JSON is written to it. "
79  "Otherwise it is written to the console. The supported algorithms are (where A, B, etc are ordered input band files): \n"
80  " NDWI = (A - B) / (A + B) \n"
81  " AWEI = 4*(A + B) - 0.25*C - 2.75*D \n"
82  " PAN-THRESHOLD = A (no equation applied). The input single-band image is thresholded directly. \n");
83 
84  // Set the command line options:
85  au->addCommandLineOption("--algorithm <name>",
86  "Specifies detection algorithm to apply. Supported names are: "
87  "\"ndwi\", \"aewi\", \"pan-threshold\"");
88  au->addCommandLineOption("--color-coding <water> <marginal> <land>",
89  "Specifies the pixel values (0-255) for the output product corresponding to water, marginal, "
90  "and land zones. Defaults to 0, 128, and 255, respectively.");
91  au->addCommandLineOption("--no-vector",
92  "Outputs the raster, thresholded indexed image instead of a vector product. For engineering purposes.");
93  au->addCommandLineOption("--sensor <string>",
94  "Sensor used to compute Modified Normalized Difference Water Index. Currently only "
95  "\"ls8\" supported (default).");
96  au->addCommandLineOption("--smooth <sigma>",
97  "Applies gaussian filter to index raster file. The filter sigma must be specified (0.2 is good). Sigma=0 "
98  "indicates no smoothing.");
99  au->addCommandLineOption("--threshold <0.0-1.0>",
100  "Normalized threshold for converting the image to bitmap. Defaults to 0.55. If none specified, an optimized threshold"
101  " is computed.");
102  au->addCommandLineOption("--tmode <1|2|3>",
103  "Mode to use for computing threshold from k-means statistics, where:\n"
104  " 0 = no auto-thresholding,\n"
105  " 1 = unweighted mean of means,\n"
106  " 2 = sigma-weighted mean of means (default),\n"
107  " 3 = variance-weighted mean of means."
108  "If \"--threshold\" option is specified, this option is ignored.\n");
109  au->addCommandLineOption("--tolerance <float>",
110  "tolerance +- deviation from threshold for marginal classifications. Defaults to 0.01.");
111 }
112 
114 {
116  return false;
117  if (m_helpRequested)
118  return true;
119 
120  ossimString ts1;
122  ossimString ts2;
124  ossimString ts3;
126 
127  if ( ap.read("--algorithm", sp1))
128  m_kwl.addPair(ALGORITHM_KW, ts1);
129 
130  if (ap.read("--color-coding", sp1, sp2, sp3))
131  {
132  ostringstream value;
133  value<<ts1<<" "<<ts2<<" "<<ts3;
134  m_kwl.addPair( COLOR_CODING_KW, value.str() );
135  }
136 
137  if ( ap.read("--no-vector"))
138  m_noVector = true;
139 
140  if ( ap.read("--sensor", sp1))
142 
143  if ( ap.read("--smooth", sp1))
144  m_kwl.addPair(SMOOTHING_KW, ts1);
145 
146  if ( ap.read("--threshold", sp1))
147  m_kwl.addPair(THRESHOLD_KW, ts1);
148 
149  if ( ap.read("--tmode", sp1))
150  m_kwl.addPair(TMODE_KW, ts1);
151 
152  if ( ap.read("--tolerance", sp1))
153  m_kwl.addPair(TOLERANCE_KW, ts1);
154 
155  // Added for "beachfront" to allow passing properties (keyword:value pairs) through to the
156  // GeoJSON vector output
157  while (ap.read("--prop", sp1))
158  {
159  m_geoJsonProps.insert(pair<ossimString, ossimString>(ts1.before(":"), ts1.after(":")));
160  }
161 
162  // Fake the base class into thinking there is a default output filename to avoid it complaining,
163  // since this utility will stream vector output to console if no output file name provided:
164  m_kwl.add( ossimKeywordNames::OUTPUT_FILE_KW, DUMMY_OUTPUT_FILENAME.c_str());
165 
167  return true;
168 }
169 
171 {
172  ossimString value;
173  ostringstream xmsg;
174 
175  // Don't copy KWL if member KWL passed in:
176  if (&kwl != &m_kwl)
177  {
178  // Start with clean options keyword list.
179  m_kwl.clear();
180  m_kwl.addList( kwl, true );
181  }
182 
183  value = m_kwl.findKey(ALGORITHM_KW);
184  if (!value.empty())
185  {
186  if (value=="ndwi")
187  m_algorithm = NDWI;
188  else if (value=="awei")
189  m_algorithm = AWEI;
190  else if (value=="pan-threshold")
192  else
193  {
194  xmsg<<"ossimShorelineUtil:"<<__LINE__<<" Bad value encountered for keyword <"
195  <<ALGORITHM_KW<<">.";
196  throw ossimException(xmsg.str());
197  }
198  }
199 
200  value = m_kwl.findKey(COLOR_CODING_KW);
201  if (!value.empty())
202  {
203  vector<ossimString> values = value.split(" ");
204  if (values.size() == 3)
205  {
206  m_waterValue = values[0].toUInt8();
207  m_marginalValue = values[1].toUInt8();
208  m_landValue = values[2].toUInt8();
209  }
210  else
211  {
212  xmsg<<"ossimShorelineUtil:"<<__LINE__<<" Unexpected number of values encountered for keyword <"
213  <<COLOR_CODING_KW<<">.";
214  throw ossimException(xmsg.str());
215  }
216  }
217 
219  if (!value.empty())
220  m_sensor = value;
221 
222  value = m_kwl.findKey(SMOOTHING_KW);
223  if (!value.empty())
224  m_smoothing = value.toDouble();
225 
226  value = m_kwl.findKey(TMODE_KW);
227  if (!value.empty())
228  {
229  int tmode = value.toInt();
230  if ((tmode >= 0) && (tmode <= 4))
231  m_thresholdMode = (ThresholdMode) tmode;
232  }
233 
234  value = m_kwl.findKey(THRESHOLD_KW);
235  if (!value.empty())
236  {
237  m_threshold = value.toDouble();
239  }
240 
241  value = m_kwl.findKey(TOLERANCE_KW);
242  if (!value.empty())
243  m_tolerance = value.toDouble();
244 
245  // Output filename specifies the vector output, while base class interprets as raster, correct:
247  if (m_vectorFilename == DUMMY_OUTPUT_FILENAME)
248  {
249  m_vectorFilename = "";
250  m_indexFilename = TEMP_INDEX_FILENAME;
251  m_threshFilename = TEMP_THRESHOLD_FILENAME;
252  m_maskFilename = TEMP_MASK_FILENAME;
253  }
254  else
255  {
259  }
261 
262  // Unless an output projection was specifically requested, use the input:
263  m_kwl.add(ossimKeywordNames::PROJECTION_KW, "identity", false);
264 
266 }
267 
269 {
270  // The processing chain to produce the index image is assembled here. The thresholding part is
271  // done during execute().
272  ostringstream xmsg;
273 
275  {
276  xmsg<<"ossimShorelineUtil:"<<__LINE__<<" Encountered NaNs in AOI."<<ends;
277  throw ossimException(xmsg.str());
278  }
279 
280  ossim_uint32 reqdNumInputs = 0;
281  ossimString equationSpec;
282  switch (m_algorithm)
283  {
284  case NDWI:
285  reqdNumInputs = 2;
286  equationSpec = "in[0]/(in[0]+in[1])";
287  break;
288  case AWEI:
289  reqdNumInputs = 4;
290  equationSpec = "4*(in[0]+in[1]) - 0.25*in[2] - 2.75*in[3]";
291  break;
292  case PAN_THRESHOLD:
293  reqdNumInputs = 1;
294  break;
295  default:
296  break;
297  }
298 
299  if (m_imgLayers.size() < reqdNumInputs)
300  {
301  xmsg<<"ossimShorelineUtil:"<<__LINE__<<" Expected "<< reqdNumInputs << " input images"
302  " but only found "<<m_imgLayers.size()<<"."<<ends;
303  throw ossimException(xmsg.str());
304  }
305 
306  if ((m_algorithm==NDWI) || (m_algorithm==AWEI))
307  {
308  // Set up equation combiner:
310  for (ossim_uint32 i=0; i<reqdNumInputs; ++i)
311  connectable_list.push_back(m_imgLayers[i].get());
312  ossimRefPtr<ossimEquationCombiner> eqFilter = new ossimEquationCombiner(connectable_list);
314  eqFilter->setEquation(equationSpec);
315  m_procChain->add(eqFilter.get());
316  }
317  else
318  {
319  // Just add input connection for pan thresholding:
320  m_procChain->add(m_imgLayers[0].get());
321  }
322 
323  if (m_smoothing > 0)
324  {
325  // Set up gaussian filter:
327  smoother->setGaussStd(m_smoothing);
328  m_procChain->add(smoother.get());
329  }
330 
331  return;
332 }
333 
335 {
336  // NOTE:
337  // getChip only performs the index and thresholding (and possibly edge). For vector output,
338  // execute must be called.
339 
340  ostringstream xmsg;
341  if (!m_geom.valid())
342  return 0;
343 
344  m_aoiViewRect = bounding_irect;
347 
348  return m_procChain->getTile( m_aoiViewRect, 0 );
349 }
350 
352 {
353  if (m_helpRequested)
354  return true;
355 
356  bool status = true;
357 
358  // Base class handles the thresholded image generation. May throw exception. Output written to
359  // m_productFilename. Note that if PAN mode selected, there is no intermediate index file:
362  return false;
363 
364  if (m_thresholdMode != NONE)
365  doThreshold();
366  else
367  return true;
368 
369  if (m_noVector)
370  return status;
371 
372  // Now for vector product, need services of a plugin utility. Check if available:
373  ossimRefPtr<ossimTool> potrace =
374  ossimToolRegistry::instance()->createTool(string("potrace"));
375  if (!potrace.valid())
376  {
377  ossimNotify(ossimNotifyLevel_WARN)<<"ossimShorelineUtil:"<<__LINE__<<" Need the "
378  "ossim-potrace plugin to perform vectorization. Only the thresholded image is "
379  "available at <"<<m_productFilename<<">."<<endl;
380  return false;
381  }
382 
383  // Need a mask image representing an eroded version of the input image:
385  m_procChain->add(m_imgLayers[0].get());
386  if (m_smoothing > 0)
387  {
388  // Set up gaussian filter:
390  smoother->setGaussStd(m_smoothing);
391  m_procChain->add(smoother.get());
392  }
394  eroder->setWindowSize(10);
395  m_procChain->add(eroder.get());
398  status = ossimChipProcTool::execute(); // generates mask
399  if (m_productFilename.ext() != "JSON")
401 
402  // Convey possible redirection of console out:
404 
405  ossimKeywordlist potrace_kwl;
406  potrace_kwl.add("image_file0", m_threshFilename.chars());
407  potrace_kwl.add("image_file1", m_maskFilename.chars());
409  potrace_kwl.add("mode", "linestring");
410  potrace_kwl.add("alphamax", "1.0");
411  potrace_kwl.add("turdsize", "4");
412 
413  potrace->initialize(potrace_kwl);
414 
415  status = potrace->execute();
416 
417 #if OSSIM_HAS_JSONCPP
418  if (status)
419  status = addPropsToJSON();
420 #endif
421 
422  if (status)
423  ossimNotify(ossimNotifyLevel_INFO)<<"Wrote vector product to <"<<m_productFilename<<">"<<endl;
424  else
425  ossimNotify(ossimNotifyLevel_WARN)<<"Error encountered writing vector product to <"<<m_productFilename<<">"<<endl;
426 
427  return status;
428 }
429 
431 {
432  ostringstream xmsg;
433 
434  // Open the index file (unless doing pan thresholding) to use as the input:
435  if (m_algorithm != PAN_THRESHOLD)
436  {
438  ossimRefPtr<ossimImageHandler> indexImage =
440  if (!indexImage.valid())
441  {
442  xmsg<<"ossimShorelineUtil:"<<__LINE__<<" Error encountered reading index image at <"
443  <<m_indexFilename<<">.";
444  throw ossimException(xmsg.str());
445  }
446  m_procChain->add(indexImage.get());
447  }
448 
449  // Some form of auto-thresholding was specified:
450  if (m_thresholdMode != VALUE)
452 
453  // Set up threshold filter using a simple LUT remapper:
454  double del = FLT_EPSILON;
459  ossimString thresholdValueLo2 = ossimString::toString(m_threshold-m_tolerance+del, 9).chars();
461  ossimString thresholdValueHi2 = ossimString::toString(m_threshold+m_tolerance+del, 9).chars();
462  ossimKeywordlist remapper_kwl;
463  remapper_kwl.add("type", "ossimBandLutFilter");
464  remapper_kwl.add("enabled", "1");
465  remapper_kwl.add("mode", "interpolated");
466  remapper_kwl.add("scalar_type", "U8");
467  remapper_kwl.add("entry0.in", "0.0");
468  remapper_kwl.add("entry0.out", landValue.chars());
469  remapper_kwl.add("entry1.in", thresholdValueLo1.chars());
470  remapper_kwl.add("entry1.out", landValue.chars());
471  if (m_tolerance == 0)
472  {
473  remapper_kwl.add("entry2.in", thresholdValueLo2.chars());
474  remapper_kwl.add("entry2.out", waterValue.chars());
475  remapper_kwl.add("entry3.in", "1.0");
476  remapper_kwl.add("entry3.out", waterValue.chars());
477  }
478  else
479  {
480  remapper_kwl.add("entry2.in", thresholdValueLo2.chars());
481  remapper_kwl.add("entry2.out", marginalValue.chars());
482  remapper_kwl.add("entry3.in", thresholdValueHi1.chars());
483  remapper_kwl.add("entry3.out", marginalValue.chars());
484  remapper_kwl.add("entry4.in", thresholdValueHi2.chars());
485  remapper_kwl.add("entry4.out", waterValue.chars());
486  remapper_kwl.add("entry5.in", "1.0");
487  remapper_kwl.add("entry5.out", waterValue.chars());
488  }
489 
491  remapper->loadState(remapper_kwl);
492  m_procChain->add(remapper.get());
493 
496  {
497  xmsg<<"ossimShorelineUtil:"<<__LINE__<<" Error encountered creating threshold image at <"
498  <<m_threshFilename<<">.";
499  throw ossimException(xmsg.str());
500  }
501 }
502 
504 {
505  // Use the K-means classifier to determine the threshold point based on the histogram clustering
506  // into two groups: land and water.
507 
508  // If an input histogram was provided, use it. Otherwise compute one:
509  ossimImageHandler* handler = dynamic_cast<ossimImageHandler*>(m_procChain->getFirstSource());
510  ostringstream xmsg;
511  if (!handler)
512  {
513  xmsg<<"ossimShorelineUtil:"<<__LINE__<<" No input handler in procession chain.";
514  throw ossimException(xmsg.str());
515  }
517  if (!multi_histo.valid())
518  {
519  xmsg<<"ossimShorelineUtil:"<<__LINE__<<" Could not establish an index histogram.";
520  throw ossimException(xmsg.str());
521  }
522 
523  ossimRefPtr<ossimHistogram> band_histo = multi_histo->getHistogram(0);
524  if (!band_histo.valid())
525  {
526  xmsg<<"ossimShorelineUtil:"<<__LINE__<<" Null band histogram returned!";
527  throw ossimException(xmsg.str());
528  }
529 
531  //classifier->setVerbose(); // TODO: Remove verbose mode
532  classifier->setNumClusters(2);
533  classifier->setSamples(band_histo->GetVals(), band_histo->GetRes());
534  classifier->setPopulations(band_histo->GetCounts(), band_histo->GetRes());
535  if (!classifier->computeKmeans())
536  {
537  xmsg<<"ossimShorelineUtil:"<<__LINE__<<" K-means clustering of histogram failed. Cannot "
538  "auto-compute threshold point.";
539  throw ossimException(xmsg.str());
540  }
541 
542  double mean0 = classifier->getMean(0);
543  double mean1 = classifier->getMean(1);
544  double sigma0 = classifier->getSigma(0);
545  double sigma1 = classifier->getSigma(1);
546  switch (m_thresholdMode)
547  {
548  case MEAN:
549  m_threshold = (mean0 + mean1)/2.0;
550  break;
551  case SIGMA:
552  m_threshold = (sigma1*mean0 + sigma0*mean1)/(sigma0 + sigma1);
553  break;
554  case VARIANCE:
555  m_threshold = (sigma1*sigma1*mean0 + sigma0*sigma0*mean1)/(sigma0*sigma0 + sigma1*sigma1);
556  break;
557  default:
558  break;
559  }
560 
561  cout.precision(8);
562  cout<<"ossimShorelineUtil::autoComputeThreshold(): Using threshold = "<<m_threshold<<endl;
563 }
564 
565 #if OSSIM_HAS_JSONCPP
566 #include <json/json.h>
567 bool ossimShorelineTool::addPropsToJSON()
568 {
569  // Read existing JSON file as output by potrace:
570  Json::Value root;
571  std::ifstream jsonFile (m_vectorFilename.chars(), std::ifstream::binary);
572  if (jsonFile.fail() || jsonFile.eof())
573  return false;
574  jsonFile >> root;
575  jsonFile.close();
576 
577  // Add OSSIM-specific properties:
578  Json::Value properties(Json::objectValue);
579  properties["ossim-version"] = OSSIM_VERSION;
580 
581  properties["commit"] = OSSIM_REVISION;
582 
583  properties["build_date"] = OSSIM_BUILD_DATE;
584 
585  switch (m_algorithm)
586  {
587  case NDWI:
588  properties["algorithm"] = "NDWI";
589  break;
590  case AWEI:
591  properties["algorithm"] = "AWEI";
592  break;
593  default:
594  properties["algorithm"] = "UNKNOWN";
595  }
596 
597  Json::Value fnames(Json::arrayValue);
598  for (ossim_uint32 f=0; f<m_imgLayers.size(); f++)
599  {
600  Json::Value fname (m_imgLayers[f]->getFilename().chars());
601  fnames.append(fname);
602  }
603  properties["input_files"] = fnames;
604 
605  // Add additional properties provided in the command line:
606  map<ossimString, ossimString>::iterator prop = m_geoJsonProps.begin();
607  while (prop != m_geoJsonProps.end())
608  {
609  properties[prop->first.chars()] = prop->second.chars();
610  ++prop;
611  }
612 
613  Json::Value& features = root["features"];
614  int n = features.size();
615  for (int i=0; i<n; ++i)
616  {
617  Json::Value& feature = features[i];
618  Json::Value& feature_props = feature["properties"];
619  feature_props = properties;
620  }
621 
622  // Output the updated JSON to the file:
623  ofstream outFile;
624  outFile.open (m_vectorFilename.chars(), ofstream::out | ofstream::trunc);
625  if (outFile.fail())
626  return false;
627 
628  outFile << root;
629  outFile.close();
630 
631  return true;
632 }
633 #endif
634 
635 
virtual void setOutputScalarType(ossimScalarType scalarType)
virtual bool initialize(ossimArgumentParser &ap)
Initial method to be ran prior to execute.
std::string getApplicationName() const
return the application name, as specified by argv[0]
#define OSSIM_REVISION
Definition: ossimVersion.h:9
void addCommandLineOption(const ossimString &option, const ossimString &explanation)
ossimRefPtr< ossimImageData > getChip()
Get chip method that assumes pre-initialized state.
ossimString before(const ossimString &str, std::string::size_type pos=0) const
METHOD: before(str, pos) Returns string beginning at pos and ending one before the token str If strin...
static const char * PROJECTION_KW
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
Within the image chain will pass the head of the list.
ossimRefPtr< ossimHistogram > getHistogram(ossim_uint32 band, ossim_uint32 resLevel=0)
ossimRefPtr< ossimImageGeometry > m_geom
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
static const char * OUTPUT_FILE_KW
virtual ossimImageSource * getFirstSource()
Return the first source which is the one that first receives the getTile request. ...
ossimGrect m_aoiGroundRect
virtual ossimImageHandler * open(const ossimFilename &fileName, bool trySuffixFirst=true, bool openOverview=true) const
open that takes a filename.
Represents serializable keyword/value map.
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
bool m_helpRequested
Definition: ossimTool.h:150
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
bool valid() const
Definition: ossimRefPtr.h:75
const char * find(const char *key) const
ossimFilename m_vectorFilename
bool read(const std::string &str)
search for an occurance of a string in the argument list, on sucess remove that occurance from the li...
void setWindowSize(ossim_uint32 windowSize)
Size of resampling kernel width & height.
virtual void setUsage(ossimArgumentParser &ap)
Initializes the aurgument parser with expected parameters and options.
virtual void initialize()
Will combine the input data based on a supplied equation.
void addList(const ossimKeywordlist &src, bool overwrite=true)
static ossimString toString(bool aValue)
Numeric to string methods.
ossim_uint8 m_marginalValue
ossimKeywordlist m_kwl
Definition: ossimTool.h:148
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
virtual void initProcessingChain()
Derived classes initialize their custom chains here.
void setCommandLineUsage(const ossimString &explanation)
ossimApplicationUsage * getApplicationUsage()
void setImageSize(const ossimIpt &size)
virtual void setEquation(const ossimString &equ)
ossimIpt size() const
Definition: ossimIrect.h:510
bool hasNans() const
Definition: ossimGrect.h:298
ossimRefPtr< ossimMultiResLevelHistogram > getImageHistogram() const
Fetches the current entry image&#39;s histogram.
void setOutputStream(std::ostream *os)
Redirects any console output to the supplied stream for logging or JNI application.
Definition: ossimTool.h:128
void setSamples(T *samples, ossim_uint32 num_entries)
ossimRefPtr< ossimImageChain > m_procChain
ossimFilename m_threshFilename
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual ossimTool * createTool(const std::string &typeName) const
int GetRes() const
virtual void setUsage(ossimArgumentParser &ap)
Initializes the aurgument parser with expected parameters and options.
virtual bool initialize(ossimArgumentParser &ap)
Initial method to be ran prior to execute.
static ossimToolRegistry * instance()
std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
static const char * SENSOR_ID_KW
ossimFilename m_productFilename
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
std::map< ossimString, ossimString > m_geoJsonProps
class for symmetric Gaussian filtering implemented as two separable horizontal/vertical gaussian filt...
os2<< "> n<< " > nendobj n
#define FLT_EPSILON
void setNumClusters(ossim_uint32 K)
unsigned int ossim_uint32
void processRemainingArgs(ossimArgumentParser &ap)
Intended to be called after derived class has picked off its own options from the parser...
const char * chars() const
For backward compatibility.
Definition: ossimString.h:77
double toDouble() const
std::vector< ossimRefPtr< ossimSingleImageChain > > m_imgLayers
virtual bool initialize(ossimArgumentParser &ap)
Initializes from command line arguments.
Definition: ossimTool.cpp:58
virtual bool execute()=0
Writes product to output file if applicable.
virtual bool add(ossimConnectableObject *source)
Will return true or false if an image source was added to the chain.
void setGaussStd(const ossim_float64 &v)
ossimFilename m_indexFilename
std::ostream * m_consoleStream
Definition: ossimTool.h:149
return status
64 bit normalized floating point
static const char * DESCRIPTION
Used by ossimUtilityFactory.
This class defines an abstract Handler which all image handlers(loaders) should derive from...
void setDescription(const ossimString &desc)
float * GetCounts()
ossimFilename fileNoExtension() const
virtual bool execute()
Performs the actual product write.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
bool empty() const
Definition: ossimString.h:411
ossimFilename m_maskFilename
bool hasNans() const
Definition: ossimIrect.h:337
ossimString ext() const
static ossimImageHandlerRegistry * instance()
float * GetVals()
std::basic_ofstream< char > ofstream
Class for char output file streams.
Definition: ossimIosFwd.h:47
#define OSSIM_VERSION
Definition: ossimVersion.h:4
void setPopulations(T *populations, ossim_uint32 num_entries)
double getSigma(ossim_uint32 groupId) const
ossimFilename & setExtension(const ossimString &e)
Sets the extension of a file name.
ossimString after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.
double getMean(ossim_uint32 groupId) const
ThresholdMode m_thresholdMode
virtual bool execute()
Performs the actual product write.
#define OSSIM_BUILD_DATE
Definition: ossimVersion.h:12
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=NULL)
Method to the load (recreate) the state of an object from a keyword list.
int toInt() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)