[vtkusers] Problem with vtkTIFFReader

P B chose29 at hotmail.com
Thu Jan 15 09:12:25 EST 2009


Hi,
 
   I've been having trouble reading tiff files. I'm wondering if the file is corrupted (although I can visualize it with Paint). The output of vtk says : Problem reading the row: XX. My code is the following. Am I missing something? I've been reading jpg images with vtkJPEGReader and it works fine.
 
Thanks in advance for your help,
Pascale
 
 
vtkTIFFReader * TIFFRead = vtkTIFFReader::New();
TIFFRead->SetFileName("D:\\Canyon.TIF");
TIFFRead->Modified();
TIFFRead->Update();
 
vtkImageData * TIFFImage = TIFFRead->GetOutput();
int NumComponents = TIFFImage->GetNumberOfScalarComponents();
cout << "number of components = " << NumComponents; // outputs 3
int ImageDimensions[3]; 
 

int * Extent; Extent = TIFFImage->GetExtent();
ImageDimensions[0] = Extent[1] - Extent[0];
ImageDimensions[1] = Extent[3] - Extent[2];
ImageDimensions[2] = Extent[5] - Extent[4];
cout << "Dimensions = (" << ImageDimensions[0] << ", " << ImageDimensions[1] << ", " << ImageDimensions[2] << ")" ; // outputs the correct image size
 
vtkImageViewer * ImView = vtkImageViewer::New();
ImView->SetInput(TIFFImage);
ImView->Modified();
ImView->Render();
 
vtkRenderWindowInteractor * Interactor = vtkRenderWindowInteractor::New();
ImView->GetRenderWindow()->SetInteractor(Interactor);
ImView->GetRenderWindow()->Render(); // outputs a black image (?)
Interactor->Start();
 
 
_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
http://www.microsoft.com/windows/windowslive/photos.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090115/53ce9e00/attachment.htm>


More information about the vtkusers mailing list