<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> vtkFloatArray *arr = vtkFloatArray::New();<br> arr->SetNumberOfTuples(dimension);<br> arr->SetNumberOfComponents(9);<br> for(int i=0; i<dimension; i++) {<br> arr->InsertTuple(i, in[i]);<br> }<br> <br> vtkStructuredPoints *sp = vtkStructuredPoints::New();<br> int dim[3] = {dx, dy, dz};<br> sp->SetDimensions(dim);<br> sp->SetScalarType( VTK_FLOAT);<br> sp->SetNumberOfScalarComponents(9);<br> sp->SetSpacing(1.75, 1.75, 2);<br> sp->SetOrigin(0, 0, 0); <br> sp->GetPointData()->SetTensors(arr);<br> arr->Delete();<br><br> vtkGlyph3D * glyph = vtkGlyph3D::New();<br><br> vtkSphereSource *sphere = vtkSphereSource::New();<br> sphere->SetRadius(1);<br><br> glyph->SetInputConnection(thres->GetOutputPort());<br> glyph->SetSourceConnection (sphere->GetOutputPort());<br> glyph->ScalingOff();<br><br> vtkPolyData *output2 = vtkPolyData::New();<br> output2 = glyph->GetOutput();<br><br> vtkCleanPolyData *cleaner = vtkCleanPolyData::New();<br> cleaner->SetInput(output2);<br><br> vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();<br> <br> mapper->SetInput(cleaner->GetOutput());<br> vtkActor *streamerActor = vtkActor::New();<br> streamerActor->SetMapper(mapper); <br><br> vtkRenderer *renderer = vtkRenderer::New();<br> vtkRenderWindow *renWin = vtkRenderWindow::New();<br> renWin->AddRenderer(renderer);<br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br> iren->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>