Hi,

You may try using "SetParameterInputImage" for the input of your second 
application ? When I use "SetParameterString" for the In-memory connection I 
produce an error (however not the same), but with using this it works:

App2.SetParameterInputImage('in',App1.GetParameterOutputImage('out'))

Best regards,

Baptiste
________________________________
De : [email protected] [[email protected]] de la part de 
Arthur B. [[email protected]]
Envoyé : mardi 20 juin 2017 15:40
À : otb-users
Objet : [otb-users] How to correctly setup the OTB using with Python on windows

Hi everyone,

I would like to create a processing chain with Python, and maybe integrate it 
in a Qgis plugin later, so i'm writing my code while i test in the python 
command line available on Qgis. To accelerate the process and free some space 
i'm trying to use the In-memory connection between application but this 
fonctionnality seems to doesn't work on my case. There is a simple example:

from sys import argv
import otbApplication as otb
image = 
'C:\\Users\\abourachot\\Documents\\python_folder\\ORT_2015033139184457_0703_6191-2-3.tif'
App1 = otb.Registry.CreateApplication('Smoothing')
App1.SetParameterString('in', image)
App1.Execute()

App2 = otb.Registry.CreateApplication('Smoothing')
App2.SetParameterString('in',App1.GetParameterOutputImage('out'))
***error***
App2.SetParameterString('out', 
'C:\\Users\\abourachot\\Documents\\python_folder\\SmoothBarcares.tif')
App2.ExecuteAndWriteOutput()

At the error line i get:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\OSGEO4~1\apps\orfeotoolbox\python\otbApplication.py", line 1535, in 
<lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Application, name)
  File "C:\OSGEO4~1\apps\orfeotoolbox\python\otbApplication.py", line 74, in 
_swig_getattr
    return _swig_getattr_nondynamic(self, class_type, name, 0)
  File "C:\OSGEO4~1\apps\orfeotoolbox\python\otbApplication.py", line 69, in 
_swig_getattr_nondynamic
    return object.__getattr__(self, name)
AttributeError: type object 'object' has no attribute '__getattr__'


i don't know if my code is wrong, but i also tested it with the example 
available in the cookbook and get the same results.
Do I go astray, and it is not possible to use the connection via Qgis ? As i 
said, i would like to use Qgis to combine OTB with others applications and 
finally create a Qgis plugin with interface...

Thank ou in advance !

Best regards
Arthur

--
--
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]<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

-- 
-- 
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.

Reply via email to