Commit 5b952c87 authored by Antoine Regimbeau's avatar Antoine Regimbeau

MRG: Merge branch 'develop' into metadata_pixeltype

parents 5443f08d 5185493f
......@@ -16,16 +16,6 @@ A simple example is given below:
#include "otbBandMathImageFilterX.h"
#include "otbVectorImage.h"
int otbBandMathImageFilterXNew( int itkNotUsed(argc), char* itkNotUsed(argv) [])
{
typedef double PixelType;
typedef otb::VectorImage<PixelType, 2> ImageType;
typedef otb::BandMathImageFilterX<ImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
return EXIT_SUCCESS;
}
As we can see, the new band math filter works with the class
otb::VectorImage.
......
......@@ -122,7 +122,7 @@ int main(int argc, char * argv[])
writer->SetInput(Izz);
outputFileName = outputPrefix + "-Izz.hdr";
writer->SetFileName(outputFileName.c_str());
writer->SetFileName(outputFileName);
writer->Update();
gc->SetDirection(1); // gc now works along Y
......@@ -135,7 +135,7 @@ int main(int argc, char * argv[])
writer->SetInput(Iyy);
outputFileName = outputPrefix + "-Iyy.hdr";
writer->SetFileName(outputFileName.c_str());
writer->SetFileName(outputFileName);
writer->Update();
gc->SetDirection(0); // gc now works along X
......@@ -148,7 +148,7 @@ int main(int argc, char * argv[])
writer->SetInput(Ixx);
outputFileName = outputPrefix + "-Ixx.hdr";
writer->SetFileName(outputFileName.c_str());
writer->SetFileName(outputFileName);
writer->Update();
ga->SetDirection(0);
......@@ -166,7 +166,7 @@ int main(int argc, char * argv[])
writer->SetInput(Iyz);
outputFileName = outputPrefix + "-Iyz.hdr";
writer->SetFileName(outputFileName.c_str());
writer->SetFileName(outputFileName);
writer->Update();
ga->SetDirection(1);
......@@ -184,7 +184,7 @@ int main(int argc, char * argv[])
writer->SetInput(Ixz);
outputFileName = outputPrefix + "-Ixz.hdr";
writer->SetFileName(outputFileName.c_str());
writer->SetFileName(outputFileName);
writer->Update();
ga->SetDirection(2);
......@@ -202,7 +202,7 @@ int main(int argc, char * argv[])
writer->SetInput(Ixy);
outputFileName = outputPrefix + "-Ixy.hdr";
writer->SetFileName(outputFileName.c_str());
writer->SetFileName(outputFileName);
writer->Update();
// Software Guide : EndCodeSnippet
......
......@@ -101,7 +101,7 @@ int main(int itkNotUsed(argc), char * argv[])
// Software Guide : BeginCodeSnippet
otb::GDALImageIO::Pointer readerGDAL = otb::GDALImageIO::New();
readerGDAL->SetFileName(inputFilename.c_str());
readerGDAL->SetFileName(inputFilename);
std::vector<std::string> vectSubdatasetNames;
std::vector<std::string> vectorSubdatasetDescriptions;
......@@ -146,7 +146,7 @@ int main(int itkNotUsed(argc), char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
writer->SetFileName(outputFilename.c_str());
writer->SetFileName(outputFilename);
writer->SetInput(reader->GetOutput());
writer->Update();
......
......@@ -209,7 +209,7 @@ int main(int itkNotUsed(argc), char * argv[])
oss << outputFilenamePrefix << index << "." << outputFilenameSuffix;
writer = WriterType::New();
writer->SetInput(it.Get());
writer->SetFileName(oss.str().c_str());
writer->SetFileName(oss.str());
writer->Update();
std::cout << oss.str() << " file written." << std::endl;
oss.str("");
......
......@@ -215,8 +215,8 @@ int main(int argc, char * argv[])
// Software Guide : BeginLatex
// Software Guide : BeginCodeSnippet
reader->SetFileName(parseResult->GetInputImage().c_str());
writer->SetFileName(parseResult->GetOutputImage().c_str());
reader->SetFileName(parseResult->GetInputImage());
writer->SetFileName(parseResult->GetOutputImage());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......
......@@ -71,8 +71,10 @@ public:
std::unordered_map< std::string , std::string > gdalOptions;
};
/** Set extended filename */
void SetExtendedFileName(const char * extFname) override;
/** \deprecated const char* overload of SetExtendedFileName is deprecated, use std::string instead */
void SetExtendedFileName(const char* extFname) override;
void SetExtendedFileName(const std::string& extFname) override;
/** Get the GDAL option for type operation */
GDALOptionType GetGDALOptions( const std::string & type ) const ;
......
......@@ -48,10 +48,21 @@ GetGDALLayerOptionsHelper( const GDALOptionType & options )
return res;
}
void
OGRExtendedFilenameToOptions::
SetExtendedFileName(const char* extFname)
{
if (extFname == nullptr)
{
itkGenericExceptionMacro( << "Filename is NULL" );
}
this->SetExtendedFileName(std::string(extFname));
}
void
OGRExtendedFilenameToOptions::
SetExtendedFileName(const char *extFname)
SetExtendedFileName(const std::string& extFname)
{
Superclass::SetExtendedFileName(extFname);
m_HasFileName = true;
......
......@@ -193,12 +193,6 @@ otb_add_test(NAME prTvossimElevManagerTest4 COMMAND otbOSSIMAdaptersTestDriver
# LARGEINPUT{TERRASARX/2008-03-10_GrandCanyon_SSC//TSX1_SAR__SSC______SM_S_SRA_20080310T133220_20080310T133228/TSX1_SAR__SSC______SM_S_SRA_20080310T133220_20080310T133228.xml}
# ${TEMP}/uaTvPlatformPositionComputeBaselineTest.txt)
otb_add_test(NAME uaTvGeometricSarSensorModelAdapterNew COMMAND otbOSSIMAdaptersTestDriver
otbGeometricSarSensorModelAdapterNewTest)
otb_add_test(NAME uaTvPlatformPositionComputeBaselineNew COMMAND otbOSSIMAdaptersTestDriver
otbPlatformPositionComputeBaselineNewTest)
otb_add_test(NAME uaTvDEMHandler_AboveEllipsoid_NoSRTM_NoGeoid_NoData COMMAND otbOSSIMAdaptersTestDriver
otbDEMHandlerTest
no
......
......@@ -25,13 +25,6 @@
#include "otbImageFileReader.h"
#include "otbGeometricSarSensorModelAdapter.h"
int otbGeometricSarSensorModelAdapterNewTest(int itkNotUsed(argc), char* itkNotUsed(argv)[])
{
typedef otb::GeometricSarSensorModelAdapter SarSensorModelType;
SarSensorModelType::Pointer masterPlatform = SarSensorModelType::New();
return EXIT_SUCCESS;
}
int otbGeometricSarSensorModelAdapterTest(int argc, char* argv[])
{
if (argc != 3)
......
......@@ -27,9 +27,7 @@ void RegisterTests()
REGISTER_TEST(otbMapProjectionAdapterTest);
REGISTER_TEST(otbOssimElevManagerTest2);
REGISTER_TEST(otbOssimElevManagerTest4);
REGISTER_TEST(otbGeometricSarSensorModelAdapterNewTest);
REGISTER_TEST(otbGeometricSarSensorModelAdapterTest);
REGISTER_TEST(otbPlatformPositionComputeBaselineNewTest);
REGISTER_TEST(otbPlatformPositionComputeBaselineTest);
REGISTER_TEST(otbDEMHandlerTest);
REGISTER_TEST(otbRPCSolverAdapterTest);
......
......@@ -22,13 +22,6 @@
#include "otbImageFileReader.h"
#include "otbPlatformPositionAdapter.h"
int otbPlatformPositionComputeBaselineNewTest(int itkNotUsed(argc), char* itkNotUsed(argv)[])
{
typedef otb::PlatformPositionAdapter PlatformType;
PlatformType::Pointer masterPlatform = PlatformType::New();
return EXIT_SUCCESS;
}
int otbPlatformPositionComputeBaselineTest(int argc, char* argv[])
{
if (argc != 3)
......
......@@ -173,11 +173,9 @@ private:
std::string tmpKey="field."+key.substr(0, end - key.begin());
AddChoice(tmpKey,item);
}
if( fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64( fieldType ) || fieldType == OFTReal )
{
std::string tmpKey = "exclude." + key.substr( 0, static_cast<unsigned long>( end - key.begin() ) );
AddChoice( tmpKey, item );
}
std::string tmpKey = "exclude." + key.substr( 0, static_cast<unsigned long>( end - key.begin() ) );
AddChoice( tmpKey, item );
}
}
}
......
......@@ -215,7 +215,7 @@ TrainVectorBase::GetStatistics(unsigned int nbFeatures)
{
StatisticsReader::Pointer statisticsReader = StatisticsReader::New();
std::string XMLfile = GetParameterString( "io.stats" );
statisticsReader->SetFileName( XMLfile.c_str() );
statisticsReader->SetFileName( XMLfile );
measurement.meanMeasurementVector = statisticsReader->GetStatisticVectorByName( "mean" );
measurement.stddevMeasurementVector = statisticsReader->GetStatisticVectorByName( "stddev" );
}
......
......@@ -61,6 +61,12 @@ public:
typedef ExtractROIFilterType::InputImageType ImageType;
protected:
ExtractROI()
: m_IsExtentInverted(false)
{
}
private:
void
DoInit() override
......@@ -424,10 +430,11 @@ private:
inImage->TransformPhysicalPointToIndex(ulp_out,uli);
inImage->TransformPhysicalPointToIndex(lrp_out,lri);
}
SetParameterInt( "startx", uli[0]);
SetParameterInt( "starty", uli[1]);
SetParameterInt( "sizex", lri[0] - uli[0] + 1);
SetParameterInt( "sizey", lri[1] - uli[1] + 1);
m_IsExtentInverted = ( lri[0] < uli[0] || lri[1] < uli[1] );
SetParameterInt( "startx", uli[0]);
SetParameterInt( "starty", uli[1]);
SetParameterInt( "sizex", lri[0] - uli[0] + 1);
SetParameterInt( "sizey", lri[1] - uli[1] + 1);
}
void
......@@ -786,6 +793,13 @@ private:
SetParameterInt("sizey",lri[1]-uli[1]);
}
else if( GetParameterString( "mode" ) == "extent" )
{
if(m_IsExtentInverted)
{
otbAppLogFATAL(<< "Extent coordinates are inverted!");
}
}
if ( !CropRegionOfInterest() )
otbAppLogWARNING(<<"Could not extract the ROI as it is out of the "
......@@ -806,6 +820,9 @@ private:
SetParameterOutputImage("out", extractROIFilter->GetOutput());
RegisterPipeline();
}
/** flag to check if given extent was inverted */
bool m_IsExtentInverted;
};
}
......
......@@ -269,30 +269,14 @@ private:
genericRSEstimator->SetOutputProjectionRef(m_OutputProjectionRef);
genericRSEstimator->Compute();
// Fill the Gui with the computed parameters
if (!HasUserValue("outputs.sizex"))
SetParameterInt("outputs.sizex",genericRSEstimator->GetOutputSize()[0]);
if (!HasUserValue("outputs.sizey"))
SetParameterInt("outputs.sizey",genericRSEstimator->GetOutputSize()[1]);
if (!HasUserValue("outputs.spacingx"))
SetParameterFloat("outputs.spacingx",genericRSEstimator->GetOutputSpacing()[0]);
if (!HasUserValue("outputs.spacingy"))
SetParameterFloat("outputs.spacingy",genericRSEstimator->GetOutputSpacing()[1]);
if (!HasUserValue("outputs.ulx"))
SetParameterFloat("outputs.ulx",genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]);
if (!HasUserValue("outputs.uly"))
SetParameterFloat("outputs.uly",genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]);
if (!HasUserValue("outputs.lrx"))
SetParameterFloat("outputs.lrx",GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")));
if (!HasUserValue("outputs.lry"))
SetParameterFloat("outputs.lry",GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")));
SetDefaultParameterInt("outputs.sizex", genericRSEstimator->GetOutputSize()[0]);
SetDefaultParameterInt("outputs.sizey", genericRSEstimator->GetOutputSize()[1]);
SetDefaultParameterFloat("outputs.spacingx", genericRSEstimator->GetOutputSpacing()[0]);
SetDefaultParameterFloat("outputs.spacingy", genericRSEstimator->GetOutputSpacing()[1]);
SetDefaultParameterFloat("outputs.ulx", genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]);
SetDefaultParameterFloat("outputs.uly", genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]);
SetDefaultParameterFloat("outputs.lrx", GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast<double>(GetParameterInt("outputs.sizex")));
SetDefaultParameterFloat("outputs.lry", GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast<double>(GetParameterInt("outputs.sizey")));
// Handle the spacing and size field following the mode
// chose by the user
......@@ -300,16 +284,6 @@ private:
{
case Mode_UserDefined:
{
// Automatic set to off except lower right coordinates
AutomaticValueOff("outputs.ulx");
AutomaticValueOff("outputs.uly");
AutomaticValueOff("outputs.sizex");
AutomaticValueOff("outputs.sizey");
AutomaticValueOff("outputs.spacingx");
AutomaticValueOff("outputs.spacingy");
AutomaticValueOn("outputs.lrx");
AutomaticValueOn("outputs.lry");
// Enable all the parameters except lower right coordinates
EnableParameter("outputs.ulx");
EnableParameter("outputs.uly");
......@@ -350,16 +324,6 @@ private:
DisableParameter("outputs.lry");