OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Member Functions | List of all members
ossimMonoGridRemapEngine Class Reference

#include <ossimMonoGridRemapEngine.h>

Inheritance diagram for ossimMonoGridRemapEngine:
ossimGridRemapEngine ossimObject ossimReferenced

Public Member Functions

 ossimMonoGridRemapEngine ()
 
virtual ossimObjectdup () const
 
virtual void remapTile (const ossimDpt &origin_point, ossimGridRemapSource *remapper, ossimRefPtr< ossimImageData > &tile)
 
virtual void assignRemapValues (std::vector< ossimAtbPointSource *> &sources)
 
virtual void computeSourceValue (ossimRefPtr< ossimImageData > &source, void *result)
 
- Public Member Functions inherited from ossimGridRemapEngine
int getNumberOfParams () const
 
int getNumberOfBands () const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 

Protected Member Functions

virtual void computeRemapNode (ossimAtbPointSource *point_source, void *source_value, void *target_value)
 
- Protected Member Functions inherited from ossimGridRemapEngine
 ossimGridRemapEngine (int numParams, int numBands)
 
 ossimGridRemapEngine ()
 
virtual ~ossimGridRemapEngine ()
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Additional Inherited Members

- Protected Attributes inherited from ossimGridRemapEngine
int theNumberOfParams
 
int theNumberOfBands
 

Detailed Description


CLASS: ossimMonoGridRemapEngine

Definition at line 29 of file ossimMonoGridRemapEngine.h.

Constructor & Destructor Documentation

◆ ossimMonoGridRemapEngine()

ossimMonoGridRemapEngine::ossimMonoGridRemapEngine ( )
inline

Definition at line 32 of file ossimMonoGridRemapEngine.h.

Referenced by dup().

Member Function Documentation

◆ assignRemapValues()

void ossimMonoGridRemapEngine::assignRemapValues ( std::vector< ossimAtbPointSource *> &  sources)
virtual

Implements ossimGridRemapEngine.

Definition at line 402 of file ossimMonoGridRemapEngine.cpp.

404 {
405  static const char MODULE[] = "ossimMonoGridRemapEngine::assignRemapValues";
406  if (traceExec()) CLOG << "entering..." << endl;
407 
408  int i; // index to individual sources
409 
410  //***
411  // Declare a 2D array that will contain all of the contributing sources'
412  // MONO mean values. Also declare the accumulator target vector.
413  //***
414  int num_contributors = (int)sources_list.size();
415  double** contributor_pixel = new double* [num_contributors];
416  for (i=0; i<num_contributors; i++)
417  contributor_pixel[i] = new double[1];
418  double target_pixel = 0.0;
419 
420  //***
421  // Now loop over each remaining contributor and sum in its contribution:
422  //***
423  vector<ossimAtbPointSource*>::iterator source;
424  i = 0;
425  for(source=sources_list.begin();
426  source!=sources_list.end();
427  source++)
428  {
429  (*source)->getSourceValue(contributor_pixel[i]);
430  target_pixel += contributor_pixel[i][0]/(double)num_contributors;
431  ++i;
432  }
433 
434  //***
435  // The target pixel has been established. Now need to compute the actual
436  // remap quantities that will be written to the appropriate remap grids:
437  //***
438  i = 0;
439  for(source=sources_list.begin();
440  source!=sources_list.end();
441  source++)
442  {
443  computeRemapNode(*source, contributor_pixel[i], &target_pixel);
444  ++i;
445  }
446 
447  // ***
448  // Delete locally allocated memory:
449  // ***
450  for (i=0; i<num_contributors; ++i)
451  {
452  delete [] contributor_pixel[i];
453  }
454  delete [] contributor_pixel;
455 
456  if (traceExec()) CLOG << "returning..." << endl;
457  return;
458 }
#define CLOG
Definition: ossimTrace.h:23
virtual void computeRemapNode(ossimAtbPointSource *point_source, void *source_value, void *target_value)

◆ computeRemapNode()

void ossimMonoGridRemapEngine::computeRemapNode ( ossimAtbPointSource point_source,
void *  source_value,
void *  target_value 
)
protectedvirtual

Implements ossimGridRemapEngine.

Definition at line 487 of file ossimMonoGridRemapEngine.cpp.

