As a general rule, you should not call delete on something that you didn'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'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"><<a href="mailto:slam_ono@yahoo.com">slam_ono@yahoo.com</a>></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'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->SetDimensions(10,25,100);<br> id->SetScalarTypeToUnsignedShort();<br> id->SetNumberOfScalarComponents(1);<br> id->AllocateScalars();<br>
<br> unsigned short *ptr= (unsigned short *) id->GetScalarPointer();<br> for(int i=0; i<10*25*100;i++)<br> { <br>
*ptr++=i;<br> }<br><br> vtkImageFlip *flipX=vtkImageFlip::New();<br> flipX->SetInput(id);<br> flipX->SetFilteredAxis(0);<br> flipX->Update();<br><br> vtkImageData *id2=vtkImageData::SafeDownCast(flipX->GetOutput());<br>
<br> id->Delete();<br> flipX->Delete();<br> id2->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'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>