[vtkusers] Display tensors for large image
YaoHaofeng
hfyao1983 at hotmail.com
Sat Mar 10 06:26:23 EST 2007
Hi,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.Many thanksHere is my code: vtkFloatArray *arr = vtkFloatArray::New(); arr->SetNumberOfTuples(dimension); arr->SetNumberOfComponents(9); for(int i=0; i<dimension; i++) { arr->InsertTuple(i, in[i]); } vtkStructuredPoints *sp = vtkStructuredPoints::New(); int dim[3] = {dx, dy, dz}; sp->SetDimensions(dim); sp->SetScalarType( VTK_FLOAT); sp->SetNumberOfScalarComponents(9); sp->SetSpacing(1.75, 1.75, 2); sp->SetOrigin(0, 0, 0); sp->GetPointData()->SetTensors(arr); arr->Delete(); vtkGlyph3D * glyph = vtkGlyph3D::New(); vtkSphereSource *sphere = vtkSphereSource::New(); sphere->SetRadius(1); glyph->SetInputConnection(thres->GetOutputPort()); glyph->SetSourceConnection (sphere->GetOutputPort()); glyph->ScalingOff(); vtkPolyData *output2 = vtkPolyData::New(); output2 = glyph->GetOutput(); vtkCleanPolyData *cleaner = vtkCleanPolyData::New(); cleaner->SetInput(output2); vtkPolyDataMapper *mapper = vtkPolyDataMapper::New(); mapper->SetInput(cleaner->GetOutput()); vtkActor *streamerActor = vtkActor::New(); streamerActor->SetMapper(mapper); vtkRenderer *renderer = vtkRenderer::New(); vtkRenderWindow *renWin = vtkRenderWindow::New(); renWin->AddRenderer(renderer); vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New(); iren->SetRenderWindow(renWin);hank
_________________________________________________________________
使用下一代的 MSN Messenger。
http://imagine-msn.com/messenger/launch80/default.aspx?locale=zh-cn&source=wlmailtagline
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070310/8d20aa1e/attachment.htm>
More information about the vtkusers
mailing list