+Make sure to use a compiler that is compatible to your currently installed MeVisLab version.</div></div><h3 id=ml-modules-on-the-c-level>ML modules on the C++ level</h3><ul><li>Image processing modules are objects derived from class Module defined in the ML library and therefore are also called ML modules.</li><li>Image inputs and outputs are connectors to objects of class PagedImage, which are defined in the ML library.</li><li>Inputs and outputs for abstract data structures are connectors to pointers of objects derived from class Base and are called Base objects.</li></ul><h3 id=inventor-modules-on-the-c-level>Inventor modules on the C++-level:</h3><ul><li>Most Inventor modules are objects derived from class SoNode defined in the Open Inventor library.</li><li>Inventor inputs and outputs are connectors to objects derived from class SoNode defined in the Open Inventor library. Many Inventor modules will return themselves as outputs (“self”). On inputs, they may have connectors to child Inventor modules.</li><li>Some Inventor modules are objects derived from class SoEngine. They are used for calculations and return their output not via output connectors but via fields.</li><li>Inventor modules may also have input and output connectors to Base objects and Image objects.</li><li>All standard Inventor nodes defined in the Open Inventor library are available in MeVisLab as Inventor modules.</li></ul><p>This chapter describes some examples for developing your own ML and Inventor modules.</p><h2 id=some-tips-for-module-design>Some Tips for Module Design</h2><h3 id=macro-modules-or-c-modules>Macro Modules or C++ Modules?</h3><p>In <a href=tutorials/basicmechanisms/macromodules/>Example 2: Macro Modules</a>, we already described Macro Modules and how to create them yourself.</p><p><strong>Advantages of macros:</strong></p><ul><li>Macros are useful for creating a layer of abstraction by hierarchical grouping of existing modules.</li><li>Scripts can be edited on the fly:<ul><li>no compilation and reload of the module database necessary</li><li>scripting possible on the module or network level</li><li>scripting supported by the Scripting Assistant View (basically a recorder for actions performed on the network)</li></ul></li></ul><p><strong>Disadvantages:</strong></p><ul><li>With macros, only existing functionalities and algorithms can be used.</li></ul><p><strong>Conclusion:</strong></p><ul><li>For rapid prototyping based on existing image processing algorithms, use macros.</li><li>For implementing new image processing, write new ML or Open Inventor modules.</li></ul><h3 id=combining-functionalities>Combining Functionalities</h3><p>It is possible to have ML and Open Inventor connectors in the same module. Two cases are possible:</p><ul><li>Type 1: <strong>ML -> visualization:</strong> Image data or properties are displayed by a visualization module. Usually a <field>SoSFXVImage</field> field gets random access to an ML image by <em>getTile()</em>. Examples: <code>SoView2D</code>, <code>GlobalStatistics</code>.</li><li>Type 2: <strong>visualization -> ML:</strong> Modules generate an ML image from an Inventor scene. Examples: <code>VoxelizeInventorScene</code>, <code>SoExaminerViewer</code> (hidden functionality).</li></ul><p>Generally, however, it is not always a good solution to combine that, as the processes of image processing and image visualization are usually separated.</p><p>Therefore, rather separate the ML and Open Inventor functionalities into two modules. This way,</p><ul><li>functionality is encapsulated and can be reused as module</li><li>modules for the single steps may already be available in MeVisLab and spare you a new development</li></ul><h2 id=code-examples>Code examples</h2><p>In addition to the tutorials in this chapter, you can find additional code examples in your MeVisLab installation directory.</p></div></div><script>const body_element=document.querySelector("html body"),modal_div=document.createElement("div");let modal_window=document.body.appendChild(modal_div),modal_html='<div class="modal fade" id="lightboxModalFullscreen" tabindex="-1" aria-labelledby="lightboxModalFullscreenLabel" aria-hidden="true"><div class="modal-dialog modal-fullscreen" data-bs-dismiss="modal" aria-label="Close"><div class="modal-content border-0"><div class="modal-body d-flex align-self-center align-items-center justify-content-center"><div class="modal-custom"><img src="" id="LightboxCanvas" class="img-fluid" data-bs-dismiss="modal" aria-label="Close" /><figcaption id="LightboxCaption" class="figure-caption"></figcaption></div></div></div></div></div>';modal_window.innerHTML=modal_html,Array.from(document.querySelectorAll('[data-modal*="bs-lightbox"]')).forEach(e=>{e.setAttribute("data-bs-toggle","modal"),e.setAttribute("data-bs-target","#lightboxModalFullscreen"),e.addEventListener("click",t=>{const n=e.getAttribute("href"),s=e.getAttribute("title");document.getElementById("LightboxCanvas").src=n,document.getElementById("LightboxCaption").innerHTML=s,t.preventDefault(),console.log(n)})})</script><hr><div class=row style=margin:25px!important><div class=col><a href=https://mevislab.github.io/examples/pull/139/tutorials/image_processing/ title="Chapter IV: Image Processing" class="btn btn-outline-secondary btn-sm" role=button aria-pressed=true><svg width="16" height="16" fill="currentColor" class="bi bi-skip-start-fill" viewBox="0 0 16 16"><path d="M4 4a.5.5.0 011 0v3.248l6.267-3.636c.54-.313 1.232.066 1.232.696v7.384c0 .63-.692 1.01-1.232.697L5 8.753V12a.5.5.0 01-1 0V4z"/></svg> Chapter IV: Image Processing</a></div><div class=col style=text-align:right><a href=https://mevislab.github.io/examples/pull/139/tutorials/image_processing/cpp_1/ title="Example 1: Creating a New ML Module for Adding Values" class="btn btn-outline-secondary btn-sm" role=button aria-pressed=true>Example 1: Creating a New ML Module for Adding Values
0 commit comments