The MontiVision I/O Textfile Renderer Filter is used to save data from a filter into a structured text file.
| File: | MVIOTextfileRenderer.ax |
| CLSID: | CLSID_MVIOTextfileRenderer |
Supported Interfaces
MV I/O Textfile Property Page
Implements the IMVIOTextfileRenderer configuartion interface.
| Create on run | The filter creates the outputfile every time the graph is started. |
| Create on every dataset | The filter creates a file for every dataset, received on its input pins. |
| Name | Path to a template file for the file name. |
| Folder | Output folder for the text files. |
| Header | Path to a template file for the file header. |
| Dataset | Path to a template file for a dataset. |
| Footer | Path to a template file for the file footer. |
| Edit | Start notepad with the template file. |
Template files
The filter can use template files to customize the text output file. There are four templates available, one for the file name, the file header, a dataset and the file footer. All template files use the same simple syntax:
| Text | Output as it is. |
| Variable | %Variable Name% |
| % | %% |
Template variables
The following table shows all the available fixed variables for template files.
| YEAR | 4 digit year, e.g. 2003. |
| SHORT_YEAR | 2 digit year, e.g. 03 |
| MONTH | 2 digit month, e.g. 01 |
| MONTH_NAME | Name of the month, e.g. January. |
| DAY | 2 digit day, e.g. 29. |
| DAY_NAME | Week name of the day, e.g. Monday. |
| WEEK | 2 digit week number, e.g. 45. |
| HOUR | 2 digit hour, e.g. 17. |
| MINUTE | 2 digit minute, e.g. 54. |
| SECOND | 2 digit second, e.g. 32. |
| DS_COUNT | Counter for the datasets since the filter graph was started. |
| RUN_COUNT | Counter for the run sessions of the filter graph. |
| FILE_COUNT | Counter for the files created by the filter. |
Additionally a template can contain a variable with the name of the input pin, e.g. %Input1%. The filter substitutes the variable with the value from the input pin as a string. If the variable name is not valid the filter inserts no text for the variable.
File Name Template
The file name template describes the file name for the output data. If no file name template is selected, the filter generates no output. If a file name exists the filter overwrites the file without any prompt. You can create unique file names with the FILE_COUNT variable. If the file name template includes the FILE_COUNT variable the filter increments the counter until it finds an unused file name. If an output folder is selected, the path to the output folder is copied in front of the filename. The filter automatically adds the backslash after the folder path.
Example:
%YEAR%-%MONTH%-%DAY%-Result-%FILE_COUNT%.xml
This template would result in filenames like this: 2003-01-27-Result-1.xml
Header, Dataset, Footer Template
The other three template files describes the content of the textfile created by the filter. The header text is inserted at the beginning of the file, when opened. The footer text is written at the end of the file before the file is closed. The dataset template is used to create a text output for every dataset received on the input pins.
Example:
This example shows the template files for the filter graph showing below. It saves the two thresholds from the binary filters into an simple XML file. The binary filter uses different algorithms to calculate the threshold.
Header Template:
<HEADER date="%DAY%.%MONTH%.%YEAR%">
Footer Template:
</HEADER>
Dataset Template:
<dataset
count="%DS_COUNT%" time="%HOUR%:%MINUTE%:%SECOND%">
<Value alg="Edge
Pixels">%Input1%</Value>
<Value alg="Two
Peaks">%Input2%</Value>
</dataset>
The example filter graph creates an output file like this:
<HEADER
date="28.01.2003">
<dataset count="1" time="13:57:46">
<Value alg="Edge
Pixels">203</Value>
<Value alg="Two
Peaks">225</Value>
</dataset>
<dataset count="2" time="13:57:46">
<Value alg="Edge
Pixels">194</Value>
<Value alg="Two
Peaks">197</Value>
</dataset>
<dataset count="3" time="13:57:46">
<Value alg="Edge
Pixels">182</Value>
<Value alg="Two
Peaks">184</Value>
</dataset>
</HEADER>