20 static ossimTrace traceDebug(
"ossimFeatherMosaic:debug");
26 theInputFeatherInformation(NULL),
35 theInputFeatherInformation(NULL),
56 long w = tileRect.
width();
57 long h = tileRect.
height();
94 if((w*h)!=(tileW*tileH))
106 return combine(static_cast<ossim_uint8>(0),
116 return combine(static_cast<ossim_uint16>(0),
121 return combine(static_cast<ossim_sint16>(0),
127 return combine(static_cast<double>(0),
133 return combine(static_cast<float>(0),
140 <<
"ossimFeatherMosaic::getTile: error, unknown scalar type!!!" 159 long numberOfTilesProcessed = 0;
161 float *bandRes = NULL;
174 if(!currentImageData.
valid())
178 return currentImageData;
181 for(band = 0; band < minNumberOfBands; ++band)
183 srcBands[band] =
static_cast<T*
>(currentImageData->
getBuf(band));
190 srcBands[band] = srcBands[minNumberOfBands - 1];
199 T* destBand = destBands[band];
200 T* srcBand = srcBands[band];
201 if(destBand&&srcBand)
203 for(offset = 0; offset < upperBound;++offset)
205 *destBand = *srcBand;
206 ++srcBand; ++destBand;
212 while(currentImageData.
valid())
216 long h = (long)currentImageData->
getHeight();
217 long w = (long)currentImageData->
getWidth();
221 ++numberOfTilesProcessed;
224 for(band = 0; band < minNumberOfBands; ++band)
226 srcBands[band] =
static_cast<T*
>(currentImageData->
getBuf(band));
232 srcBands[band] = srcBands[minNumberOfBands - 1];
236 for(row = 0; row < h; ++row)
238 for(col = 0; col < w; ++col)
240 if(!currentImageData->
isNull(offset))
249 bandRes[offset] += (srcBands[band][offset]*weight);
251 sumBand[offset] += weight;
261 for(row = 0; row < h; ++row)
263 for(col = 0; col < w; ++col)
273 bandRes[offset] += (srcBands[band][offset]*weight);
275 sumBand[offset] += weight;
281 currentImageData =
getNextTile(layerIdx, tileRect, resLevel);
285 if(numberOfTilesProcessed > 1)
290 for(offset = 0; offset < upperBound;++offset)
299 if(sumBand[offset] != 0.0)
301 weightedBand[offset] = (weightedBand[offset])/sumBand[offset];
302 if(weightedBand[offset]<minPix[band])
304 weightedBand[offset] = minPix[band];
306 else if(weightedBand[offset] > maxPix[band])
308 weightedBand[offset] = maxPix[band];
313 weightedBand[offset] = nullPix[band];
315 destBand[offset] =
static_cast<T
>(weightedBand[offset]);
337 if(length1 > length2)
339 result = (1.0 - length1);
343 result = (1.0 - length2);
345 if(result < 0) result = 0;
370 std::vector<ossimIpt> validVertices;
382 validVertices.clear();
401 const char* MODULE =
"ossimFeatherMosaic::ossimFeatherInputInformation::setVertexList()";
403 theValidVertices = validVertices;
411 double xSum=0.0, ySum=0.0;
415 for(
ossim_uint32 index = 0; index < upperBound; ++index)
417 xSum += validVertices[index].x;
418 ySum += validVertices[index].y;
421 theCenter.x = xSum/upperBound;
422 theCenter.y = ySum/upperBound;
430 ossimDpt edgeDirection1 = validVertices[1] - validVertices[0];
431 ossimDpt edgeDirection2 = validVertices[2] - validVertices[1];
433 theAxis1 =
ossimDpt(-edgeDirection1.
y, edgeDirection1.
x);
435 theAxis2 =
ossimDpt(-edgeDirection2.
y, edgeDirection2.
x);
437 theAxis1 = theAxis1/theAxis1.length();
438 theAxis2 = theAxis2/theAxis2.length();
441 theCenter + theAxis1*2);
445 theCenter + theAxis2*2);
453 theAxis1Length = ossim::round<int>((theCenter-intersectionPoint1).length());
454 theAxis2Length = ossim::round<int>((theCenter-intersectionPoint2).length());
458 CLOG <<
"theAxis1Length: " << theAxis1Length << endl
459 <<
"theAxis2Length: " << theAxis2Length << endl
460 <<
"center: " << theCenter << endl;
469 out <<
"center: " << data.
theCenter << endl
470 <<
"axis1: " << data.
theAxis1 << endl
471 <<
"axis2: " << data.
theAxis2 << endl
474 <<
"valid vertices: " << endl;
477 std::ostream_iterator<ossimDpt>(out,
"\n"));
ossimRefPtr< ossimImageData > theAlphaSum
16 bit unsigned integer (15 bits used)
virtual ossim_uint32 getWidth() const
virtual bool isSourceEnabled() const
void fill(ossim_uint32 band, ossim_float64 value)
will fill the entire band with the value.
long theFeatherInfoSize
Will hold the count for the feather information list.
ossimRefPtr< ossimImageData > theTile
virtual const ossim_float64 * getMaxPix() const
virtual ossim_uint32 getNumberOfBands() const
ossimRefPtr< ossimImageData > combine(T dummyVariableNotUsed, const ossimIrect &tileRect, ossim_uint32 resLevel)
The dummy variable is used for the template type.
virtual void setImageRectangle(const ossimIrect &rect)
ossim_uint32 height() const
const ossimIpt & ul() const
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &origin, ossim_uint32 resLevel=0)
Performs a spatial blend accross overlapping regions.
An image mosaic is a simple combiner that will just do a simple mosaic.
virtual void initialize()
Initialize the data buffer.
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
bool isNull(ossim_uint32 offset) const
void allocate()
Called on first getTile, will initialize all data needed.
virtual void setHeight(ossim_uint32 height)
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 &returnedIdx, const ossim_uint32 startIdx, const ossimIrect &tileRect, ossim_uint32 resLevel=0)
virtual void initialize()
std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
ossimDpt intersectInfinite(const ossimLine &line) const
friend ostream & operator<<(ostream &out, const ossimFeatherInputInformation &data)
ossim_uint32 theLargestNumberOfInputBands
virtual ossimDataObjectStatus validate() const
virtual void getValidImageVertices(std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
ordering specifies how the vertices should be arranged.
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
32 bit normalized floating point
virtual ~ossimFeatherMosaic()
virtual void setWidth(ossim_uint32 width)
ossim_uint32 width() const
virtual void setOrigin(const ossimIpt &origin)
virtual const ossim_float64 * getMinPix() const
ossimRefPtr< ossimImageData > theResult
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
virtual const void * getBuf() const
virtual ossim_uint32 getNumberOfInputs() const
Returns the number of input objects.
virtual void setDataObjectStatus(ossimDataObjectStatus status) const
Full list found in ossimConstants.h.
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &origin, ossim_uint32 resLevel=0)
virtual double computeWeight(long index, const ossimDpt &point) const
ossimDataObjectStatus
Definitions for data object status.
RTTI_DEF1(ossimFeatherMosaic, "ossimFeatherMosaic", ossimImageMosaic)
virtual void initialize()
ossimFeatherInputInformation * theInputFeatherInformation
will hold an array of input information
virtual const ossimIpt & getOrigin() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
16 bit unsigned integer (12 bits used)