<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
From: hawkingyy@hotmail.com<BR>To: daviddoria+vtk@gmail.com<BR>Subject: RE: [vtkusers] An ERROR during reconstruction by using vtkMarchingCubes<BR>Date: Mon, 17 May 2010 15:54:38 +0800<BR><BR>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
Well, thank you so much!<BR> <BR>As what you told me, I used Updata() and vtkSmartPointer, and rearrange the codes, but the problem still remain:<BR> <BR>ERROR: In f:\program files\vtk 5.4\vtk src\common\vtkDataArrayTemplate.txx, line 141<BR>vtkIdTypeArray (56C9E450): Unable to allocate 53329185 elements of size 4 bytes.<BR> <BR>I'm not familiar with coding, so I have no idear with debugging, but I set some break during running, and found the ERROR just happened when the vtkStripper is running.<BR> <BR>Could you give me some advice please?<BR>
<BR>
Here is the code:<BR>
/////////////////////////////////////////////////////////////<BR>
#include "vtkRenderer.h"<BR>#include "vtkRenderWindow.h"<BR>#include "vtkRenderWindowInteractor.h"<BR>#include "vtkImageData.h"<BR>#include "vtkMarchingCubes.h"<BR>#include "vtkActor.h"<BR>#include "vtkPolyDataMapper.h"<BR>#include "vtkDICOMImageReader.h"<BR>#include "vtkStripper.h"<BR>#include "vtkDirectory.h"<BR>#include "vtkStripper.h"<BR>#include "vtkImageThreshold.h"<BR>#include "vtkSmartPointer.h"<BR>
int main()<BR>{ <BR> vtkSmartPointer<vtkDICOMImageReader> DicomReader = vtkSmartPointer<vtkDICOMImageReader> :: New(); <BR> DicomReader -> SetDirectoryName("D://Data//CT");<BR> DicomReader -> Update();<BR> <BR>
vtkSmartPointer<vtkMarchingCubes> MC = vtkSmartPointer<vtkMarchingCubes> :: New();<BR> MC -> SetInput(DicomReader -> GetOutput());<BR> MC -> SetValue(0, 80);<BR> MC -> ComputeGradientsOn();<BR> MC -> ComputeScalarsOff();<BR> MC -> Update();<BR>
<BR>
vtkSmartPointer<vtkStripper> stripper = vtkSmartPointer<vtkStripper> :: New();<BR> stripper -> SetInput (MC -> GetOutput());<BR> stripper -> Update();<BR>
<BR>
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper> :: New();<BR> mapper -> SetInput (stripper -> GetOutput());<BR> mapper -> Update();<BR>
<BR>
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor> :: New();<BR> actor -> SetMapper(mapper);<BR>
<BR>
vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer> :: New();<BR> ren -> AddActor(actor);<BR> ren -> SetBackground (1, 1, 1);<BR>
<BR>
vtkSmartPointer<vtkRenderWindow> renWin = vtkSmartPointer<vtkRenderWindow> :: New();<BR> renWin -> AddRenderer(ren);<BR> <BR> vtkSmartPointer<vtkRenderWindowInteractor> iren = vtkSmartPointer<vtkRenderWindowInteractor> :: New();<BR> iren -> SetRenderWindow (renWin);<BR> <BR>
iren->Initialize();<BR> iren->Start();<BR>
return 0;<BR>
}<BR> <BR>
///////////////////////////////////////////////////////////// <BR><BR>
Thanks!<BR> <BR>Daniel<BR> <BR>> Date: Sun, 16 May 2010 09:04:38 -0400<BR>> Subject: Re: [vtkusers] An ERROR during reconstruction by using vtkMarchingCubes<BR>> From: daviddoria+vtk@gmail.com<BR>> To: hawkingyy@hotmail.com<BR>> CC: vtkusers@vtk.org<BR>> <BR>> 2010/5/16 noc <hawkingyy@hotmail.com>:<BR>> > Hi everybody,<BR>> > I'm just new here.<BR>> ><BR>> > Well, I met a problem in isosurface drawing.<BR>> ><BR>> > The ERROE message is: ERROR: In f:\program files\vtk 5.4\vtk<BR>> > src\common\vtkDataArrayTemplate.txx, line 141 vtkIdTypeArray (501E4CC8):<BR>> > Unable to allocate 44288846 elements of size 4 bytes.<BR>> ><BR>> > I wondered why this happen so frequently. I just used 100 DICOM files, the<BR>> > RAM of my computer is 1GB, and the virtual memory is 2GB, during<BR>> > reconstruction, it only cost 0.99GB memory in total.<BR>> ><BR>> > Could anyone help me please?<BR>> ><BR>> > Thanks a lot!!!<BR>> ><BR>> > In the end, here is my code:<BR>> ><BR>> > #include "vtkRenderer.h"<BR>> > #include "vtkRenderWindow.h"<BR>> > #include "vtkRenderWindowInteractor.h"<BR>> > #include "vtkImageData.h"<BR>> > #include "vtkMarchingCubes.h"<BR>> > #include "vtkActor.h"<BR>> > #include "vtkPolyDataMapper.h"<BR>> > #include "vtkDICOMImageReader.h"<BR>> > #include "vtkStripper.h"<BR>> > #include "vtkDirectory.h"<BR>> > #include "vtkStripper.h"<BR>> ><BR>> > int main()<BR>> > {<BR>> > vtkDICOMImageReader * Dicom Reader = vtkDICOMImageReader :: New();<BR>> > DicomReader -> SetDirectoryName("D:/Data/CT");<BR>> ><BR>> > vtkRenderer * ren = vtkRenderer :: New();<BR>> > ren -> SetBackground (1, 1, 1);<BR>> ><BR>> > vtkRenderWindow * renWin = vtkRenderWindow :: New();<BR>> > renWin -> AddRenderer(ren);<BR>> ><BR>> > vtkRenderWindowInteractor * iren = vtkRenderWindowInteractor :: New();<BR>> > iren -> SetRenderWindow (renWin);<BR>> ><BR>> > vtkMarchingCubes * MC = vtkMarchingCubes :: New();<BR>> > MC -> SetInput(DicomReader -> GetOutput());<BR>> > MC -> SetValue(0, 30);<BR>> > MC -> ComputeGradientsOn( );<BR>> > MC -> ComputeScalarsOff();<BR>> ><BR>> > vtkStripper * stripper = vtkStripper :: New();<BR>> > stripper -> SetInput (MC -> GetOutput());<BR>> ><BR>> > vtkPolyDataMapper * mapper = vtkPolyDataMapper :: New();<BR>> > mapper -> SetInput (stripper -> GetOutput());<BR>> ><BR>> > vtkActor * actor = vtkActor :: New();<BR>> > actor -> SetMapper(mapper);<BR>> ><BR>> > ren -> AddActor(actor);<BR>> ><BR>> > iren->Initialize();<BR>> > iren->Start();<BR>> > return 0;<BR>> > }<BR>> <BR>> Welcome to VTK!<BR>> <BR>> First, I strongly recommend that you use smart pointers:<BR>> http://vtk.org/Wiki/VTK/Tutorials/SmartPointers<BR>> <BR>> Second, that doesn't sound to me like it is failing during the<BR>> reconstruction. I'd put an ->Update() after everything and step<BR>> through with a debugger to see exactly where that error occurs:<BR>> <BR>> e.g.<BR>> <BR>> vtkSmartPointer<vtkDICOMImageReader> Dicom Reader =<BR>> vtkSmartPointer<vtkDICOMImageReader> :: New();<BR>> DicomReader -> SetDirectoryName("D:/Data/CT");<BR>> DicomReader ->Update();<BR>> <BR>> Let us know what you find out.<BR>> <BR>> Thanks,<BR>> <BR>> David<BR><BR><BR>
<HR>
<BR>
搜索本应是彩色的,快来体验新一代搜索引擎-必应,精美图片每天换哦! <A href="http://cn.bing.com/?form=CRMADS">立即试用!</A><BR>                                            <br /><hr />使用新一代 Windows Live Messenger 轻松交流和共享! <a href='http://www.windowslive.cn/messenger/' target='_new'>立刻下载!</a></body>
</html>