[Insight-users] Integrating with VTK basics

Diego R. Medaglia diegomedaglia at terra.com.br
Tue Nov 15 15:05:09 EST 2005


Hi Luis!
    Thanks for helping. It DID link now, but I got a exception as follows:
    Unhandled exception at 0x7c81eb33 in ITKtoVTK.exe: Microsoft C++ 
exception: itk::ImageFileReaderException @ 0x00f8f958.

    Do I have to set the Image extent or something when passing it to VTK in 
case it is a raw image? I thought the fuctions did that...

            Thank you once more, Diego
----- Original Message ----- 
From: "Luis Ibanez" <luis.ibanez at kitware.com>
To: "Diego R. Medaglia" <diegomedaglia at terra.com.br>
Cc: <insight-users at itk.org>
Sent: Monday, November 14, 2005 10:26 AM
Subject: Re: [Insight-users] Integrating with VTK basics


>
> Hi Diego,
>
> You are missing to link with the ITKBasicFilters library.
>
>
> ---
>
>
> In the future,
> each time that you find unresolved symbols in your
> application, simply search for the directory where
> the class is, and add the library that corresponds
> to the directory name.
>
> For Example
>
> in your case you are missing symbols from the class:
>
>           itk::VTKImageExportBase
>
> if you search in the ITK source tree, you will find
> that this file is in the subdirectory:
>
>
>           Insight/Code/BasicFilters
>
>
> All the .cxx files in this directory get packed in
> the library : ITKBasicFilters.
>
>
>
>
>   Regards,
>
>
>
>       Luis
>
>
>
> -------------------------
> Diego R. Medaglia wrote:
>> Hi!
>>     I'm starting to work with integration between ITK and VTK, and I 
>> wrote a basic program, as follows:
>>  #include "itkImageFileReader.h"
>> #include "itkRawImageIO.h"
>> #include "itkVTKImageExport.h"
>> #include "itkImage.h"
>>  #include "vtkImageImport.h"
>> #include "vtkImageViewer.h"
>>  int main( )
>> {
>>  typedef unsigned short      PixelType;
>>   const   unsigned int        Dimension = 2;
>>   typedef itk::Image< PixelType, Dimension >    ImageType;
>>   typedef itk::RawImageIO<PixelType, Dimension> IOType;
>>  typedef itk::ImageFileReader< ImageType >  ReaderType;
>>   typedef itk::VTKImageExport< ImageType >  ExporterType;
>>  ReaderType::Pointer reader = ReaderType::New();
>>   ExporterType::Pointer exporter = ExporterType::New();
>>   IOType::Pointer io = IOType::New();
>>  io->SetDimensions(0,64);
>>   io->SetDimensions(1,64);
>>  reader->SetImageIO( io );
>>  reader->SetFileName( "D:\\VTK\\VTKData\\Data\\headsq\\quarter.30" );
>>  exporter->SetInput( reader->GetOutput() );
>>  vtkImageImport *importer = vtkImageImport::New();
>>   vtkImageViewer *viewer = vtkImageViewer::New();
>>  importer->SetImportVoidPointer( exporter );
>>   viewer->SetInput(importer->GetOutput() );
>>  try
>>     {
>>     viewer->Render();
>>     }
>>   catch( itk::ExceptionObject & err )
>>     {
>>     std::cerr << "ExceptionObject caught !" << std::endl;
>>     std::cerr << err << std::endl;
>>     return EXIT_FAILURE;
>>     }
>>  return EXIT_SUCCESS;
>> }
>>  which just reads a raw image with ITK and passes it to VTK for 
>> visualisation. I get an unresolved external symbol error during 
>> compilation (VS .NET 2005) concerning the callback fuctions in 
>> VTKImageExportBase:
>>  ITKtoVTK error LNK2001: unresolved external symbol "protected: virtual 
>> int __thiscall itk::VTKImageExportBase::PipelineModifiedCallback(void)" 
>> (?PipelineModifiedCallback at VTKImageExportBase@itk@@MAEHXZ 
>> <mailto:?PipelineModifiedCallback at VTKImageExportBase@itk@@MAEHXZ>)
>> ITKtoVTK error LNK2001: unresolved external symbol "protected: virtual 
>> void __thiscall itk::VTKImageExportBase::PrintSelf(class 
>> std::basic_ostream<char,struct std::char_traits<char> > &,class 
>> itk::Indent)const " 
>> (?PrintSelf at VTKImageExportBase@itk@@MBEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@VIndent at 2@@Z 
>> <mailto:?PrintSelf at VTKImageExportBase@itk@@MBEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@VIndent at 2@@Z>)
>> ITKtoVTK error LNK2001: unresolved external symbol "protected: virtual 
>> void __thiscall itk::VTKImageExportBase::UpdateDataCallback(void)" 
>> (?UpdateDataCallback at VTKImageExportBase@itk@@MAEXXZ 
>> <mailto:?UpdateDataCallback at VTKImageExportBase@itk@@MAEXXZ>)
>> ITKtoVTK error LNK2001: unresolved external symbol "protected: virtual 
>> void __thiscall itk::VTKImageExportBase::UpdateInformationCallback(void)" 
>> (?UpdateInformationCallback at VTKImageExportBase@itk@@MAEXXZ 
>> <mailto:?UpdateInformationCallback at VTKImageExportBase@itk@@MAEXXZ>)
>> ITKtoVTK error LNK2019: unresolved external symbol "protected: __thiscall 
>> itk::VTKImageExportBase::VTKImageExportBase(void)" 
>> (??0VTKImageExportBase at itk@@IAE at XZ 
>> <mailto:??0VTKImageExportBase at itk@@IAE at XZ>) referenced in function 
>> "protected: __thiscall itk::VTKImageExport<class itk::Image<unsigned 
>> short,2> >::VTKImageExport<class itk::Image<unsigned short,2> >(void)" 
>> (??0?$VTKImageExport at V?$Image at G$01 at itk@@@itk@@IAE at XZ 
>> <mailto:??0?$VTKImageExport at V?$Image at G$01 at itk@@@itk@@IAE at XZ>)
>>     Do I have to create those functions? From what I read in the docs, I 
>> think that these are passed to VTKImageImport, that sets them as its 
>> callbacks. Also, it seemed like an "include" error, but ITK's 
>> VTKImageExport header includes the VTKImageExportBase header file.
>>  CMakeLists.txt looks like this:
>>  PROJECT(ITKtoVTK)
>>  FIND_PACKAGE ( ITK)
>> IF ( ITK_FOUND)
>> INCLUDE( ${USE_ITK_FILE} )
>> ENDIF( ITK_FOUND)
>>  FIND_PACKAGE ( VTK)
>> IF ( VTK_FOUND)
>> INCLUDE( ${USE_VTK_FILE} )
>> ENDIF( VTK_FOUND)
>>  INCLUDE_DIRECTORIES(${C:\[CORRECT_PATH]\ITKtoVTK})
>>  ADD_EXECUTABLE( ITKtoVTK ITKtoVTK.cxx)
>>  TARGET_LINK_LIBRARIES (ITKtoVTK ITKCommon ITKIO vtkRendering vtkGraphics 
>> vtkHybrid vtkImaging vtkIO vtkCommon)
>>  Am I missing some libraries?
>>  Thanks a lot for any help, Diego
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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