490 {
491  static const char MODULE[] = "ossimMonoGridRemapEngine::computeRemapNode";
492  if (traceExec()) CLOG << "entering..." << endl;
493 
494  //***
495  // Compute the remap grid node value specific to this MONO implementation:
496  //***
497  double node;
498  node = ((double*)target_value)[0] - ((double*)source_value)[0];
499 
500  //***
501  // Fetch a pointer to the remapper feeding this point source in order to
502  // pass it the node value:
503  //***
504  ossimGridRemapSource* remapper = ps->getRemapSource();
505  remapper->setGridNode(ps->getViewPoint(), &node);
506 
507  if (traceDebug() || TRACE_FLAG)
508  {
509  CLOG << "DEBUG -- "
510  << "\n\t ps->getViewPoint() = "<<ps->getViewPoint()
511  << "\n\t source_value = "<<((double*)source_value)[0]
512  << "\n\t target_value = "<<((double*)target_value)[0]
513  << "\n\t node = "<<node
514  << "\n\t remapper at "<<remapper<<endl;
515  }
516 
517  if (traceExec()) CLOG << "returning..." << endl;
518  return;
519 }
#define CLOG
Definition: ossimTrace.h:23
void setGridNode(const ossimDpt &view_pt, const double *value)

◆ computeSourceValue()

void ossimMonoGridRemapEngine::computeSourceValue ( ossimRefPtr< ossimImageData > &  source,
void *  result 
)
virtual

Implements ossimGridRemapEngine.

Definition at line 464 of file ossimMonoGridRemapEngine.cpp.

466 {
467  static const char MODULE[]="ossimMonoGridRemapEngine::computeSourceValue";
468  if (traceExec()) CLOG << "entering..." << endl;
469 
470  //***
471  // This engine defines "value" as the MONO vector corresponding to the mean
472  // MONO pixel value of the source data:
473  //***
474  ((double*)result)[0] = source->computeAverageBandValue(0);
475 
476  if (traceExec()) CLOG << "returning..." << endl;
477  return;
478 }
#define CLOG
Definition: ossimTrace.h:23
virtual ossim_float64 computeAverageBandValue(ossim_uint32 bandNumber=0) const
This will compute the average value for the band.

◆ dup()

ossimObject * ossimMonoGridRemapEngine::dup ( ) const
virtual

Implements ossimGridRemapEngine.

Definition at line 44 of file ossimMonoGridRemapEngine.cpp.

References ossimMonoGridRemapEngine().

45 {
46  return new ossimMonoGridRemapEngine;
47 }

◆ remapTile()

void ossimMonoGridRemapEngine::remapTile ( const ossimDpt origin_point,
ossimGridRemapSource remapper,
ossimRefPtr< ossimImageData > &  tile 
)
virtual

Implements ossimGridRemapEngine.

Definition at line 53 of file ossimMonoGridRemapEngine.cpp.

