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