Creating an Image-Pro Premier Add-in
edited March 2015 in Image-Pro Automation (Macros, Apps, Reports)
This short tutorial explains how to create an add-in for Image-Pro Premier using Microsoft Visual Studio. An add-in is an extension to Image-Pro Premier, which has full access to the Premier automation APIs (Application Programming Interface) and commands and implements some custom User Interface providing additional functionality to the product. It is similar to an Image-Pro Premier App but is compiled, developed and debugged using one of the versions of Microsoft Visual Studio, the Microsoft Integrated Development Environment (IDE), instead of the Premier Project Workbench. A free version, called Visual Basic Express 2010, can be downloaded on the Microsoft website.
Installing Visual Studio
The first step required to configure a computer to enable the development of such add-ins is to make sure that you have access to a copy of Microsoft Visual Studio 2010, either the free one, or the professional version with support for the VB.NET language.
Mapping the Image-Pro Premier Installation Folder
Once Visual Studio is installed, the next step is to create a X: logical drive to facilitate access to the Image-Pro premier installation directory and its dlls. This operation is performed in a DOS prompt, using the command subst to map the Premier installation folder (e.g. C:\Program Files\Media Cybernetics\Image-Pro Premier 9.1).
Installing the Add-in Template
After the X: drive is created, it is now time to download the attached ZIP file (Image-Pro Premier Add-in.zip) and save it to the Visual Studio Templates folder: My Documents\Visual Studio 2010\Templates\ProjectTemplates. Doing this, will allow us next, to use the Premier add-in template when creating a new project in Visual Studio.
Compiling the Project
Finally it's only a matter of compiling the resulting project, to create our first add-in. Note that you must have write access to the Image-Pro Premier application folder in order to compile successfully to that location which is the default output folder in this project. Once the project is successfully compiled to the X:\ folder, you can restart Image-Pro Premier and it should have a new Samples tab containing a "Sample Tool" button which when clicked will toggle the "Sample Tool" panel, displaying the name of the active document as an example.
At this point you have all the tools needed to build new Image Analysis features, as sophisticated as required, using the Image-Pro Premier commands and APIs, just like you would do with macros and Apps. Add-ins created using this approach will be compatible with all the variants of Image-Pro Premier, as well as the new Image-Pro Insight 9.1 as long as the APIs used are part of Insight.
I have created a PREMIER APP which supports the PRIOR STAGE and FOCUS via the OPTISCAN and PROSCAN controllers.
This APP is not as flexible as SCOPE-PRO / STAGE-PRO but it provides a solid foundation for anyone that would like to control the XYZ on a SCOPE via PRIOR HARDWARE from within PREMIER. The APP also includes a DEMO APP that illustrates how to communicate with the XYZ APP and therefore how to communicate with the XYZ HARDWARE.
Below is the TITLE PAGE from the DOCUMENTATION for this APP and a zoomed in view of the GRAPHIC that shows the UI.
I hope this information is helpful
Current versions of Visual Studio, including VS 2015 are also supported. Just copy the template to the corresponded VS folder (e.g. C:\Users\<<USER>>\Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual Basic)
Is there a demo add-in program which can be used for reference?
We don't have Addin demos, but I just created an addin in VB 2015 using the wizard (described above) and added one button "Apply Sobel filter" to the panel.
You can download the attached project, compile it and then run (don't forget to map Premier folder as X drive, as explained above). Then you can run Image-Pro Premier.exe and will see "Samples" tab in the ribbon, which will have one button that will open a panel with "Apply Sobel filter" button.
The same way you can create own addins using the wizard.
There are many apps available as demo samples, you can use code from any of our apps in addins.
- Yes, the Visual Studio Community edition can be an alternative to the Scripting Workbench in Image-Pro for individual developers (see https://visualstudio.microsoft.com/vs/compare/). The main differences are the tighter
integration of the workbench, the ability to step through the interpreted code
and the simplicity of app creation and deployment. Visual Studio is more difficult to use but provides more powerful tools.
- We recommand Visual Studio Professional, which can be used by any organization.
- Yes the information above is still applicable. Of course, the Visual Studio route is a bit more involved and there's some learning curve outside of Image-Pro before being able to deploy applications (called add-ins in that case).