[vtkusers] vtkImageReader Output

Pallavi Joshi pallavi.joshi at vanderbilt.edu
Fri Jul 9 15:45:43 EDT 2004


Hi All,
I am trying to display a 3D volume. I read it first using vtkImageReader and give it to vtkPolyDataMapper. But it gives me an error saying that input of vtkPolyDataMapper has to be a vtkPolyData. 
Also in the Following piece of code I get an error:

vtkImageReader *reader1 = vtkImageReader::New();
    reader1->SetDataByteOrderToLittleEndian();
    reader1->SetDataExtent(0, 511, 0, 511, 0, 88);
    reader1->SetDataSpacing(0.5859375,0.5859375,2);
    reader1->SetFileDimensionality(3);
    reader1->SetDataScalarTypeToUnsignedShort();
    reader1->SetFileName("Z:/Registration/Adults/Patients/6740/images/CT6740.img");
    reader1->Update();
    
vtkThreshold *thresh = vtkThreshold::New();
    thresh->SetInput( (vtkDataSet *)reader1->GetOutput() );
    thresh->ThresholdByUpper(1350);
    thresh->AllScalarsOn();

//COnvert from vtkUnstructured grid output of threshold to vtkPOlyData
vtkUnstructuredGridToPolyDataFilter *pfilter = vtkUnstructuredGridToPolyDataFilter::New();
   pfilter->SetInput( thresh->GetOutput() );

//Displays the thresholded image:
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
    mapper->SetInput( pfilter->GetOutput() );
vtkActor *actor = vtkActor::New();
    actor->SetMapper(mapper);   
vtkRenderer *ren1 = vtkRenderer::New();

ren1->AddActor(actor);
ren1->SetBackground(.2, .3, .5);
ren1->SetViewport(0.0, 0.0, 0.5, 1.0);
renWin->AddRenderer(ren1);

For vtkUnstructered grid I get an error saying :invalid conversion from vtkObject* at the following line:
vtkUnstructuredGridToPolyDataFilter *pfilter = vtkUnstructuredGridToPolyDataFilter::New();

Could anyone please help me ?
Thank You,
Pallavi

-------------------------------------------------------------------
Pallavi Joshi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040709/6e67653d/attachment.htm>


More information about the vtkusers mailing list