[vtk-developers] vtkStringArray and vtkImageReader

David Gobbi dgobbi at atamai.com
Wed Feb 8 17:51:33 EST 2006


David Gobbi wrote:

> Mathieu Malaterre wrote:
>
>> David Gobbi wrote:
>>
>>> The generic solution is to add a "vtkFileNameGenerator", similar to 
>>> the way ITK does things.  For
>>> VTK I would build the different kinds of file name generation 
>>> (wildcard, numbered series,
>>> archetype) into one single class rather than create a class 
>>> hierarchy.  There would eventually be
>>> a vtkDICOMFileNameGenerator specifically for handling DICOM series.
>>
>>
>>
>> I would rather see an ITK like approach, it has proven to be very 
>> customizable in particular for the DICOM case as you mention.
>
>
> When I looked at how ITK does things, I saw that ITK's set of 
> "SeriesFileNames" classes do not fit into a heirarchy.  The 
> GDCMSeriesFileNames, ArchetypeSeriesFileNames, 
> RegularExpressionSeriesFileNames, etc. are all derived directly from 
> itk::Object, it seems that there should be a base class.
>
> None of the ITK classes seems to have to feature I want most: to be 
> able to generate a list of file names based on the "*?[][!]" set of 
> wildcards. Regular expressions are a bit too advanced for most of my 
> users.


I've decided on a solution, if people agree that it is a good way to go 
then I will implement it and commit it.

First I'll state the problem that I want to solve.  My app accepts 
filenames in two ways :
1) on the command line, e.g.  "myapp [options] filename*.png
2) through a file browser that allows multiple file selections
I have to take these file names and sort them into a series that either 
the ImageReader can use, or that a collection of vtkDataSetReaders can use.

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

I've already done (1) and (3) and they are ready to commit.

I only have the vtkSortSeriesFileNames class left to write.   It can be 
the first of VTK's series file name generators.

 - David










More information about the vtk-developers mailing list