Hi,

before implementing this kind of functionality (letting users define their 
own operator without hacking the code), I think that we could initiate a 
wish list somewhere. 

Meanwhile, if it is absolutely necessary to implement a new operator, here 
are some tips:
1) Here is the place where you must register your new functionality/operator
http://hg.orfeo-toolbox.org/OTB/file/8881c66c4899/Code/Common/otbParserX.cxx#l58


2) And here, the places where you must implement it:
 
http://hg.orfeo-toolbox.org/OTB/file/8881c66c4899/Code/Common/otbParserXPlugins.h
http://hg.orfeo-toolbox.org/OTB/file/8881c66c4899/Code/Common/otbParserXPlugins.cxx

As we can see, the idea is first to publicly derive from mup::ICallback. 
Then, the main job is to reimplement the Eval member function. 
Everything is explained here 
http://articles.beltoforion.de/article.php?a=muparserx&p=extending&s=idPageTop&ad=1#idPageTop
and of course, it is possible to take already-implemented operators as 
models.

I am a sorry to redirect users to an external documentation, but it is the 
best I can do for now.
A true additional documentation about new functions/operators, with 
recommendations, should be completed.
For instance, in the case of a mono-dimensional evaluation, always try to 
output a vector instead of a scalar: this allows keeping homogeneity inside 
expressions (and preventing from always asking whether to use brackets to 
enclose the output of an operator). And so on...

Regards,
Christophe.
 

Le mardi 9 décembre 2014 10:57:59 UTC+1, Guillaume Pasero a écrit :
>
>  Hi, 
>
> The NDVI is "hard-coded" in the OTB class that parses formulas : 
> http://orfeo-toolbox.org/doxygen/otbParser_8cxx_source.html
>
> I agree with you that it would be useful to define other functions and to 
> share them. For the moment, you would have to hack the code to add your own 
> functions.
> There is no dedicated wiki page at the moment, but the idea is 
> interesting. If we modify the framework to allow users to easily define 
> their own functions, this page should be initiated.
>
> Regards,
> Guillaume
>
> Le 05/12/2014 10:00, Agustin Lobo a écrit :
>  
> How was the ndvi function saved for ulterior use within BandMath?  It
> would be a useful example for the user to save other functions.
> Is there a wiki page where users could contribute their own BandMath
> functions beyond ndvi?
> Thanks
> Agus
>
> On Mon, Jun 30, 2014 at 2:55 PM, Julien Michel <[email protected]> 
> <javascript:> wrote:
>
>  Hi,
>
> MuParser allows to define additional functions. As a proof of concept, we
> added the ndvi function, but there are no other additional function I think.
>
> Regards,
>
> Julien
>
> Le 30/06/2014 14:46, Andreas Rabe a écrit :
>
> Hello,
>
> in the documentation "CookBook for Non-developers" inside a band math
> example the "ndvi" function is used:
> otbcli_BandMath -il verySmallFSATSW_r.tif verySmallFSATSW_nir.tif
> verySmallFSATSW.tif -out apTvUtBandMathOutput.tif -exp
> "cos(im1b1)+im2b1⋆im3b1-im3b2+ndvi(im3b3, im3b4)"
>
> , which is not part of the build-in functions of muparser
> (http://muparser.beltoforion.de/mup_features.html).
> I was wondering if anybody could provide a complete list of available
> functions for the otbcli_BandMath application.
>
> Thanks
> Andreas
> --
> --
> Check the OTB FAQ athttp://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 [email protected] 
> <javascript:>
> For more options, visit this group 
> athttp://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.
>
>
>
> --
> Julien MICHEL
> CNES - DCT/SI/AP - BPI 1219
> 18, avenue Edouard Belin
> 31401 Toulouse Cedex 09 - France
> Tel: +33 561 282 894 - Fax: +33 561 283 109
>
> --
> --
> Check the OTB FAQ athttp://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 [email protected] 
> <javascript:>
> For more options, visit this group 
> athttp://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*
> Ingénieur d'études et développement
>  *Business Unit E-SPACE & Geo Information* 
> <https://thor.si.c-s.fr/blogs/cs-blogs-business/>* - Département 
> 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.

Reply via email to