<br><div class="gmail_quote">On Sun, Dec 6, 2009 at 12:40 PM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">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><div></div><div>On Sun, Dec 6, 2009 at 9:36 AM, David Doria &lt;<a href="mailto:daviddoria%2Bvtk@gmail.com" target="_blank">daviddoria+vtk@gmail.com</a>&gt; wrote:<br>
&gt; I am trying to mark pixels in an image that have been found to be keypoints<br>
&gt; so I can visualize where the keypoints are. If I mark a pixel like this:<br>
&gt;<br>
&gt;   //set the pixel (10,10) to red<br>
&gt;   image-&gt;SetScalarComponentFromDouble(10, 10, 0, 0, 255.0);<br>
&gt;   image-&gt;SetScalarComponentFromDouble(10, 10, 0, 1, 0.0);<br>
&gt;   image-&gt;SetScalarComponentFromDouble(10, 10, 0, 2, 0.0);<br>
&gt;<br>
&gt; the red mark is often too small to even see (since it is only one pixel!).<br>
&gt; Are there any functions to draw a filled circle/square of a specified color<br>
&gt; in an image centered at a specified pixel?<br>
<br>
</div></div>The vtkImageCanvasSource2D has drawing functionality, and you can use<br>
vtkImageBlend to alpha-blend the canvas output into an RGB or RGBA<br>
version of your image.  But I wouldn&#39;t recommend it.  There is a<br>
better way to do things!<br>
<br>
If you want to annotate an image, don&#39;t do it by modifying the image.<br>
Use a vtkActor instead.  For example, use a vtkSphereSource and set<br>
the position of the vtkActor to the pixel location.  In an ideal<br>
world, you could just use actor-&gt;SetPosition(image-&gt;GetPoint(i,j,k)),<br>
but no such GetPoint() method exists because the interface to<br>
vtkImageData sucks eggs.  Instead, you have to compute the x,y,z<br>
coordinates of the i,j,k pixel yourself.<br>
<font color="#888888"><br>
  David<br></font></blockquote><div> </div></div>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.<br>
<br>I made an example:<br><a href="http://www.vtk.org/Wiki/VTK_Examples_Drawing">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 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:<br>
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?<br><br>2) How would I copy this image &quot;onto&quot; the input image so it was as if I drew on the input image?<br>

<br>David - What you mentioned about the ImageData interface is interesting... 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 image does a clicked point in the window (on the image actor) correspond to?)<br><br><br clear="all">
Thanks,<br><br>David