<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:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></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="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello Iyas,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">There are many VTK-based applications that allow contouring on image slices. I would recommend to extend/modify these applications to suit your needs, instead of reimplementing everything from scratch. If you just want to implement this
as a learning experience, then you can check out the source code of these existing applications, you can learn a lot about how to implement this and many other features.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For example:<o:p></o:p></p>
<p class="MsoNormal"><a href="http://www.slicer.org">www.slicer.org</a><o:p></o:p></p>
<p class="MsoNormal"><a href="http://www.itksnap.org">www.itksnap.org</a><o:p></o:p></p>
<p class="MsoNormal"><a href="http://www.mitk.org">www.mitk.org</a><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Andras<o:p></o:p></p>
<p class="MsoNormal"><a name="_MailEndCompose"><o:p> </o:p></a></p>
<span style="mso-bookmark:_MailEndCompose"></span>
<p class="MsoNormal"><b>From:</b> vtkusers [mailto:vtkusers-bounces@vtk.org] <b>On Behalf Of
</b>Iyas Hamdan<br>
<b>Sent:</b> Friday, August 25, 2017 9:51 AM<br>
<b>To:</b> VTK Users <vtkusers@vtk.org><br>
<b>Subject:</b> [vtkusers] VTK contour Widget<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hello, <o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I have a problem using the vtkcontourwidget in 3D. What I'm trying to do is to draw contours on my 3D image, where a different contour can be drawn on each slice of the image.
<o:p></o:p></p>
</div>
<p class="MsoNormal">The problem that I'm getting is that when I draw a contour on one of the slices, the same contour appears on all the other slices as well.
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Here's a piece of the code i'm using:
<br>
<br>
vtkSmartPointer<vtkImageViewer2> ImageViewer = vtkSmartPointer<vtkImageViewer2>::New();<br>
ImageViewer->SetInputData(reader->GetOutput());<br>
ImageViewer->SetColorLevel(127);<br>
ImageViewer->SetColorWindow(255);<br>
<br>
vtkSmartPointer<vtkRenderWindowInteractor> iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
ImageViewer->SetupInteractor(iren);<br>
ImageViewer->Render();<br>
ImageViewer->GetRenderer()->ResetCamera();<br>
ImageViewer->Render();<br>
<br>
vtkSmartPointer<vtkSliderWidget> SliderWidget = vtkSmartPointer<vtkSliderWidget>::New();<br>
SliderWidget->SetInteractor(iren);<br>
SliderWidget->SetRepresentation(SliderRepres2D);<br>
SliderWidget->KeyPressActivationOff();<br>
SliderWidget->SetAnimationModeToAnimate();<br>
SliderWidget->SetEnabled(true);<br>
<br>
vtkSmartPointer<vtkSliderCallback> SliderCb = vtkSmartPointer<vtkSliderCallback>::New();<br>
SliderCb->SetImageViewer(ImageViewer);<br>
SliderWidget->AddObserver(vtkCommand::InteractionEvent, SliderCb);<br>
<br>
ImageViewer->SetSlice(static_cast<int>(SliderRepres2D->GetValue()));<br>
<br>
vtkSmartPointer<vtkContourWidget> ContourWidget = vtkSmartPointer<vtkContourWidget>::New();<br>
vtkSmartPointer<vtkOrientedGlyphContourRepresentation> rep = vtkSmartPointer<vtkOrientedGlyphContourRepresentation>::New();<br>
ContourWidget->SetRepresentation(rep);<br>
<br>
vtkSmartPointer<vtkImageActorPointPlacer> imageActorPointPlacer = vtkSmartPointer<vtkImageActorPointPlacer>::New();<br>
imageActorPointPlacer->SetImageActor(ImageViewer->GetImageActor());<br>
rep->SetPointPlacer(imageActorPointPlacer);<br>
rep->GetProperty()->SetColor(0, 1, 0);<br>
<br>
ContourWidget->SetInteractor(iren);<br>
ContourWidget->FollowCursorOn();<br>
ContourWidget->SetEnabled(true);<br>
ContourWidget->ProcessEventsOn();<br>
<br>
iren->Start();<br>
<br>
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Any idea what's causing this problem and eventually how to fix it ?
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Any help would be really appreciated,
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Thanks in advance, <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Iyas<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>