[vtkusers] 2D slice display on the main plane
shivanna.prashanth at wipro.com
shivanna.prashanth at wipro.com
Tue Nov 2 23:31:04 EST 2004
hi ,
I need to develop a viewer which displays slices from the 3D volume
data. I would like to render the slices(2D Image) on the main plane, so
that I could draw line annotations over the displayed slices, i.e., on
the overlay plane. As of now, I am able to extract the slices from the
volume, but I am unable to display it on the main plane.
The code I have written to display the slices.
vtkImageReader2 *vtkImgRdr = vtkImageReader2::New();
vtkImgRdr->ReleaseDataFlagOn();
vtkImgRdr->SetDataByteOrderToBigEndian();
vtkImgRdr->SetDataExtent(0,255,0,255,1,113);
vtkImgRdr->SetDataScalarTypeToUnsignedShort();
vtkImgRdr->SetDataOrigin(-128.5, -128.5, -57);
vtkImgRdr->SetFilePrefix("E:/GUI/sample_code/CTHead/CThead");
vtkImgRdr->Update();
vtkImageReslice *axial=vtkImageReslice::New();
axial->SetInput(vtkImgRdr->GetOutput());
axial->SetOutputDimensionality(2);
axial->SetInterpolationModeToCubic();
axial->SetResliceAxesDirectionCosines(1, 0, 0,
0, 1, 0,
0, 0, 1);
axial->Update();
// Following code displays slice on the overlay plane.
vtkImageMapper *axial_mapper=vtkImageMapper::New();
axial_mapper->SetInput(axial->GetOutput());
axial_mapper->SetColorWindow(500);
axial_mapper->SetColorLevel(1000);
vtkActor2D *axial_actor = vtkActor2D::New();
axial_actor->SetMapper(axial_mapper);
vtkRenderer *renAxial= vtkRenderer :: New();
renAxial->AddActor(axial_actor);
renWin->AddRenderer( renAxial );
renWin->SetSize( 500, 500);
vtkRenderWindowInteractor *renInt =
vtkRenderWindowInteractor::New();
renInt->SetRenderWindow(renWin);
renWin->Render();
Can any one suggest, how do we modify the above code to display the
slice on the main plane, instead on an overlay plane, i.e., we need to
replace vtkActor2D, with appropriate Actor for displaying slice on main
plane.
Thanks & Regards
Prashanth
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin at wipro.com immediately
and destroy all copies of this message and any attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20041103/6ab32d20/attachment.htm>
More information about the vtkusers
mailing list