<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Bookman Old Style">
<DIV><FONT face="Bookman Old Style">Hi,</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">I read dicom using itk and change it to vtk 
to visualize it. I read dicom and change it to vtk in fun1();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>ImageType::Pointer* fun1()</DIV>
<DIV>{</DIV>
<DIV>
<DIV>...</DIV>
<DIV><FONT face="Bookman Old Style">&nbsp;dicomReader = 
ReaderType_Short::New();//itk<BR>...</FONT></DIV>
<DIV><FONT face="Bookman Old Style">&nbsp;</FONT><FONT 
face="Bookman Old Style">&nbsp;//convert itk image to vtk 
image<BR>&nbsp;&nbsp;&nbsp; connectorMRI = 
ConnectorType::New();<BR>&nbsp;connectorMRI-&gt;SetInput(dicomReader-&gt;GetOutput());<BR>&nbsp;try<BR>&nbsp;{&nbsp;<BR>&nbsp;&nbsp;connectorMRI-&gt;Update();<BR>&nbsp;}<BR>&nbsp;catch( 
itk::ExceptionObject &amp; excp )<BR>&nbsp;{<BR>&nbsp;&nbsp;std::cerr &lt;&lt; 
"Error reading the series " &lt;&lt; std::endl;<BR>&nbsp;&nbsp;std::cerr 
&lt;&lt; excp &lt;&lt; std::endl;<BR>&nbsp;}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>return connectorMRI-&gt;GetOutput();</DIV></DIV>
<DIV><BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>In fun2(), I generate a volume and render it.</DIV>
<DIV>fun2()</DIV>
<DIV>{</DIV>
<DIV>&nbsp; vtkVolume *volume = GenerateVolume(fun1());</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkWin-&gt;Render();</DIV>
<DIV>&nbsp;</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>However, exception occurs. If I change the connectoMRI to class variable 
instead of local variable. I can render it correctly. I do not konw the reason. 
I guess that if connectorMIR is a local variable it release memory when the fun1 
return. </DIV>
<DIV>&nbsp;</DIV>
<DIV>Regards,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Yixun Liu</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT 
face="Bookman Old Style"></FONT>&nbsp;</DIV></FONT></DIV></BODY></HTML>