[vtkusers] Image reader : JPEG,BMP and TIFFReader

David Cole david.cole at kitware.com
Wed Jul 20 09:48:12 EDT 2005


change "jpg" and "JPG" to "tif" and "TIF" in your last if block. You're 
trying to use the TIFF reader on jpeg files and you're not executing any 
code for TIFF files as it stands... Copy and paste works great! ;-)

HTH,
David


Alain SIMAC wrote:

> Hi,
>
>  
>
> I wish to open without distinction of the images of format BMP, JPEG, 
> TIFF. For the moment: I open without problem the BMP but the JPEG and 
> the tiff are not posted. I do not include/understand why. Would 
> somebody be to modify my program?
>
>  
>
> Program:
>
> vtkImageData *imageData = vtkImageData::New();
>
> int* dimimage;
>
>  if ((strcmp(GetExtensions(filename2),"bmp")==0) or 
> (strcmp(GetExtensions(filename2),"BMP")==0))
>
>             {
>
>             vtkBMPReader *bmpreader = vtkBMPReader::New();
>
>             bmpreader->SetFileName(filename2);
>
>             bmpreader->Update();
>
>             imageData = bmpreader->GetOutput();
>
>             }
>
>  if ((strcmp(GetExtensions(filename2),"jpg")==0) or 
> (strcmp(GetExtensions(filename2),"JPG")==0))
>
>             {
>
>             vtkJPEGReader *jpgreader = vtkJPEGReader::New();
>
>             jpgreader->SetFileName(filename2);
>
>             jpgreader->Update();
>
>             imageData = jpgreader->GetOutput();
>
>             }
>
>   if ((strcmp(GetExtensions(filename2),"jpg")==0) or 
> (strcmp(GetExtensions(filename2),"JPG")==0))
>
>             {
>
>             vtkTIFFReader *tiffreader = vtkTIFFReader::New();
>
>             tiffreader->SetFileName(filename2);
>
>             //tiffreader->Update();
>
>             imageData = tiffreader->GetOutput();
>
>             }
>
>     dimimage = imageData -> GetDimensions();
>
>   }
>
>  
>
> Thanks
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>  
>



More information about the vtkusers mailing list