[vtkusers] add circles & sphere to DICOM slices & 3D viewer

David Gobbi david.gobbi at gmail.com
Mon Jan 12 11:27:12 EST 2015

On Mon, Jan 12, 2015 at 7:54 AM, mbcx9rb9 <richard.j.brown at live.co.uk>

> The circle, for example, always appears in the centre of the rendered
> screen
> and is always the same size.

If you don't set the FocalPoint, Position, ViewUp, and ViewAngle of the
then the vtkCamera will set these automatically so that the the actors are
view.  To get an idea of what is going on, you should try setting these
manually.  Also, search google for "opengl camera" because there are tons
of well-
written documents about the camera metaphor that is used for 3D graphics.

If I go to the 0th slice and click the bottom
> left pixel, the circle then jumps up in the middle of the screen. Using the
> GetPointIJK structured coordinates, do I need to convert the selected point
> to a different coordinate system for the sphere/cutting plane?

Get GetPointIJK gives the i,j,k (row, col, slice) indices into the image,
i.e. integers.
VTK uses floating-point x,y,z coords for its data coords, which implicitly
use units
of "mm" when dealing with DICOM files.  The picker's GetMapperPosition() and
GetPickPosition() methods return the latter.

> I also haven't managed to see both the circle and the DICOM image at the
> same time, despite what feels like every combination of setOpacity,
> setAmbient, etc. When I set the background of the newly cut circle to
> green,
> everything goes green, so I think it might be that the background of the
> circle is masking the DICOM slice, can I set it to have a transparent
> background?

There is no way to set the background for a single actor, AFAIK the only
way to
set the background is in the vtkRenderer, in which case you are setting the
for everything, and the background will therefore be behind everything and
ever be in front of something.  Can you explain in more detail what you are

Lastly, when I can draw the circle in the correct place, the correct size
> and can see the DICOM underneath, I need to fill the middle of the circle
> in. I saw on  this
> <
> http://vtk.1045678.n5.nabble.com/Filling-vtkCutter-output-td1244798.html#a1244800
> >
>  thread some suggestions, but neither vtkTriangleFilter nor
> vtkLinearExtrusionFilter did the trick for me. Any ideas?

 Try vtkContourTriangulator.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150112/39ae258f/attachment.html>

More information about the vtkusers mailing list