As a general rule, you should not call delete on something that you didn&#39;t create yourself. Hence you should not be calling Delete()on output of any filter explicitly. The output dataset will be cleaned up automatically when it&#39;s no longer referenced.<div>
<br></div><div>Utkarsh<br><br><div class="gmail_quote">On Wed, Jun 24, 2009 at 5:35 AM, Anthony <span dir="ltr">&lt;<a href="mailto:slam_ono@yahoo.com">slam_ono@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit">Hi all,<br><br>In this part of code I tried to create a new vtkImageData , pass it  through vtkImageFlip , get the output and then tried to free the memory. Don&#39;t know why I get Segmentation fault , what could I be missing here?  really appreciate any suggestion .<br>
<br>vtkImageData *id =vtkImageData::New();<br>        id-&gt;SetDimensions(10,25,100);<br>        id-&gt;SetScalarTypeToUnsignedShort();<br>        id-&gt;SetNumberOfScalarComponents(1);<br>        id-&gt;AllocateScalars();<br>
    <br>    unsigned short *ptr= (unsigned short *) id-&gt;GetScalarPointer();<br>    for(int i=0; i&lt;10*25*100;i++)<br>    { <br>       
 *ptr++=i;<br>    }<br><br>    vtkImageFlip *flipX=vtkImageFlip::New();<br>        flipX-&gt;SetInput(id);<br>        flipX-&gt;SetFilteredAxis(0);<br>        flipX-&gt;Update();<br><br>    vtkImageData *id2=vtkImageData::SafeDownCast(flipX-&gt;GetOutput());<br>
    <br>    id-&gt;Delete();<br>    flipX-&gt;Delete();<br>    id2-&gt;Delete(); //probably because of this?<br><br>Cheers,<br><font color="#888888"><br>Anthony<br></font></td></tr></tbody></table><div class="hm"><br>
      <hr size="1"> <a href="http://sg.rd.yahoo.com/aa/mail/domainchoice/mail/signature/*http://mail.promotions.yahoo.com/newdomains/aa/" target="_blank"> New Email addresses available on Yahoo! </a> <br>
Get the Email name you&#39;ve always wanted on the new @ymail and @rocketmail.<br>
Hurry before someone else does!</div><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 <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>