[vtkusers] Outline of a result from a vtkimagereslicemapper

Doug Hoppes dhoppes at mbfbioscience.com
Thu Sep 18 15:00:23 EDT 2014


Hi all,

                I've gotten the image reslice mapper working beautifully for my image volume.  However, I'm trying to get the outline filter to work so that I can show a bound region around my image slice.  All I'm showing is a small square in the upper left corner:

[cid:image001.png at 01CFD350.75909DD0]

The code that I'm using is:

First Function
---------------------------
      // Create the plane that will hold the slice results
      m_pSlicePlane = vtkSmartPointer<vtkPlane>::New();

      // extract a slice from the volume
      m_pSliceMapper = vtkSmartPointer<vtkImageResliceMapper>::New();
      m_pSliceMapper->SetInputData(GetImageDefinition()->GetImage()->GetImageData());
      m_pSliceMapper->SetSlicePlane(m_pSlicePlane);

      // Set it up so that the slice is not affected by the current lighting situation
      vtkSmartPointer<vtkImageProperty> m_sliceProperty = vtkSmartPointer<vtkImageProperty>::New();
      m_sliceProperty->SetAmbient(1.0);
      m_sliceProperty->SetDiffuse(0.0);
      m_sliceProperty->SetOpacity(1.0);
      m_sliceProperty->SetInterpolationTypeToLinear();

      // Create the mapper to display the slice
      m_pSliceActor = vtkSmartPointer<vtkImageSlice>::New();
      m_pSliceActor->SetMapper(m_pSliceMapper);
      m_pSliceActor->SetProperty(m_sliceProperty);

      // Add the slice to the scene
      m_pSceneManager->AddActor(m_pSliceActor);
---------------------------


Another Function
---------------------------
      // setup the outline actor
      vtkSmartPointer<vtkOutlineFilter> pOutlineFilter = vtkSmartPointer<vtkOutlineFilter>::New();
      pOutlineFilter->SetInputConnection(m_pSliceMapper->GetOutputPort());

      vtkSmartPointer<vtkPolyDataMapper> pOutlineMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
      pOutlineMapper->SetInputConnection(pOutlineFilter->GetOutputPort());

      // Set the color of the slice
      double rgbColor[3];
      SolidsColor::ToVTKRGB(rgbColor, GetImageDefinition()->GetColor());
      m_pOutlineActor->GetProperty()->SetColor(rgbColor[0], rgbColor[1], rgbColor[2]);
      m_pOutlineActor->SetMapper(pOutlineMapper);
---------------------------


Doug Hoppes I Senior Software Engineer I [cid:image007.png at 01CEF686.037AE7C0]

T: 802-288-9290   E: dhoppes at mbfbioscience.com<mailto:dhoppes at mbfbioscience.com>

MBF Bioscience
185 Allen Brook Lane
Williston, VT 05495 USA
www.mbfbioscience.com<http://www.mbfbioscience.com/>
http://www.mbfbioscience.com/blog

[cid:image008.png at 01CEF686.037AE7C0]<http://www.facebook.com/mbfbioscience> [cid:image011.png at 01CEF686.037AE7C0] <http://www.linkedin.com/company/mbf-bioscience>  [cid:image012.png at 01CEF686.037AE7C0] <http://www.youtube.com/mbfbioscience>  [cid:image014.png at 01CEF686.037AE7C0] <http://www.twitter.com/mbfbioscience>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140918/81ce24f3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 27393 bytes
Desc: image001.png
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140918/81ce24f3/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 2645 bytes
Desc: image002.png
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140918/81ce24f3/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 787 bytes
Desc: image003.png
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140918/81ce24f3/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 927 bytes
Desc: image004.png
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140918/81ce24f3/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 1170 bytes
Desc: image005.png
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140918/81ce24f3/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 870 bytes
Desc: image006.png
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140918/81ce24f3/attachment-0011.png>


More information about the vtkusers mailing list