[Insight-users] itkVTKImageToImageFilter

Karthik Krishnan Karthik.Krishnan at kitware.com
Thu Feb 17 14:25:02 EST 2005


Extract and convert the components individually. Try replacing pipeline 
with

  vtkImageLuminance *lum = vtkImageLuminance::New();
  lum->SetInput(reader->GetOutput()); 
  connector->SetInput(lum->GetOutput() );

Does this help ?     

thanks
kk

Tubak.Zoltan at stud.u-szeged.hu wrote:

>Hi all,
>
>  I would like to ask your help!
>
>I always get the following exception, when I try to update my vtk->itk 
>pipeline:
>
>
>Exception caught !
>
>itk::ExceptionObject (0x8295830)
>Location: "Unknown"
>File: /home/.../BasicFilters/itkVTKImageImport.txx
>Line: 237
>Description: itk::ERROR: VTKImageImport(0x8292db0): Input number of components 
>is 3 but should be 1
>
>
>My primitive code is the following:
>
>#include "vtkPNGReader.h"
>
>#include "itkImage.h"
>#include "itkImageFileWriter.h"
>#include "itkVTKImageToImageFilter.h"
>
>int main( int argc, char **argv ) {
>
>  vtkPNGReader * reader = vtkPNGReader::New();
>  reader->SetFileName(argv[1]);
>
>  typedef itk::Image<unsigned short, 2> ImageType;
>  typedef itk::ImageFileWriter<ImageType> WriterType;
>  typedef itk::VTKImageToImageFilter<ImageType> ConnectorType;
>
>  WriterType::Pointer writer = WriterType::New();
>  ConnectorType::Pointer connector = ConnectorType::New();
>
>  connector->SetInput(reader->GetOutput() );
>  writer->SetInput( connector->GetOutput() );
>  writer->SetFileName(argv[2]);
>
>  try{ writer->Update(); } 
>  catch(itk::ExceptionObject & excep)
>     {
>      std::cerr << "Exception caught !" << std::endl;
>      std::cerr << excep << std::endl;
>     }
>
>  return 0;
>}
>
>
>Thanks for your help!
>
>Zoltan
>
>
>
>
>-------------------------------------------------
>This mail sent through IMP: http://horde.org/imp/
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>
>  
>



More information about the Insight-users mailing list