[vtkusers] Help Display Slice of images on 3D ((vtkImageActor))
Hellice
saouli-abdelhak at hotmail.com
Sat Mar 3 07:28:47 EST 2012
Hi I real need help ;I wanna dispaly slices image on 3D.the problem is the
only first image in slice is shown so plz thx for your time
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkCamera.h"
#include "vtkLODActor.h"
#include "vtkRenderer.h"
#include "vtkProperty.h"
#include "vtkRenderWindowInteractor.h"
#include <vtkDICOMImageReader.h>
#include <vtkImageActor.h>
#include <vtkImageCast.h>
#include <vtkImageData.h>
using namespace std;
int main()
{
vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
vtkImageActor *viewer = vtkImageActor::New();
reader->SetDirectoryName("Data");
vtkImageCast *cast = vtkImageCast::New();
cast->SetInput(reader->GetOutput());
cast->SetOutputScalarTypeToUnsignedChar();
viewer->SetInput(cast->GetOutput());
int vol_data = viewer->GetSliceNumber();
reader->Update();
vtkRenderer *ren1= vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
for(int i =0;i<vol_data; i++)
{
viewer->SetZSlice(i);
}
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
renWin->SetSize( 600, 600 );
ren1->AddActor(viewer);
renWin->AddRenderer( ren1 );
ren1->ResetCamera();
ren1->GetActiveCamera()->Zoom(1.5);
renWin->Render();
iren->Start();
return 0;
}
--
View this message in context: http://vtk.1045678.n5.nabble.com/Help-Display-Slice-of-images-on-3D-vtkImageActor-tp5533571p5533571.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list