Skip to content
Snippets Groups Projects
Commit aa00281e authored by Gaëlle USSEGLIO's avatar Gaëlle USSEGLIO
Browse files

UPDATE : Correction into DEMPolygonsAnalysis and Doppler 0 + Compatibility Python2/3 for diapOTB.py

parent 9e481a84
No related branches found
No related tags found
No related merge requests found
......@@ -97,7 +97,7 @@ private:
// Define pipeline
corFilter->SetInput(GetParameterComplexDoubleImage("in"));
corFilter->SetInput(GetParameterComplexDoubleImage("insar"));
// Execute pipeline
corFilter->Update();
......
......@@ -229,7 +229,7 @@ namespace otb
//////// Check Input/Output in function of Functor ////////
//////// The functor can be required a classic image or a vector Image as main output ////////
if (inputPtr->GetNameOfClass() != "VectorImage")
if (strcmp(inputPtr->GetNameOfClass(), "VectorImage") != 0)
{
itkExceptionMacro(<<"Input must be a Vector Image.");
return;
......@@ -245,7 +245,7 @@ namespace otb
unsigned int numberOfEstimatedComponents = m_FunctionOnPolygon->GetNumberOfEstimatedComponents();
if (numberOfEstimatedComponents > 1)
{
if (outputPtr->GetNameOfClass() != "VectorImage")
if (strcmp(outputPtr->GetNameOfClass(), "VectorImage") != 0)
{
itkExceptionMacro(<<"Output must be a Vector Image.");
return;
......@@ -256,7 +256,7 @@ namespace otb
}
else
{
if (outputPtr->GetNameOfClass() != "Image")
if (strcmp(outputPtr->GetNameOfClass(), "Image") != 0)
{
itkExceptionMacro(<<"Output must be a Vector Image.");
return;
......
......@@ -20,6 +20,7 @@
# limitations under the License.
#
from __future__ import print_function
__author__ = "POC-THALES"
__version__ = "0.1"
......@@ -29,10 +30,15 @@ __last_modified__ = "27/10/2017"
# Imports
import logging
import ConfigParser
try:
from ConfigParser import SafeConfigParser as ConfigParser
except ImportError:
from configparser import ConfigParser
import os
import sys
import argparse
import otbApplication as otb
logger = logging.getLogger(__name__)
......@@ -74,11 +80,11 @@ def ConfigCheck(config):
for option in dictOfSections[section] :
# Check if option exists into section of config
if not config.has_option(section, option) :
print option + " is missing for the section " + section + " of the configuration file"
print(option + " is missing for the section " + section + " of the configuration file")
configOk = False
else :
print section + " is missing into the configuration file"
print(section + " is missing into the configuration file")
configOk = False
......@@ -93,18 +99,17 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("configfile", help="input conguration file for the application DiapOTB")
args = parser.parse_args()
print args.configfile
print(args.configfile)
# Read the configuration file
Config = ConfigParser.ConfigParser()
Config = ConfigParser()
Config.read(args.configfile)
configOk = ConfigCheck(Config)
# If some values are missing, quit the application
if not configOk :
quit()
# Get elements from configuration file
master_Image = ConfigSectionMap(Config, "Global")['master_image_path']
slave_Image = ConfigSectionMap(Config, "Global")['slave_image_path']
......@@ -123,19 +128,19 @@ if __name__ == "__main__":
# Check if images exist
if not os.path.exists(master_Image) :
print master_Image + " does not exists"
print(master_Image + " does not exists")
quit()
if not os.path.exists(slave_Image) :
print slave_Image + " does not exists"
print(slave_Image + " does not exists")
quit()
if not os.path.exists(dem) :
print dem + " does not exists"
print(dem + " does not exists")
quit()
if not os.path.exists(output_dir):
print "The output directory does not exist and will be created"
print("The output directory does not exist and will be created")
os.makedirs(output_dir)
else :
print "The output directory exists. Some files can be overwritten"
print("The output directory exists. Some files can be overwritten")
master_Image_base = os.path.basename(master_Image)
slave_Image_base = os.path.basename(slave_Image)
......@@ -147,7 +152,7 @@ if __name__ == "__main__":
dopFile.write("Doppler for master image : " + os.path.basename(master_Image_base)+ "\n")
dopFile.close()
appDoppler0Master = otb.Registry.CreateApplication("SARDoppler0")
appDoppler0Master.SetParameterString("in", master_Image)
appDoppler0Master.SetParameterString("insar", master_Image)
appDoppler0Master.SetParameterString("outfile", os.path.join(output_dir, dop_file))
appDoppler0Master.SetParameterInt("ram", 4000)
appDoppler0Master.ExecuteAndWriteOutput()
......@@ -157,7 +162,7 @@ if __name__ == "__main__":
dopFile.write("Doppler for slave image : " + os.path.basename(slave_Image_base) + "\n")
dopFile.close()
appDoppler0Slave = otb.Registry.CreateApplication("SARDoppler0")
appDoppler0Slave.SetParameterString("in", slave_Image)
appDoppler0Slave.SetParameterString("insar", slave_Image)
appDoppler0Slave.SetParameterString("outfile", os.path.join(output_dir, dop_file))
appDoppler0Slave.SetParameterInt("ram", 4000)
appDoppler0Slave.ExecuteAndWriteOutput()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment