-
Notifications
You must be signed in to change notification settings - Fork 4
macro module #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macro module #116
Conversation
A preview of 9173128 is uploaded and can be seen here: ✨ https://mevislab.github.io/examples/pull/116/ ✨ Changes may take a few minutes to propagate. Since this is a preview of production, content with |
|
||
MeVisLab provides different types of modules, which can be distinguished by their color. The brown modules are called Macro modules. Macro modules condense a whole network into one module. You can open the internal network by pressing the middle mouse button {{< mousebutton "middle" >}} or via right mouse click {{< mousebutton "right" >}} and select {{< menuitem "Help" "Show Internal Network" >}}. Macro modules provide the possibility to create customized user interfaces and Python interactions. | ||
* **With Internal Networks**: Use a macro module to reuse a network of modules. For example, if you build a network that applies a specific image filter and you want to use this setup in multiple projects, you can wrap the entire network into a single macro module. This way, you don’t need to manually reconnect all the individual modules each time — you just use your macro module.You can see in the left side of the image is the Internal network. You can see an example in [Basic Mechanics of MeVisLab (Example: Building a Contour Filter)](/tutorials/basicmechanisms#TutorialMacroModules). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.You can see in the left side of the image is the Internal network. ->
. You can see the internal network at the left side of the image.
- which image this refers to?
* **Without Internal Networks**: Use a macro module to add your own Python code. If MeVisLab is missing a specific functionality, you can write your own Python script and include it in a macro module. | ||
This allows you to extend the software with custom behavior that integrates smoothly into your project. You can see the right side of the image the python code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see the right side of the image the python code. ->
You can see the Python code at the right side of the image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Macro modules are primarily defined using the MeVisLab Definition Language (MDL) and often incorporate Python scripting for more dynamic behavior. You don't need to write C++ code to create a macro module. | ||
* **User Interface:** | ||
You can define your own User Interface for macro modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...using MDL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
{{<alert class="info" caption="Info">}} | ||
Packages are the way MeVisLab organizes different development projects. You can organize zour own modules, test cases or C++ modules in a package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: zour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
You can also add fields to your macro module. Fields allow you to change parameters for your module or to see the values of results. Fields can also be added to the panel of the macro module so that the user can change them. | ||
* **Fields:** These are parameters that control the module's behavior, typically visible in the modules panel or in the Module Inspector. You define fields in the *\*.script* file using the Field keyword, specifying the data type, default value, and other properties. | ||
The below figure shows the input , outoutand feilds : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
### Files Associated with a Macro Module: | ||
Macro modules typically contain the following files: | ||
* **Definition file (*\*.def*):** The module definition file contains the definition and information about the module like name, author, package, etc. **Defintion files are only available for global macro modules**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: Defintion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* **Definition file (*\*.def*):** The module definition file contains the definition and information about the module like name, author, package, etc. **Defintion files are only available for global macro modules**. | ||
|
||
* **Script file (*\*.script*):** The script file defines inputs, outputs, fields and the user interface of the macro module. In case you want to add Python code, it includes the reference to the Python script file. The *\*.script* file allows you to define Python functions to be called for multiple situations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for multiple situations -> on field changes and user interactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* Field Listeners: Run Python code when a field value changes | ||
|
||
* Package: are the way MeVisLab organizes different development projects. Required for global macros. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -1,6 +1,6 @@ | |||
--- | |||
title: "Example 2: Macro modules and Module Interaction" | |||
date: 2022-06-15T08:58:44+02:00 | |||
date: 19-05-2025 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adapt format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* **Field changes**: You can also react on any changes of fields in your module and create Field Listeners. See below for details. | ||
* **Python file (*\*.py*):** *(Optional)*: The Python file contains the Python code that is used by the module. You can add Python functions to fields or UI elements to react on user interactions in the *\*.script* file. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add section about .mlab and .mhelp files here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added 2 comments
mevislab.github.io/content/tutorials/basicmechanisms/macromodules.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added 2 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mine are fine
No description provided.