AnimFilenameGen

Synopsis

Outputs a filename string which includes a sequence number within user specifiable text, which may be looped according to the given parameters, by using the accompanying module AnimFilenameLoop.

  module AnimFilenameGen {
    AnimFilenameParams &AnimFilenameParams;
    string pre => AnimFilenameParams.pre;
    string post => AnimFilenameParams.post;
    int number;
    int precision => AnimFilenameParams.precision;
    string format => str_format("%%s%%.%dd%%s",.precision);
    string output =>
        str_format(.format,.pre,.number,.post);
  };

Description

AnimFilenameGen allows the user to pass a sequence of filenames to other modules and macros, allowing a set of files to be read from disk, that have a naming scheme that incorporates a simple sequence of numbers. AnimFilenameGen will generate a filename on its output, each time the module receives a new sequence number from the AnimFilenameLoop module, when it executes during its loop.
The module parameters allow text to be included in the output filename string, that occurs both before and after the number. Additionally, the number may have a precision attached to it.
The module works in conjunction with the AnimFilenameLoop module which is a variation of the AVS/Express loop module. The AnimFilenameLoop works as before, and requires the start and end values for the loop to be specified, along with an increment value. In addition to this the AnimFilenameLoop module has reset, run and cycle toggles, to respectively reset the output sequence number, start the loop, and allow the loop to repeatedly cycle, until the user stops it.
The AnimFilenameUI UI Macro incorporates a user interface for both the AnimFilenameGen and AnimFilenameLoop modules, via the Functional Macro, AnimFilename.

Inputs

&AnimFilenameParams
Reference to the parameter block, which contains references to the real instances of the pre- and post-text, and the precision.
pre
Reference to the pre-text, which is placed before the sequence number in the output filename string, via the parameter block, i.e., <pre>000.tif.
post
Reference to the post-text, which is placed after the sequence number in the output filename string, via the parameter block, i.e., myfile000<post>.
precision
Reference to the sequence number precision to be used in the generation of the output filename string. This allows the number of digits used for the sequence number to be fixed to at least the precision given, e.g., precision=1, produces output of the form <pre>0<post>, whereas precision=3, forces it to <pre>000<post>. If the numer of digits exceeds the precision, then the required number of digits will be present, e.g., precision=3, and the sequence has reached 1234, then the output will be <pre>1234<post>.
number
The sequence number to be used in the generation of the output filename string. This number is normally provided by the AnimFilenameLoop module included with this project, which generates the number sequence.

Outputs

output
The output filename string, which contains the string based on the pre- and post-text, with the current input number inserted according to the specified precision.

Utility Macros

The low-level AnimFilenameGen module is used in conjunction with the AnimFilenameLoop module (which is a variation of the AVS/Express loop module), and used in the Functional Macro AnimFilename, and the User Macro animfilename. Additionally these macros also use the AnimFilenameParams and AnimLoopParams parameter block group objects, as does the AnimFilenameUI UI Macro.

Example

An example application is not provided, however the use is very simple. For example, typing "myfile" into pre-text, ".tif" into post-text, setting precision to 3, and using start and end values of 0 and 10 respectively, with an increment of 1, will produce the sequence "myfile000.tif", "myfile001.tif", and so on upto "myfile010.tif".

Files

iac_proj/animfile/afn_mods.v contains the AnimFilenameParams and AnimLoopParams groups, the AnimFilenameGen module, and the modified AVS/Express module loop (as AnimFilenameLoop) module V definitions.

Other Notes

The AnimFilenameGen and AnimFilenameLoop modules do not require any compilation.

Author

Paul G. Lever

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
UK
M13 9PL

See Also

AnimFilenameParams, AnimLoopParams, AnimFilenameLoop, AnimFilename, AnimFilenameUI and animfilename.
Loop, loop