<div dir="ltr"><div><div>@Bill, the compiling of the the normal ITK examples are fine for me here. It just when it links the ITK and VTK together problem happens.<br><br></div>@Matt, I will test it once I have the time. <br><br></div>I kind of did a workaround, since I just need the VXL in ITK code, so I gave up linking ITK, but used the following CMakeLists.txt<br><br>cmake_minimum_required(VERSION 2.8)<br> <br>PROJECT(BackProjection)<br><br>find_package(VTK REQUIRED)<br>include(${VTK_USE_FILE})<br><br>FIND_PACKAGE( OpenCV REQUIRED )<br>INCLUDE_DIRECTORIES(${OPENCV_INCLUDE_DIR})<br><br>FIND_PACKAGE(VXL REQUIRED)<br>INCLUDE(${VXL_CMAKE_DIR}/UseVXL.cmake)<br> <br>SET(CMAKE_CXX_FLAGS "-g -O2 -fopenmp")<br><br>add_executable(BackProjection MACOSX_BUNDLE BackProjection)<br>add_executable(deviation MACOSX_BUNDLE deviation)<br>add_executable(imageviewer MACOSX_BUNDLE imageviewer)<br>add_executable(deviation_autopipeline MACOSX_BUNDLE deviation_autopipeline)<br>add_executable(ReadPLY MACOSX_BUNDLE ReadPLY.cxx)<br> <br>target_link_libraries(ReadPLY ${VTK_LIBRARIES} )<br>target_link_libraries(BackProjection vnl vnl_algo ${VTK_LIBRARIES} ${OpenCV_LIBS})<br>target_link_libraries(deviation ${OpenCV_LIBS})<br>target_link_libraries(imageviewer ${OpenCV_LIBS})<br>target_link_libraries(deviation_autopipeline ${OpenCV_LIBS})<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 2 February 2015 at 21:48, Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jianming,<br>
<br>
Could you please also try VTK Git master and report your results?<br>
<br>
Thanks,<br>
Matt<br>
<div class="HOEnZb"><div class="h5"><br>
On Mon, Feb 2, 2015 at 8:34 AM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:<br>
> What you have should work. I just built this example:<br>
> <a href="http://itk.org/Wiki/ITK/Examples/Smoothing/MedianImageFilter" target="_blank">http://itk.org/Wiki/ITK/Examples/Smoothing/MedianImageFilter</a><br>
><br>
> no problems. Can you try the same example?<br>
><br>
> On Mon, Feb 2, 2015 at 2:08 AM, Jianming <<a href="mailto:jianming.tom@gmail.com">jianming.tom@gmail.com</a>> wrote:<br>
>><br>
>><br>
>><br>
>><br>
>> Hi,<br>
>><br>
>> I have the previous working fine code when I used VTK 5.6.1+ITK 3.20.1, but<br>
>> I got lots of problem when I wanted to reuse the code while upgrading to the<br>
>> new VTK/ITK version.<br>
>><br>
>> My environment, Ubuntu 12.04, CMake 2.8.12.2, VTK 6.1, ITK 4.7. ItkVtkGlue<br>
>> is turned ON.<br>
>><br>
>> The CMakeLists.txt is as the following, I checked the example,<br>
>><br>
>> cmake_minimum_required(VERSION 2.8)<br>
>><br>
>> PROJECT(BackProjection)<br>
>><br>
>> FIND_PACKAGE(ITK REQUIRED)<br>
>> INCLUDE(${ITK_USE_FILE})<br>
>><br>
>> if (ITKVtkGlue_LOADED)<br>
>>   find_package(VTK REQUIRED)<br>
>>   include(${VTK_USE_FILE})<br>
>> else()<br>
>>   find_package(ItkVtkGlue REQUIRED)<br>
>>   include(${ItkVtkGlue_USE_FILE})<br>
>>   set(Glue ItkVtkGlue)<br>
>> endif()<br>
>> add_executable(ReadPLY MACOSX_BUNDLE ReadPLY.cxx)<br>
>> target_link_libraries(ReadPLY ${Glue} ${VTK_LIBRARIES} ${ITK_LIBRARIES})<br>
>><br>
>> ###<br>
>><br>
>> When I build with make, the error is,<br>
>><br>
>> [100%] Building CXX object CMakeFiles/ReadPLY.dir/ReadPLY.cxx.o<br>
>> Linking CXX executable ReadPLY<br>
>> CMakeFiles/ReadPLY.dir/ReadPLY.cxx.o: In function<br>
>> `vtkSmartPointer<vtkPLYReader>::New()':<br>
>> ReadPLY.cxx:(.text._ZN15vtkSmartPointerI12vtkPLYReaderE3NewEv[_ZN15vtkSmartPointerI12vtkPLYReaderE3NewEv]+0xd):<br>
>> undefined reference to `vtkPLYReader::New()'<br>
>> collect2: error: ld returned 1 exit status<br>
>> make[2]: *** [ReadPLY] Error 1<br>
>> make[1]: *** [CMakeFiles/ReadPLY.dir/all] Error 2<br>
>> make: *** [all] Error 2<br>
>><br>
>> Interestingly, when I fully remove anything about ITK in my CMakeLists.txt,<br>
>> it doesn't show any error. So I suspect it is the ITK's build macro which is<br>
>> breaking my VTK code compiling.<br>
>> The working CMakeLists.txt is like,<br>
>><br>
>> cmake_minimum_required(VERSION 2.8)<br>
>><br>
>> PROJECT(ReadPLY)<br>
>><br>
>> find_package(VTK REQUIRED)<br>
>> include(${VTK_USE_FILE})<br>
>><br>
>> add_executable(ReadPLY MACOSX_BUNDLE ReadPLY.cxx)<br>
>><br>
>> if(VTK_LIBRARIES)<br>
>>   target_link_libraries(ReadPLY ${VTK_LIBRARIES})<br>
>> else()<br>
>>   target_link_libraries(ReadPLY vtkHybrid vtkWidgets)<br>
>> endif()<br>
>><br>
>><br>
>> ####<br>
>><br>
>> And the ReadPLY.cxx source code is, it is actually a VTK example, doesn't<br>
>> contain any ITK code. But I have the other source code file has ITK code,<br>
>> presenting this example just to show the problem.<br>
>><br>
>> #include <vtkPolyData.h><br>
>> #include <vtkPLYReader.h><br>
>> #include <vtkSmartPointer.h><br>
>> #include <vtkPolyDataMapper.h><br>
>> #include <vtkActor.h><br>
>> #include <vtkRenderWindow.h><br>
>> #include <vtkRenderer.h><br>
>> #include <vtkRenderWindowInteractor.h><br>
>><br>
>> int main ( int argc, char *argv[] )<br>
>> {<br>
>>   if(argc != 2)<br>
>>     {<br>
>>     std::cout << "Usage: " << argv[0] << "  Filename(.ply)" << std::endl;<br>
>>     return EXIT_FAILURE;<br>
>>     }<br>
>><br>
>>   std::string inputFilename = argv[1];<br>
>><br>
>>   vtkSmartPointer<vtkPLYReader> reader =<br>
>>     vtkSmartPointer<vtkPLYReader>::New();<br>
>>   reader->SetFileName ( inputFilename.c_str() );<br>
>><br>
>>   // Visualize<br>
>>   vtkSmartPointer<vtkPolyDataMapper> mapper =<br>
>>     vtkSmartPointer<vtkPolyDataMapper>::New();<br>
>>   mapper->SetInputConnection(reader->GetOutputPort());<br>
>><br>
>>   vtkSmartPointer<vtkActor> actor =<br>
>>     vtkSmartPointer<vtkActor>::New();<br>
>>   actor->SetMapper(mapper);<br>
>><br>
>>   vtkSmartPointer<vtkRenderer> renderer =<br>
>>     vtkSmartPointer<vtkRenderer>::New();<br>
>>   vtkSmartPointer<vtkRenderWindow> renderWindow =<br>
>>     vtkSmartPointer<vtkRenderWindow>::New();<br>
>>   renderWindow->AddRenderer(renderer);<br>
>>   vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =<br>
>>     vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
>>   renderWindowInteractor->SetRenderWindow(renderWindow);<br>
>><br>
>>   renderer->AddActor(actor);<br>
>>   renderer->SetBackground(0.1804,0.5451,0.3412); // Sea green<br>
>><br>
>>   renderWindow->Render();<br>
>>   renderWindowInteractor->Start();<br>
>><br>
>>   return EXIT_SUCCESS;<br>
>> }<br>
>><br>
>> ####<br>
>><br>
>><br>
>> _____________________________________<br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Kitware offers ITK Training Courses, for more information visit:<br>
>> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
>><br>
>> Please keep messages on-topic and check the ITK FAQ at:<br>
>> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Unpaid intern in BillsBasement at noware dot com<br>
> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br></div>