Commit d0c9aa51 authored by gpernot's avatar gpernot
Browse files

Merge branch 'develop' into drop_opencv2_support

parents 5f845bae 832879c3
......@@ -10,6 +10,8 @@ Aurélie Emilien <aurelie.emilien@c-s.fr>
Aurélie Emilien <aurelie.emilien@c-s.fr> Aurelie Emilien <aurelie.emilien@c-s.fr>
Bas Couwenberg <sebastic@debian.org>
Bas Couwenberg <sebastic@debian.org> Bas Couwenberg <sebastic@xs4all.nl>
Carole Amiot <carole.amiot@cnes.fr>
Carole Amiot <carole.amiot@cnes.fr> Carole Amiot <carole.amiot@thales-services.fr>
Caroline Ruffel <caroline.ruffel@c-s.fr>
Charles Peyrega <charles.peyrega@c-s.fr>
Chia Aik Song <crscas@nus.edu.sg>
......
......@@ -247,6 +247,11 @@ public:
* \sa \c OGRFeature::GetFieldDefnRef()
*/
FieldDefn GetFieldDefn(std::string const& name) const;
/** Searches the index of a field given a name.
* \invariant <tt>m_Feature != 0</tt>
* \throw itk::ExceptionObject if no field named \c name exists.
*/
int GetFieldIndex(std::string const& name) const;
//@}
/**\name Geometries
......@@ -351,12 +356,6 @@ private:
void UncheckedSetGeometry(OGRGeometry const* geometry);
//@}
/** Searches the index of a field given a name.
* \invariant <tt>m_Feature != 0</tt>
* \throw itk::ExceptionObject if no field named \c name exists.
*/
int GetFieldIndex(std::string const& name) const;
/**
* Checks whether the internal \c OGRFeature is non null.
* Fires an assertion otherwise.
......
......@@ -24,8 +24,6 @@ set(OTBOSSIMAdapters_SRC
otbSensorModelAdapter.cxx
otbRPCSolverAdapter.cxx
otbDateTimeAdapter.cxx
otbFilterFunctionValues.cxx
otbMetaDataKey.cxx
otbEllipsoidAdapter.cxx
otbSarSensorModelAdapter.cxx
)
......
......@@ -32,6 +32,10 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Waddress"
#if defined(__GNUC__) && (__GNUC__ > 5)
#pragma GCC diagnostic ignored "-Wnonnull-compare"
#endif
#include "ossim/base/ossimKeywordlist.h"
#include "ossim/base/ossimString.h"
#include "ossim/ossimPluginProjectionFactory.h"
......
......@@ -30,6 +30,10 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Waddress"
#if defined(__GNUC__) && (__GNUC__ > 5)
#pragma GCC diagnostic ignored "-Wnonnull-compare"
#endif
#include "ossim/projection/ossimRpcSolver.h"
#include "ossim/projection/ossimProjection.h"
#include "ossim/projection/ossimRpcProjection.h"
......
......@@ -31,6 +31,10 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Waddress"
#if defined(__GNUC__) && (__GNUC__ > 5)
#pragma GCC diagnostic ignored "-Wnonnull-compare"
#endif
#include "ossim/ossimSarSensorModel.h"
#include "ossim/ossimPluginProjectionFactory.h"
#pragma GCC diagnostic pop
......
......@@ -31,6 +31,10 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Waddress"
#if defined(__GNUC__) && (__GNUC__ > 5)
#pragma GCC diagnostic ignored "-Wnonnull-compare"
#endif
#include "ossim/projection/ossimProjection.h"
#include "ossim/projection/ossimSensorModelFactory.h"
#include "ossim/projection/ossimSensorModel.h"
......
......@@ -109,7 +109,7 @@ private:
ogr::DataSource::Pointer buffer);
/** Create the output DataSource. */
otb::ogr::DataSource::Pointer CreateOutputDataSource(ogr::DataSource::Pointer source, ogr::Layer& layer);
otb::ogr::DataSource::Pointer CreateOutputDataSource(ogr::Layer& layer);
/** Add a prediction field in the output layer if it does not exist.
* If computeConfidenceMap evaluates to true a confidence field will be
......
......@@ -72,24 +72,36 @@ void VectorPrediction<RegressionMode>::DoUpdateParameters()
}
}
template <bool RegressionMode>
typename VectorPrediction<RegressionMode>::ListSampleType::Pointer VectorPrediction<RegressionMode>::ReadInputListSample(otb::ogr::Layer const& layer)
template <bool RegressionMode>
typename VectorPrediction<RegressionMode>::ListSampleType::Pointer
VectorPrediction<RegressionMode>
::ReadInputListSample(otb::ogr::Layer const& layer)
{
typename ListSampleType::Pointer input = ListSampleType::New();
const int nbFeatures = GetSelectedItems("feat").size();
const auto nbFeatures = GetSelectedItems("feat").size();
input->SetMeasurementVectorSize(nbFeatures);
std::vector<int> featureFieldIndex(nbFeatures, -1);
ogr::Layer::const_iterator it_feat = layer.cbegin();
for (unsigned int i = 0; i < nbFeatures; i++)
{
try
{
featureFieldIndex[i] = (*it_feat).GetFieldIndex(GetChoiceNames("feat")[GetSelectedItems("feat")[i]]);
}
catch(...)
{
otbAppLogFATAL("The field name for feature " << GetChoiceNames("feat")[GetSelectedItems("feat")[i]] << " has not been found" << std::endl);
}
}
for (auto const& feature : layer)
{
MeasurementType mv(nbFeatures);
for (int idx = 0; idx < nbFeatures; ++idx)
for (unsigned int idx = 0; idx < nbFeatures; ++idx)
{
// Beware that itemIndex differs from ogr layer field index
unsigned int itemIndex = GetSelectedItems("feat")[idx];
std::string fieldName = GetChoiceNames("feat")[itemIndex];
auto field = feature[fieldName];
auto field = feature[featureFieldIndex[idx]];
switch (field.GetType())
{
case OFTInteger:
......@@ -108,6 +120,7 @@ typename VectorPrediction<RegressionMode>::ListSampleType::Pointer VectorPredict
return input;
}
template <bool RegressionMode>
typename VectorPrediction<RegressionMode>::ListSampleType::Pointer VectorPrediction<RegressionMode>::NormalizeListSample(ListSampleType::Pointer input)
{
......@@ -164,7 +177,7 @@ otb::ogr::DataSource::Pointer VectorPrediction<RegressionMode>::ReopenDataSource
}
template <bool RegressionMode>
otb::ogr::DataSource::Pointer VectorPrediction<RegressionMode>::CreateOutputDataSource(ogr::DataSource::Pointer source, ogr::Layer& layer)
otb::ogr::DataSource::Pointer VectorPrediction<RegressionMode>::CreateOutputDataSource(ogr::Layer& layer)
{
ogr::DataSource::Pointer output;
// Create new OGRDataSource
......@@ -278,13 +291,11 @@ void VectorPrediction<RegressionMode>::DoExecute()
auto shapefileName = GetParameterString("in");
auto source = otb::ogr::DataSource::New(shapefileName, otb::ogr::DataSource::Modes::Read);
ogr::DataSource::Pointer source = ogr::DataSource::New(shapefileName, ogr::DataSource::Modes::Read);
auto layer = source->GetLayer(0);
auto input = ReadInputListSample(layer);
ListSampleType::Pointer listSample = NormalizeListSample(input);
typename LabelListSampleType::Pointer target;
// The quality listSample containing confidence values is defined here, but is only used when
......@@ -316,7 +327,7 @@ void VectorPrediction<RegressionMode>::DoExecute()
}
else
{
output = CreateOutputDataSource(source, layer);
output = CreateOutputDataSource(layer);
}
otb::ogr::Layer outLayer = output->GetLayer(0);
......
......@@ -206,7 +206,7 @@ private:
return outputFile;
}
void DoInit()
void DoInit() override
{
SetName("Mosaic");
SetDescription("Perform a mosaic of input images");
......@@ -382,7 +382,7 @@ private:
SetDocExampleParameterValue("out", "mosaicImage.tif");
}
void DoUpdateParameters()
void DoUpdateParameters() override
{
// TODO: update parameters
}
......@@ -1028,7 +1028,7 @@ private:
}
}
void DoExecute()
void DoExecute() override
{
GDALAllRegister();
m_TemporaryFiles.clear();
......@@ -1055,7 +1055,7 @@ private:
} // DoExecute()
void AfterExecuteAndWriteOutputs()
void AfterExecuteAndWriteOutputs() override
{
if (m_TemporaryFiles.size() > 0)
{
......
......@@ -77,10 +77,10 @@ private:
"lut", "Lookup table values are not available with all SAR products. Products that provide lookup table with metadata are: Sentinel1, Radarsat2.");
AddChoice("lut.sigma", "Use sigma nought lookup");
SetParameterDescription("lut.sigma", "Use Sigma nought lookup value from product metadata");
AddChoice("lut.gamma", "Use gamma nought lookup");
SetParameterDescription("lut.gamma", "Use Gamma nought lookup value from product metadata");
AddChoice("lut.beta", "Use beta nought lookup");
SetParameterDescription("lut.beta", "Use Beta nought lookup value from product metadata");
AddChoice("lut.gamma", "Use gamma nought lookup");
SetParameterDescription("lut.gamma", "Use Gamma nought lookup value from product metadata");
AddChoice("lut.dn", "Use DN value lookup");
SetParameterDescription("lut.dn", "Use DN value lookup value from product metadata");
SetDefaultParameterInt("lut", 0);
......
......@@ -253,6 +253,8 @@ private:
SetDefaultParameterInt("inverse.ssrate", 16);
SetMinimumParameterIntValue("inverse.ssrate", 1);
AddRAMParameter();
// Doc example
SetDocExampleParameterValue("io.inleft", "wv2_xs_left.tif");
SetDocExampleParameterValue("io.inright", "wv2_xs_left.tif");
......
......@@ -92,6 +92,24 @@ otb_test_application(NAME apTvDmStereoRectificationGridGeneratorTest
)
otb_test_application(NAME apTvDmStereoRectificationGridGeneratorTestAvgDEM
APP StereoRectificationGridGenerator
OPTIONS -io.inleft ${INPUTDATA}/sensor_stereo_left.tif
-io.inright ${INPUTDATA}/sensor_stereo_right.tif
-io.outleft ${TEMP}/apTvDmStereoRectificationGridGeneratorLeftTestAvgDEM.tif
-io.outright ${TEMP}/apTvDmStereoRectificationGridGeneratorRightTestAvgDEM.tif
-inverse.outleft ${TEMP}/apTvDmStereoRectificationGridGeneratorInverseLeftTestAvgDEM.tif
-inverse.outright ${TEMP}/apTvDmStereoRectificationGridGeneratorInverseRightTestAvgDEM.tif
-epi.elevation.dem ${INPUTDATA}/DEM/srtm_directory
-epi.elevation.geoid ${INPUTDATA}/DEM/egm96.grd
-epi.elevation.avgdem.step 10
-epi.scale 1.0
-epi.step 4
# No validation here, purpose is only to see that te avgdem mode works without errors
)
#----------- FineRegistration TESTS ----------------
otb_test_application(NAME apTvDmFineRegistrationTest
APP FineRegistration
......
......@@ -27,7 +27,7 @@
#include "itkObjectFactory.h"
#include "itkMacro.h"
#include "OTBOSSIMAdaptersExport.h"
#include "OTBMetadataExport.h"
namespace otb
{
......@@ -39,9 +39,9 @@ namespace otb
*
* \ingroup IO
*
* \ingroup OTBOSSIMAdapters
* \ingroup OTBMetadata
*/
class OTBOSSIMAdapters_EXPORT FilterFunctionValues : public itk::DataObject
class OTBMetadata_EXPORT FilterFunctionValues : public itk::DataObject
{
public:
/** Standard typedefs */
......
......@@ -26,7 +26,7 @@
#include "itkDataObject.h"
#include "itkVariableLengthVector.h"
#include "OTBOSSIMAdaptersExport.h"
#include "OTBMetadataExport.h"
namespace otb
{
......@@ -35,46 +35,46 @@ namespace otb
*/
namespace MetaDataKey
{
extern OTBOSSIMAdapters_EXPORT char const* DriverShortNameKey;
extern OTBOSSIMAdapters_EXPORT char const* DriverLongNameKey;
extern OTBMetadata_EXPORT char const* DriverShortNameKey;
extern OTBMetadata_EXPORT char const* DriverLongNameKey;
extern OTBOSSIMAdapters_EXPORT char const* ProjectionRefKey;
extern OTBMetadata_EXPORT char const* ProjectionRefKey;
extern OTBOSSIMAdapters_EXPORT char const* GCPProjectionKey;
extern OTBOSSIMAdapters_EXPORT char const* GCPParametersKey;
extern OTBOSSIMAdapters_EXPORT char const* GCPCountKey;
extern OTBMetadata_EXPORT char const* GCPProjectionKey;
extern OTBMetadata_EXPORT char const* GCPParametersKey;
extern OTBMetadata_EXPORT char const* GCPCountKey;
extern OTBOSSIMAdapters_EXPORT char const* GeoTransformKey;
extern OTBMetadata_EXPORT char const* GeoTransformKey;
extern OTBOSSIMAdapters_EXPORT char const* MetadataKey;
extern OTBOSSIMAdapters_EXPORT char const* SubMetadataKey;
extern OTBMetadata_EXPORT char const* MetadataKey;
extern OTBMetadata_EXPORT char const* SubMetadataKey;
extern OTBOSSIMAdapters_EXPORT char const* UpperLeftCornerKey;
extern OTBOSSIMAdapters_EXPORT char const* UpperRightCornerKey;
extern OTBOSSIMAdapters_EXPORT char const* LowerLeftCornerKey;
extern OTBOSSIMAdapters_EXPORT char const* LowerRightCornerKey;
extern OTBMetadata_EXPORT char const* UpperLeftCornerKey;
extern OTBMetadata_EXPORT char const* UpperRightCornerKey;
extern OTBMetadata_EXPORT char const* LowerLeftCornerKey;
extern OTBMetadata_EXPORT char const* LowerRightCornerKey;
extern OTBOSSIMAdapters_EXPORT char const* ColorTableNameKey;
extern OTBOSSIMAdapters_EXPORT char const* ColorEntryCountKey;
extern OTBOSSIMAdapters_EXPORT char const* ColorEntryAsRGBKey;
extern OTBMetadata_EXPORT char const* ColorTableNameKey;
extern OTBMetadata_EXPORT char const* ColorEntryCountKey;
extern OTBMetadata_EXPORT char const* ColorEntryAsRGBKey;
extern OTBOSSIMAdapters_EXPORT char const* OSSIMKeywordlistKey;
extern OTBOSSIMAdapters_EXPORT char const* OSSIMKeywordlistDelimiterKey;
extern OTBMetadata_EXPORT char const* OSSIMKeywordlistKey;
extern OTBMetadata_EXPORT char const* OSSIMKeywordlistDelimiterKey;
extern OTBOSSIMAdapters_EXPORT char const* VectorDataKeywordlistKey;
extern OTBOSSIMAdapters_EXPORT char const* VectorDataKeywordlistDelimiterKey;
extern OTBMetadata_EXPORT char const* VectorDataKeywordlistKey;
extern OTBMetadata_EXPORT char const* VectorDataKeywordlistDelimiterKey;
extern OTBOSSIMAdapters_EXPORT char const* ResolutionFactor;
extern OTBOSSIMAdapters_EXPORT char const* SubDatasetIndex;
extern OTBOSSIMAdapters_EXPORT char const* CacheSizeInBytes;
extern OTBMetadata_EXPORT char const* ResolutionFactor;
extern OTBMetadata_EXPORT char const* SubDatasetIndex;
extern OTBMetadata_EXPORT char const* CacheSizeInBytes;
extern OTBOSSIMAdapters_EXPORT char const* TileHintX;
extern OTBOSSIMAdapters_EXPORT char const* TileHintY;
extern OTBMetadata_EXPORT char const* TileHintX;
extern OTBMetadata_EXPORT char const* TileHintY;
extern OTBOSSIMAdapters_EXPORT char const* NoDataValueAvailable;
extern OTBOSSIMAdapters_EXPORT char const* NoDataValue;
extern OTBMetadata_EXPORT char const* NoDataValueAvailable;
extern OTBMetadata_EXPORT char const* NoDataValue;
extern OTBOSSIMAdapters_EXPORT char const* DataType;
extern OTBMetadata_EXPORT char const* DataType;
enum KeyType
......@@ -110,7 +110,7 @@ struct KeyTypeDef
}
};
KeyType OTBOSSIMAdapters_EXPORT GetKeyType(const std::string& name);
KeyType OTBMetadata_EXPORT GetKeyType(const std::string& name);
typedef std::vector<double> VectorType;
typedef std::vector<bool> BoolVectorType;
......@@ -123,9 +123,9 @@ typedef itk::VariableLengthVector<double> VariableLengthVectorType;
* in OTB.
*
*
* \ingroup OTBOSSIMAdapters
* \ingroup OTBMetadata
*/
class OTBOSSIMAdapters_EXPORT OTB_GCP
class OTBMetadata_EXPORT OTB_GCP
{
public:
/** Unique identifier, often numeric */
......
......@@ -66,6 +66,8 @@ set(OTBMetadata_SRC
otbRadarsat2ImageMetadataInterface.cxx
otbNoDataHelper.cxx
otbFilterFunctionValues.cxx
otbMetaDataKey.cxx
)
add_library(OTBMetadata ${OTBMetadata_SRC})
......
......@@ -29,6 +29,7 @@ ENABLE_SHARED
OTBCommon
OTBITK
OTBImageBase
OTBMetadata
OTBOSSIMAdapters
OTBObjectList
......
......@@ -31,6 +31,7 @@ otb_module(OTBTransform
OTBITK
OTBInterpolation
OTBOSSIMAdapters
OTBMetadata
OTBGdalAdapters
TEST_DEPENDS
OTBImageBase
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment