Difference between revisions of "ParaView/UsersGuide/Macros"

From KitwarePublic
Jump to navigationJump to search
(Created page with "== Macros (aka Custom Filters) == It often happens that once you figure out how to do some specific data processing task, you will want to repeat that task often. It is very usef...")
 
(Replaced content with "{{ParaView/Template/DeprecatedUsersGuide}}")
 
(21 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Macros (aka Custom Filters) ==
+
{{ParaView/Template/DeprecatedUsersGuide}}
It often happens that once you figure out how to do some specific data processing task, you will want to repeat that task often. It is very useful to be able to reuse particular filters with exact filter settings (for example complicated calculator or programmable filter expressions) or even entire pipeline sections consisting of a number of filters on different datasets.
 
 
 
 
 
<nowiki>You can use of course edit and use state files <REFERENCE BATCH MODE CHAPTER?> to recreate entire ParaView sessions but this does not give you fine enough control for small, highly reusable tasks. Another alternative is to use Python Tracing <REFERENCE PYTHON TRACING>, which does give you fine grained control, but assumes that your have python enabled in your copy of ParaView (which is usually but not always the case) and that you remembered to turn on Trace recording before you did whatever it was that you wanted to be able to play back. ParaView’s Custom Filters suffer from neither of these problems.</nowiki>
 
 
 
 
 
A Custom Filter is a black box filter that encapsulates one or more filters in a sub-pipeline and exposes only those parameters from that sub-pipeline that the Custom Filter creator chose to make available. For example, if you have a ten element pipeline in your Custom Filter and each filter in the pipeline has eight controls, you can choose to expose anywhere from zero to eighty controls in your Custom Filter's Properties tab.
 
 
 
 
 
<center>[[File:ParaView_UsersGuide_CustomFilterConcept.png|400px|link=]]</center>
 
 
 
<center>'''Figure 13: Custom Filter concept'''</center>
 
 
 
 
 
Once you have set up some pipeline that performs the data processing that you want to reuse, the process of creating a Custom Filter consists of three steps. First select one or more filters from the Pipeline Browser using the mouse. Next from the Tools menu select Create Custom Filter. From that dialog choose the module who's input is representative of where you want data to enter into your Custom Filter. This is usually the topmost filter. If you are creating a multi-input filter, use the + button to add more and configure it as well. Clicking Next brings you to a similar dialog that you use similarly to configure one or more outputs of your Custom Filter. Click Next again to get to the last dialog. This dialog is where you specify the parameters of the internal filters that you want to expose to the eventual user of your custom filter. You also are able here to give each parameter a label if you like. The three dialogs are shown below.
 
 
 
 
 
{| style="border-spacing:0;"
 
| style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| <center>Step 1: configure one or more inputs to your new filter.</center>
 
| style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"|
 
<center>[[File:ParaView_UsersGuide_CustomFilterInputs.png|400px|link=]]</center>
 
 
 
|-
 
| style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| <center>Step 2: configure one or more outputs of your new filter.</center>
 
| style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"|
 
<center>[[File:ParaView_UsersGuide_CustomFilterOutputs.png|400px|link=]]</center>
 
 
 
|-
 
| style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"| <center>Step 3: identify and name the controls you want to expose of your new filter.</center>
 
| style="border:none;padding-top:0in;padding-bottom:0in;padding-left:0.075in;padding-right:0.075in;"|
 
<center>[[File:ParaView_UsersGuide_CustomFilterParameters.png|400px|link=]]</center>
 
 
 
|}
 
<center>'''Figure 9: Creating a Custom Filter'''</center>
 
 
 
 
 
Once you create a Custom Filter it is added to the Alphabetical sub menu of the Filters menu. It is saved in ParaView's settings, so the next time you start ParaView on the same machine you will have access to your new filter. Custom Filters are treated no differently than other filters in ParaView and are saveable and restorable in state files and python scripts. If you find that you no longer need some Custom Filter, you can use the Tools->Manage Custom Filters dialog box to remove it from your Filters menu.
 
 
 
 
 
If on the other hand you find that a Custom Filter is very useful, you may instead want to give it to a colleague. On that same dialog are controls for exporting and importing Custom Filters. When you save a Custom Filter you are prompted for a location and filename to save the filter in, and the filter will be written to that file in an XML text file that you can simply email to share.
 

Latest revision as of 14:37, 14 January 2015

PAGE DELETED
The Users Guide has been moved from the Wiki to The ParaView Guide. Please use the history if you want to access the old version of this document.