<div dir="ltr">Sorry, earlier mail was incomplete. here is the full code<br><br>cutPlane=vtk.vtkPlane()<br> cutPlane.SetOrigin(0,0,SliceNo)<br> cutPlane.SetNormal(0,0,1)<br> cutter=vtk.vtkCutter()<br>
cutter.SetCutFunction(cutPlane)<br> cutter.GenerateCutScalarsOff()<br> Color=Object.GetProperty().GetColor()<br> cutter.SetInput(Object.GetMapper().GetInput())<br> cutter.Update()<br>
<br>cutMapper=vtk.vtkPolyDataMapper()<br> #cutMapper.ScalarVisibilityOn()<br> cutMapper.SetInputConnection( cutter.GetOutputPort())<br> color=Object.GetProperty().GetColor()<br> planeActor=vtk.vtkActor()<br>
planeActor.GetProperty().SetOpacity(0.5)<br> planeActor.GetProperty().SetColor(color)<br> planeActor.GetProperty().SetLineWidth(0.1)<br> planeActor.GetProperty().SetAmbient(1)<br> planeActor.GetProperty().SetSpecularColor(1, 1, 1)<br>
planeActor.GetProperty().SetDiffuseColor(color)<br> planeActor.GetProperty().SetDiffuse(0.8)<br> planeActor.GetProperty().SetSpecular(0.3)<br> planeActor.GetProperty().SetSpecularPower(20)<br>
planeActor.GetProperty().SetRepresentationToSurface()<br> planeActor.SetMapper(cutMapper)<br> return planeActor<br><br>Jothy<br><br><div class="gmail_quote">On Fri, Mar 26, 2010 at 4:36 PM, Jothybasu K Selvaraj <span dir="ltr"><<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr">I am wondering, I too uses a simialr function to cut the sphere and adding it to the imageviewer2 and able to display it properly after adding those lines. Initially I too had this problem. I am sending you the entire cuttin code of mine verify with that.<br>
<br>cutPlane=vtk.vtkPlane()<br> cutPlane.SetOrigin(0,0,SliceNo)<br> cutPlane.SetNormal(0,0,1)<br> cutter=vtk.vtkCutter()<br> cutter.SetCutFunction(cutPlane)<br> cutter.GenerateCutScalarsOff()<br>
Color=Object.GetProperty().GetColor()<br> cutter.SetInput(Object.GetMapper().GetInput())<br> cutter.Update()<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Fri, Mar 26, 2010 at 4:34 PM, Scott Johnson <span dir="ltr"><<a href="mailto:Scott.Johnson@neuwave.com" target="_blank">Scott.Johnson@neuwave.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">I had tried it earlier and it made no difference. I tried it
again, just to be sure. Still no difference.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thanks</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> -- Scott</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; padding: 3pt 0in 0in;">
<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> Jothybasu K
Selvaraj [mailto:<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>] <br>
<b>Sent:</b> Friday, March 26, 2010 11:32 AM<div><div></div><div><br>
<b>To:</b> Scott Johnson<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] Combining resliced images and polygons</div></div></span></p>
</div><div><div></div><div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">Did you add Cutter.Update()<br>
<br>
Jothy</p>
<div>
<p class="MsoNormal">On Fri, Mar 26, 2010 at 4:30 PM, Scott Johnson <<a href="mailto:Scott.Johnson@neuwave.com" target="_blank">Scott.Johnson@neuwave.com</a>>
wrote:</p>
<div>
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Yes.</span></p>
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clippedROI = vtk.vtkCutter()</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clippedROI.SetCutFunction(plane)</span></p>
</div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clippedROI.GenerateCutScalarsOff()</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clippedROI.SetInputConnection(targetSphere.GetOutputPort())</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">
-- Scott</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-color: -moz-use-text-color;">
<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;">
Jothybasu K Selvaraj [mailto:<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>] <br>
<b>Sent:</b> Friday, March 26, 2010 11:29 AM</span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;"><br>
<b>To:</b> Scott Johnson<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] Combining resliced images and polygons</span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">Did you
set the generateCutScalarsOff() in cutter?<br>
<br>
That is the most important point.<br>
<br>
Jothy</p>
<div>
<p class="MsoNormal">On
Fri, Mar 26, 2010 at 4:27 PM, Scott Johnson <<a href="mailto:Scott.Johnson@neuwave.com" target="_blank">Scott.Johnson@neuwave.com</a>>
wrote:</p>
<div>
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thanks again Jothy, but it didn’t make
any difference.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">My actor definition code now looks like:</span></p>
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor =
vtk.vtkActor()</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor.SetMapper(clipMapper)</span></p>
</div>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor.GetProperty().SetLineWidth(10)</span></p>
<div>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor.GetProperty().SetOpacity(1.0)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor.GetProperty().SetColor(1.0,
0.0, 0.0)</span></p>
</div>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor.GetProperty().SetDiffuseColor(1.0,
0.0, 0.0)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor.GetProperty().SetEdgeColor(1.0,
0.0, 0.0)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor.GetProperty().SetDiffuse(0.8)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor.GetProperty().SetSpecular(0.3)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor.GetProperty().SetSpecularPower(20)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">clipActor.GetProperty().SetRepresentationToSurface()</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Could it be something in the image
viewer? That code is:</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">imageViewer =
vtk.vtkImageViewer2()</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">imageViewer.SetupInteractor(interactor)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">imageViewer.SetInputConnection(reslice.GetOutputPort())</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">imageViewer.SetSlice((zMax
- zMin) / 2)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">imageViewer.GetRenderer().AddActor(clipActor)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">imageViewer.GetRenderer().AddActor(annotation)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">imageViewer.SetSize(winWidth,
winHeight)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">imageViewer.SetColorWindow(defaultWindowValue)</span></p>
<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 11pt; color: rgb(31, 73, 125);">imageViewer.SetColorLevel(defaultWindowValue
/ 2)</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">I’ll attach a picture of what I’m
seeing. The confusing part to me is that the ‘annotation’ does show up
colored as expected.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thanks</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">
-- Scott</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-color: -moz-use-text-color;">
<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;">
Jothybasu K Selvaraj [mailto:<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>] <br>
<b>Sent:</b> Friday, March 26, 2010 10:22 AM<br>
<b>To:</b> Scott Johnson<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a></span></p>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;"><br>
<b>Subject:</b> Re: [vtkusers] Combining resliced images and polygons</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">Set
cutter.GenerateCutScalarsOff()</p>
<div>
<div>
<p class="MsoNormal"><br>
<br>
and <br>
<br>
Actor.GetProperty().SetDiffuseColor(color)<br>
Actor.GetProperty().SetDiffuse(0.8) Actor.GetProperty().SetSpecular(0.3)<br>
Actor.GetProperty().SetSpecularPower(20)<br>
Actor.GetProperty().SetRepresentationToSurface()<br>
<br>
Jothy</p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal">On
Fri, Mar 26, 2010 at 10:32 AM, Jothybasu K Selvaraj <<a href="mailto:jothybasu@gmail.com" target="_blank">jothybasu@gmail.com</a>>
wrote:</p>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">Instead
of using Clipper use vtkCutter, that will give you a contour not half sphere.<br>
<br>
Jothy</p>
<div>
<p class="MsoNormal">On
Thu, Mar 25, 2010 at 10:14 PM, Scott Johnson <<a href="mailto:Scott.Johnson@neuwave.com" target="_blank">Scott.Johnson@neuwave.com</a>>
wrote:</p>
<div>
<div>
<p class="MsoNormal">Hi
Folks,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I’m
looking for a pointer.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I’m
trying to display a resliced image, either axial, coronal, or sagital and then
display a contour representing the same plane cutting through a polygonal
shape. In my current example I have created a sphere which intersects
some of the image slices. As I scroll through the slices I expect to see
circles where the slice intersects the sphere.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Right
now I have created a SphereSource -> ClipPolyData -> PolyDataMapper ->
Actor. The ClipPolyData has a plane as the clip function.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">For
the images I have ImageReslice -> ImageMapToWindowLevelColors ->
ImageActor</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Both
of these actors are connected to a Renderer and added to a RenderWindow.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">What
I get is a slice and half of a sphere floating over it. I can’t get the
circle to be reflected on the image. I’ve also tried to use an
ImageViewer2 for the display to no avail.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">My
original plan was to sync the plane definitions in the ImageReslice and the
clipping plane, but I can’t get past this point.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">This
seems much more difficult than it needs to be. Is there a simpler way?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">
-- Scott</p>
<p class="MsoNormal"> </p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom: 12pt;"><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<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></p>
</div>
<p class="MsoNormal"> </p>
</div>
</div>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"> </p>
</div>
</div></div></div>
</div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>