[Insight-users] Problem with Real-time Visualization of itkDeformableSimplexMesh3DBalloonForceFilterTest

Tanweer Rashid trash001 at odu.edu
Wed Mar 13 20:14:14 EDT 2013


Hi all,

I am trying to set up a real-time visualization (using VTK) of the
deformation of the test file
itkDeformableSimplexMesh3DBalloonForceFilter.cxx.

Most of the test file's code is pretty much unchanged. I added vtkPolyData,
vtkActor, vtkRenderer, vtkRenderWindow, vtkRenderWindowInteractor at the
beginning of the test and initialized them. Then, at the end of the test
file, I added a for-loop, within which is the deformFilter's update()
function being called. The changes are as follows:


    DeformFilterType::Pointer deformFilter = DeformFilterType::New();
    deformFilter->SetGradient(gradientFilter->GetOutput());
    deformFilter->SetAlpha(0.2);
    deformFilter->SetBeta(0.1);
    deformFilter->SetKappa(0.01);
    deformFilter->SetRigidity(0);

    SimplexMeshType::Pointer simplexMesh = simplexFilter->GetOutput();
    SimplexMeshType::Pointer simplexMesh2 = simplexMesh;

    for (int i = 0; i < 100; i++) {
        deformFilter->SetInput(simplexMesh);
        deformFilter->SetIterations(1);
        deformFilter->Update();

        simplexMesh2 = deformFilter->GetOutput();

        mapper->SetInput(itkMesh2VTKPolyData(simplexMesh2));
        actor->SetMapper(mapper);
        ren->Render();
    }

The function itkMesh2VTKPolyData() takes an itk mesh and returns a
vtkPolyData, and is taken from the ITKApps/DeformableModelSimplexMesh
project.

The program gives a "Segmentation fault; core dumped" error.
When I try debugging the program, the first for-loop iteration works
without any problems, but during the second iteration's
deformFilter->Update() call, the program breaks.

Any suggestions would be appreciated.

PS,
My CMakeLists.txt is as follows:

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(ITK_DeformableSimplexMeshTests)
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(${ITK_DeformableSimplexMeshTests_SOURCE_DIR})
ADD_EXECUTABLE(ITK_DeformableSimplexMeshTests   main.cpp)
TARGET_LINK_LIBRARIES (ITK_DeformableSimplexMeshTests ${ITK_LIBRARIES}
${VTK_LIBRARIES})



-- 
Tanweer Rashid
MSVE Dept.
Old Dominion University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130313/fc15fee4/attachment.htm>


More information about the Insight-users mailing list