Hi Jerry,<br />
<p>do you want something like this?</p>
<div style="margin-left: 50px;"><img src="http://vtk.1045678.n5.nabble.com/file/n5714177/VTK_Examples_CSharp_vtkImageActor_With_Overlayed_Renderer.png" border="0"/77></div>

<p>I have written an example in C#. The basic idea is to overlay an additional renderer where the cross is displayed. Both renderers are synchronized.<br />
Whenever you click the image the cross will follow the new position.</p>

<pre><span style=' color: Blue;'>using</span> System;
<span style=' color: Blue;'>using</span> System.ComponentModel;
<span style=' color: Blue;'>using</span> System.Drawing;
<span style=' color: Blue;'>using</span> System.Windows.Forms;
<span style=' color: Blue;'>using</span> System.Diagnostics;

<span style=' color: Blue;'>using</span> Kitware.VTK;

<span style=' color: Blue;'>namespace</span> TestActiViz {
   <span style=' color: Blue;'>public</span> <span style=' color: Blue;'>partial</span> <span style=' color: Blue;'>class</span> Form1 : Form {
      vtkCamera _CameraOverlay;
      vtkActor _Cross;
      vtkPropPicker _PropPicker;
      vtkRenderWindow _RenderWindow;

      
      <span style=' color: Blue;'>public</span> Form1() {
         InitializeComponent();
      }


      <span style=' color: Blue;'>protected</span> <span style=' color: Blue;'>override</span> <span style=' color: Blue;'>void</span> OnLoad(EventArgs e) {
         <span style=' color: Blue;'>base</span>.OnLoad(e);
         <span style=' color: Blue;'>try</span> {
            TestImageActorOverlay();
         }
         <span style=' color: Blue;'>catch</span>(Exception ex) {
            MessageBox.Show(<span style=' color: Maroon;'>"Exception: "</span> + ex.Message);
         }
      }


      <span style=' color: Blue;'>private</span> <span style=' color: Blue;'>void</span> TestImageActorOverlay() {
         <span style=' color: Green;'>// Path to vtk data must be set as an environment variable</span>
         <span style=' color: Green;'>// VTK_DATA_ROOT = "C:\VTK\vtkdata-5.8.0"</span>
         vtkTesting test = vtkTesting.New();
         <span style=' color: Blue;'>string</span> root = test.GetDataRoot();
         <span style=' color: Blue;'>string</span> filePath = System.IO.Path.Combine(root, <span style=' color: Maroon;'>@"Data\clouds.jpeg"</span>);
         vtkJPEGReader reader = vtkJPEGReader.New();
         <span style=' color: Blue;'>if</span>(reader.CanReadFile(filePath) == <span style=' color: Maroon;'>0</span>) {
            MessageBox.Show(<span style=' color: Maroon;'>"Cannot read file \""</span> + 
               filePath + 
               <span style=' color: Maroon;'>"\""</span>, <span style=' color: Maroon;'>"Error"</span>, MessageBoxButtons.OK);
            <span style=' color: Blue;'>return</span>;
         }
         reader.SetFileName(filePath);
         reader.Update();
         <span style=' color: Green;'>// we need the imagedata to get the world coordinates of the center,</span>
         <span style=' color: Green;'>// get the bounds and get the scalar range</span>
         vtkImageData imageData = reader.GetOutput();

         <span style=' color: Green;'>// Create an imageActor</span>
         vtkImageActor imageActor = vtkImageActor.New();
         imageActor.SetInput(imageData);

         <span style=' color: Green;'>// get bounds and center of the imagedata to size and position the _Cross</span>
         <span style=' color: Blue;'>double</span>[] bounds = imageData.GetBounds();
         SizeF imageSize = <span style=' color: Blue;'>new</span> SizeF(
            (<span style=' color: Blue;'>float</span>)( bounds[<span style=' color: Maroon;'>1</span>] - bounds[<span style=' color: Maroon;'>0</span>] ), 
            (<span style=' color: Blue;'>float</span>)( bounds[<span style=' color: Maroon;'>3</span>] - bounds[<span style=' color: Maroon;'>2</span>] ));
         <span style=' color: Blue;'>double</span>[] imageCenter = imageData.GetCenter();
         <span style=' color: Blue;'>float</span> max = Math.Max(imageSize.Width, imageSize.Height);


         vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
         mapper.SetInput(CreateCross(max / <span style=' color: Maroon;'>10</span>));
         _Cross = vtkActor.New();
         _Cross.GetProperty().SetLineWidth(<span style=' color: Maroon;'>5</span>);
         _Cross.SetPosition(
                imageCenter[<span style=' color: Maroon;'>0</span>],
                imageCenter[<span style=' color: Maroon;'>1</span>],
                imageCenter[<span style=' color: Maroon;'>2</span>]);
         _Cross.SetMapper(mapper);

         <span style=' color: Green;'>// get a reference to the renderwindow of our renderWindowControl1</span>
         _RenderWindow = renderWindowControl1.RenderWindow;
         <span style=' color: Green;'>// renderer</span>
         vtkRenderer renderer = _RenderWindow.GetRenderers().GetFirstRenderer();
         <span style=' color: Green;'>// set background color</span>
         renderer.SetBackground(<span style=' color: Maroon;'>0</span><span style=' color: Maroon;'>.2</span>, <span style=' color: Maroon;'>0</span><span style=' color: Maroon;'>.3</span>, <span style=' color: Maroon;'>0</span><span style=' color: Maroon;'>.4</span>);
         <span style=' color: Green;'>// add our imageActor to the renderer</span>
         renderer.AddActor(imageActor);
         <span style=' color: Green;'>// important call to make entire image visible</span>
         renderer.ResetCamera();

         <span style=' color: Green;'>// create an interactorstyle and event handler for pressing left mouse button</span>
         vtkInteractorStyleImage interactorStyleImage = vtkInteractorStyleImage.New();
         _RenderWindow.GetInteractor().SetInteractorStyle(interactorStyleImage);
         interactorStyleImage.LeftButtonPressEvt += 
            <span style=' color: Blue;'>new</span> vtkObject.vtkObjectEventHandler(InteractorStyleImage_LeftButtonPressEvt);

         <span style=' color: Green;'>// create a transparent overlay renderer</span>
         _RenderWindow.SetNumberOfLayers(<span style=' color: Maroon;'>2</span>);
         vtkRenderer rendererOverlay = vtkRenderer.New();
         rendererOverlay.SetLayer(<span style=' color: Maroon;'>1</span>);
         <span style=' color: Green;'>// important, cause we want the renderer which contains </span>
         <span style=' color: Green;'>// the imageActor to be interactive and not the overlay</span>
         rendererOverlay.SetInteractive(<span style=' color: Maroon;'>0</span>);
         _RenderWindow.AddRenderer(rendererOverlay);

         rendererOverlay.AddActor(_Cross);
         _CameraOverlay = rendererOverlay.GetActiveCamera();

         <span style=' color: Green;'>// synchronize cameras</span>
         _CameraOverlay.ShallowCopy(renderer.GetActiveCamera());

         <span style=' color: Green;'>// event handler to synchronize cameras</span>
         renderer.GetActiveCamera().ModifiedEvt += 
            <span style=' color: Blue;'>new</span> vtkObject.vtkObjectEventHandler(Camera_ModifiedEvt);
         _PropPicker = vtkPropPicker.New();
      }


      <span style=' color: Blue;'>void</span> InteractorStyleImage_LeftButtonPressEvt(vtkObject sender, vtkObjectEventArgs e) {
         vtkInteractorStyleImage caller = e.Caller <span style=' color: Blue;'>as</span> vtkInteractorStyleImage;
         <span style=' color: Blue;'>if</span>(caller != <span style=' color: Blue;'>null</span>) {
            <span style=' color: Blue;'>int</span>[] mousePosition = caller.GetInteractor().GetLastEventPosition();
            <span style=' color: Green;'>//Debug.WriteLine("left mouse button pressed -&gt; mouse position: " </span>
            <span style=' color: Green;'>//   + mousePosition[0] </span>
            <span style=' color: Green;'>//   + " " </span>
            <span style=' color: Green;'>//   + mousePosition[1]);</span>
            <span style=' color: Blue;'>int</span> ret = _PropPicker.Pick(
               mousePosition[<span style=' color: Maroon;'>0</span>], 
               mousePosition[<span style=' color: Maroon;'>1</span>], 
               <span style=' color: Maroon;'>0</span>, 
               _RenderWindow.GetRenderers().GetFirstRenderer());
            <span style=' color: Blue;'>if</span>(ret == <span style=' color: Maroon;'>1</span>) {
               <span style=' color: Blue;'>double</span>[] pos = _Cross.GetPosition();
               <span style=' color: Blue;'>double</span>[] pickPosition = _PropPicker.GetPickPosition();
               <span style=' color: Green;'>//Debug.WriteLine("Pick Position: " </span>
               <span style=' color: Green;'>//   + pickPosition[0] + " " </span>
               <span style=' color: Green;'>//   + pickPosition[1] + " " </span>
               <span style=' color: Green;'>//   + pickPosition[2]);</span>
               _Cross.SetPosition(
                  pickPosition[<span style=' color: Maroon;'>0</span>],
                  pickPosition[<span style=' color: Maroon;'>1</span>],
                  pickPosition[<span style=' color: Maroon;'>2</span>]);
               _RenderWindow.Render();
            }
         }
      }


      <span style=' color: Blue;'>void</span> Camera_ModifiedEvt(vtkObject sender, vtkObjectEventArgs e) {
         _CameraOverlay.ShallowCopy((vtkCamera)sender);
      }


      <span style=' color: Green;'>// create a cross</span>
      vtkPolyData CreateCross(<span style=' color: Blue;'>float</span> size) {
         <span style=' color: Green;'>// Create a vtkPoints object and store the points in it</span>
         vtkPoints pts = vtkPoints.New();
         pts.InsertNextPoint(-size / <span style=' color: Maroon;'>2</span>, <span style=' color: Maroon;'>0</span>, <span style=' color: Maroon;'>0</span>);
         pts.InsertNextPoint(size / <span style=' color: Maroon;'>2</span>, <span style=' color: Maroon;'>0</span>, <span style=' color: Maroon;'>0</span>);
         pts.InsertNextPoint(<span style=' color: Maroon;'>0</span>, -size / <span style=' color: Maroon;'>2</span>, <span style=' color: Maroon;'>0</span>);
         pts.InsertNextPoint(<span style=' color: Maroon;'>0</span>, size / <span style=' color: Maroon;'>2</span>, <span style=' color: Maroon;'>0</span>);

         <span style=' color: Green;'>// Setup the colors array</span>
         <span style=' color: Blue;'>byte</span>[] color = <span style=' color: Blue;'>new</span> <span style=' color: Blue;'>byte</span>[] { <span style=' color: Maroon;'>255</span>, <span style=' color: Maroon;'>128</span>, <span style=' color: Maroon;'>0</span> };
         vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();
         colors.SetNumberOfComponents(<span style=' color: Maroon;'>3</span>);
         colors.SetName(<span style=' color: Maroon;'>"Colors"</span>);

         <span style=' color: Green;'>// Add the colors we created to the colors array</span>
         colors.InsertNextValue(color[<span style=' color: Maroon;'>0</span>]);
         colors.InsertNextValue(color[<span style=' color: Maroon;'>1</span>]);
         colors.InsertNextValue(color[<span style=' color: Maroon;'>2</span>]);

         colors.InsertNextValue(color[<span style=' color: Maroon;'>0</span>]);
         colors.InsertNextValue(color[<span style=' color: Maroon;'>1</span>]);
         colors.InsertNextValue(color[<span style=' color: Maroon;'>2</span>]);

         <span style=' color: Green;'>// Create the first line</span>
         vtkLine line0 = vtkLine.New();
         line0.GetPointIds().SetId(<span style=' color: Maroon;'>0</span>, <span style=' color: Maroon;'>0</span>);
         line0.GetPointIds().SetId(<span style=' color: Maroon;'>1</span>, <span style=' color: Maroon;'>1</span>);

         <span style=' color: Green;'>// Create the second line</span>
         vtkLine line1 = vtkLine.New();
         line1.GetPointIds().SetId(<span style=' color: Maroon;'>0</span>, <span style=' color: Maroon;'>2</span>);
         line1.GetPointIds().SetId(<span style=' color: Maroon;'>1</span>, <span style=' color: Maroon;'>3</span>);

         <span style=' color: Green;'>// Create a cell array to store the lines in and add the lines to it</span>
         vtkCellArray lines = vtkCellArray.New();
         lines.InsertNextCell(line0);
         lines.InsertNextCell(line1);

         <span style=' color: Green;'>// Create a polydata to store everything in</span>
         vtkPolyData linesPolyData = vtkPolyData.New();
         <span style=' color: Green;'>// Add the points to the dataset</span>
         linesPolyData.SetPoints(pts);
         <span style=' color: Green;'>// Add the lines to the dataset</span>
         linesPolyData.SetLines(lines);
         <span style=' color: Green;'>// Color the lines</span>
         linesPolyData.GetCellData().SetScalars(colors);
         <span style=' color: Blue;'>return</span> linesPolyData;
      }
   }
}
</pre><br />
Hope that's what your looking for.<br /><br />
with kind regards<br />
Jochen


        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Draw-a-2D-cross-on-vtkImageActor-tp5714166p5714177.html">Re: Draw a 2D cross on vtkImageActor</a><br/>
Sent from the <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html">VTK - Users mailing list archive</a> at Nabble.com.<br/>