The three events, in order, are: 31, 3, and 2.&nbsp; Based on the vtkCommand documentation, that is a ModifiedEvent, a DeleteEvent, and an AnyEvent...<br><br>The code for my main function is below.&nbsp; It is basically one of the vtk medical examples with some extra volume rendering code.&nbsp; The VirtualWindowInteractorStyle is a custom interactor class I made.&nbsp; It has no functionality implemented, I made it so that I could start an application loop using iren-&gt;Start(), but I don&#39;t want the user to have any keyboard or mouse interaction with the object, so no actual controls are implemented.&nbsp; Let me know if for some reason you guys need to see that code.
<br><br>///<br>/// MAIN.CPP<br>///<br><br>// Create the renderer, the render window, and the interactor. The renderer<br>// draws into the render window, the interactor enables mouse- and <br>// keyboard-based interaction with the data within the render window.
<br>vtkRenderer *aRenderer = vtkRenderer::New();<br>vtkRenderWindow *renWin = vtkRenderWindow::New();<br>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>VirtualWindowInteractorStyle *virtualWindowInteractorStyle = VirtualWindowInteractorStyle::New();
<br><br>renWin-&gt;AddRenderer(aRenderer);<br>iren-&gt;SetInteractorStyle(virtualWindowInteractorStyle);<br>iren-&gt;CreateTimer(VTKI_TIMER_UPDATE);<br>iren-&gt;SetRenderWindow(renWin);<br><br>// The following reader is used to read a series of 2D slices (images)
<br>// that compose the volume. The slice dimensions are set, and the<br>// pixel spacing. The data Endianness must also be specified. The reader<br>// usese the FilePrefix in combination with the slice number to construct
<br>// filenames using the format FilePrefix.%d. (In this case the FilePrefix<br>// is the root name of the file: quarter.)<br>vtkVolume16Reader *v16 = vtkVolume16Reader::New();<br>v16-&gt;SetDataDimensions(64,64);<br>v16-&gt;SetDataByteOrderToLittleEndian();
<br>v16-&gt;SetFilePrefix (argv[1]);<br>v16-&gt;SetImageRange(1, 93);<br>v16-&gt;SetDataSpacing (3.2, 3.2, 1.5);<br><br>// An isosurface, or contour value of 500 is known to correspond to the<br>// skin of the patient. Once generated, a vtkPolyDataNormals filter is
<br>// is used to create normals for smooth surface shading during rendering.<br>// The triangle stripper is used to create triangle strips from the<br>// isosurface; these render much faster on may systems.<br>vtkContourFilter *skinExtractor = vtkContourFilter::New();
<br>skinExtractor-&gt;SetInputConnection(v16-&gt;GetOutputPort());<br>skinExtractor-&gt;SetValue(0, 500);<br><br>vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();<br>skinNormals-&gt;SetInputConnection(skinExtractor-&gt;GetOutputPort());
<br>skinNormals-&gt;SetFeatureAngle(60.0);<br><br>vtkStripper *skinStripper = vtkStripper::New();<br>skinStripper-&gt;SetInputConnection(skinNormals-&gt;GetOutputPort());<br><br>vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();
<br>skinMapper-&gt;SetInputConnection(skinStripper-&gt;GetOutputPort());<br>skinMapper-&gt;ScalarVisibilityOff();<br><br>vtkActor *skin = vtkActor::New();<br>skin-&gt;SetMapper(skinMapper);<br>skin-&gt;GetProperty()-&gt;SetDiffuseColor(1, .49, .25);
<br>skin-&gt;GetProperty()-&gt;SetSpecular(.3);<br>skin-&gt;GetProperty()-&gt;SetSpecularPower(20);<br>skin-&gt;GetProperty()-&gt;SetOpacity(1.0);<br><br>// An isosurface, or contour value of 1150 is known to correspond to the
<br>// skin of the patient. Once generated, a vtkPolyDataNormals filter is<br>// is used to create normals for smooth surface shading during rendering.<br>// The triangle stripper is used to create triangle strips from the
<br>// isosurface; these render much faster on may systems.<br>vtkContourFilter *boneExtractor = vtkContourFilter::New();<br>boneExtractor-&gt;SetInputConnection(v16-&gt;GetOutputPort());<br>boneExtractor-&gt;SetValue(0, 1150);
<br><br>vtkPolyDataNormals *boneNormals = vtkPolyDataNormals::New();<br>boneNormals-&gt;SetInputConnection(boneExtractor-&gt;GetOutputPort());<br>boneNormals-&gt;SetFeatureAngle(60.0);<br><br>vtkStripper *boneStripper = vtkStripper::New();
<br>boneStripper-&gt;SetInputConnection(boneNormals-&gt;GetOutputPort());<br><br>vtkPolyDataMapper *boneMapper = vtkPolyDataMapper::New();<br>boneMapper-&gt;SetInputConnection(boneStripper-&gt;GetOutputPort());<br>boneMapper-&gt;ScalarVisibilityOff();
<br><br>vtkActor *bone = vtkActor::New();<br>bone-&gt;SetMapper(boneMapper);<br>bone-&gt;GetProperty()-&gt;SetDiffuseColor(1, 1, .9412);<br><br>///<br>/// Render the volume of the inputted dataset<br>///<br>vtkVolumeTextureMapper2D *volumeMapper = vtkVolumeTextureMapper2D::New();
<br>volumeMapper-&gt;SetInputConnection(v16-&gt;GetOutputPort());<br><br>vtkPiecewiseFunction *volumeOpacity = vtkPiecewiseFunction::New();<br>volumeOpacity-&gt;AddPoint(&nbsp; 0.0, 0.0);<br>volumeOpacity-&gt;AddPoint(255.0, 0.1
);<br><br>vtkColorTransferFunction *volumeColor = vtkColorTransferFunction::New();<br>volumeColor-&gt;AddRGBPoint(64, 1.0, 1.0, 1.0);<br>volumeColor-&gt;AddRGBPoint(128, 0.0, 0.0, 1.0);<br>volumeColor-&gt;AddRGBPoint(196, 
0.0, 1.0, 0.0);<br><br>vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();<br>volumeProperty-&gt;SetColor(volumeColor);<br>volumeProperty-&gt;SetScalarOpacity(volumeOpacity);<br><br>vtkVolume *volume = vtkVolume::New();
<br>volume-&gt;SetMapper(volumeMapper);<br>volume-&gt;SetProperty(volumeProperty);<br><br>aRenderer-&gt;AddProp(volume);<br><br>// It is convenient to create an initial view of the data. The FocalPoint<br>// and Position form a vector direction. Later on (ResetCamera() method)
<br>// this vector is used to position the camera to look at the data in<br>// this direction.<br>vtkCamera *aCamera = vtkCamera::New();<br>aCamera-&gt;SetViewUp (0, 0, -1);<br>aCamera-&gt;SetPosition (0, 1, 0);<br>aCamera-&gt;SetFocalPoint (0, 0, 0);
<br>aCamera-&gt;ComputeViewPlaneNormal();<br><br>// Actors are added to the renderer. An initial camera view is created.<br>// The Dolly() method moves the camera towards the FocalPoint,<br>// thereby enlarging the image.
<br>aRenderer-&gt;AddActor(skin);<br>aRenderer-&gt;AddActor(bone);<br>aRenderer-&gt;SetActiveCamera(aCamera);<br>aRenderer-&gt;ResetCamera ();<br><br>aCamera-&gt;Dolly(1.5);<br><br>// Set a background color for the renderer and set the size of the
<br>// render window (expressed in pixels).<br>aRenderer-&gt;SetBackground(0,0,0);<br><br>renWin-&gt;SetSize(1280, 1024);<br><br>// Note that when camera movement occurs (as it does in the Dolly()<br>// method), the clipping planes often need adjusting. Clipping planes
<br>// consist of two planes: near and far along the view direction. The <br>// near plane clips out objects in front of the plane; the far plane<br>// clips out objects behind the plane. This way only what is drawn<br>// between the planes is actually rendered.
<br>aRenderer-&gt;ResetCameraClippingRange ();<br><br>///<br>/// Add an update callback for our application<br>///<br>vtkUpdateCallback* onUpdate = vtkUpdateCallback::New();<br>iren-&gt;AddObserver(vtkCommand::AnyEvent, onUpdate);
<br><br>// Set a background color for the renderer and set the size of the<br>// render window (expressed in pixels).<br>iren-&gt;Initialize();<br>iren-&gt;Start(); <br><br>/// Deletion Code Excluded for this email...<br>
<br>And now here is the code for my observer:<br><br>///<br>/// OBSERVER CLASS<br>///<br><br>class vtkUpdateCallback : public vtkCommand<br>{<br>&nbsp;&nbsp;&nbsp; public:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; static vtkUpdateCallback *New() <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return new vtkUpdateCallback; 
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; void Delete()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; delete this; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; virtual void Execute(vtkObject *caller, unsigned long eventId, void* arguments)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; printf(&quot;Update\n&quot;);
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>};<br><br><div class="gmail_quote">On Jan 18, 2008 6:15 AM, David Cole &lt;<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Is the 3rd event, by any chance, the &quot;ExitEvent&quot;?<br><br>If not, what are the 3 events you do receive?<br><br>What does the rest of your code in main look like? Do you have your own event loop, or do you call Start on the RenderWindowInteractor?
<br><br>Post some more info and somebody will help you get to the bottom of this...<br><br><br>David<br><br><br><div><div><div></div><div class="Wj3C7c"><span class="gmail_quote">On 1/17/08, <b class="gmail_sendername">Mark Waligora
</b> &lt;<a href="mailto:mark.waligora@gmail.com" target="_blank">
mark.waligora@gmail.com</a>&gt; wrote:</span></div></div><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 class="Wj3C7c">
Hey all,<br>I&#39;m having a problem with setting up an event handler.&nbsp; I create a class called UpdateCallback which inherits from vtkCommand.&nbsp; I override the Execute function from vtkCommand.&nbsp; My Execute function simply contains a print statement for the time being.&nbsp; 
<br><br>In my main function, I create an instance of my class and add it as an observer to my vtkRenderWindowInteractor for the &quot;AnyEvent&quot; event.<br><br>UpdateCallback* onUpdate = UpdateCallback::New();<br>iren-&gt;AddObserver(vtkCommand::AnyEvent, onUpdate);
<br><br>When I do this, my program prints the statement in my Execute function 3 times, and then exits.&nbsp; If I comment out the line of code that adds my UpdateCallback as an observer:<br><br>// iren-&gt;AddObserver(vtkCommand::AnyEvent, onUpdate);
<br><br>then the program runs as normal until you close it.&nbsp; I&#39;ve searched the mailing list, googled the problem, and I&#39;ve read through the code in vtkCommand and vtkObject trying to see if adding an observer somehow changes the behavior of the event handling.&nbsp; From what I can tell, any observer class should get called on the appropriate event, so adding my observer shouldn&#39;t create any additional side effects besides what the code in my observer does.&nbsp; Can anyone tell me what might be going on?
<br><br>Thanks a bunch in advance everyone!<br><span><br>-Mark<br>
</span><br></div></div>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">

http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers
</a><br><br></blockquote></div><br>
</blockquote></div><br>