[vtkusers] problem of image display
付文宇
fuwenyu at emails.bjut.edu.cn
Wed Nov 15 09:31:06 EST 2006
hi all:
I used the codes found in the web to display image. File type of data is
DICOM(the dimension of file data is 512x512x211).There is no errors in compiling
and linking,but I can see nothing when executing.I use vc++6.0 as my IDE. Source
code is in the next:
#include <vtkDICOMImageReader.h>
#include <vtkImageViewer2.h>
#include <vtkRenderer.h>
#include <vtkImageData.h>
int main()
{
vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
vtkImageViewer2 *viewer = vtkImageViewer2::New();
viewer->SetInput(reader->GetOutput());
reader->SetDirectoryName("10171602");
reader->Update();
int VolData_Images = viewer->GetWholeZMax ();
for (int i=0;i<=VolData_Images;i++)
{
viewer->SetZSlice(i);
viewer->GetRenderer()->ResetCameraClippingRange();
viewer->Render();
}
reader->Delete();
viewer->Delete();
return 0;
}
---------------------------------------------------------------------------------
If I change the code to show only one slice image, I can see the image for a few
seconds.But I want to see the image in the screen for arbitrary time, what should
I do to achieve this result?
thanks in advance
Fu Wenyu
2006.11.15
More information about the vtkusers
mailing list