FileDirectory

MacroModule
genre File
author MeVis Medical Solutions AG
package MeVisLab/Standard
definition FileHandling.def
see also FileInformation, LocalImage, MakeName, FieldIterator
keywords Filename, path

Purpose

The module FileDirectory can be used to obtain a list of entries in a given directory, with or without the recursive inclusion of subdirectories. Filename patterns can be specified to restrict the list to certain file subsets.

Usage

The parameter fields in the File Set Selection section are used to specify the directory from which the entries are read (or the root directory in case a recursive scan of subdirectories is desired), the type of the file entries in the generated list (plain file, directory or both), and whether to treat paired image files (such as DICOM/TIFF pairs) as a single entry.

The fields in the Filename Patterns section can be used to specify optional Include patterns, excluding all entries that do not match these patterns, as well as optional Exclude patterns, excluding all entries matching these patterns. Each pattern is tested against the full file path; use wildcards to specify patterns for substrings. Multiple patterns can be separated by spaces. Both include and exclude patterns can contain regular expressions (if the Regular Expression option is checked) or standard wildcard characters (‘*’ and ‘?’).

See the MakeName module documentation for a reference of the most important regular expressions. Some predefined Include patterns can be entered using the Set Pattern buttons.

Pressing the Update buttons generates a list of directory entries in the File List field. The representation of the directory portion of these entries is controlled by the Include Path pop-up menu.

Details

The Join Image Pairs option enables a special handling of paired image files. Currently, pairs of DICOM/TIFF files, recognized by .dcm and .tif extensions, and Analyze image files, recognized by .hdr and .ima extensions, are handled.

When Join Image Pairs is enabled, only one of the files for such an image file pair will be included in the generated file list.

The Ignore Case setting in the Filename Patterns section should be activated on operating systems with non-case-sensitive file systems (e.g. Windows).

Windows

Default Panel

../../../Modules/Macros/FileHandling/mhelp/Images/Screenshots/FileDirectory._default.png

Parameter Fields

Visible Fields

Root Path

name: rootPath, type: String

Sets the path to the root directory containing the files to list.

Include subdirectories

name: recursive, type: Bool, default: FALSE

If checked, subdirectories of the root directory are recursively included.

Maximum Search Depth (-1 for no limit)

name: maxRecursionDepth, type: Integer, default: -1

Sets the maximum subdirectory depth for the subdirectory inclusion. For unlimited depth, select a negative value.

File Type

name: fileType, type: Enum, default: Files

Defines the type of the directory entries to be included in the generated file list.

Values:

Title Name
Files Files
Dirs Dirs
All All

Join image pairs

name: joinImagePairs, type: Bool, default: FALSE

If checked, paired image files (e.g. DICOM/TIFF pairs) are treated as a single file.

Include

name: include, type: String

If include patterns (separated by spaces) are specified, only entries matching at least one of these patterns are included in the list.

Regular expression (includeRegExp)

name: includeRegExp, type: Bool, default: FALSE

If checked, the include pattern can contain regular expressions.

Predefined

name: predefined, type: Enum, default: void

Defines a predefined pattern

Values:

Title Name
void void
All All
Images Images
Dicom Dicom

Exclude

name: exclude, type: String

If exclude patterns (separated by spaces) are specified, entries matching at least one of these patterns are excluded in the list.

Regular expression (excludeRegExp)

name: excludeRegExp, type: Bool, default: FALSE

If checked, the exclude pattern can contain regular expressions.

Ignore case

name: ignoreCase, type: Bool, default: TRUE

If checked, upper/lower cases are ignored.

File List

name: fileList, type: String, persistent: no

Shows the generated list of files. It is not updated until the Update button is pressed.

Include Path

name: dirMode, type: Enum, default: Absolute

Sets how the directory portion of the file entries are represented in the generated file list.

Values:

Title Name Description
Absolute Absolute The file list contains absolute file paths.
Relative Relative The file list contains file paths relative to the root path.
Strip Strip The file list contains no path specifications.

Update

name: update, type: Trigger

If pressed, the File List is updated.

Clear

name: clear, type: Trigger

If pressed, the file list is cleared.