<!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> </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> </DIV>
<DIV>ImageType::Pointer* fun1()</DIV>
<DIV>{</DIV>
<DIV>
<DIV>...</DIV>
<DIV><FONT face="Bookman Old Style"> dicomReader =
ReaderType_Short::New();//itk<BR>...</FONT></DIV>
<DIV><FONT face="Bookman Old Style"> </FONT><FONT
face="Bookman Old Style"> //convert itk image to vtk
image<BR> connectorMRI =
ConnectorType::New();<BR> connectorMRI->SetInput(dicomReader->GetOutput());<BR> try<BR> { <BR> connectorMRI->Update();<BR> }<BR> catch(
itk::ExceptionObject & excp )<BR> {<BR> std::cerr <<
"Error reading the series " << std::endl;<BR> std::cerr
<< excp << std::endl;<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV>return connectorMRI->GetOutput();</DIV></DIV>
<DIV><BR>}</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>In fun2(), I generate a volume and render it.</DIV>
<DIV>fun2()</DIV>
<DIV>{</DIV>
<DIV> vtkVolume *volume = GenerateVolume(fun1());</DIV>
<DIV> </DIV>
<DIV>vtkWin->Render();</DIV>
<DIV> </DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV> </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> </DIV>
<DIV>Regards,</DIV>
<DIV> </DIV>
<DIV>Yixun Liu</DIV>
<DIV> </DIV>
<DIV><FONT
face="Bookman Old Style"></FONT> </DIV></FONT></DIV></BODY></HTML>