[Insight-developers] Delete an itk::Image??

Luis Ibanez luis.ibanez@kitware.com
Mon, 17 Feb 2003 13:44:45 -0500


Hi Yinpeng,


You should not call "Delete()" on any ITK object.

If you want to get rid of the image, simply
assign a new image created with the "New()" operator.

If the new image has a different size, you will have
to call again the "SetInputImage()" method of the
viewer providing as argument the smart pointer of
the newly created image. The viewer recomputes
its internal state at each call of SetInputImage().


   Luis


============================
Yinpeng Jin wrote:
> I need to finish the following job:
> 
> step 1: build an image object A
> step 2: use fltk::image2dviewer to view it.
> step 3: load another image to object A (might change size, therefore I guess
> I have to A->Delete(), then A=Image<>::New(); )
> step 4: goto step 2;
> 
> my code crashed at A->Delete();
> I guess it is because it is still associated with Image2DViewer?
> any solution?
> I think I have to achieve it  to allow user to try another image in a FLTK
> demo without first close it.
> 
> 
> thanks.
> yinpeng.
> 
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>