Hello,
it worked!!! Thank you very much Guillaume!!
Regards,
Natalie
On Monday, April 24, 2017 at 7:43:02 PM UTC+3, Guillaume Pasero wrote:
>
> Hi,
>
> Try to add this line before the SetParameterString("field",'cl') :
>
> PolygonClassStatistics.UpdateParameters()
>
> Guillaume
> On 03/28/2017 02:18 PM, Natalie Verde wrote:
>
> Hello to all,
>
> I'm new to OTB and trying to write a classification script using python.
> I have an itk Error while trying to run some otbApplications.
> Specifically, when trying to run the PolygonClassStatistics app, I get:
>
> "exceptions.RuntimeError:Exception thrown in otbApplication
> Application_SetParameterString:
> C:\dashboard\otb\scr\Modules\Wrappers\Applicatio...:
> itk::ERROR: ListViewParameter(00000000062DC770):
> Cannot find cl"
>
> I've doubled checked that my class field is called "cl".
>
> Even if I run the PolygonClassStatistics GUI to extract the statistics
> xml, and then try to run the SampleSelection app with the xml I extracted
> before, I get another itk error:
>
> "exceptions.RuntimeError:Exception thrown in otbApplication
> Application_ExecuteAndWriteOutput:
> C:\dashboard\otb\scr\Modules\Wrappers\Applicatio...:267:
> itk::ERROR: Fatal error caught. Aborting..."
>
> The RadiometricIndices app I run on my script works fine.
>
> Thank you in advance
>
> Regards,
> Natalie
>
> -------------------------
> OS: Windows 10 64-bit OS
> OTB version: OTB-contrib-5.10.1-win64
> Scripter: PyScripter
>
> My script is:
>
> import sys
> import os
> import otbApplication
> import numpy as np
> import commands
>
> #----------1. Polygon Class
> Statistics------------------------------------------
> # The following line creates an instance of the PolygonClassStatistics
> application
> PolygonClassStatistics =
> otbApplication.Registry.CreateApplication('PolygonClassStatistics')
> # We print the keys of all its parameter
> print PolygonClassStatistics.GetParametersKeys()
> # The following lines set all the application parameters:
> # First, we set the input image filename
> PolygonClassStatistics.SetParameterString("in",
> r"C:\Users\Natalie\Dropbox\ATM_auth_pgp\THESIS\Data\Dimou\2007\2007.tif")
> # input vector filename
> PolygonClassStatistics.SetParameterString("vec",
> r"C:\Users\Natalie\Dropbox\ATM_auth_pgp\THESIS\Files\Classifications\samptriad.shp")
> #vector field name
> PolygonClassStatistics.SetParameterString("field", 'cl')
> # Set the output filename, using the algorithm to differentiate the outputs
> PolygonClassStatistics.SetParameterString("out",
> r"C:\Users\Natalie\Dropbox\ATM_auth_pgp\THESIS\Files\Classifications\1triadsamples.xml")
> # This will execute the application and save the output file
> PolygonClassStatistics.ExecuteAndWriteOutput()
>
> #----------2. Select
> Samples----------------------------------------------------
> # The following line creates an instance of the SampleSelection application
> SampleSelection =
> otbApplication.Registry.CreateApplication("SampleSelection")
> # The following lines set all the application parameters:
> SampleSelection.SetParameterString("in",
> r"C:\Users\Natalie\Dropbox\ATM_auth_pgp\THESIS\Data\Dimou\2007\2007.tif")
> SampleSelection.SetParameterString("vec",
> r"C:\Users\Natalie\Dropbox\ATM_auth_pgp\THESIS\Files\Classifications\samptriad.shp")
> SampleSelection.SetParameterString("instats",
> r"C:\Users\Natalie\Dropbox\ATM_auth_pgp\THESIS\Files\Classifications\1triadsamples.xml")
> SampleSelection.SetParameterString("out",
> r"C:\Users\Natalie\Dropbox\ATM_auth_pgp\THESIS\Files\Classifications\2triadsampselect.shp")
> # The following line execute the application
> SampleSelection.ExecuteAndWriteOutput()
>
> --
> --
> Check the OTB FAQ at
> http://www.orfeo-toolbox.org/FAQ.html
>
> You received this message because you are subscribed to the Google
> Groups "otb-users" group.
> To post to this group, send email to [email protected]
> <javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> For more options, visit this group at
> http://groups.google.com/group/otb-users?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "otb-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> <http://www.c-s.fr> *Guillaume PASERO*
> Responsable technique
> *Business Unit ESPACE & GeoInformation - Département Payload Data &
> Applications*
>
> *CS Systèmes d'Information*
> Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872
> 31506 Toulouse Cedex 05 - FRANCE
> +33 561 17 64 21 - [email protected] <javascript:>
>
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html
You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.