[vtkusers] volume reslice problem

Andreas Brüning mail-andi at web.de
Fri Aug 8 05:33:26 EDT 2008


Hello,

i am writing a program to reslice a volume(stacked CT images) in any direction and angle. Therefore i choose a point in the volume where to slice through and also angles in x-,y- and z direction to define gradient of the reslicearea. I create a reslice matrix using vtkTransform and reslice the volume with a vtkImagereslice object like described in the medical examples in vtk. I would like to get the data of the resliced image but i dont know where i can get this data.

The following code shows my vtk pipeline:


vtkRenderer *vtk_Renderer = vtkRenderer::New();

vtkWin32OpenGLRenderWindow *vtk_Win32OpenGLWindow = vtkWin32OpenGLRenderWindow::New();
vtk_Win32OpenGLWindow->AddRenderer(vtk_Renderer);

double *spacing = pThis->m_vtkvolumedata->GetSpacing();
int extent[6];
pThis->m_vtkvolumedata->GetExtent(extent);
	
vtkImageReslice *vtkImageReslicer = vtkImageReslice::New();
vtkImageReslicer->SetInput(pThis->m_vtkvolumedata);    //vtkImageData comming from vtkImport
vtkImageReslicer->SetOutputDimensionality(2);
vtkImageReslicer->SetInterpolationModeToLinear();


vtkImageReslicer->SetOutputSpacing(spacing);
 vtkImageReslicer->ReleaseDataFlagOn();

vtkImageMapper *mapper = vtkImageMapper::New();
mapper->SetInput(vtkImageReslicer->GetOutput());
mapper->SetColorLevel(pThis->m_dLevel);
mapper->SetColorWindow(pThis->m_dWindow);
	
vtkActor2D *vtkactor = vtkActor2D::New();
vtkactor->SetMapper(mapper);

vtkTransform *vtk_slicetransform	= vtkTransform::New();
	
vtk_Renderer->AddActor(vtkactor);
vtk_Renderer->ResetCamera();
vtk_Renderer->GetActiveCamera()->ParallelProjectionOn();


 The reslicing part looks like this:

vtk_slicetransform->Identity();
vtk_slicetransform->Translate(pThis->m_pSliceCenter[0], pThis->m_pSliceCenter[1], pThis->m_pSliceCenter[2]); //centerpoint for reslicing

vtk_slicetransform->RotateZ(pThis->m_dSliceAngle_z);
vtk_slicetransform->RotateX(pThis->m_dSliceAngle_x);
vtk_slicetransform->RotateY(pThis->m_dSliceAngle_y);

vtkImageReslicer->SetResliceAxes(vtk_slicetransform->GetMatrix());

vtkImageReslicer->UpdateInformation();

vtk_Win32OpenGLWindow->Render();

	

When i run the program and change one angle i see gray areas around the resultimage. I dont know where it comes from, but i guess they are somehow representing the rest of the volume. Does anybody know how i can only show the resultimage? When i rotate around x-axis and y-axis the gray area get really big. I checked the OutputExtend of the resliceobject after reslicing and at this time i get negative results the outcomming extent is (0,-1,0,-1,0,-1).


By the way. I dont use any vtkInteractors in here because i want to run this offscreen and only use everything to reslice the volume.


Thanks in advance 
Andi   
____________________________________________________________
Großes Kino für zu Hause - Kostenlos für alle WEB.DE Nutzer!
Jetzt kostenlos anmelden unter http://www.blockbuster.web.de




More information about the vtkusers mailing list