36 static ossimTrace traceExec (
"ossimMonoGridRemapEngine:exec");
37 static ossimTrace traceDebug (
"ossimMonoGridRemapEngine:debug");
38 static bool TRACE_FLAG =
true;
57 static const char MODULE[] =
"ossimMonoGridRemapEngine::remapTile";
58 if (traceExec())
CLOG <<
"entering..." << endl;
85 for (
double line=origin.
line; line<origin.
line+height; line+=1.0)
87 for (
double samp=origin.
samp; samp<origin.
samp+width; samp+=1.0)
97 pixel = tile_buf[offset] + (short) grid(samp,line);
102 if (pixel<0) tile_buf[offset] = 0;
103 else if (pixel>255) tile_buf[offset] = 255;
104 else tile_buf[offset] = pixel;
109 if (tile_buf[offset] == (
ossim_uint8) null) tile_buf[offset]++;
123 for (
double line=origin.
line; line<origin.
line+height; line+=1.0)
125 for (
double samp=origin.
samp; samp<origin.
samp+width; samp+=1.0)
135 pixel = tile_buf[offset] + (int) grid(samp,line);
140 if (pixel<0) tile_buf[offset] = 0;
141 else if (pixel>2047) tile_buf[offset] = 2047;
142 else tile_buf[offset] = pixel;
147 if (tile_buf[offset] == (
ossim_uint16) null) tile_buf[offset]++;
161 for (
double line=origin.
line; line<origin.
line+height; line+=1.0)
163 for (
double samp=origin.
samp; samp<origin.
samp+width; samp+=1.0)
173 pixel = tile_buf[offset] + (int) grid(samp,line);
178 if (pixel<0) tile_buf[offset] = 0;
179 else if (pixel>4095) tile_buf[offset] = 4095;
180 else tile_buf[offset] = pixel;
185 if (tile_buf[offset] == (
ossim_uint16) null) tile_buf[offset]++;
199 for (
double line=origin.
line; line<origin.
line+height; line+=1.0)
201 for (
double samp=origin.
samp; samp<origin.
samp+width; samp+=1.0)
211 pixel = tile_buf[offset] + (int) grid(samp,line);
216 if (pixel<0) tile_buf[offset] = 0;
217 else if (pixel>8191) tile_buf[offset] = 8191;
218 else tile_buf[offset] = pixel;
223 if (tile_buf[offset] == (
ossim_uint16) null) tile_buf[offset]++;
237 for (
double line=origin.
line; line<origin.
line+height; line+=1.0)
239 for (
double samp=origin.
samp; samp<origin.
samp+width; samp+=1.0)
249 pixel = tile_buf[offset] + (int) grid(samp,line);
254 if (pixel<0) tile_buf[offset] = 0;
255 else if (pixel>16383) tile_buf[offset] = 16383;
256 else tile_buf[offset] = pixel;
261 if (tile_buf[offset] == (
ossim_uint16) null) tile_buf[offset]++;
275 for (
double line=origin.
line; line<origin.
line+height; line+=1.0)
277 for (
double samp=origin.
samp; samp<origin.
samp+width; samp+=1.0)
287 pixel = tile_buf[offset] + (int) grid(samp,line);
292 if (pixel<0) tile_buf[offset] = 0;
293 else if (pixel>32767) tile_buf[offset] = 32767;
294 else tile_buf[offset] = pixel;
299 if (tile_buf[offset] == (
ossim_uint16) null) tile_buf[offset]++;
313 for (
double line=origin.
line; line<origin.
line+height; line+=1.0)
315 for (
double samp=origin.
samp; samp<origin.
samp+width; samp+=1.0)
325 pixel = tile_buf[offset] + (int) grid(samp,line);
330 if (pixel<0) tile_buf[offset] = 0;
331 else if (pixel>65535) tile_buf[offset] = 65535;
332 else tile_buf[offset] = pixel;
337 if (tile_buf[offset] == (
ossim_uint16) null) tile_buf[offset]++;
348 short* tile_buf = (
short*)tile->
getBuf(0);
351 for (
double line=origin.
line; line<origin.
line+height; line+=1.0)
353 for (
double samp=origin.
samp; samp<origin.
samp+width; samp+=1.0)
358 if (tile_buf[offset] != (
short) null)
363 pixel = tile_buf[offset] + (short) grid(samp,line);
368 if (pixel<-32766) tile_buf[offset] = -32766;
369 else if (pixel> 32767) tile_buf[offset] = 32767;
370 else tile_buf[offset] = pixel;
375 if (tile_buf[offset] == (
short) null) tile_buf[offset]++;
391 if (traceExec())
CLOG <<
"returning..." << endl;
403 vector<ossimAtbPointSource*>& sources_list)
405 static const char MODULE[] =
"ossimMonoGridRemapEngine::assignRemapValues";
406 if (traceExec())
CLOG <<
"entering..." << endl;
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;
423 vector<ossimAtbPointSource*>::iterator source;
425 for(source=sources_list.begin();
426 source!=sources_list.end();
429 (*source)->getSourceValue(contributor_pixel[i]);
430 target_pixel += contributor_pixel[i][0]/(double)num_contributors;
439 for(source=sources_list.begin();
440 source!=sources_list.end();
450 for (i=0; i<num_contributors; ++i)
452 delete [] contributor_pixel[i];
454 delete [] contributor_pixel;
456 if (traceExec())
CLOG <<
"returning..." << endl;
467 static const char MODULE[]=
"ossimMonoGridRemapEngine::computeSourceValue";
468 if (traceExec())
CLOG <<
"entering..." << endl;
476 if (traceExec())
CLOG <<
"returning..." << endl;
491 static const char MODULE[] =
"ossimMonoGridRemapEngine::computeRemapNode";
492 if (traceExec())
CLOG <<
"entering..." << endl;
498 node = ((
double*)target_value)[0] - ((
double*)source_value)[0];
507 if (traceDebug() || TRACE_FLAG)
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;
517 if (traceExec())
CLOG <<
"returning..." << endl;
16 bit unsigned integer (15 bits used)
ossimMonoGridRemapEngine()
virtual ossim_uint32 getWidth() const
virtual void remapTile(const ossimDpt &origin_point, ossimGridRemapSource *remapper, ossimRefPtr< ossimImageData > &tile)
virtual void assignRemapValues(std::vector< ossimAtbPointSource *> &sources)
virtual ossim_uint32 getHeight() const
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
unsigned short ossim_uint16
virtual ossimObject * dup() const
const ossimDpt & getViewPoint() const
ossimGridRemapSource * getRemapSource()
virtual void computeRemapNode(ossimAtbPointSource *point_source, void *source_value, void *target_value)
virtual const ossim_float64 * getNullPix() const
void setGridNode(const ossimDpt &view_pt, const double *value)
ossimDblGrid * getGrid(unsigned int index)
virtual ossim_float64 computeAverageBandValue(ossim_uint32 bandNumber=0) const
This will compute the average value for the band.
virtual ossimScalarType getScalarType() const
16 bit unsigned integer (11 bits used)
virtual const void * getBuf() const
virtual void computeSourceValue(ossimRefPtr< ossimImageData > &source, void *result)
RTTI_DEF1(ossimMonoGridRemapEngine, "ossimMonoGridRemapEngine", ossimGridRemapEngine)
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
16 bit unsigned integer (12 bits used)