<div class="gmail_quote">On Sun, Dec 6, 2009 at 9:48 PM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;</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 &lt;<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; vtkImageCanvasSource2D was exactly what I was looking/asking for, thanks!<br>
&gt; Although I agree that it is not a good plan to actually modify the pixels<br>
&gt; just to visualize something, this may be useful to write out images to<br>
&gt; remind myself of the results obtained at a later date.<br>
&gt;<br>
&gt; I made an example:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_Examples_Drawing" target="_blank">http://www.vtk.org/Wiki/VTK_Examples_Drawing</a><br>
&gt; it attempts to read an input image and then draw on top of it. Since<br>
&gt; vtkImageCanvasSource2D is a source, this does not seem to be how it is<br>
&gt; supposed to operate. Instead I copied the Extent of the input image and draw<br>
&gt; on a blank image. I have two questions:<br>
&gt; 1) I set the draw color to what I believe is red ( (r, g, b, a) I was<br>
&gt; guessing). The resulting circle was white. Anyone know why?<br>
<br>
</div>Someone else will have to answer that... I don&#39;t really know much<br>
about CanvasSource myself, other than that it exists.<br>
<div class="im"><br>
<br>
&gt; 2) How would I copy this image &quot;onto&quot; the input image so it was as if I drew<br>
&gt; 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 &quot;in place&quot;, then don&#39;t.  The pipeline<br>
gods will strike you down if you do.<br>
<div class="im"><br>
<br>
&gt; David - What you mentioned about the ImageData interface is interesting...<br>
&gt; it would definitely be nice to have good methods for determining:<br>
&gt; a) world space coordinates of an image actor pixel<br>
&gt; b) world space coordinates of an image actor pixel<br>
&gt; c) image space coordinates of a screen space point (ie. which pixel in the<br>
&gt; image does a clicked point in the window (on the image actor) correspond<br>
&gt; to?)<br>
<br>
</div>You must have meant to reverse (b).  It&#39;s a very good idea to add<br>
these methods to vtkImageData, but it&#39;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&#39;t understand what is going on - can you help clarify?<br><br>I&#39;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&#39;s around here, haha)!<br><br clear="all">Thanks,<br><br>David<br></div></div>