[vtkusers] vtkImageMapper problem

Abhishek gattani at aktina.com
Mon Feb 7 10:41:43 EST 2005


Hello all,

 

I have a problem using vtkImageMapper to display a single image slice from a
3D CT data that I loaded in vtkImageData. First, is vtkImageMapper the
correct way to display 2D slices of 3D data? The error occurs in the
internal function, *vtkActor::GetBounds()while executing the statement,
bounds = this->Mapper->GetBounds(); Since I use the vtkImageMapper as the
mapper for my Actor, I assume the problem lies in the way I have initialized
vtkImageMapper. Here is the code:

 

renWin->AddRenderer(aRenderer);

renWin->SetParentId(this->m_hWnd);

iren->SetRenderWindow(renWin);

vtkImageMapper *twodview= vtkImageMapper::New();

twodview->SetInput((vtkImageData*)pData);

twodview->SetColorWindow(255.0);

twodview->SetColorLevel(127.5);

vtkActor *skin = vtkActor::New();

skin->SetMapper((vtkMapper*)twodview);

vtkCamera *aCamera = vtkCamera::New();

aCamera->SetViewUp (0, 0, -1);

aCamera->SetPosition (0, 1, 0);

aCamera->SetFocalPoint (0, 0, 0);

aCamera->ComputeViewPlaneNormal();

 

aRenderer->AddActor(skin);

aRenderer->SetActiveCamera(aCamera);

aRenderer->ResetCamera ();

aCamera->Dolly(1.5);

aRenderer->SetBackground(1,1,1);

renWin->SetSize(640, 480);

iren->Start(); 

renWin->Render();

 

Could any tell me what am I doing wrong? Thanks in advance.

 

-Best Regards,

Abhishek

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050207/a7240714/attachment.htm>


More information about the vtkusers mailing list