Hi Arnaud, <div><br></div><div>Sorry for the late response. You can find the </div><div>output of the BinaryMash3DMeshSource here</div><div><a href="http://vision.lbl.gov/People/bilgin/mesh.vtk.tar.gz">http://vision.lbl.gov/People/bilgin/mesh.vtk.tar.gz</a> </div>
<div><br></div><div>The code seems to run as expected with other images. </div><div>For the failing image, decimation in Paraview works fine.</div><div><br></div><div>Thank you, </div><div>Cagatay<br><br><div class="gmail_quote">
On Fri, Feb 24, 2012 at 12:09 AM, Arnaud Gelas <span dir="ltr">&lt;<a href="mailto:arnaudgelas@gmail.com">arnaudgelas@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Cagatay,<br><br>Thanks for reporting the error / bug.<br><br>Can you save the output of the BinaryMash3DMeshSource filter and share it with me, please?<br><br>Thanks,<br>Arnaud<br><br><div class="gmail_quote"><div><div>
</div><div class="h5">On Wed, Feb 22, 2012 at 12:23 AM, cagatay bilgin <span dir="ltr">&lt;<a href="mailto:bilgincc@gmail.com" target="_blank">bilgincc@gmail.com</a>&gt;</span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5"><div>Hi ITK users, </div><div>I am having trouble with QuadricDecimationQuadEdgeMeshFilter</div>
<div>class. Here is the code snippet I used. The program compiles </div>

<div>but crashes while running   </div><div><br></div>
<div>  typedef itk::QuadEdgeMesh&lt; double, 3 &gt;                        InputQuadMeshType;</div><div>  typedef itk::Vector&lt; double, 3 &gt;                              QuadVectorType;</div><div>  </div><div>  //Binary image to mesh</div>



<div>  typedef itk::BinaryMask3DMeshSource&lt; OIT, InputQuadMeshType &gt; MeshSourceType;</div><div>  MeshSourceType::Pointer meshSource = MeshSourceType::New();</div><div>  meshSource-&gt;SetObjectValue( 255 );</div><div>



  meshSource-&gt;SetInput( thresholdFilter-&gt;GetOutput() );</div><div>  meshSource-&gt;Update();</div><div>  InputQuadMeshType::Pointer mesh = meshSource-&gt;GetOutput( );</div><div>  std::cout &lt;&lt; &quot;Initially #faces: &quot; &lt;&lt; mesh-&gt;GetNumberOfFaces() &lt;&lt; std::endl;</div>



<div>    </div><div>  //Mesh decimate</div><div>  typedef itk::NumberOfFacesCriterion&lt; InputQuadMeshType &gt; CriterionType;</div><div>  typedef itk::QuadricDecimationQuadEdgeMeshFilter</div><div>    &lt;InputQuadMeshType, InputQuadMeshType, CriterionType &gt; DecimationType;</div>



<div><br></div><div>  long N=1000;</div><div>  CriterionType::Pointer criterion = CriterionType::New();</div><div>  criterion-&gt;SetTopologicalChange( true );</div><div>  criterion-&gt;SetNumberOfElements( N );</div><div>



<br></div><div>  DecimationType::Pointer decimate = DecimationType::New();</div><div>  decimate-&gt;SetInput( mesh );</div><div>  decimate-&gt;SetCriterion( criterion );</div><div>  decimate-&gt;Update();</div><div>  InputQuadMeshType::Pointer decimatedMesh = decimate-&gt;GetOutput();</div>



<div>  std::cout &lt;&lt; &quot;Decimation # of faces: &quot; &lt;&lt; decimatedMesh-&gt;GetNumberOfFaces() &lt;&lt; std::endl;</div><div><br></div><div>when I do N = mesh-&gt;GetNumberOfFaces(); </div><div>the code just works fine. </div>



<div><br></div><div>Here is the output</div><div><br></div><div><div>Initially #faces: 360790</div></div><div><div>*** glibc detected *** ./CBSRelease: double free or corruption (out): 0x00007fc0e4000020 ***</div><div>======= Backtrace: =========</div>



<div>/lib/x86_64-linux-gnu/libc.so.6(+0x78a96)[0x7fc14b72fa96]</div><div>/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7fc14b733d7c]</div><div>./CBSRelease(_ZN10vnl_matrixIfE7destroyEv+0x33)[0x86ad83]</div><div>./CBSRelease(_ZN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS_17QuadEdgeMeshPointIfLj3ENS_19GeometricalQuadEdgeImmbbLb1EEEEEED1Ev+0x1c)[0x6e83c8]</div>



<div>./CBSRelease(_ZNSt4pairIKmN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS1_17QuadEdgeMeshPointIfLj3ENS1_19GeometricalQuadEdgeImmbbLb1EEEEEEEED1Ev+0x1c)[0x6e4ae4]</div><div>./CBSRelease(_ZN9__gnu_cxx13new_allocatorISt4pairIKmN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS3_17QuadEdgeMeshPointIfLj3ENS3_19GeometricalQuadEdgeImmbbLb1EEEEEEEEE7destroyEPSA_+0x1c)[0x6e4b02]</div>



