<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2715.400" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=191330914-01042003><FONT size=2>I have been using
vtkImageViewer2 for most of my image viewing needs for maybe the last year or
so. I like vtkImageViewer2 because I can zoom into the image and I can
easily add geometry to scene using</FONT></SPAN></DIV>
<DIV><SPAN class=191330914-01042003><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=191330914-01042003><FONT size=2>viewer->SetInput( myImage
);</FONT></SPAN></DIV>
<DIV><SPAN class=191330914-01042003><FONT
size=2>viewer->GetRenderer()->AddActor( myActor );</FONT></SPAN></DIV>
<DIV class=Section1>
<P class=MsoNormal><SPAN class=191330914-01042003><FONT size=2>This is nice when
I want to "draw" on top of an image. For instance, I can construct a
PolyData of "edges" and draw them on top of an image. Or I can highlight
sections of an image, etc.</FONT></SPAN></P>
<P class=MsoNormal><SPAN class=191330914-01042003><FONT size=2>But when I use
vtkImageViewer2 to display slices from a volume, I hit upon a problem. I could
only look at the first few slices of volume. After the first few slices,
the image would always be black. My first thought was this was an "extent"
problem with the viewer, but digging through the code, everything checked
out. </FONT></SPAN></P>
<P class=MsoNormal><SPAN class=191330914-01042003><FONT size=2>vtkImageViewer2
uses the 3D rendering/texture mapping engine to draw a slice onto a plane.
It turns out that the location of that plane is based on the "z-coordinate" of
the slice. As you adjust the slice that is viewed, the plane moves and
eventually gets outside the camera clipping range.</FONT></SPAN></P>
<P class=MsoNormal><SPAN class=191330914-01042003><FONT size=2>I am not sure
whether this really a bug or not. If you are mixing the image with 3D
geometry, I think you want the z-coordinate of the plane to be adjusted as you
switch slices. This way the image can "hide" the portions of the geometry
that is behind it. There are other ways to do this now using the
ImagePlaneWidgets but ImageViewer2 is a quick and dirty solution,
especially if you want to restrict the view to be down
the z-axis. vtkImageViewer2 is confusing, however, when just using the
viewer to look at each slice in the volume. I post this message here because I
think google will index this message so other people can find the solution.
</FONT></SPAN></P>
<P class=MsoNormal><SPAN class=191330914-01042003><FONT size=2>The solution is
rather easy. Whenever you call SetZSlice on the viewer, you need to reset
the camera clipping range.</FONT></SPAN></P>
<P class=MsoNormal><SPAN class=191330914-01042003><FONT
size=2>viewer->SetZSlice( slice );</FONT></SPAN></P>
<P class=MsoNormal><SPAN class=191330914-01042003></SPAN><SPAN
class=191330914-01042003><FONT
size=2>viewer->GetRenderer()->ResetCameraClippingRange();</FONT></SPAN></P>
<P class=MsoNormal><SPAN class=191330914-01042003><FONT size=2>That is all there
is to that.</FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt"><B><SPAN
style="COLOR: navy; FONT-FAMILY: 'Comic Sans MS'">Jim Miller</SPAN></B>
<BR><B><I><SPAN
style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Arial">_____________________________________</SPAN></I></B><BR><EM><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">Visualization &
Computer Vision</SPAN></EM><I><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial"><BR><EM>GE
Research</EM><BR><EM>Bldg. KW, Room C218B</EM><BR><EM>P.O. Box 8, Schenectady NY
12301</EM><BR><BR></SPAN></I><EM><U><SPAN
style="FONT-SIZE: 7.5pt; COLOR: blue"><A
href="mailto:millerjv@research.ge.com">millerjv@research.ge.com</A></SPAN></U></EM></P>
<P style="MARGIN: 0in 0in 0pt"><EM><U><SPAN
style="FONT-SIZE: 7.5pt; COLOR: blue">james.miller@research.ge.com</SPAN></U></EM><BR><I><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">(518) 387-4005, Dial
Comm: 8*833-4005, </SPAN></I><BR><I><SPAN
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">Cell: (518) 505-7065,
Fax: (518) 387-6981</SPAN></I> </P>
<P class=MsoNormal> <?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office" /><o:p></o:p></P></DIV>
<DIV> </DIV></BODY></HTML>