[vtkusers] volume reslice problem

David Gobbi david.gobbi at gmail.com
Fri Aug 8 06:46:15 EDT 2008


Hi Andreas,

By default, vtkImageReslice sets the "Background" value to zero.
Depending on how the Window/Level are set, this might appear as grey
in the rendered image.

There is an easy fix for this.  Add vtkImageMapToColors (or
vtkImageMapToWindowLevelColors) in front of vtkImageReslice, instead
of doing the Window/Level in the ImageMapper.  For the ImageMapper,
you will have to set ColorWindow(255.0) and ColorLevel(127.5) to
properly render data that has already been window/leveled.

When you create the vtkLookupTable for vtkImageMapToColors, make sure
that you call this function:

table->SetRampToLinear();

By default, VTK uses an sigmoid ramp (i.e. S-curve) for its lookup
tables, which you definitely do not want for medical images.  So you
have to make sure to set the lookup table's ramp to linear before you
use it.

    David


On Fri, Aug 8, 2008 at 5:33 AM, Andreas Brüning <mail-andi at web.de> wrote:
> 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
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list