56 {
57  static const char MODULE[] = "ossimMonoGridRemapEngine::remapTile";
58  if (traceExec()) CLOG << "entering..." << endl;
59 
60  //***
61  // Fetch tile size and NULL pixel value:
62  //***
63  int width = tile->getWidth();
64  int height = tile->getHeight();
65  int offset = 0;
66  double null;
67 
68  //***
69  // Determine null pixel values so that we can recognize a null coming in and
70  // not remap it:
71  //***
72  null = tile->getNullPix(0);
73  ossimDblGrid& grid = *(remapper->getGrid(0));
74 
75  //***
76  // Remap according to pixel type:
77  //***
78  switch(tile->getScalarType())
79  {
80  case OSSIM_UCHAR:
81  {
82  ossim_uint8* tile_buf = (ossim_uint8*)tile->getBuf(0);
83  short pixel;
84 
85  for (double line=origin.line; line<origin.line+height; line+=1.0)
86  {
87  for (double samp=origin.samp; samp<origin.samp+width; samp+=1.0)
88  {
89  //***
90  // Scan for null pixel before adding remap delta:
91  //***
92  if (tile_buf[offset] != (ossim_uint8) null)
93  {
94  //***
95  // Remap MONO pixel with spatially variant bias value:
96  //***
97  pixel = tile_buf[offset] + (short) grid(samp,line);
98 
99  //***
100  // Clamp:
101  //***
102  if (pixel<0) tile_buf[offset] = 0;
103  else if (pixel>255) tile_buf[offset] = 255;
104  else tile_buf[offset] = pixel;
105 
106  //***
107  // Avoid NULLS:
108  //***
109  if (tile_buf[offset] == (ossim_uint8) null) tile_buf[offset]++;
110  }
111 
112  offset++;
113  }
114  }
115  break;
116  }
117 
118  case OSSIM_USHORT11:
119  {
120  ossim_uint16* tile_buf = (ossim_uint16*)tile->getBuf(0);
121  int pixel;
122 
123  for (double line=origin.line; line<origin.line+height; line+=1.0)
124  {
125  for (double samp=origin.samp; samp<origin.samp+width; samp+=1.0)
126  {
127  //***
128  // Scan for null pixel before adding remap delta:
129  //***
130  if (tile_buf[offset] != (ossim_uint16) null)
131  {
132  //***
133  // Remap MONO pixel with spatially variant bias value:
134  //***
135  pixel = tile_buf[offset] + (int) grid(samp,line);
136 
137  //***
138  // Clamp:
139  //***
140  if (pixel<0) tile_buf[offset] = 0;
141  else if (pixel>2047) tile_buf[offset] = 2047;
142  else tile_buf[offset] = pixel;
143 
144  //***
145  // Avoid NULLS:
146  //***
147  if (tile_buf[offset] == (ossim_uint16) null) tile_buf[offset]++;
148  }
149 
150  offset++;
151  }
152  }
153  break;
154  }
155 
156  case OSSIM_USHORT12:
157  {
158  ossim_uint16* tile_buf = (ossim_uint16*)tile->getBuf(0);
159  int pixel;
160 
161  for (double line=origin.line; line<origin.line+height; line+=1.0)
162  {
163  for (double samp=origin.samp; samp<origin.samp+width; samp+=1.0)
164  {
165  //***
166  // Scan for null pixel before adding remap delta:
167  //***
168  if (tile_buf[offset] != (ossim_uint16) null)
169  {
170  //***
171  // Remap MONO pixel with spatially variant bias value:
172  //***
173  pixel = tile_buf[offset] + (int) grid(samp,line);
174 
175  //***
176  // Clamp:
177  //***
178  if (pixel<0) tile_buf[offset] = 0;
179  else if (pixel>4095) tile_buf[offset] = 4095;
180  else tile_buf[offset] = pixel;
181 
182  //***
183  // Avoid NULLS:
184  //***
185  if (tile_buf[offset] == (ossim_uint16) null) tile_buf[offset]++;
186  }
187 
188  offset++;
189  }
190  }
191  break;
192  }
193 
194  case OSSIM_USHORT13:
195  {
196  ossim_uint16* tile_buf = (ossim_uint16*)tile->getBuf(0);
197  int pixel;
198 
199  for (double line=origin.line; line<origin.line+height; line+=1.0)
200  {
201  for (double samp=origin.samp; samp<origin.samp+width; samp+=1.0)
202  {
203  //***
204  // Scan for null pixel before adding remap delta:
205  //***
206  if (tile_buf[offset] != (ossim_uint16) null)
207  {
208  //***
209  // Remap MONO pixel with spatially variant bias value:
210  //***
211  pixel = tile_buf[offset] + (int) grid(samp,line);
212 
213  //***
214  // Clamp:
215  //***
216  if (pixel<0) tile_buf[offset] = 0;
217  else if (pixel>8191) tile_buf[offset] = 8191;
218  else tile_buf[offset] = pixel;
219 
220  //***
221  // Avoid NULLS:
222  //***
223  if (tile_buf[offset] == (ossim_uint16) null) tile_buf[offset]++;
224  }
225 
226  offset++;
227  }
228  }
229  break;
230  }
231 
232  case OSSIM_USHORT14:
233  {
234  ossim_uint16* tile_buf = (ossim_uint16*)tile->getBuf(0);
235  int pixel;
236 
237  for (double line=origin.line; line<origin.line+height; line+=1.0)
238  {
239  for (double samp=origin.samp; samp<origin.samp+width; samp+=1.0)
240  {
241  //***
242  // Scan for null pixel before adding remap delta:
243  //***
244  if (tile_buf[offset] != (ossim_uint16) null)
245  {
246  //***
247  // Remap MONO pixel with spatially variant bias value:
248  //***
249  pixel = tile_buf[offset] + (int) grid(samp,line);
250 
251  //***
252  // Clamp:
253  //***
254  if (pixel<0) tile_buf[offset] = 0;
255  else if (pixel>16383) tile_buf[offset] = 16383;
256  else tile_buf[offset] = pixel;
257 
258  //***
259  // Avoid NULLS:
260  //***
261  if (tile_buf[offset] == (ossim_uint16) null) tile_buf[offset]++;
262  }
263 
264  offset++;
265  }
266  }
267  break;
268  }
269 
270  case OSSIM_USHORT15:
271  {
272  ossim_uint16* tile_buf = (ossim_uint16*)tile->getBuf(0);
273  int pixel;
274 
275  for (double line=origin.line; line<origin.line+height; line+=1.0)
276  {
277  for (double samp=origin.samp; samp<origin.samp+width; samp+=1.0)
278  {
279  //***
280  // Scan for null pixel before adding remap delta:
281  //***
282  if (tile_buf[offset] != (ossim_uint16) null)
283  {
284  //***
285  // Remap MONO pixel with spatially variant bias value:
286  //***
287  pixel = tile_buf[offset] + (int) grid(samp,line);
288 
289  //***
290  // Clamp:
291  //***
292  if (pixel<0) tile_buf[offset] = 0;
293  else if (pixel>32767) tile_buf[offset] = 32767;
294  else tile_buf[offset] = pixel;
295 
296  //***
297  // Avoid NULLS:
298  //***
299  if (tile_buf[offset] == (ossim_uint16) null) tile_buf[offset]++;
300  }
301 
302  offset++;
303  }
304  }
305  break;
306  }
307 
308  case OSSIM_USHORT16:
309  {
310  ossim_uint16* tile_buf = (ossim_uint16*)tile->getBuf(0);
311  int pixel;
312 
313  for (double line=origin.line; line<origin.line+height; line+=1.0)
314  {
315  for (double samp=origin.samp; samp<origin.samp+width; samp+=1.0)
316  {
317  //***
318  // Scan for null pixel before adding remap delta:
319  //***
320  if (tile_buf[offset] != (ossim_uint16) null)
321  {
322  //***
323  // Remap MONO pixel with spatially variant bias value:
324  //***
325  pixel = tile_buf[offset] + (int) grid(samp,line);
326 
327  //***
328  // Clamp:
329  //***
330  if (pixel<0) tile_buf[offset] = 0;
331  else if (pixel>65535) tile_buf[offset] = 65535;
332  else tile_buf[offset] = pixel;
333 
334  //***
335  // Avoid NULLS:
336  //***
337  if (tile_buf[offset] == (ossim_uint16) null) tile_buf[offset]++;
338  }
339 
340  offset++;
341  }
342  }
343  break;
344  }
345 
346  case OSSIM_SSHORT16:
347  {
348  short* tile_buf = (short*)tile->getBuf(0);
349  int pixel;
350 
351  for (double line=origin.line; line<origin.line+height; line+=1.0)
352  {
353  for (double samp=origin.samp; samp<origin.samp+width; samp+=1.0)
354  {
355  //***
356  // Scan for null pixel before adding remap delta:
357  //***
358  if (tile_buf[offset] != (short) null)
359  {
360  //***
361  // Remap MONO pixel with spatially variant bias value:
362  //***
363  pixel = tile_buf[offset] + (short) grid(samp,line);
364 
365  //***
366  // Clamp:
367  //***
368  if (pixel<-32766) tile_buf[offset] = -32766;
369  else if (pixel> 32767) tile_buf[offset] = 32767;
370  else tile_buf[offset] = pixel;
371 
372  //***
373  // Avoid NULLS:
374  //***
375  if (tile_buf[offset] == (short) null) tile_buf[offset]++;
376  }
377 
378  offset++;
379  }
380  }
381  break;
382  }
383  default:
384  {
385  ossimNotify(ossimNotifyLevel_WARN) << "WARNING ossimMonoGridRemapEngine::remapTile: Scalar type not handled" << std::endl;
386  break;
387  }
388 
389  } // end switch statement
390 
391  if (traceExec()) CLOG << "returning..." << endl;
392  return;
393 };
16 bit unsigned integer (15 bits used)
virtual ossim_uint32 getWidth() const
#define CLOG
Definition: ossimTrace.h:23
virtual ossim_uint32 getHeight() const
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
unsigned short ossim_uint16
virtual const ossim_float64 * getNullPix() const
ossimDblGrid * getGrid(unsigned int index)
virtual ossimScalarType getScalarType() const
16 bit unsigned integer (11 bits used)
virtual const void * getBuf() const
16 bit unsigned iteger
16 bit signed integer
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
8 bit unsigned iteger
16 bit unsigned integer (12 bits used)

The documentation for this class was generated from the following files: