30 #include "../raster/Grid.h"
31 #include "../raster/BandProperty.h"
32 #include "../raster/Utils.h"
33 #include "../raster/RasterFactory.h"
34 #include "../memory/CachedRaster.h"
35 #include "../memory/ExpansibleRaster.h"
36 #include "../geometry/Envelope.h"
37 #include "../geometry/GeometricTransformation.h"
38 #include "../geometry/Polygon.h"
39 #include "../geometry/LinearRing.h"
40 #include "../geometry/MultiPolygon.h"
41 #include "../geometry/MultiPoint.h"
42 #include "../geometry/Point.h"
43 #include "../common/progress/TaskProgress.h"
45 #include <boost/lexical_cast.hpp>
49 #define SEQUENCE_RASTER_MAX_MOSAIC_MEM_USE 10
74 m_feederRasterPtr = 0;
75 m_inputRastersBands.clear();
76 m_geomTransfName =
"Affine";
79 m_forceInputNoDataValue =
false;
81 m_autoEqualize =
true;
82 m_useRasterCache =
true;
83 m_enableMultiThread =
true;
84 m_enableProgress =
false;
85 m_tiePointsLocationBandIndex = 0;
86 m_outDataSetsNamePrefix.clear();
87 m_outDataSetsNameSufix.clear();
88 m_minRequiredTiePointsCoveredAreaPercent = 0.0;
89 m_locatorParams.reset();
111 m_minRequiredTiePointsCoveredAreaPercent =
144 m_sequencesInfo.clear();
175 m_dataSetName.clear();
176 m_rasterFeederIndexes.clear();
192 throw( te::rp::Exception )
201 "Invalid data source" );
203 "Invalid data source" );
209 std::auto_ptr< te::common::TaskProgress > progressPtr;
216 progressPtr->setMessage(
"Mosaicking" );
224 std::vector< unsigned int > dummyRasterBandsIndexes;
226 for(
unsigned int bandIdx = 0 ; bandIdx <
228 dummyRasterBandsIndexes.push_back( bandIdx );
231 std::auto_ptr< te::mem::ExpansibleRaster > mosaicRasterHandler;
232 std::vector< double > mosaicTargetMeans;
233 std::vector< double > mosaicTargetVariances;
235 std::vector< double > mosaicBandsRangeMin;
236 std::vector< double > mosaicBandsRangeMax;
237 unsigned int lastInputRasterBBoxLLXIndexed = 0;
238 unsigned int lastInputRasterBBoxLLYIndexed = 0;
239 unsigned int lastInputRasterBBoxURXIndexed = 0;
240 unsigned int lastInputRasterBBoxURYIndexed = 0;
246 const unsigned int inputRasterIdx =
252 std::auto_ptr< te::mem::CachedRaster > cachedInputRasterPtr;
258 inputRasterPtr = cachedInputRasterPtr.get();
275 if( mosaicRasterHandler.get() == 0 )
283 auxLinearRingPtr->
setPoint( 0, mosaicLLX, mosaicURY );
284 auxLinearRingPtr->
setPoint( 1, mosaicURX, mosaicURY );
285 auxLinearRingPtr->
setPoint( 2, mosaicURX, mosaicLLY );
286 auxLinearRingPtr->
setPoint( 3, mosaicLLX, mosaicLLY );
287 auxLinearRingPtr->
setPoint( 4, mosaicLLX, mosaicURY );
288 mosaicValidDataPol.
clear();
289 mosaicValidDataPol.
push_back( auxLinearRingPtr );
292 lastInputRasterBBoxLLXIndexed = 0;
295 lastInputRasterBBoxURYIndexed = 0;
297 mosaicBandsRangeMin.resize(
299 mosaicBandsRangeMax.resize(
302 std::vector< te::rst::BandProperty* > bandsProperties;
303 for( std::vector< unsigned int >::size_type inputRastersBandsIdx = 0 ;
304 inputRastersBandsIdx <
306 ++inputRastersBandsIdx )
310 inputRasterIdx ][ inputRastersBandsIdx ] )->
getProperty();
315 bandsProperties[ inputRastersBandsIdx ]->m_blkw = (
unsigned int)
317 bandsProperties[ inputRastersBandsIdx ]->m_blkh = (
unsigned int)
319 bandsProperties[ inputRastersBandsIdx ]->m_nblocksx = (
unsigned int)
321 ((
double)bandsProperties[ inputRastersBandsIdx ]->m_blkw ) );
322 bandsProperties[ inputRastersBandsIdx ]->m_nblocksy = (
unsigned int)
324 ((
double)bandsProperties[ inputRastersBandsIdx ]->m_blkh ) );
327 mosaicBandsRangeMin[ inputRastersBandsIdx ],
328 mosaicBandsRangeMax[ inputRastersBandsIdx ]);
331 mosaicRasterHandler.reset(
336 "Output raster creation error" );
338 const unsigned int nBands = mosaicRasterHandler->getNumberOfBands();
340 mosaicTargetMeans.resize( nBands, 0.0 );
341 mosaicTargetVariances.resize( nBands, 0.0 );
343 for(
unsigned int inputRastersBandsIdx = 0 ; inputRastersBandsIdx <
344 nBands ; ++inputRastersBandsIdx )
346 const unsigned int inputBandIdx =
354 (*mosaicRasterHandler->getBand( inputRastersBandsIdx ));
356 (*inputRasterPtr->
getBand( inputBandIdx ));
357 unsigned int validPixelsNumber = 0;
358 unsigned int outCol = 0;
359 unsigned int outRow = 0;
360 double pixelValue = 0;
362 double& mean = mosaicTargetMeans[ inputRastersBandsIdx ];
365 for( outRow = 0 ; outRow < outRowsBound ; ++outRow )
367 for( outCol = 0 ; outCol < outColsBound ; ++outCol )
369 inBand.
getValue( outCol, outRow, pixelValue );
371 if( pixelValue != bandNoDataValue )
373 outBand.
setValue( outCol, outRow, pixelValue );
382 mean /= ( (double)validPixelsNumber );
388 double& variance = mosaicTargetVariances[ inputRastersBandsIdx ];
391 double pixelValue = 0;
393 for( outRow = 0 ; outRow < outRowsBound ; ++outRow )
395 for( outCol = 0 ; outCol < outColsBound ; ++outCol )
397 outBand.
getValue( outCol, outRow, pixelValue );
399 if( pixelValue != bandNoDataValue )
401 variance += ( ( pixelValue - mean ) * ( pixelValue -
402 mean ) ) / ( (
double)validPixelsNumber );
414 std::vector< te::gm::GTParameters::TiePoint >() );
418 cachedInputRasterPtr.reset();
424 progressPtr->pulse();
425 if( ! progressPtr->isActive() )
return false;
451 lastInputRasterBBoxURXIndexed - lastInputRasterBBoxLLXIndexed + 1 );
453 lastInputRasterBBoxLLYIndexed - lastInputRasterBBoxURYIndexed + 1 );
486 locatorInParams ),
"Tie points locator init error" );
488 locatorOutParams ),
"Tie points locator exec error" );
528 boost::lexical_cast< std::string >( outParamsPtr->
m_sequencesInfo.size() ) +
535 assert( mosaicRasterHandler.get() );
538 *( mosaicRasterHandler.get() ), outParamsPtr->
m_outputDSPtr ),
539 "Data set creation error" );
540 mosaicRasterHandler.reset();
542 currentMosaicSquenceInfo.
clear();
548 std::vector< double > currentRasterBandsOffsets;
549 std::vector< double > currentRasterBandsScales;
553 double currentRasterVariance = 0;
554 double currentRasterMean = 0;
556 for(
unsigned int inputRastersBandsIdx = 0 ; inputRastersBandsIdx <
558 ++inputRastersBandsIdx )
561 inputRastersBandsIdx ];
567 currentRasterVariance );
569 currentRasterBandsScales.push_back( std::sqrt( mosaicTargetVariances[ inputRastersBandsIdx ] /
570 currentRasterVariance ) );
571 currentRasterBandsOffsets.push_back( mosaicTargetMeans[ inputRastersBandsIdx ] -
572 ( currentRasterBandsScales[ inputRastersBandsIdx ] * currentRasterMean ) );
577 currentRasterBandsOffsets = dummyRasterOffsets;
578 currentRasterBandsScales = dummyRasterScales;
592 std::auto_ptr< te::gm::GeometricTransformation > geoTransPtr(
596 const double oldLLYIndexed =
598 const double oldURXIndexed =
601 double mappedLLX = 0;
602 double mappedLLY = 0;
603 double mappedLRX = 0;
604 double mappedLRY = 0;
605 double mappedURX = 0;
606 double mappedURY = 0;
607 double mappedULX = 0;
608 double mappedULY = 0;
630 const double newLLXIndexed = std::min( mappedLLX, std::min( mappedLRX, std::min( mappedURX, mappedULX ) ) );
631 const double newLLYIndexed = std::max( mappedLLY, std::max( mappedLRY, std::max( mappedURY, mappedULY ) ) );
632 const double newURXIndexed = std::max( mappedLLX, std::max( mappedLRX, std::max( mappedURX, mappedULX ) ) );
633 const double newURYIndexed = std::min( mappedLLY, std::min( mappedLRY, std::min( mappedURY, mappedULY ) ) );
635 double oldMosaicReferenceX = 0;
636 double oldMosaicReferenceY = 0;
637 mosaicRasterHandler->getGrid()->gridToGeo( 0.0, 0.0, oldMosaicReferenceX,
638 oldMosaicReferenceY );
640 double mosaicReferenceHasChanged =
false;
643 if( newLLXIndexed < 0.0 )
646 (
unsigned int)std::ceil( -1.0 * newLLXIndexed ) ),
647 "Mosaic expansion error" );
648 mosaicReferenceHasChanged =
true;
651 if( newURYIndexed < 0.0 )
654 (
unsigned int)std::ceil( -1.0 * newURYIndexed ) ),
655 "Mosaic expansion error" );
656 mosaicReferenceHasChanged =
true;
659 if( newURXIndexed > ((
double)(mosaicRasterHandler->getNumberOfColumns() - 1) ) )
662 (
unsigned int)std::ceil( newURXIndexed -
663 ((
double)(mosaicRasterHandler->getNumberOfColumns() - 1)) ) ),
664 "Mosaic expansion error" );
667 if( newLLYIndexed > ((
double)(mosaicRasterHandler->getNumberOfRows() - 1) ) )
670 (
unsigned int)std::ceil( newLLYIndexed -
671 ((
double)(mosaicRasterHandler->getNumberOfRows() - 1) ) ) ),
672 "Mosaic expansion error" );
677 if( mosaicReferenceHasChanged )
679 double expansionOffSetX = 0;
680 double expansionOffSetY = 0;
681 mosaicRasterHandler->getGrid()->geoToGrid( oldMosaicReferenceX,
682 oldMosaicReferenceY, expansionOffSetX, expansionOffSetY );
686 geoTransPtr->getParameters().m_tiePoints;
688 for(
unsigned int tpIdx = 0 ; tpIdx <
691 newTransParams.
m_tiePoints[ tpIdx ].first.x += expansionOffSetX;
692 newTransParams.
m_tiePoints[ tpIdx ].first.y += expansionOffSetY;
696 "Geometric transformation parameters calcule error" );
702 double inputRasterMappedLLXIndexed = 0;
703 double inputRasterMappedLLYIndexed = 0;
704 double inputRasterMappedLRXIndexed = 0;
705 double inputRasterMappedLRYIndexed = 0;
706 double inputRasterMappedURXIndexed = 0;
707 double inputRasterMappedURYIndexed = 0;
708 double inputRasterMappedULXIndexed = 0;
709 double inputRasterMappedULYIndexed = 0;
711 const double lastRowIdx =
713 const double lastColIdx =
716 geoTransPtr->inverseMap(
719 inputRasterMappedLLXIndexed,
720 inputRasterMappedLLYIndexed);
721 geoTransPtr->inverseMap(
724 inputRasterMappedLRXIndexed,
725 inputRasterMappedLRYIndexed);
726 geoTransPtr->inverseMap(
729 inputRasterMappedURXIndexed,
730 inputRasterMappedURYIndexed);
731 geoTransPtr->inverseMap(
734 inputRasterMappedULXIndexed,
735 inputRasterMappedULYIndexed);
737 lastInputRasterBBoxLLXIndexed = (
unsigned int)
739 std::min( (
double)( mosaicRasterHandler->getNumberOfColumns() - 1 ),
741 std::min( inputRasterMappedLLXIndexed,
742 std::min( inputRasterMappedLRXIndexed,
743 std::min( inputRasterMappedURXIndexed,
744 inputRasterMappedULXIndexed
752 lastInputRasterBBoxLLYIndexed = (
unsigned int)
754 std::min( (
double)( mosaicRasterHandler->getNumberOfRows() - 1 ),
756 std::max( inputRasterMappedLLYIndexed,
757 std::max( inputRasterMappedLRYIndexed,
758 std::max( inputRasterMappedURYIndexed,
759 inputRasterMappedULYIndexed
767 lastInputRasterBBoxURXIndexed = (
unsigned int)
769 std::min( (
double)( mosaicRasterHandler->getNumberOfColumns() - 1 ),
771 std::max( inputRasterMappedLLXIndexed,
772 std::max( inputRasterMappedLRXIndexed,
773 std::max( inputRasterMappedURXIndexed,
774 inputRasterMappedULXIndexed
782 lastInputRasterBBoxURYIndexed = (
unsigned int)
784 std::min( (
double)( mosaicRasterHandler->getNumberOfRows() - 1 ),
786 std::min( inputRasterMappedLLYIndexed,
787 std::min( inputRasterMappedLRYIndexed,
788 std::min( inputRasterMappedURYIndexed,
789 inputRasterMappedULYIndexed
797 assert( lastInputRasterBBoxLLXIndexed >= 0 );
798 assert( lastInputRasterBBoxLLXIndexed <=
799 ( mosaicRasterHandler->getNumberOfColumns() - 1 ) );
800 assert( lastInputRasterBBoxLLYIndexed >= 0 );
801 assert( lastInputRasterBBoxLLYIndexed <=
802 ( mosaicRasterHandler->getNumberOfRows() - 1 ) );
803 assert( lastInputRasterBBoxURXIndexed >= 0 );
804 assert( lastInputRasterBBoxURXIndexed <=
805 ( mosaicRasterHandler->getNumberOfColumns() - 1 ) );
806 assert( lastInputRasterBBoxURYIndexed >= 0 );
807 assert( lastInputRasterBBoxURYIndexed <=
808 ( mosaicRasterHandler->getNumberOfRows() - 1 ) );
817 *( mosaicRasterHandler.get() ),
818 dummyRasterBandsIndexes,
828 currentRasterBandsOffsets,
829 currentRasterBandsScales,
833 "Blender initiazing error" );
835 std::vector< double > blendedValues( mosaicRasterHandler->getNumberOfBands() );
836 unsigned int outputRow = 0;
837 unsigned int outputCol = 0;
838 const unsigned int nBands = mosaicRasterHandler->getNumberOfBands();
839 unsigned int outBandIdx = 0;
842 for( outputRow = lastInputRasterBBoxURYIndexed ; outputRow <= lastInputRasterBBoxLLYIndexed ;
845 for( outputCol = lastInputRasterBBoxLLXIndexed ; outputCol <= lastInputRasterBBoxURXIndexed ;
851 for( outBandIdx = 0 ; outBandIdx < nBands ; ++outBandIdx )
853 double& blendedValue = blendedValues[ outBandIdx ];
857 blendedValue = std::max( blendedValue ,
858 mosaicBandsRangeMin[ outBandIdx ] );
859 blendedValue = std::min( blendedValue ,
860 mosaicBandsRangeMax[ outBandIdx ] );
862 outputRaster.
setValue( outputCol, outputRow, blendedValue, outBandIdx );
873 double inputRasterMappedLLX = 0;
874 double inputRasterMappedLLY = 0;
875 mosaicRasterHandler->getGrid()->gridToGeo(
876 (
double)inputRasterMappedLLXIndexed, (
double)inputRasterMappedLLYIndexed,
877 inputRasterMappedLLX, inputRasterMappedLLY );
879 double inputRasterMappedLRX = 0;
880 double inputRasterMappedLRY = 0;
881 mosaicRasterHandler->getGrid()->gridToGeo(
882 (
double)inputRasterMappedLRXIndexed, (
double)inputRasterMappedLRYIndexed,
883 inputRasterMappedLRX, inputRasterMappedLRY );
885 double inputRasterMappedURX = 0;
886 double inputRasterMappedURY = 0;
887 mosaicRasterHandler->getGrid()->gridToGeo(
888 (
double)inputRasterMappedURXIndexed, (
double)inputRasterMappedURYIndexed,
889 inputRasterMappedURX, inputRasterMappedURY );
891 double inputRasterMappedULX = 0;
892 double inputRasterMappedULY = 0;
893 mosaicRasterHandler->getGrid()->gridToGeo(
894 (
double)inputRasterMappedULXIndexed, (
double)inputRasterMappedULYIndexed,
895 inputRasterMappedULX, inputRasterMappedULY );
898 auxLinearRingPtr->
setPoint( 0, inputRasterMappedULX, inputRasterMappedULY );
899 auxLinearRingPtr->
setPoint( 1, inputRasterMappedURX, inputRasterMappedURY );
900 auxLinearRingPtr->
setPoint( 2, inputRasterMappedLRX, inputRasterMappedLRY );
901 auxLinearRingPtr->
setPoint( 3, inputRasterMappedLLX, inputRasterMappedLLY );
902 auxLinearRingPtr->
setPoint( 4, inputRasterMappedULX, inputRasterMappedULY );
904 lastMosaicAddedRasterPol.
push_back( auxLinearRingPtr );
905 lastMosaicAddedRasterPol.
setSRID( mosaicRasterHandler->getSRID() );
908 std::auto_ptr< te::gm::MultiPolygon > mosaicValidDataPolMultiPolPtr(
910 mosaicValidDataPol.
getSRID(), 0 ) );
914 std::auto_ptr< te::gm::Geometry > unionMultiPolPtr;
915 unionMultiPolPtr.reset( mosaicValidDataPolMultiPolPtr->Union(
916 &lastMosaicAddedRasterPol ) );
918 unionMultiPolPtr->setSRID( mosaicRasterHandler->getSRID() );
921 "Invalid geometry type")
927 cachedInputRasterPtr.reset();
933 progressPtr->pulse();
934 if( ! progressPtr->isActive() )
return false;
940 if( mosaicRasterHandler.get() )
945 boost::lexical_cast< std::string >( outParamsPtr->
m_sequencesInfo.size() ) +
952 *( mosaicRasterHandler.get() ), outParamsPtr->
m_outputDSPtr ),
953 "Data set creation error" );
955 currentMosaicSquenceInfo.
clear();
968 throw( te::rp::Exception )
981 "Invalid m_feederRasterPtr" )
985 "Invalid number of rasters" )
996 for( std::vector< std::vector< unsigned int > >::size_type
997 inputRastersBandsIdx = 0 ; inputRastersBandsIdx <
1001 != 0,
"Invalid raster" )
1004 inputRastersBandsIdx ].size() > 0,
"Invalid bands number" );
1008 0 ].size(),
"Bands number mismatch" );
1010 for( std::vector< unsigned int >::size_type currRasterBandidx = 0 ;
1012 inputRastersBandsIdx ].size() ; ++currRasterBandidx )
1015 inputRastersBandsIdx ][ currRasterBandidx ] <
1017 "Invalid band index" );
1021 "Invalid parameter m_tiePointsLocationBandIndex" );
1030 "Invalid parameter m_minRequiredTiePointsCoveredAreaPercent" );
1043 const bool& forceNoDataValue,
1044 const double& noDataValue,
1045 double& mean,
double& variance )
1050 double internalNoDataValue = 0;
1051 if( forceNoDataValue )
1052 internalNoDataValue = noDataValue;
1061 double pixelsNumber = 0;
1063 unsigned int col = 0;
1064 unsigned int line = 0;
1066 for( line = 0 ; line < nLines ; ++line )
1067 for( col = 0 ; col < nCols ; ++col )
1071 if( value != internalNoDataValue )
1078 if( pixelsNumber != 0.0 )
1080 mean /= pixelsNumber;
1082 for( line = 0 ; line < nLines ; ++line )
1083 for( col = 0 ; col < nCols ; ++col )
1087 if( value != internalNoDataValue )
1089 variance += ( ( value - mean ) * ( value - mean ) ) / pixelsNumber;
1099 if( dataSetName.empty() )
return false;
1101 if( dataSourcePtr == 0 )
return false;
1102 if( ! dataSourcePtr->
isValid() )
return false;
1108 std::vector< te::rst::BandProperty* > bandsProperties;
1109 unsigned int bandIdx = 0;
1110 for( bandIdx = 0 ; bandIdx < nBands ; ++bandIdx )
1118 bandsProperties, dataSetName, *dataSourcePtr, outRasterHandler) )
1121 unsigned int col = 0;
1122 unsigned int row = 0;
1125 for( bandIdx = 0 ; bandIdx < nBands ; ++bandIdx )
1130 for( row = 0 ; row < nRows ; ++row )
1132 for( col = 0 ; col < nCols ; ++col )
1134 inBand.
getValue( col, row, value );
1135 outBand.
setValue( col, row, value );
1146 std::map<std::string, std::string> rInfo;
1147 rInfo[
"URI"] = fileName;
1151 std::vector<te::rst::BandProperty*> bandsProperties;
1152 unsigned int bandIdx = 0;
1153 for( bandIdx = 0 ; bandIdx < nBands ; ++bandIdx )
1159 std::auto_ptr< te::rst::Raster > outputRasterPtr(
1161 if( outputRasterPtr.get() == 0 )
return false;
1163 unsigned int line = 0;
1164 unsigned int col = 0;
1170 for( bandIdx = 0 ; bandIdx < nBands ; ++bandIdx )
1173 te::rst::Band& outBand = *outputRasterPtr->getBand( bandIdx );
1175 for( line = 0 ; line < nLines ; ++line )
1176 for( col = 0 ; col < nCols ; ++col )
1178 inBand.
getValue( col, line, value );
1179 outBand.
setValue( col, line, value );
1187 const std::vector< te::gm::GTParameters::TiePoint >& tiePoints,
1188 const bool useTPSecondCoordPair )
const
1190 if( tiePoints.size() < 3 )
1198 for(
unsigned int tiePointsIdx = 0 ; tiePointsIdx < tiePoints.size() ;
1201 if( useTPSecondCoordPair )
1203 tiePoints[ tiePointsIdx ].second.y ) );
1206 tiePoints[ tiePointsIdx ].first.y ) );
1209 std::auto_ptr< te::gm::Polygon > convexHullPolPtr(
1210 dynamic_cast< te::gm::Polygon* >( points.
convexHull() ) );
1212 if( convexHullPolPtr.get() )
1213 return convexHullPolPtr->getArea();
virtual unsigned int getObjsCount() const =0
Return the total number of feeder objects.
AbstractParameters * clone() const
Create a clone copy of this instance.
std::string m_geomTransfName
The name of the geometric transformation used if tie-points are supplied (see each te::gm::GTFactory ...
int m_blkh
Block height (pixels).
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
bool m_useRasterCache
Enable(true) or disable the use of raster caching (default:true).
bool m_enableProgress
Enable/Disable the progress interface (default:false).
int getSRID() const
It returns the Spatial Reference System ID associated to this geometric object.
std::vector< te::gm::GTParameters::TiePoint > m_tiePoints
The generated tie-pionts (te::gm::GTParameters::TiePoint::first are raster 1 line/column indexes...
const OutputParameters & operator=(const OutputParameters ¶ms)
virtual te::rst::Raster const * getCurrentObj() const =0
Return the current sequence object.
A raster (stored in memory and eventually swapped to disk) where it is possible to dynamically add li...
virtual void setValue(unsigned int c, unsigned int r, const double value, std::size_t b=0)
Sets the attribute value in a band of a cell.
std::string m_outDataSetsNamePrefix
The raster output data sets names prefix.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
ColorInterp m_colorInterp
The color interpretation.
A LinearRing is a LineString that is both closed and simple.
te::rst::Raster const * m_inMaskRaster2Ptr
Optional one band input mask raster 2 (tie-points will not be generated inside mask image areas marke...
double getResolutionX() const
Returns the raster horizontal (x-axis) resolution.
virtual unsigned int getCurrentOffset() const =0
Return the index of the current object.
Raster Processing functions.
std::vector< MosaicSequenceInfo > m_sequencesInfo
void setSRID(int srid)
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
virtual Geometry * convexHull() const
This method calculates the Convex Hull of a geometry.
unsigned int m_raster2TargetAreaWidth
The raster 2 target area width (default:0 - The entire raster will be considered).
te::rp::Blender::BlendMethod m_blendMethod
The pixel blending method (default: NoBlendMethod).
std::auto_ptr< te::gm::GeometricTransformation > m_transformationPtr
The generated geometric transformation with the base mininum required tie-points set ( depending on t...
te::da::DataSource * m_outputDSPtr
The mosaic sequences info.
Grid * getGrid()
It returns the raster grid.
std::vector< unsigned int > m_inRaster1Bands
Bands to be used from the input raster 1.
std::vector< unsigned int > m_rasterFeederIndexes
The indexes (inside the input rasters feeder) of the rasters written to this mosaic sequence...
bool m_enableGeometryFilter
Enable/disable the geometry filter/outliers remotion (default:true).
unsigned int m_raster2TargetAreaColStart
The first column of the raster 2 target area to process (default:0 - The entire raster will be consid...
static Raster * make()
It creates and returns an empty raster with default raster driver.
virtual void getValue(unsigned int c, unsigned int r, double &value) const =0
Returns the cell attribute value.
unsigned int m_tiePointsLocationBandIndex
The band used to locate tie-points, this is the index inside each vector of m_inputRastersBands (defa...
double m_noDataValue
The pixel value used where no raster data is avaliable (defaul:0).
int m_nblocksy
The number of blocks in y.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
void reset()
Clear all internal allocated objects and reset the algorithm to its initial state.
Blended pixel value calculation for two overlaped rasters.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
void getBlendedValues(const double &line, const double &col, std::vector< double > &values)
Blend a pixel value using the current parameters.
double getTPConvexHullArea(const std::vector< te::gm::GTParameters::TiePoint > &tiePoints, const bool useTPSecondCoordPair) const
Returns the tie points converx hull area.
void add(Geometry *g)
It adds the geometry into the collection.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
#define TERP_TRUE_OR_RETURN_FALSE(value, message)
Checks if value is true. For false values a warning message will be logged and a return of context wi...
double m_pixelSizeXRelation
The pixel resolution relation m_pixelSizeXRelation = raster1_pixel_res_x / raster2_pixel_res_x (defau...
std::string m_outDataSetsNameSufix
The raster output data sets names sufix.
Abstract parameters base interface.
std::vector< TiePoint > m_tiePoints
Tie points.
A raster band description.
A rectified grid is the spatial support for raster data.
MultiPolygon is a MultiSurface whose elements are Polygons.
TiePointsLocator input parameters.
double m_lly
Lower left corner y-coordinate.
FeederConstRaster * m_feederRasterPtr
Input rasters feeder.
int m_blkw
Block width (pixels).
virtual void setValue(unsigned int c, unsigned int r, const double value)=0
Sets the cell attribute value.
bool m_enableMultiThread
Enable/Disable the use of multi-threads (default:true).
double m_ury
Upper right corner y-coordinate.
te::gm::Envelope * getExtent()
Returns the geographic extension of the grid.
bool m_enableProgress
Enable/Disable the progress interface (default:false).
void clear()
It deletes all the rings of the CurvePolygon and clear it.
Create mosaics from a sequence of overlapped rasters using an automatic tie-points detection method...
bool m_autoEqualize
Auto equalization will be performed using the overlaped image areas (default:true).
bool isInitialized() const
Returns true if the algorithm instance is initialized and ready for execution.
unsigned int m_raster2TargetAreaLineStart
The first line of the raster 2 target area to process (default:0 - The entire raster will be consider...
A point with x and y coordinate values.
std::vector< std::vector< te::gm::GTParameters::TiePoint > > m_tiePoints
The generated tie-pionts (te::gm::GTParameters::TiePoint::first are mosaic coods, te::gm::GTParameter...
bool CreateNewRaster(const te::rst::Grid &rasterGrid, const std::vector< te::rst::BandProperty * > &bandsProperties, const std::string &outDataSetName, const std::string &dataSourceType, RasterHandler &outRasterHandler)
Create a new raster into the givem data source.
unsigned int m_raster1TargetAreaLineStart
The first line of the raster 1 target area to process (default:0 - The entire raster will be consider...
#define SEQUENCE_RASTER_MAX_MOSAIC_MEM_USE
std::vector< std::vector< unsigned int > > m_inputRastersBands
Bands to process for each input raster.
double m_urx
Upper right corner x-coordinate.
unsigned int m_raster2TargetAreaHeight
The raster 2 target area height (default:0 - The entire raster will be considered).
const InputParameters & operator=(const InputParameters ¶ms)
std::string m_geomTransfName
The name of the geometric transformation used to ensure tie-points consistency (see each te::gm::GTFa...
SequenceMosaic::InputParameters m_inputParameters
Input execution parameters.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
const Algorithm & operator=(const Algorithm &)
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
virtual te::dt::AbstractData * clone() const
It clones the linestring.
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
A raster band description.
std::vector< unsigned int > m_inRaster2Bands
Bands to be used from the input raster 2.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits<double>::max().
bool createDiskRasterCopy(const std::string &fileName, const te::rst::Raster &sourceRaster) const
Create copy of the given raster into a disk file.
virtual void reset()=0
Reset the feeder to the first position (subsequent accesses will start from the first sequence obejct...
#define TERP_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
static void calcBandStatistics(const te::rst::Band &band, const bool &forceNoDataValue, const double &noDataValue, double &mean, double &variance)
Raster band statistics calcule.
double m_pixelSizeYRelation
The pixel resolution relation m_pixelSizeYRelation = raster1_pixel_res_y / raster2_pixel_res_y (defau...
A RAM cache adaptor to an external existent raster that must always be avaliable. ...
std::string m_dataSetName
The generated data set name for this mosaic sequence.
te::rst::Raster const * m_inMaskRaster1Ptr
Optional one band input mask raster 1 (tie-points will not be generated inside mask image areas marke...
Raster Processing algorithm output parameters base interface.
double m_llx
Lower left corner x-coordinate.
int m_nblocksx
The number of blocks in x.
Mosaic output parameters.
An abstract class for raster data strucutures.
MultiPoint is a GeometryCollection whose elements are restricted to points.
BandProperty * getProperty()
Returns the band property.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
This class can be used to inform the progress of a task.
unsigned int m_raster1TargetAreaColStart
The first column of the raster 2 target area to process (default:0 - The entire raster will be consid...
te::rst::Raster * getRasterPtr()
Returns a pointer the the handled raster instance or NULL if no instance is handled.
double getResolutionY() const
Returns the raster vertical (y-axis) resolution.
int getSRID() const
Returns the grid spatial reference system identifier.
te::rp::TiePointsLocator::InputParameters m_locatorParams
The parameters used by the tie-points locator when processing each rasters pair (leave untouched to u...
void clear()
Clear the internal allocated resources.
double m_minRequiredTiePointsCoveredAreaPercent
The mininumum required tie-points covered area percent of each raster area - valid range [0...
unsigned int m_raster1TargetAreaWidth
The raster 1 target area width (default:0 - The entire raster will be considered).
2D Geometric transformation parameters.
bool createRasterDataSet(const std::string &dataSetName, const te::rst::Raster &sourceRaster, te::da::DataSource *dataSourcePtr) const
Create a raster data set from the given raster.
te::rst::Raster const * m_inRaster1Ptr
Input raster 1.
bool m_enableMultiThread
Enable/Disable the use of multi-threads (default:true).
Near neighborhood interpolation method.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
TERASTEREXPORT void GetDataTypeRanges(const int &dataType, double &min, double &max)
Return the values range of a given data type.
bool m_isInitialized
Tells if this instance is initialized.
unsigned int m_raster1TargetAreaHeight
The raster 1 target area height (default:0 - The entire raster will be considered).
Index into a lookup table.
bool m_forceInputNoDataValue
If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
te::rst::Raster const * m_inRaster2Ptr
Input raster 2.
void push_back(Curve *ring)
It adds the curve to the curve polygon.
bool initialize(const te::rst::Raster &raster1, const std::vector< unsigned int > &raster1Bands, const te::rst::Raster &raster2, const std::vector< unsigned int > &raster2Bands, const BlendMethod &blendMethod, const te::rst::Interpolator::Method &interpMethod1, const te::rst::Interpolator::Method &interpMethod2, const double &noDataValue, const bool forceInputNoDataValue, const std::vector< double > &pixelOffsets1, const std::vector< double > &pixelScales1, const std::vector< double > &pixelOffsets2, const std::vector< double > &pixelScales2, te::gm::Polygon const *const r1ValidDataDelimiterPtr, te::gm::Polygon const *const r2ValidDataDelimiterPtr, const te::gm::GeometricTransformation &geomTransformation)
Inititate the blender instance.
te::common::AccessPolicy getAccessPolicy() const
Returns the raster access policy.
virtual bool moveNext()=0
Advances to the next sequence obeject.
Raster Processing algorithm input parameters base interface.
AbstractParameters * clone() const
Create a clone copy of this instance.
TiePointsLocator output parameters.
virtual bool isValid() const =0
It checks if the data source is valid (available for using).