[vtkusers] Image process & volome visualization from CT data Problem.

#YAN RI AN# PS7278514B at ntu.edu.sg
Tue Aug 27 06:10:52 EDT 2002


Dear All:
I use the window NT based computer & VC6.0 compiler.
 I meet the problem in Visualizeing Image & Volume Rendering:
The source code below:
#include "vtkImageReader.h"
#include "vtkImageGradient.h"
#include "vtkImageViewer.h"

int main(int argc, char *argv[])
{
  vtkImageReader *reader=vtkImageReader::New();
   	reader->SetFilePrefix("c:/Vtkdata/Data/headsq/quarter");//from manual
	reader->SetDataByteOrderToLittleEndian();
    reader->SetDataExtent(0,63,0,63,1,93);
    reader->SetDataMask(0x7ff);

  vtkImageGradient *gradient=vtkImageGradient::New();
  gradient->SetInput(reader->GetOutput());
  gradient->SetDimensionality(3);

	vtkImageViewer *viewer=vtkImageViewer::New();
	viewer->SetInput(gradient->GetOutput());
	viewer->SetZSlice(22);
	viewer->SetColorWindow(400);
	viewer->SetColorLevel(0);
        viewer->Render();
        viewer->Delete();
 
   return 0;
}
could  the  vtkImageViewer class bind with:
 	vtkRenderer* ren=vtkRenderer::New();
    ren-> SetBackground (1,1,1);

	vtkRenderWindow* renWin=vtkRenderWindow::New();
    renWin-> AddRenderer(ren);
    renWin-> SetSize(500,500);

	vtkRenderWindowInteractor* iren=vtkRenderWindowInteractor::New();
iren-> SetRenderWindow(renWin);

so the renderering can permanently show.
thanks very much.
my e-mail address is :
ps7278514b at ntu.edu.sg

*************************************** 
* Best Regards
* Yan Rian (Research Student) 
* Email : ps7278514b at ntu.edu.sg
* Lab : AMRC Research Centre 
* Nanyang Technological University 
* Singapore 
***************************************





More information about the vtkusers mailing list