<div>./CBSRelease(_ZNSt8_Rb_treeImSt4pairIKmN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS2_17QuadEdgeMeshPointIfLj3ENS2_19GeometricalQuadEdgeImmbbLb1EEEEEEEESt10_Select1stIS9_ESt4lessImESaIS9_EE15_M_destroy_nodeEPSt13_Rb_tree_nodeIS9_E+0x46)[0x6e11dc]</div>



<div>./CBSRelease(_ZNSt8_Rb_treeImSt4pairIKmN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS2_17QuadEdgeMeshPointIfLj3ENS2_19GeometricalQuadEdgeImmbbLb1EEEEEEEESt10_Select1stIS9_ESt4lessImESaIS9_EE12_M_erase_auxESt23_Rb_tree_const_iteratorIS9_E+0x3e)[0x768840]</div>



<div>./CBSRelease(_ZNSt8_Rb_treeImSt4pairIKmN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS2_17QuadEdgeMeshPointIfLj3ENS2_19GeometricalQuadEdgeImmbbLb1EEEEEEEESt10_Select1stIS9_ESt4lessImESaIS9_EE5eraseESt17_Rb_tree_iteratorIS9_E+0x36)[0x74d20e]</div>



<div>./CBSRelease(_ZNSt3mapImN3itk42QuadEdgeMeshDecimationQuadricElementHelperINS0_17QuadEdgeMeshPointIfLj3ENS0_19GeometricalQuadEdgeImmbbLb1EEEEEEESt4lessImESaISt4pairIKmS6_EEE5eraseESt17_Rb_tree_iteratorISB_E+0x23)[0x73140f]</div>



<div>./CBSRelease(_ZN3itk35QuadricDecimationQuadEdgeMeshFilterINS_12QuadEdgeMeshIdLj3ENS_18QuadEdgeMeshTraitsIdLj3EbbffEEEES4_NS_22NumberOfFacesCriterionIS4_mdNS_30MinPriorityQueueElementWrapperIPNS_19GeometricalQuadEdgeImmbbLb1EEESt4pairIbdEmEEEEE11DeletePointERKmSG_+0x99)[0x6f9ee9]</div>



<div>./CBSRelease(_ZN3itk32EdgeDecimationQuadEdgeMeshFilterINS_12QuadEdgeMeshIdLj3ENS_18QuadEdgeMeshTraitsIdLj3EbbffEEEES4_NS_22NumberOfFacesCriterionIS4_mdNS_30MinPriorityQueueElementWrapperIPNS_19GeometricalQuadEdgeImmbbLb1EEESt4pairIbdEmEEEEE37ProcessWithoutAnyTopologicalGuaranteeEv+0x42c)[0x6f9792]</div>



<div>./CBSRelease(_ZN3itk32EdgeDecimationQuadEdgeMeshFilterINS_12QuadEdgeMeshIdLj3ENS_18QuadEdgeMeshTraitsIdLj3EbbffEEEES4_NS_22NumberOfFacesCriterionIS4_mdNS_30MinPriorityQueueElementWrapperIPNS_19GeometricalQuadEdgeImmbbLb1EEESt4pairIbdEmEEEEE31ProcessWithTopologicalGuaranteeEv+0x3b)[0x6f9ad7]</div>



<div>./CBSRelease(_ZN3itk28DecimationQuadEdgeMeshFilterINS_12QuadEdgeMeshIdLj3ENS_18QuadEdgeMeshTraitsIdLj3EbbffEEEES4_NS_22NumberOfFacesCriterionIS4_mdNS_30MinPriorityQueueElementWrapperIPNS_19GeometricalQuadEdgeImmbbLb1EEESt4pairIbdEmEEEEE12GenerateDataEv+0x98)[0x6f87be]</div>



<div>./CBSRelease(_ZN3itk13ProcessObject16UpdateOutputDataEPNS_10DataObjectE+0xc5)[0x8b6eb5]</div><div>./CBSRelease(_ZN3itk13ProcessObject6UpdateEv+0x116)[0x8b4116]</div><div>./CBSRelease(main+0xf8a)[0x6be89e]</div><div>


/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fc14b6d830d]</div>
<div>./CBSRelease[0x6bd861]</div></div><span><font color="#888888"><div><br></div><div><br></div><div>Cagatay</div><div><br></div>
</font></span><br></div></div>_____________________________________<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.html" target="_blank">http://www.kitware.com/products/protraining.html</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://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br><span><font color="#888888">Arnaud Gelas, Ph. D.<br>Avenue Beauregard 30<br>CH-1700 Fribourg<br>Switzerland<br>cellphone: <a href="tel:%28%2B41%29%2076-635-08-66" value="+41766350866" target="_blank">(+41) 76-635-08-66</a><br>
phone: <a href="tel:%28%2B41%29%2026-535-44-36" value="+41265354436" target="_blank">(+41) 26-535-44-36</a><br>


<a href="mailto:arnaudgelas@gmail.com" target="_blank">arnaudgelas@gmail.com</a></font></span><br>
</font></blockquote></div><br></div>