[vtk-developers] Re: vtkStringArray and vtkImageReader

David Gobbi dgobbi at atamai.com
Thu Feb 9 11:01:21 EST 2006


I hope nobody minds if I jump back in here...

The ArchetypeSeriesFilenames class always the original list of filenames 
from a directory.  I need to be able to take my original list of 
filenames from anywhere: a file load dialog (via multiple selections), a 
directory listing, a wildcard glob, a network query, a text file, etc.

I'm not criticizing the ITK file name generator classes... I'm just 
saying that none of them satisfy my requirements.

I want to contribute a generator that will take an unsorted list of 
files from anywhere, and produce one or more sorted lists.  It will have 
a NumericSort option to do proper left-to-right numeric sorting.  It 
will be very much in the spirit of the ITK generators, but not quite so 
specific-purpose.  Hopefully others will build on it to provide 
regular-expression and archetype  generators.

 - David

P.S. One crazy idea I had was to make a new vtkDataObject as a container 
for the filenames.  Then the series file name generators would actually 
be sources or filters, and the Readers would convert the filename data 
objects into VTK data sets.


Lorensen, William E (GE, Research) wrote:

>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
>_______________________________________________
>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