<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2769" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi!</FONT></DIV>
<DIV><FONT face=Arial size=2> I'm starting to work with
integration between ITK and VTK, and I wrote a basic program, as
follows:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#include "itkImageFileReader.h"<BR>#include
"itkRawImageIO.h"<BR>#include "itkVTKImageExport.h"<BR>#include
"itkImage.h"</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#include "vtkImageImport.h"<BR>#include
"vtkImageViewer.h"</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><FONT face=Arial size=2>
<DIV><BR>int main( )<BR>{<BR> <BR> <BR> typedef unsigned
short PixelType;<BR> const
unsigned int Dimension = 2;<BR></DIV>
<DIV> typedef itk::Image< PixelType, Dimension >
ImageType;<BR></DIV>
<DIV> typedef itk::RawImageIO<PixelType, Dimension> IOType;</DIV>
<DIV> </DIV>
<DIV> typedef itk::ImageFileReader< ImageType >
ReaderType;<BR> typedef itk::VTKImageExport< ImageType >
ExporterType;<BR> <BR> <BR> ReaderType::Pointer reader =
ReaderType::New();<BR> ExporterType::Pointer exporter =
ExporterType::New();<BR> IOType::Pointer io = IOType::New();</DIV>
<DIV> </DIV>
<DIV> io->SetDimensions(0,64);<BR>
io->SetDimensions(1,64);</DIV>
<DIV> </DIV>
<DIV> reader->SetImageIO( io );<BR> </DIV>
<DIV> </DIV>
<DIV> reader->SetFileName( "D:\\VTK\\VTKData\\Data\\headsq\\quarter.30"
);<BR> <BR> exporter->SetInput( reader->GetOutput()
);<BR> <BR> vtkImageImport *importer =
vtkImageImport::New();<BR> vtkImageViewer *viewer =
vtkImageViewer::New();</DIV>
<DIV> </DIV>
<DIV> importer->SetImportVoidPointer( exporter );<BR>
viewer->SetInput(importer->GetOutput() );</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> try <BR> { <BR>
viewer->Render(); <BR> } <BR> catch(
itk::ExceptionObject & err ) <BR> { <BR>
std::cerr << "ExceptionObject caught !" << std::endl;
<BR> std::cerr << err << std::endl;
<BR> return EXIT_FAILURE;<BR> } <BR>
<BR> return EXIT_SUCCESS;<BR>}</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>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:</DIV>
<DIV> </DIV>
<DIV>ITKtoVTK error LNK2001: unresolved external symbol "protected: virtual int
__thiscall itk::VTKImageExportBase::PipelineModifiedCallback(void)" (<A
href="mailto:?PipelineModifiedCallback@VTKImageExportBase@itk@@MAEHXZ">?PipelineModifiedCallback@VTKImageExportBase@itk@@MAEHXZ</A>)<BR>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 " (<A
href="mailto:?PrintSelf@VTKImageExportBase@itk@@MBEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@VIndent@2@@Z">?PrintSelf@VTKImageExportBase@itk@@MBEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@VIndent@2@@Z</A>)<BR>ITKtoVTK
error LNK2001: unresolved external symbol "protected: virtual void __thiscall
itk::VTKImageExportBase::UpdateDataCallback(void)" (<A
href="mailto:?UpdateDataCallback@VTKImageExportBase@itk@@MAEXXZ">?UpdateDataCallback@VTKImageExportBase@itk@@MAEXXZ</A>)<BR>ITKtoVTK
error LNK2001: unresolved external symbol "protected: virtual void __thiscall
itk::VTKImageExportBase::UpdateInformationCallback(void)" (<A
href="mailto:?UpdateInformationCallback@VTKImageExportBase@itk@@MAEXXZ">?UpdateInformationCallback@VTKImageExportBase@itk@@MAEXXZ</A>)<BR>ITKtoVTK
error LNK2019: unresolved external symbol "protected: __thiscall
itk::VTKImageExportBase::VTKImageExportBase(void)" (<A
href="mailto:??0VTKImageExportBase@itk@@IAE@XZ">??0VTKImageExportBase@itk@@IAE@XZ</A>)
referenced in function "protected: __thiscall itk::VTKImageExport<class
itk::Image<unsigned short,2> >::VTKImageExport<class
itk::Image<unsigned short,2> >(void)" (<A
href="mailto:??0?$VTKImageExport@V?$Image@G$01@itk@@@itk@@IAE@XZ">??0?$VTKImageExport@V?$Image@G$01@itk@@@itk@@IAE@XZ</A>)<BR></DIV>
<DIV> 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. </DIV>
<DIV> </DIV>
<DIV>CMakeLists.txt looks like this:</DIV>
<DIV> </DIV>
<DIV>PROJECT(ITKtoVTK)</DIV>
<DIV> </DIV>
<DIV>FIND_PACKAGE ( ITK)<BR>IF ( ITK_FOUND)<BR>INCLUDE( ${USE_ITK_FILE}
)<BR>ENDIF( ITK_FOUND)</DIV>
<DIV> </DIV>
<DIV>FIND_PACKAGE ( VTK)<BR>IF ( VTK_FOUND)<BR>INCLUDE( ${USE_VTK_FILE}
)<BR>ENDIF( VTK_FOUND)</DIV>
<DIV> </DIV>
<DIV>INCLUDE_DIRECTORIES(${C:\[CORRECT_PATH]\ITKtoVTK})</DIV>
<DIV> </DIV>
<DIV>ADD_EXECUTABLE( ITKtoVTK ITKtoVTK.cxx)</DIV>
<DIV> </DIV>
<DIV>TARGET_LINK_LIBRARIES (ITKtoVTK ITKCommon ITKIO vtkRendering vtkGraphics
vtkHybrid vtkImaging vtkIO vtkCommon)</DIV>
<DIV> </DIV>
<DIV>Am I missing some libraries?</DIV>
<DIV> </DIV>
<DIV> Thanks a lot for any help,
Diego</DIV></FONT></BODY></HTML>