<DIV>Hi</DIV>
<DIV> </DIV>
<DIV>Here is my CMakelist.txt:</DIV>
<DIV> </DIV>
<DIV>PROJECT( segex )</DIV>
<DIV><BR># Find the ITK and VTK libraries</DIV>
<DIV> </DIV>
<DIV>FIND_PACKAGE(ITK)</DIV>
<DIV>IF(ITK_FOUND)<BR> <BR> INCLUDE(${ITK_USE_FILE})</DIV>
<DIV>ELSE(ITK_FOUND)<BR> <BR> MESSAGE(FATAL_ERROR "Cannot build without ITK. Please set ITK_DIR.")</DIV>
<DIV>ENDIF(ITK_FOUND)</DIV>
<DIV> </DIV>
<DIV>FIND_PACKAGE(VTK)</DIV>
<DIV>IF (VTK_FOUND)<BR> <BR> INCLUDE (${VTK_USE_FILE})</DIV>
<DIV>ELSE(VTK_FOUND)<BR> <BR> MESSAGE(FATAL_ERROR<BR> "Cannot build without ITK. Please set VTK_DIR.")</DIV>
<DIV>ENDIF(VTK_FOUND)</DIV>
<DIV> </DIV>
<DIV>ADD_EXECUTABLE(segex segex.cpp)</DIV>
<DIV> </DIV>
<DIV># Optionally use vtkPatented libs (for Contouring/Marching Cubes)</DIV>
<DIV> </DIV>
<DIV>TARGET_LINK_LIBRARIES(segex ITKCommon ITKIO ITKBasicFilters vtkCommon vtkImaging vtkGraphics vtkIO vtkFiltering #vtkPatented # vtkHybrid vtkRendering))</DIV>
<DIV> </DIV>
<DIV>and here is my program :</DIV>
<DIV> </DIV>
<DIV><FONT size=2>
<P>#include <string></P>
<P>#include <itkImage.h></P>
<P>#include <itkImageFileReader.h></P>
<P>#include <itkImageFileWriter.h></P>
<P>#include <itkFixedArray.h></P>
<P>#include <itkFlipImageFilter.h></P>
<P>#include <itkDiscreteGaussianImageFilter.h></P>
<P>#include <itkThresholdImageFilter.h></P>
<P>#include <vtkImageShiftScale.h></P>
<P>#include <vtkImageActor.h></P>
<P>#include <vtkRenderer.h></P>
<P>#include <vtkRenderWindow.h></P>
<P>#include <vtkRenderWindowInteractor.h></P>
<P>#include <vtkInteractorStyleImage.h></P>
<P>#include "itkImageToVTKImageFilter.h"</P>
<P>int main( int argc, char* argv[] ) {</P>
<P>std::string filename( "images/stem.jpg" );</P>
<P>int threshold = 100;</P>
<P></P>
<P>if ( argc > 1 ) {</P>
<P>std::string ftmp( argv[1] );</P>
<P>filename = ftmp;</P>
<P>}</P>
<P></P>
<P>if ( argc > 2 ){</P>
<P>threshold = atoi( argv[2] );</P>
<P>}</P>
<P></P>
<P>const unsigned int TwoD = 2;</P>
<P>typedef unsigned char ImagePixelType;</P>
<P>typedef itk::Image< ImagePixelType, TwoD > InputImageType;</P>
<P> </P>
<P>typedef itk::ImageFileReader< InputImageType > ReaderType;</P>
<P>ReaderType::Pointer reader = ReaderType::New();</P>
<P>reader->SetFileName( filename.c_str() );</P>
<P>reader->Update();</P>
<P> </P>
<P>typedef itk::ThresholdImageFilter<</P>
<P>InputImageType > SegmentFilterType;</P>
<P>SegmentFilterType::Pointer segmenter = SegmentFilterType::New();</P>
<P>segmenter->SetInput( reader->GetOutput() );</P>
<P>segmenter->SetOutsideValue( 0 );</P>
<P>segmenter->ThresholdBelow( threshold );</P>
<P>segmenter->Update();</P>
<P> </P>
<P></P>
<P>typedef itk::ImageFileWriter< InputImageType > WriterType;</P>
<P>WriterType::Pointer writer = WriterType::New();</P>
<P>writer->SetInput( segmenter->GetOutput() );</P>
<P>writer->SetFileName( "images/stem_out.jpg" );</P>
<P>writer->Update();</P>
<P> </P>
<P>// Show segmentation result (connect ITK -> VTK)</P>
<P>typedef itk::ImageToVTKImageFilter< InputImageType > ImageToVTKType;</P>
<P>ImageToVTKType::Pointer bridge = ImageToVTKType::New();</P>
<P>bridge->SetInput( segmenter->GetOutput() );</P>
<P>vtkImageActor* actor = vtkImageActor::New();</P>
<P>actor->SetInput( bridge->GetOutput() );</P>
<P>actor->InterpolateOff();</P>
<P>vtkRenderer* ren = vtkRenderer::New();</P>
<P>ren->SetBackground( 0.4392, 0.5020, 0.5647 );</P>
<P>ren->AddActor( actor );</P>
<P>vtkRenderWindow* renwin = vtkRenderWindow::New();</P>
<P>renwin->AddRenderer( ren );</P>
<P>vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();</P>
<P>iren->SetRenderWindow( renwin );</P>
<P>iren->Initialize();</P>
<P>vtkInteractorStyleImage* style = vtkInteractorStyleImage::New();</P>
<P>iren->SetInteractorStyle( style );</P>
<P> </P>
<P>iren->Start();</P>
<P></P>
<P>style->Delete();</P>
<P>iren->Delete();</P>
<P>renwin->Delete();</P>
<P>ren->Delete();</P>
<P>actor->Delete();</P>
<P>return( 0 );</P>
<P>}</P></FONT></DIV>
<DIV>Any advices?</DIV>
<DIV> </DIV>
<DIV>Stanislava Ivanova<BR><BR><B><I>Karthik Krishnan <Karthik.Krishnan@kitware.com></I></B> a écrit :</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Please post your CMakeLists.txt file and if possible a minimal example. <BR>It looks like you are not linking against some VTK libraries. If you are <BR>not certain, for now add all the libraries to see if it compiles<BR>TARGET_LINK_LIBRARIES( ProjectFoo vtkIO vtkCommon vtkHybrid vtkRendering <BR>vtkImaging ITKCommon ITKBasicFilters ITKNumerics ITKAlgorithms ITKIO)<BR><BR>thanks<BR>karthik<BR><BR>syssboxx-reg@yahoo.fr wrote:<BR><BR>>Hi Luis;<BR>><BR>>I was thinking that the cause of my linking problems<BR>>when using itkImageToVTKImageFilter was my<BR>>installation.Now i reinstalled VTK and i try to build <BR>>all above Visual Studio 7.NET 2003 but it's the same.<BR>>I really can't find the problem.Is anybody else have a<BR>>problems with itkImageToVTKImageFilter?Or not could<BR>>you help me to make it work correctly?<BR>><BR>> <BR>>--- Luis Ibanez
<LUIS.IBANEZ@KITWARE.COM>a écrit:<BR>> <BR>><BR>>>Hi Stanislava,<BR>>><BR>>>You are missing to link with some VTK libraries.<BR>>><BR>>>Please post the CMakeLists.txt file of your project<BR>>>and let us konw what version of VTK you are using.<BR>>><BR>>><BR>>> Thanks<BR>>><BR>>><BR>>> Luis<BR>>><BR>>><BR>>><BR>>>-----------------------------------<BR>>>syssboxx-reg@yahoo.fr wrote:<BR>>><BR>>> <BR>>><BR>>>>Hi all,<BR>>>>I'm not very experienced with both itk and vtk,for<BR>>>> <BR>>>><BR>>>the moment i was <BR>>> <BR>>><BR>>>>making some processing with itk and saving the<BR>>>> <BR>>>><BR>>>output to a file.Now I <BR>>> <BR>>><BR>>>>want to make my algorithme with 3d images so I try<BR>>>> <BR>>>><BR>>>to use vtk.I listened
<BR>>> <BR>>><BR>>>>some posting about itkImageToVTKImageFilter and<BR>>>> <BR>>>><BR>>>the ways to connect itk <BR>>> <BR>>><BR>>>>and vtk ( i use one example which read,segment a<BR>>>> <BR>>>><BR>>>2d image,write it and <BR>>> <BR>>><BR>>>>show it in vtk . Now my program find the header<BR>>>> <BR>>>><BR>>>but gives me some <BR>>> <BR>>><BR>>>>errors.Could someone tell me how to solve this<BR>>>> <BR>>>><BR>>>problem please. I list <BR>>> <BR>>><BR>>>>bellow the errors:<BR>>>>Thanks<BR>>>> <BR>>>>--------------------Configuration: segex - Win32 <BR>>>>RelWithDebInfo--------------------<BR>>>>Compiling...<BR>>>>segex.cpp.cxx<BR>>>>Linking...<BR>>>> Creating library RelWithDebInfo/segex.lib and<BR>>>>
<BR>>>><BR>>>object <BR>>> <BR>>><BR>>>>RelWithDebInfo/segex.exp<BR>>>>segex.cpp.obj : error LNK2001: unresolved external<BR>>>> <BR>>>><BR>>>symbol "public: <BR>>> <BR>>><BR>>>>static class vtkInteractorStyleImage * __cdecl <BR>>>>vtkInteractorStyleImage::New(void)" <BR>>>>(?New@vtkInteractorStyleImage@@SAPAV1@XZ <BR>>>><mailto:?New@vtkInteractorStyleImage@@SAPAV1@XZ>)<BR>>>>segex.cpp.obj : error LNK2001: unresolved external<BR>>>> <BR>>>><BR>>>symbol "public: void <BR>>> <BR>>><BR>>>>__thiscall<BR>>>> <BR>>>><BR>>>vtkRenderWindowInteractor::SetRenderWindow(class <BR>>> <BR>>><BR>>>>vtkRenderWindow *)" <BR>>>><BR>>>> <BR>>>><BR>>(?SetRenderWindow@vtkRenderWindowInteractor@@QAEXPAVvtkRenderWindow@@@Z<BR>>
<BR>><BR>><mailto:?SetRenderWindow@vtkRenderWindowInteractor@@QAEXPAVvtkRenderWindow@@@Z>)<BR>> <BR>><BR>>>>segex.cpp.obj : error LNK2001: unresolved external<BR>>>> <BR>>>><BR>>>symbol "public: <BR>>> <BR>>><BR>>>>static class vtkRenderWindowInteractor * __cdecl <BR>>>>vtkRenderWindowInteractor::New(void)" <BR>>>>(?New@vtkRenderWindowInteractor@@SAPAV1@XZ <BR>>>><BR>>>> <BR>>>><BR>>><mailto:?New@vtkRenderWindowInteractor@@SAPAV1@XZ>)<BR>>> <BR>>><BR>>>>segex.cpp.obj : error LNK2001: unresolved external<BR>>>> <BR>>>><BR>>>symbol "public: <BR>>> <BR>>><BR>>>>static class vtkRenderWindow * __cdecl<BR>>>> <BR>>>><BR>>>vtkRenderWindow::New(void)" <BR>>> <BR>>><BR>>>>(?New@vtkRenderWindow@@SAPAV1@XZ<BR>>>>
<BR>>>><BR>>><mailto:?New@vtkRenderWindow@@SAPAV1@XZ>)<BR>>> <BR>>><BR>>>>segex.cpp.obj : error LNK2001: unresolved external<BR>>>> <BR>>>><BR>>>symbol "public: <BR>>> <BR>>><BR>>>>static class vtkRenderer * __cdecl<BR>>>> <BR>>>><BR>>>vtkRenderer::New(void)" <BR>>> <BR>>><BR>>>>(?New@vtkRenderer@@SAPAV1@XZ<BR>>>> <BR>>>><BR>>><mailto:?New@vtkRenderer@@SAPAV1@XZ>)<BR>>> <BR>>><BR>>>>segex.cpp.obj : error LNK2001: unresolved external<BR>>>> <BR>>>><BR>>>symbol "public: <BR>>> <BR>>><BR>>>>static class vtkImageActor * __cdecl<BR>>>> <BR>>>><BR>>>vtkImageActor::New(void)" <BR>>> <BR>>><BR>>>>(?New@vtkImageActor@@SAPAV1@XZ<BR>>>> <BR>>>><BR>>><mailto:?New@vtkImageActor@@SAPAV1@XZ>)<BR>>>
<BR>>><BR>>>>RelWithDebInfo/segex.exe : fatal error LNK1120: 6<BR>>>> <BR>>>><BR>>>unresolved externals<BR>>> <BR>>><BR>>>>Error executing link.exe.<BR>>>>ALL_BUILD - 7 error(s), 0 warning(s)<BR>>>> <BR>>>>Stanislava Ivanova<BR>>>><BR>>>><BR>>>> <BR>>>><BR>>------------------------------------------------------------------------<BR>> <BR>><BR>>>>Découvrez le nouveau Yahoo! Mail : 1 Go d'espace<BR>>>> <BR>>>><BR>>>de stockage pour vos <BR>>> <BR>>><BR>>>>mails, photos et vidéos !<BR>>>>Créez votre Yahoo! Mail <BR>>>><BR>>>> <BR>>>><BR>><HTTP: creer28.html mail fr.promotions.yahoo.com *http: default taglines_1go splash mail_campaigns mail_fr us.rd.yahoo.com><BR>> <BR>><BR>>>><BR>>>><BR>>>>
<BR>>>><BR>>------------------------------------------------------------------------<BR>> <BR>><BR>>>>_______________________________________________<BR>>>>Insight-users mailing list<BR>>>>Insight-users@itk.org<BR>>>>http://www.itk.org/mailman/listinfo/insight-users<BR>>>> <BR>>>><BR>>><BR>>><BR>>> <BR>>><BR>><BR>><BR>> <BR>> <BR>> <BR>>___________________________________________________________________________<BR>>Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger <BR>>Téléchargez cette version sur http://fr.messenger.yahoo.com<BR>>_______________________________________________<BR>>Insight-users mailing list<BR>>Insight-users@itk.org<BR>>http://www.itk.org/mailman/listinfo/insight-users<BR>><BR>>
<BR>><BR></BLOCKQUOTE></mailto:?New@vtkImageActor@@SAPAV1@XZ></mailto:?New@vtkRenderer@@SAPAV1@XZ></mailto:?New@vtkRenderWindow@@SAPAV1@XZ></mailto:?New@vtkRenderWindowInteractor@@SAPAV1@XZ></mailto:?SetRenderWindow@vtkRenderWindowInteractor@@QAEXPAVvtkRenderWindow@@@Z></mailto:?New@vtkInteractorStyleImage@@SAPAV1@XZ><p>
                <hr size=1>
<b><font color=#FF0000>Appel audio GRATUIT</font> partout dans le monde</b> avec le nouveau Yahoo! Messenger<br>
<a href="http://us.rd.yahoo.com/messenger/mail_taglines/yahoofr/*http://fr.messenger.yahoo.com">Téléchargez le ici !</a>