[vtkusers] Marking a pixel with a filled circle

David Doria daviddoria+vtk at gmail.com
Sun Dec 6 22:23:05 EST 2009


On Sun, Dec 6, 2009 at 9:48 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> On Sun, Dec 6, 2009 at 5:25 PM, David Doria <daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>>
> wrote:
> >
> > vtkImageCanvasSource2D was exactly what I was looking/asking for, thanks!
> > Although I agree that it is not a good plan to actually modify the pixels
> > just to visualize something, this may be useful to write out images to
> > remind myself of the results obtained at a later date.
> >
> > I made an example:
> > http://www.vtk.org/Wiki/VTK_Examples_Drawing
> > it attempts to read an input image and then draw on top of it. Since
> > vtkImageCanvasSource2D is a source, this does not seem to be how it is
> > supposed to operate. Instead I copied the Extent of the input image and
> draw
> > on a blank image. I have two questions:
> > 1) I set the draw color to what I believe is red ( (r, g, b, a) I was
> > guessing). The resulting circle was white. Anyone know why?
>
> Someone else will have to answer that... I don't really know much
> about CanvasSource myself, other than that it exists.
>
>
> > 2) How would I copy this image "onto" the input image so it was as if I
> drew
> > on the input image?
>
> As I said in my previous email, use vtkImageBlend to compose the
> images.  The output will be the result of putting the two images
> together.  They will have to be of the same data type.  If you are
> planning to modify your image "in place", then don't.  The pipeline
> gods will strike you down if you do.
>
>
> > David - What you mentioned about the ImageData interface is
> interesting...
> > it would definitely be nice to have good methods for determining:
> > a) world space coordinates of an image actor pixel
> > b) world space coordinates of an image actor pixel
> > c) image space coordinates of a screen space point (ie. which pixel in
> the
> > image does a clicked point in the window (on the image actor) correspond
> > to?)
>
> You must have meant to reverse (b).  It's a very good idea to add
> these methods to vtkImageData, but it's something that has to be done
> properly, i.e. whoever does it will have to hound the other developers
> for input.  There are lots of developers who do image work with VTK,
> but very few seem to be active on this list when you ask for
> opinions... hmm.
>
> About your item (c), though, I recently added a couple classes called
> vtkSurfacePicker and vtkVolumePicker to VTK that do exactly that.  If
> you click on a vtkImageActor, these pickers will give you the (i,j,k)
> and (x,y,z) coordinates under the mouse.  They also give the CellId
> and PointID so that you can easily check the data values, too, either
> with interpolation (using cells) or without (using points).
>
>   David
>
>
Sorry, I somehow completely missed the part about vtkImageBlend. It seems
like an enormous pain though - I tried to make an example:
http://www.vtk.org/Wiki/VTK_Examples_Combine_Images

but it seems to be expecting a vtkImageStencilData. I tried to use
vtkImageStencil but I don't understand what is going on - can you help
clarify?

I'll work on a vtkSurfacePicker example and let you know if there are any
questions/problems.

Thanks for your help David G (too many David's around here, haha)!

Thanks,

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


More information about the vtkusers mailing list