[Insight-users] QuadricDecimationQuadEdgeMeshFilter crashes

cagatay bilgin bilgincc at gmail.com
Tue Feb 21 18:23:38 EST 2012


Hi ITK users,
I am having trouble with QuadricDecimationQuadEdgeMeshFilter
class. Here is the code snippet I used. The program compiles
but crashes while running

  typedef itk::QuadEdgeMesh< double, 3 >
 InputQuadMeshType;
  typedef itk::Vector< double, 3 >
 QuadVectorType;

  //Binary image to mesh
  typedef itk::BinaryMask3DMeshSource< OIT, InputQuadMeshType >
MeshSourceType;
  MeshSourceType::Pointer meshSource = MeshSourceType::New();
  meshSource->SetObjectValue( 255 );
  meshSource->SetInput( thresholdFilter->GetOutput() );
  meshSource->Update();
  InputQuadMeshType::Pointer mesh = meshSource->GetOutput( );
  std::cout << "Initially #faces: " << mesh->GetNumberOfFaces() <<
std::endl;

  //Mesh decimate
  typedef itk::NumberOfFacesCriterion< InputQuadMeshType > CriterionType;
  typedef itk::QuadricDecimationQuadEdgeMeshFilter
    <InputQuadMeshType, InputQuadMeshType, CriterionType > DecimationType;

  long N=1000;
  CriterionType::Pointer criterion = CriterionType::New();
  criterion->SetTopologicalChange( true );
  criterion->SetNumberOfElements( N );

  DecimationType::Pointer decimate = DecimationType::New();
  decimate->SetInput( mesh );
  decimate->SetCriterion( criterion );
  decimate->Update();
  InputQuadMeshType::Pointer decimatedMesh = decimate->GetOutput();
  std::cout << "Decimation # of faces: " <<
decimatedMesh->GetNumberOfFaces() << std::endl;

when I do N = mesh->GetNumberOfFaces();
the code just works fine.

Here is the output

Initially #faces: 360790
*** glibc detected *** ./CBSRelease: double free or corruption (out):
0x00007fc0e4000020 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x78a96)[0x7fc14b72fa96]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7fc14b733d7c]
./CBSRelease(_ZN10vnl_matrixIfE7destroyEv+0x33)[0x86ad83]
./CBSRelease(_ZN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS_17QuadEdgeMeshPointIfLj3ENS_19GeometricalQuadEdgeImmbbLb1EEEEEED1Ev+0x1c)[0x6e83c8]
./CBSRelease(_ZNSt4pairIKmN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS1_17QuadEdgeMeshPointIfLj3ENS1_19GeometricalQuadEdgeImmbbLb1EEEEEEEED1Ev+0x1c)[0x6e4ae4]
./CBSRelease(_ZN9__gnu_cxx13new_allocatorISt4pairIKmN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS3_17QuadEdgeMeshPointIfLj3ENS3_19GeometricalQuadEdgeImmbbLb1EEEEEEEEE7destroyEPSA_+0x1c)[0x6e4b02]
./CBSRelease(_ZNSt8_Rb_treeImSt4pairIKmN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS2_17QuadEdgeMeshPointIfLj3ENS2_19GeometricalQuadEdgeImmbbLb1EEEEEEEESt10_Select1stIS9_ESt4lessImESaIS9_EE15_M_destroy_nodeEPSt13_Rb_tree_nodeIS9_E+0x46)[0x6e11dc]
./CBSRelease(_ZNSt8_Rb_treeImSt4pairIKmN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS2_17QuadEdgeMeshPointIfLj3ENS2_19GeometricalQuadEdgeImmbbLb1EEEEEEEESt10_Select1stIS9_ESt4lessImESaIS9_EE12_M_erase_auxESt23_Rb_tree_const_iteratorIS9_E+0x3e)[0x768840]
./CBSRelease(_ZNSt8_Rb_treeImSt4pairIKmN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS2_17QuadEdgeMeshPointIfLj3ENS2_19GeometricalQuadEdgeImmbbLb1EEEEEEEESt10_Select1stIS9_ESt4lessImESaIS9_EE5eraseESt17_Rb_tree_iteratorIS9_E+0x36)[0x74d20e]
./CBSRelease(_ZNSt3mapImN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS0_17QuadEdgeMeshPointIfLj3ENS0_19GeometricalQuadEdgeImmbbLb1EEEEEEESt4lessImESaISt4pairIKmS6_EEE5eraseESt17_Rb_tree_iteratorISB_E+0x23)[0x73140f]
./CBSRelease(_ZN3itk35QuadricDecimationQuadEdgeMeshFilterINS_12QuadEdgeMeshIdLj3ENS_18QuadEdgeMeshTraitsIdLj3EbbffEEEES4_NS_22NumberOfFacesCriterionIS4_mdNS_30MinPriorityQueueElementWrapperIPNS_19GeometricalQuadEdgeImmbbLb1EEESt4pairIbdEmEEEEE11DeletePointERKmSG_+0x99)[0x6f9ee9]
./CBSRelease(_ZN3itk32EdgeDecimationQuadEdgeMeshFilterINS_12QuadEdgeMeshIdLj3ENS_18QuadEdgeMeshTraitsIdLj3EbbffEEEES4_NS_22NumberOfFacesCriterionIS4_mdNS_30MinPriorityQueueElementWrapperIPNS_19GeometricalQuadEdgeImmbbLb1EEESt4pairIbdEmEEEEE37ProcessWithoutAnyTopologicalGuaranteeEv+0x42c)[0x6f9792]
./CBSRelease(_ZN3itk32EdgeDecimationQuadEdgeMeshFilterINS_12QuadEdgeMeshIdLj3ENS_18QuadEdgeMeshTraitsIdLj3EbbffEEEES4_NS_22NumberOfFacesCriterionIS4_mdNS_30MinPriorityQueueElementWrapperIPNS_19GeometricalQuadEdgeImmbbLb1EEESt4pairIbdEmEEEEE31ProcessWithTopologicalGuaranteeEv+0x3b)[0x6f9ad7]
./CBSRelease(_ZN3itk28DecimationQuadEdgeMeshFilterINS_12QuadEdgeMeshIdLj3ENS_18QuadEdgeMeshTraitsIdLj3EbbffEEEES4_NS_22NumberOfFacesCriterionIS4_mdNS_30MinPriorityQueueElementWrapperIPNS_19GeometricalQuadEdgeImmbbLb1EEESt4pairIbdEmEEEEE12GenerateDataEv+0x98)[0x6f87be]
./CBSRelease(_ZN3itk13ProcessObject16UpdateOutputDataEPNS_10DataObjectE+0xc5)[0x8b6eb5]
./CBSRelease(_ZN3itk13ProcessObject6UpdateEv+0x116)[0x8b4116]
./CBSRelease(main+0xf8a)[0x6be89e]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fc14b6d830d]
./CBSRelease[0x6bd861]


Cagatay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120221/15d4b29a/attachment.htm>


More information about the Insight-users mailing list