[vtkusers] about the BMP slice Read & 3D Rendering.

#YAN RI AN# PS7278514B at ntu.edu.sg
Sat Oct 5 01:14:30 EDT 2002


Dear VTK-Users:
I meet the problem when I read a stack of 512x512x256 BMP file.
I used the vtkImageReader class instead of vtkVolume16Reader class because It was not a 16 bit image format.
I could not get the correct rendering of each organ such as only the rendering of the bone in the BMP slice.

Here is my source code:

  vtkImageReader *reader=vtkImageReader::New();
  reader->SetFilePrefix("g:/00head/h");
  reader->SetDataByteOrderToLittleEndian();
  reader->SetDataExtent(0,100,0,100,1,12);
   reader->SetDataSpacing(1,1,0.5);
  reader->SetDataMask(0x7ff);

	vtkMarchingContourFilter *iso=vtkMarchingContourFilter::New();
    iso->SetInput(reader->GetOutput());
    iso->SetValue(0,1150);

  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();

How could I do?
*************************************** 
* 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