[vtkusers] Surface Rendering Problem.

#YAN RI AN# PS7278514B at ntu.edu.sg
Tue Oct 29 20:32:52 EST 2002


Dear VTK-User:
I met the problem when I read the pre-processed *.bmp skull slices (128X128X8 Bits from 512X512X8 Bits).
It had been two skulls when I use surface rendering technical Marchingcubes algorithm to generate the voxel.
I attached my source code.
Could anyone help me checked what is the problem.
I can send the source slices & result picture if any experts interest.
Thanks very much.
#include "vtkImageReader.h"
#include "vtkMarchingContourFilter.h"
#include "vtkPolyDataMapper.h"
#include "vtkOutlineFilter.h"
#include "vtkActor.h"
#include "vtkProperty.h"

#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"


int main(int argc, char *argv[])
{ 
  vtkImageReader *reader=vtkImageReader::New();
  reader->SetFilePrefix("g:/00head/head128/h");
  reader->SetDataByteOrderToLittleEndian();
  reader->SetDataExtent(0,127,0,127,1,33);//
   reader->SetDataSpacing(2,2,2);
  reader->SetDataMask(0x7ff);

	vtkMarchingContourFilter *iso=vtkMarchingContourFilter::New();
    iso->SetInput(reader->GetOutput());
    iso->SetValue(0,255);//Scalar between 0~255 in 8 Bits.

  vtkPolyDataMapper *isoMapper=vtkPolyDataMapper::New();
  isoMapper->SetInput(iso->GetOutput());
  isoMapper->ScalarVisibilityOff();


	vtkActor *isoActor=vtkActor::New();
    isoActor->SetMapper(isoMapper);
	isoActor->GetProperty()->SetColor(1,1,1);

    vtkRenderer *ren1 = vtkRenderer::New();
	ren1->AddActor(isoActor);
	ren1->SetBackground(0.2,0.3,0.5);
	
  vtkRenderWindow *renWin = vtkRenderWindow::New();
  renWin->AddRenderer(ren1);
  renWin->SetSize(600,600);

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

  renWin->Render();
  iren->Start();
  
  reader->Delete();
  isoMapper->Delete();
  isoActor->Delete();
  ren1->Delete();
  renWin->Delete();
  iren->Delete();

  return 0;
}

*************************************** 
* 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