I’m learning how to integrate an external tool in SNAP.
The documentation is very brief (https://senbox.atlassian.net/wiki/spaces/SNAP/pages/14811213/How+to+integrate+an+external+tool+in+SNAP).
Is there any more detailed documentation (with some examples) somewhere?
First, I would like to integrate a tool from its binary file (obtained by compiling codes written in Matlab).
I work on Linux Mint 20.1.
If I understand correctly, I must enter the binary file as a zip file.
If I enter the zip file containing the executable, it does not work.
Can you explain what must contain the zip file?
For non-experienced users, it is true that the integration of external tools is highly complex. If I may comment, I think it would be highly appreciated to dispose of such tutorials.
@ABraun, do you know if these types of tutorials are scheduled?
I would like to add a comment to what has been posted.
My question may not necessarily ask for tutorials.
I think that all I need for now is just an example tool with a simple code written in C, C++ or Matlab, the zip file containing its executable and screen shots with the panels to fill in the ‘External Tools’ dialog box of SNAP for the integration of the tool.
Thanks in advance.
Fully agree that this would foster the development of user tools.
Have you seen the two videos in the tutorial section:
Tutorials – STEP (esa.int)
Search for ‘tool adapter’ or use these direct links:
SNAP - Standalone Tool Adapter Module (with bundle) - YouTube
SNAP - Standalone Tool Adapter - YouTube
If these do not resolve your problems maybe @oana_hogoiu or @kraftek have an example, or can help you further.
Thanks a lot!
I will see if it helps.
I tried to do the integration with the tutorials ‘SNAP - Standalone Tool Adapter Module’ and ‘SNAP - Standalone Tool Adapter Module (with bundle)’, and yes it helps to better understand how the integration of external tools work.
Nevertheless, I’m stuck at installation time: in the panel ‘Bundled Binaries’, when I click on the button ‘Install now’, the installation failed and the message ‘Bundle installation failed. Please see the application log for details’ is shown. I can send you the log file.
Also, an example can help.
If it is possible, I would like to have an example for Linux with the shell file (with extension .sh instead of .bat), with the code, the zip file including the executable and a document or screen shots to configure the integration in SNAP.
If I correctly understand, you would just want to create an adapter over either a locally compiled executable or a shell script. In this case, you don’t need to “bundle” the executable and its dependencies. The bundle is intended for distributing an adapter together with the wrapped executable.
To create a simple adapter, the SNAP help covers the topic (Help > Sentinel Toolbox Application > Tools > Standalone Tool Adapter > Adapter Editor).
If you prefer being inspired from an existing adapter, you can install OTB adapters (go to Tools > Plugins > Available Plugins > Sentinel-2 Toolbox OTB Adapters Module) and then, after installing, go to Tools > Manage External Tools and edit one of the installed adapters. The OTB adapters are intended for either Windows or Linux (for executables, the tool adapters have the so-called “platform-dependent” variables that allow to specify a value for each OS).
Sorry for the delay. We are testing other solutions in parallel.
In the examples of the OTB adapters, the bundles are created with a run file made by Makeself.
Can you tell us how to create such file for the installation of our application?
We have an executable (related to a particular OS (here Linux) and a particular version of Matlab runtime) and an installer (that will install the application as the Matlab runtime).
Thanks in advance for your help.
I just succeed in making a run file for installing my application and the Matlab runtime.
When I click on the button ‘Install now’ in the configuration of the external tool, the installation is done to the end but there is still a message of SNAP that the installation failed. Can you help?
So that you can better understand the problem can I send you the screenshots showing our integration steps?
Sure. You can attach them here.
MatlabApp_IntSNAP_Run.zip (4.0 MB)
Why it fails with an error I don’t know. Maybe you can see something in the logs?
How to find the log files? - SNAP FAQs
In general, the adapter should not wrap the installer but the already installed executable. This might be the reason it fails.
Here is the log file:
messages.log (77.0 KB)
Regarding your suggestion, the adapter here wraps the installer.
Before, we made an adapter that wrap the installed executable and it works.
By wrapping the installer, we wanted to find a solution that installs the application without the user having to install it.
Is there any way to do it?
The mechanism is already in place in the STA module. What you have to do:
- Create the adapter wrapping you executable (and not the installer)
- Create the installer for your executable
- Then you have the possibility to define the “bundle” for your adapter via the user interface (editing the adapter): what is the installer (either a local file or, if you want the users to download it, the URL from where it can be downloaded)
- Then you can export the adapter as a nbm module that you can distribute to your users
Please follow the working example of OTB adapters on how the paths should be handled in the adapter/bundle definition.
Thanks. I will test that.
Thanks. This helped me to find a solution of integration with a bundle.
For this first test, I made a very simple code that takes the path of the directory with the input data as input. Now, I would like to make a test with a little more complex code that takes a SNAP product as input. To that aim, I must enter the lines ‘-in’, ‘$sourceProductFile’ in the command line of the window ‘Configuration Parameters’. But, I do not clearly see what must be the corresponding input in my code. Can you explain? Do you have an example of code?
Thanks again in advance.