<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 9pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body><div style="text-align: left;">Hi,<br>I am trying to display the tensors at each point of a 128*128*64 MRI image, the data is stored in a 9 components vtkFloatArray, I constructed a structuredPoints and pass to glyph3D, but it gives me an error that I am trying to allocate a 1Billion element array, how can I solve that? could somebody please help me on this.<br>Many thanks<br><br>Here is my code:<br><br>&nbsp;&nbsp;&nbsp; vtkFloatArray *arr = vtkFloatArray::New();<br>&nbsp;&nbsp;&nbsp; arr-&gt;SetNumberOfTuples(dimension);<br>&nbsp;&nbsp;&nbsp; arr-&gt;SetNumberOfComponents(9);<br>&nbsp;&nbsp;&nbsp; for(int i=0; i&lt;dimension; i++) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; arr-&gt;InsertTuple(i, in[i]);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; vtkStructuredPoints *sp = vtkStructuredPoints::New();<br>&nbsp;&nbsp;&nbsp; int dim[3] = {dx, dy, dz};<br>&nbsp;&nbsp;&nbsp; sp-&gt;SetDimensions(dim);<br>&nbsp;&nbsp;&nbsp; sp-&gt;SetScalarType( VTK_FLOAT);<br>&nbsp;&nbsp;&nbsp; sp-&gt;SetNumberOfScalarComponents(9);<br>&nbsp;&nbsp;&nbsp; sp-&gt;SetSpacing(1.75, 1.75, 2);<br>&nbsp;&nbsp;&nbsp; sp-&gt;SetOrigin(0, 0, 0);&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; sp-&gt;GetPointData()-&gt;SetTensors(arr);<br>&nbsp;&nbsp;&nbsp; arr-&gt;Delete();<br><br>&nbsp;&nbsp;&nbsp; vtkGlyph3D * glyph = vtkGlyph3D::New();<br><br>&nbsp;&nbsp;&nbsp; vtkSphereSource *sphere = vtkSphereSource::New();<br>&nbsp;&nbsp;&nbsp; sphere-&gt;SetRadius(1);<br><br>&nbsp;&nbsp;&nbsp; glyph-&gt;SetInputConnection(thres-&gt;GetOutputPort());<br>&nbsp;&nbsp;&nbsp; glyph-&gt;SetSourceConnection (sphere-&gt;GetOutputPort());<br>&nbsp;&nbsp;&nbsp; glyph-&gt;ScalingOff();<br><br>&nbsp;&nbsp;&nbsp; vtkPolyData&nbsp;&nbsp; *output2 = vtkPolyData::New();<br>&nbsp;&nbsp;&nbsp; output2 = glyph-&gt;GetOutput();<br><br>&nbsp;&nbsp;&nbsp; vtkCleanPolyData *cleaner = vtkCleanPolyData::New();<br>&nbsp;&nbsp;&nbsp; cleaner-&gt;SetInput(output2);<br><br>&nbsp;&nbsp;&nbsp; vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; mapper-&gt;SetInput(cleaner-&gt;GetOutput());<br>&nbsp;&nbsp;&nbsp; vtkActor *streamerActor = vtkActor::New();<br>&nbsp;&nbsp;&nbsp; streamerActor-&gt;SetMapper(mapper);&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; vtkRenderer *renderer = vtkRenderer::New();<br>&nbsp;&nbsp;&nbsp; vtkRenderWindow *renWin = vtkRenderWindow::New();<br>&nbsp;&nbsp;&nbsp; renWin-&gt;AddRenderer(renderer);<br>&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetRenderWindow(renWin);<br><br><br>hank <br></div><br /><hr />使用下一代的 MSN Messenger。 <a href='http://imagine-msn.com/messenger/launch80/default.aspx?locale=zh-cn&source=wlmailtagline' target='_new'>立即尝试!</a></body>
</html>