[vtk-developers] vtkStringArray and vtkImageReader

David Gobbi dgobbi at atamai.com
Sun Feb 5 12:39:14 EST 2006


I've finished adding the vtkImageReader2::SetFileNames(vtkStringArray *) and will be committing to
CVS unless there are objections.  The bugtracker entry is here:

http://public.kitware.com/Bug/bug.php?op=show&bugid=2834

The next thing to do is add some filename-list generators.  It would be very convenient to be able
to do this:

 reader->SetFilePattern("/data/dir/*.sli")

The SetFileNamePattern optionally generate filenames using wildcards instead of format strings, if
the string contained "*" instead of "%".  I'm hesitant to further complicate the vtkImageReader2
API, but it sure would be nice to have something like this...

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.

 - David


--- David Gobbi <dgobbi at atamai.com> wrote:

> I'll take a look at ITK IO.  Right now I use some python code to figure 
> out filenames and decide which reader to use, and it works well for 
> that.  I have an app that I need to write in pure C++, though, and need 
> the user to be able to highlight a group of files in a file browser and 
> load them as a volume.  Surprisingly, that is a very difficult thing to 
> accomplish in VTK.
> 
> Lorensen, William E (GE, Research) wrote:
> 
> >David,
> >
> >This is an excellent idea. We do this in itk. The file name generation is actually separate
> from the series readers. We always pass in lists of strings. Then we have series filenames
> generators. Looks like you could do this an still maintain the current API.
> >
> >In itk we have:
> >NumericSeriesFileNames
> >RegularExpressionFileNames
> >Dicom(GDCM)SeriesFileNames
> >and
> >ArchetypeSeriesFileNames
> >
> >The latter is particularly cool. You give it one file name from a set of filenames and it
> generates the set of names.
> >
> >Actually, the itk I/O mechanism itself is very different in itk. itk uses an IO Factory that
> discovers which file specific reader to use. Also, we separate series reading from image
> reading. The series reader invokes an image reader for each file. We do not have to decide which
> reader to use with which filename, the factory does that.
> >
> >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
> >David Gobbi
> >Sent: Thursday, February 02, 2006 4:08 PM
> >To: VTK Developers
> >Subject: [vtk-developers] vtkStringArray and vtkImageReader
> >
> >
> >Hi All,
> >
> >Over the years I've run into problems with vtkImageReader several times 
> >because I have a set of files that aren't a nice, numbered sequence.
> >
> >Now that VTK has a vtkStringArray, it would be nice if vtkImageReader 
> >had a SetFileNameArray() method to allow a user to set an arbitrary list 
> >of files to read.
> >
> >Has anyone started working on something similar?
> >
> > - David
> >
> >
> >_______________________________________________
> >vtk-developers mailing list
> >vtk-developers at vtk.org
> >http://www.vtk.org/mailman/listinfo/vtk-developers
> >
> >  
> >
> 
> _______________________________________________
> 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