<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoPlainText>Thanks Lars and Jothy for the pointer to vtkCutter.<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>I can cut the sphere, but when I add the actor to the ImageViewer2,
the cut edge is rendered as black, regardless of what color I set the property
of the actor to. A code sample for the clipping part of the pipeline looks
like:<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText style='margin-left:.5in'># Create the clipping plane for
the ROI<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>plane = vtk.vtkPlane()<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'><o:p> </o:p></p>
<p class=MsoPlainText style='margin-left:.5in'># Create the cutter to extract
contours from the ROI<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>clippedROI = vtk.vtkCutter()<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>clippedROI.SetCutFunction(plane)<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>clippedROI.SetInputConnection(targetSphere.GetOutputPort())<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'><o:p> </o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>clipMapper =
vtk.vtkPolyDataMapper()<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>clipMapper.SetInputConnection(clippedROI.GetOutputPort())<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'><o:p> </o:p></p>
<p class=MsoPlainText style='margin-left:.5in'># Create the actor to add to
vtkImageViewer2<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>clipActor = vtk.vtkActor()<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>clipActor.SetMapper(clipMapper)<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>clipActor.GetProperty().SetColor(1.0,
0.0, 0.0)<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>clipActor.GetProperty().SetLineWidth(10)<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'>clipActor.GetProperty().SetOpacity(1.0)<o:p></o:p></p>
<p class=MsoPlainText style='margin-left:.5in'><o:p> </o:p></p>
<p class=MsoPlainText>I set the width of the cut to 10, just to make it easier
to see. Ideally, I'd eventually like to fill the contour with a transparent
red color.<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>If I add the clipActor to a Renderer, and turn it on its
edge, the uncut edge is indeed red.<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>I am using vtk 5.4 on Windows XP.<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Thanks again.<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText> -- Scott<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>-----Original Message-----<br>
From: Lars Friedrich Lars [mailto:lars-friedrich@gmx.net] <br>
Sent: Friday, March 26, 2010 1:16 AM<br>
To: Scott Johnson; vtkusers@vtk.org<br>
Subject: Re: [vtkusers] Combining resliced images and polygons<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Hello Scott,<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>vtkClipPolyData does not really extract the contour, it
clips the poly data with a specified (implicit) function. Clipping a sphere
with a plane will produce a hemisphere. Depending on the method of
visualization (see below) this could easily make troubles, especially if you
set material properties (-> shadows hide parts ...).<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>You should rather use vtkCutter which is really capable
of robustly extracting contours emerging from a cut with an implicit function.
Depending on the method you're using to visualize the axial/coronal/sagittal
views, it might be necessary to modify the plane function a bit to obtain a
perfect non-floating visualization. For example the vtkImageViewer2 internally
works by generating parallel projections of a 3D scene. Therefore it might be
necessary to shift the plane a bit (really a bit - 0.001 or so which is
diagnostically irrelevant) towards the camera position. You should also turn
off all material props of that contour.<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>HTH,<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>lars<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>-------- Original-Nachricht --------<o:p></o:p></p>
<p class=MsoPlainText>> Datum: Thu, 25 Mar 2010 17:14:38 -0500<o:p></o:p></p>
<p class=MsoPlainText>> Von: "Scott Johnson" <Scott.Johnson@neuwave.com><o:p></o:p></p>
<p class=MsoPlainText>> An: vtkusers@vtk.org<o:p></o:p></p>
<p class=MsoPlainText>> Betreff: [vtkusers] Combining resliced images and
polygons<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>> Hi Folks,<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> I'm looking for a pointer.<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> I'm trying to display a resliced image, either
axial, coronal, or<o:p></o:p></p>
<p class=MsoPlainText>> sagital and then display a contour representing the
same plane cutting<o:p></o:p></p>
<p class=MsoPlainText>> through a polygonal shape. In my current example I
have created a<o:p></o:p></p>
<p class=MsoPlainText>> sphere which intersects some of the image slices.
As I scroll through<o:p></o:p></p>
<p class=MsoPlainText>> the slices I expect to see circles where the slice
intersects the<o:p></o:p></p>
<p class=MsoPlainText>> sphere.<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> Right now I have created a SphereSource ->
ClipPolyData -><o:p></o:p></p>
<p class=MsoPlainText>> PolyDataMapper -> Actor. The ClipPolyData has a
plane as the clip<o:p></o:p></p>
<p class=MsoPlainText>> function.<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> For the images I have ImageReslice ->
ImageMapToWindowLevelColors -><o:p></o:p></p>
<p class=MsoPlainText>> ImageActor<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> Both of these actors are connected to a Renderer and
added to a<o:p></o:p></p>
<p class=MsoPlainText>> RenderWindow.<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> What I get is a slice and half of a sphere floating
over it. I can't<o:p></o:p></p>
<p class=MsoPlainText>> get the circle to be reflected on the image. I've
also tried to use an<o:p></o:p></p>
<p class=MsoPlainText>> ImageViewer2 for the display to no avail.<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> My original plan was to sync the plane definitions
in the ImageReslice<o:p></o:p></p>
<p class=MsoPlainText>> and the clipping plane, but I can't get past this
point.<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> This seems much more difficult than it needs to be.
Is there a simpler<o:p></o:p></p>
<p class=MsoPlainText>> way?<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> Thanks<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> -- Scott<o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText>> <o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>-- <o:p></o:p></p>
<p class=MsoPlainText>GMX DSL: Internet, Telefon und Entertainment für nur
19,99 EUR/mtl.!<o:p></o:p></p>
<p class=MsoPlainText>http://portal.gmx.net/de/go/dsl02<o:p></o:p></p>
</div>
</body>
</html>