FreeMat: vtkSortFileNames

FreeMat

- Main Page
- Related Pages

vtkSortFileNames

Section: Visualization Toolkit IO Classes

# Usage

vtkSortFileNames will take a list of filenames (e.g. from a file load dialog) and sort them into one or more series. If the input list of filenames contains any directories, these can be removed before sorting using the SkipDirectories flag. This class should be used where information about the series groupings can be determined by the filenames, but it might not be successful in cases where the information about the series groupings is stored in the files themselves (e.g DICOM).

To create an instance of class vtkSortFileNames, simply invoke its constructor as follows

      obj = vtkSortFileNames

# Methods

The class vtkSortFileNames has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkSortFileNames class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkSortFileNames = obj.NewInstance ()`
- `vtkSortFileNames = obj.SafeDownCast (vtkObject o)`
- `obj.SetGrouping (int )` - Sort the file names into groups, according to similarity in filename name and path. Files in different directories, or with different extensions, or which do not fit into the same numbered series will be placed into different groups. This is off by default.
- `int = obj.GetGrouping ()` - Sort the file names into groups, according to similarity in filename name and path. Files in different directories, or with different extensions, or which do not fit into the same numbered series will be placed into different groups. This is off by default.
- `obj.GroupingOn ()` - Sort the file names into groups, according to similarity in filename name and path. Files in different directories, or with different extensions, or which do not fit into the same numbered series will be placed into different groups. This is off by default.
- `obj.GroupingOff ()` - Sort the file names into groups, according to similarity in filename name and path. Files in different directories, or with different extensions, or which do not fit into the same numbered series will be placed into different groups. This is off by default.
- `obj.SetNumericSort (int )` - Sort the files numerically, rather than lexicographically. For filenames that contain numbers, this means the order will be ["file8.dat", "file9.dat", "file10.dat"] instead of the usual alphabetic sorting order ["file10.dat" "file8.dat", "file9.dat"]. NumericSort is off by default.
- `int = obj.GetNumericSort ()` - Sort the files numerically, rather than lexicographically. For filenames that contain numbers, this means the order will be ["file8.dat", "file9.dat", "file10.dat"] instead of the usual alphabetic sorting order ["file10.dat" "file8.dat", "file9.dat"]. NumericSort is off by default.
- `obj.NumericSortOn ()` - Sort the files numerically, rather than lexicographically. For filenames that contain numbers, this means the order will be ["file8.dat", "file9.dat", "file10.dat"] instead of the usual alphabetic sorting order ["file10.dat" "file8.dat", "file9.dat"]. NumericSort is off by default.
- `obj.NumericSortOff ()` - Sort the files numerically, rather than lexicographically. For filenames that contain numbers, this means the order will be ["file8.dat", "file9.dat", "file10.dat"] instead of the usual alphabetic sorting order ["file10.dat" "file8.dat", "file9.dat"]. NumericSort is off by default.
- `obj.SetIgnoreCase (int )` - Ignore case when sorting. This flag is honored by both the sorting and the grouping. This is off by default.
- `int = obj.GetIgnoreCase ()` - Ignore case when sorting. This flag is honored by both the sorting and the grouping. This is off by default.
- `obj.IgnoreCaseOn ()` - Ignore case when sorting. This flag is honored by both the sorting and the grouping. This is off by default.
- `obj.IgnoreCaseOff ()` - Ignore case when sorting. This flag is honored by both the sorting and the grouping. This is off by default.
- `obj.SetSkipDirectories (int )` - Skip directories. If this flag is set, any input item that is a directory rather than a file will not be included in the output. This is off by default.
- `int = obj.GetSkipDirectories ()` - Skip directories. If this flag is set, any input item that is a directory rather than a file will not be included in the output. This is off by default.
- `obj.SkipDirectoriesOn ()` - Skip directories. If this flag is set, any input item that is a directory rather than a file will not be included in the output. This is off by default.
- `obj.SkipDirectoriesOff ()` - Skip directories. If this flag is set, any input item that is a directory rather than a file will not be included in the output. This is off by default.
- `obj.SetInputFileNames (vtkStringArray input)` - Set a list of file names to group and sort.
- `vtkStringArray = obj.GetInputFileNames ()` - Set a list of file names to group and sort.
- `vtkStringArray = obj.GetFileNames ()` - Get the full list of sorted filenames.
- `int = obj.GetNumberOfGroups ()` - Get the number of groups that the names were split into, if grouping is on. The filenames are automatically split into groups, where the filenames in each group will be identical except for their series numbers. If grouping is not on, this method will return zero.
- `vtkStringArray = obj.GetNthGroup (int i)` - Get the Nth group of file names. This method should only be used if grouping is on. If grouping is off, it will always return null.
- `obj.Update ()` - Update the output filenames from the input filenames. This method is called automatically by GetFileNames() and GetNumberOfGroups() if the input names have changed.