[vtk-developers] Re: vtkStringArray and vtkImageReader
Lorensen, William E (GE, Research)
lorensen at crd.ge.com
Thu Feb 9 08:42:42 EST 2006
The itkArchetypeSeriesFilenames class discovers patterns like the ones you describe. It uses the itkRegularExpressionSeriesFilenames internally. All regular expression, file and directory handling is done in a system independent way using kwsys. Similar classes could be written for vtk.
Bill
-----Original Message-----
From: vtk-developers-bounces+lorensen=crd.ge.com at vtk.org
[mailto:vtk-developers-bounces+lorensen=crd.ge.com at vtk.org]On Behalf Of
dean.inglis at camris.ca
Sent: Thursday, February 09, 2006 8:24 AM
To: vtk-developers at vtk.org
Subject: [vtk-developers] Re: vtkStringArray and vtkImageReader
Hi David,
I run into file name schemes of the type (sorted here)
I0012345.M01
I0012345.M02
I0012345.M03
I0012346.M01
I0012346.M02
or in general:
*< numeric_1 >.*< numeric_2 >
wherein standard alphabetical sorting does not work,
and sorting is required on two passes:
first on numeric_1 and then on numeric_2.
With regard to item 2), would it be sensible to
implement the API for vtkSortSeriesFileNames using a
callback mechanism: that is either vtkSortSeriesFileNames
(or vtkImageReader) could broadcast a vtkCommand::SortFileNames
event that users could add a callback to that would permit
custom sorting. Use scenario:
vtkStringArray array
vtkSortSeriesFileNames sorter
sorter AddObserver vtkCommand::SortFileNames mysortcallback
sorter SetFileNameArray array
sorter Sort
vtkImageReader reader
reader SetFileNameArray sorter GetSortedFileNameArray
Just a thought, and thanks for working on this. I for one
welcome the additions! The other thing that would be useful is if
vtkImageReader could read a series of single files having variable
length headers.
Dean
>My solution is to write two classes and modify vtkImageReader to accept
>a list of files:
>1) write a vtkGlob class that handles wildcards and produces a
>vtkStringArray of files, implemented with Utilities/kwsys/Glob.
>2) write a vtkSortSeriesFileNames class that will sort a vtkStringArray
>of file names taken from vtkGlob or from a file browser
>3) add a SetFileNames() method to vtkImageReader2 so that it can take a
>vtkStringArray containing file names
_______________________________________________
vtk-developers mailing list
vtk-developers at vtk.org
http://www.vtk.org/mailman/listinfo/vtk-developers
More information about the vtk-developers
mailing list