[vtkusers] Re: vtkImageReader - Interleaved Channels

Alexandre Guimond guimond at bwh.harvard.edu
Mon Feb 19 16:27:49 EST 2001


On Thu, 03 Aug 2000 10:27:09 -0400
Erik Sobel <erik.sobel at alphatech.com> writes:

> Is there a way to coax the vtkImageReader to read image sets with
> interleaved slices?  That is read I.001, I.003, I.005... or I.002,
> I.004, I.006... ?
> 
> 
> reader SetFilePrefix "I"
> reader SetFilePattern "%s.%03d"
> 
> I didn't see a way to specify SetFileStep or SetFileIncrement.

I just ran into the same problem to read the t2 image of a dtmri image
set (every 8th slice).  If you haven't solved that problem yet, here
is a patch to imaging/vtkImageReader.* that I think will do what you
want.

Index: vtkImageReader.h
===================================================================
RCS file: /vtk/cvsroot/vtk/imaging/vtkImageReader.h,v
retrieving revision 1.53
diff -r1.53 vtkImageReader.h
208,209c208,219
<   
<   
---
> 
>   // Description:
>   // Set/Get the offset of the first slice to be read relative to
>   // the data extent.
>   vtkSetMacro(SliceOffset,int);
>   vtkGetMacro(SliceOffset,int);
> 
>   // Description:
>   // Set/Get the increment between successive slices.
>   vtkSetMacro(SliceIncrement,int);
>   vtkGetMacro(SliceIncrement,int);
> 
233a244,245
>   int SliceOffset;
>   int SliceIncrement;
Index: vtkImageReader.cxx
===================================================================
RCS file: /vtk/cvsroot/vtk/imaging/vtkImageReader.cxx,v
retrieving revision 1.78
diff -r1.78 vtkImageReader.cxx
88c88,90
<   
---
>   this->SliceIncrement = 1;
>   this->SliceOffset = 0;
> 
728c730,731
<       self->OpenAndSeekFile(dataExtent,idx2);
---
>       self->OpenAndSeekFile(dataExtent,self->GetSliceOffset()+
>                           idx2*self->GetSliceIncrement());


-- 
Alexandre Guimond, Ph.D. guimond at bwh.harvard.edu Phone:(617) 278-0800 
http://spl.bwh.harvard.edu:8000/~guimond/          Fax:(617) 264-5154
Brigham and Women's Hospital, Harvard Medical School
CNI, RF396, 221 Longwood Av, Boston, MA 02115




More information about the vtkusers mailing list