[vtkusers] ImageReader don't work

Jeremy Winston jbw at ieee.org
Sat Feb 12 09:20:03 EST 2005


Stephan Theisen wrote:
> 
> I've a little problem with my ImageReader. I've a number slices which I 
> will read in as a volume. So I implemented the
> the vtkImageReader function in my programm. But all what I get is a 
> black screen. Is anything wrong in the following
> source code:
> 
>    vtkImageReader2 ireader = new vtkImageReader2();
>    ireader.SetDataExtent(0,512,0,512,1,30);
>    ireader.SetDataSpacing(0.488,0.488,1.0);
>    ireader.SetFilePrefix("G:/CT-BilderTiffumbenannt/basename");
>    ireader.SetFilePattern("%s%i.tif");

vtkImageReader is meant to be subclassed for the specific
file type.  In your case, you're reading TIFFs, so you
should instead use

      vtkTIFFReader ireader = new vtkTIFFReader();

Cf. http://www.vtk.org/doc/nightly/html/classvtkImageReader2.html
and http://www.vtk.org/doc/nightly/html/classvtkTIFFReader.html

Also, I note your x,y data extent is [0,512].  Likely it's
[0,511], no?

HTH,
-Jeremy



More information about the vtkusers mailing list