[vtk-developers] Re: vtkStringArray and vtkImageReader
dean.inglis at camris.ca
dean.inglis at camris.ca
Thu Feb 9 08:23:33 EST 2006
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
More information about the vtk-developers
mailing list