Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
eyes:flowcontrol:script [2018/01/18 17:18] sfiedle |
eyes:flowcontrol:script [2018/01/22 15:59] (current) sfiedle [Example] |
||
---|---|---|---|
Line 7: | Line 7: | ||
**To access an image in the I/O** | **To access an image in the I/O** | ||
<code lua>cow.io[number of the image in the I/O]</code> | <code lua>cow.io[number of the image in the I/O]</code> | ||
+ | Example \\ | ||
+ | The following line reads the 100-th image in the current I/O. | ||
+ | <code lua>cow.io[100]</code> | ||
**To read a header key of the I/O** | **To read a header key of the I/O** | ||
<code lua>cow.io[number of the image in the I/O] ["image header value name"]</code> | <code lua>cow.io[number of the image in the I/O] ["image header value name"]</code> | ||
+ | Example \\ | ||
+ | The following line reads the Euler angle β of the 0-th image in the current I/O. | ||
+ | <code lua>cow.io[0]["eulerBeta"] </code> | ||
**To read a header key of the I/O and write it to a [[eyes:flowcontrol:variable|]]** | **To read a header key of the I/O and write it to a [[eyes:flowcontrol:variable|]]** | ||
<code lua>cow.VariableName = cow.io[number of the image in the IO]["image header values name"] </code> | <code lua>cow.VariableName = cow.io[number of the image in the IO]["image header values name"] </code> | ||
- | Example | + | Example \\ |
- | <code lua>cow.AngleBeta = cow.io[0]["eulerBeta"] </code> | + | The following line reads the dimension in X of the 100-th image in the current I/O to the [[eyes:flowcontrol:variable|]] dimension, which is of type integer. |
- | Saves the Euler angle Beta of the 0-th image in the I/O to the Variable AngleBeta. | + | |
<code lua>cow.dimension = cow.io[100]["dimX"] </code> | <code lua>cow.dimension = cow.io[100]["dimX"] </code> | ||
- | Saves the dimension in X of the 100-th image in the I/O to the Variable dimension. | ||
- | |||
- | <code lua>cow.dimension = cow.io[cow.iter]["dimX"] </code> | ||
- | Saves the dimension in X of the i-th image in the I/O to the Variable dimension. It is necessary to set up a iteration Variable, which is incremented by [[eyes:flowcontrol:calculate|]]. | ||
**To overwrite the header value in the I/O** | **To overwrite the header value in the I/O** | ||
Line 31: | Line 31: | ||
cow.io[number of the image in the IO] = temporary variable name </code> | cow.io[number of the image in the IO] = temporary variable name </code> | ||
- | Example | + | Example \\ |
+ | The following lines reads the 0-th image of the current I/O to temp. In the second line the header value dimX of the temporary variable temp is set to 100. The last line of code passes the temporary variable back to the 0-th position of the I/O. | ||
<code lua> | <code lua> | ||
temp = cow.io[0] | temp = cow.io[0] | ||
temp["dimX"] = 100 | temp["dimX"] = 100 | ||
cow.io[0] = temp </code> | cow.io[0] = temp </code> | ||
- | Manipulates the header value dimX of the 0-th image in the I/O. The header dimX is set to 100. | ||
+ | The following lines manipulate the header value dimX of the 100-th image in the I/O. The header dimX is set to the Variable of type Sting with value dimension. The header key is not of type Integer anymore. | ||
<code lua> | <code lua> | ||
temp = cow.io[100] | temp = cow.io[100] | ||
temp["dimX"] = cow.dimension | temp["dimX"] = cow.dimension | ||
cow.io[100] = temp </code> | cow.io[100] = temp </code> | ||
- | Manipulates the header value dimX of the 100-th image in the I/O. The header dimX is set to the Variable dimension. | ||
** To write new header values to the I/O ** | ** To write new header values to the I/O ** | ||
+ | |||
<code lua> | <code lua> | ||
temporary variable name = cow.io[number of the image in the IO] | temporary variable name = cow.io[number of the image in the IO] | ||
Line 50: | Line 51: | ||
cow.io[number of the image in the IO] = temporary variable name </code> | cow.io[number of the image in the IO] = temporary variable name </code> | ||
- | Example | + | Example \\ |
+ | The following lines write a new header key named linearFactor to the header of the 0-th image in the I/O. The header linearFactor is set to a Variable of type String with value factor. | ||
<code lua> | <code lua> | ||
temp = cow.io[0] | temp = cow.io[0] | ||
temp["linearFactor"] = cow.factor | temp["linearFactor"] = cow.factor | ||
cow.io[0] = temp </code> | cow.io[0] = temp </code> | ||
- | |||
- | Writes the new header value linearFactor for the 0-th image in the I/O. The header linear Factor is set to the Variable factor. | ||
**Manipulate the whole I/O** \\ | **Manipulate the whole I/O** \\ | ||
Line 62: | Line 62: | ||
<code lua>cow.VariableName = cow.io[cow.IterationVariableName]["image header values name"]</code> | <code lua>cow.VariableName = cow.io[cow.IterationVariableName]["image header values name"]</code> | ||
+ | Example \\ | ||
+ | The following line reads the header key dimX of the i-th image in the I/O and passes it to the [[eyes:flowcontrol:variable|]] dimension. In order to iterate though the whole I/O it is necessary to set up a Variable named e.g. iter of type integer, which is incremented at the end of the script. | ||
+ | <code lua> | ||
+ | cow.dimension = cow.io[cow.iter]["dimX"] | ||
+ | cow.iter = cow.iter + 1 </code> | ||
===== Example ==== | ===== Example ==== | ||
Line 67: | Line 72: | ||
**Properties Window** | **Properties Window** | ||
- | |< 100% 5% 50% >| | + | |< 100% 5% 35% >| |
^ ^ ^ ^ | ^ ^ ^ ^ | ||
- | |{{:eyes:flowcontrol:a.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript1properties.png?nolink&500|}}| | | + | |{{:eyes:flowcontrol:a.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript1properties.png?nolink|}}|In the properties window the Script lines is shown. Here the dimension in X is read from the header key "dimX" and passed to the [[eyes:flowcontrol:variable|]] dimension.| |
- | |{{:eyes:flowcontrol:b.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript1var.png?nolink&500|}}| | | + | |{{:eyes:flowcontrol:b.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript1var.png?nolink|}}|The Variable of type decimal is called dim. The default value is zero.| |
- | |{{:eyes:flowcontrol:c.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript1group.png?nolink&500|}} | | | + | |{{:eyes:flowcontrol:c.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript1group.png?nolink|}}|The value of the Variable dim after executing the Script can be checked by clocking into the work space of a [[eyes:flowcontrol:group|]].| |
Line 77: | Line 82: | ||
**Properties Window** | **Properties Window** | ||
- | |< 100% 5% 50% >| | + | |< 100% 5% 35% >| |
^ ^ ^ ^ | ^ ^ ^ ^ | ||
- | |{{:eyes:flowcontrol:a.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript2script.png?nolink&500|}}| | | + | |{{:eyes:flowcontrol:a.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript2script.png?nolink&500|}}|Here a new header key is added to the image in the I/O. The first position in the current I/O is read to the temporary variable temp. To add a new header key and value we just call temp of the preferred new key and set is to a any value. There is no need to define it before hand. In addition it is possible to use a Variable as a value for the header key as explained in **To write new header values to the I/O**.| |
- | | |{{:eyes:flowcontrol:examplescript2header.png?nolink&500|}}| | | + | | |{{:eyes:flowcontrol:examplescript2header.png?nolink&500|}}| After running the Script it is possible to open the Viewer and check if the header key war written to the I/O. On the left side is a screenshot showing the new header key and value as well as the preexisting header key pixel size. All header keys are alphabetically ordered.| |
- | {{ :eyes:flowcontrol:examplescript3.png?nolink&600 |}} | + | {{ :eyes:flowcontrol:examplescript3.png?nolink&800 |}} |
**Properties Window** | **Properties Window** | ||
- | |< 100% 5% 50% >| | + | |< 100% 5% 35% >| |
^ ^ ^ ^ | ^ ^ ^ ^ | ||
- | |{{:eyes:flowcontrol:a.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript3script.png?nolink&500|}}| | | + | |{{:eyes:flowcontrol:a.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript3script.png?nolink&500|}}|The scirpt writes to the current position in the I/O the iteration variable value as header value to the header key "imageNumber".| |
- | |{{:eyes:flowcontrol:b.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript3var.png?nolink&500|}}| | | + | |{{:eyes:flowcontrol:b.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript3var.png?nolink&500|}}|The Variable of type integer is called iter. The default value is zero.| |
- | |{{:eyes:flowcontrol:c.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript3calc.png?nolink&500|}} | | | + | |{{:eyes:flowcontrol:c.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript3calc.png?nolink&500|}}|The element [[eyes:flowcontrol:calculate|]] iterates through the I/O. It is linked with the output of the Script and the input of the [[eyes:flowcontrol:queue|]]. After each execution of the Script the calculation element takes the Variable iter and adds one to it.| |
- | |{{:eyes:flowcontrol:d.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript3group.png?nolink&500|}} | | | + | |{{:eyes:flowcontrol:d.png?nolink&40|}}|{{:eyes:flowcontrol:examplescript3group.png?nolink&500|}}|The value of the Variable iter after executing the Script can be checked by clocking into the work space of a [[eyes:flowcontrol:group|]].| |