<div dir="ltr"><div><div>Thank you Andras for your answer! <br><br></div>Actually image contouring is a small part that I need to integrate in the project that i'm working on.  I thought I could use vtk contour widget to do that (since i dont need all the features in slicer or itk snap for example). <br><br></div><div>And I tried it on 2D images and it's exatly what i'm looking for, but I can't get it to work in 3D.<br></div><div><br></div><div>I'll take a look at the source code of these applications and see if I could find what I need. <br><br></div><div>Thanks, <br><br></div><div>Iyas<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 25, 2017 at 4:05 PM, Andras Lasso <span dir="ltr"><<a href="mailto:lasso@queensu.ca" target="_blank">lasso@queensu.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div link="#0563C1" vlink="#954F72" lang="EN-US">
<div class="m_-7551131441244788584WordSection1">
<p class="MsoNormal">Hello Iyas,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></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.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">For example:<u></u><u></u></p>
<p class="MsoNormal"><a href="http://www.slicer.org" target="_blank">www.slicer.org</a><u></u><u></u></p>
<p class="MsoNormal"><a href="http://www.itksnap.org" target="_blank">www.itksnap.org</a><u></u><u></u></p>
<p class="MsoNormal"><a href="http://www.mitk.org" target="_blank">www.mitk.org</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Andras<u></u><u></u></p>
<p class="MsoNormal"><a name="m_-7551131441244788584__MailEndCompose"><u></u> <u></u></a></p>
<span></span>
<p class="MsoNormal"><b>From:</b> vtkusers [mailto:<a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.<wbr>org</a>] <b>On Behalf Of
</b>Iyas Hamdan<br>
<b>Sent:</b> Friday, August 25, 2017 9:51 AM<br>
<b>To:</b> VTK Users <<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>><br>
<b>Subject:</b> [vtkusers] VTK contour Widget<u></u><u></u></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hello, <u></u><u></u></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.
<u></u><u></u></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.
<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Here's a piece of the code i'm using:
<br>
<br>
    vtkSmartPointer<<wbr>vtkImageViewer2> ImageViewer = vtkSmartPointer<<wbr>vtkImageViewer2>::New();<br>
    ImageViewer->SetInputData(<wbr>reader->GetOutput());<br>
    ImageViewer->SetColorLevel(<wbr>127);<br>
    ImageViewer->SetColorWindow(<wbr>255);<br>
<br>
    vtkSmartPointer<<wbr>vtkRenderWindowInteractor> iren = vtkSmartPointer<<wbr>vtkRenderWindowInteractor>::<wbr>New();<br>
    ImageViewer->SetupInteractor(<wbr>iren);<br>
    ImageViewer->Render();<br>
    ImageViewer->GetRenderer()-><wbr>ResetCamera();<br>
    ImageViewer->Render();<br>
<br>
    vtkSmartPointer<<wbr>vtkSliderWidget> SliderWidget = vtkSmartPointer<<wbr>vtkSliderWidget>::New();<br>
    SliderWidget->SetInteractor(<wbr>iren);<br>
    SliderWidget-><wbr>SetRepresentation(<wbr>SliderRepres2D);<br>
    SliderWidget-><wbr>KeyPressActivationOff();<br>
    SliderWidget-><wbr>SetAnimationModeToAnimate();<br>
    SliderWidget->SetEnabled(true)<wbr>;<br>
<br>
    vtkSmartPointer<<wbr>vtkSliderCallback> SliderCb = vtkSmartPointer<<wbr>vtkSliderCallback>::New();<br>
    SliderCb->SetImageViewer(<wbr>ImageViewer);<br>
    SliderWidget->AddObserver(<wbr>vtkCommand::InteractionEvent, SliderCb);<br>
<br>
    ImageViewer->SetSlice(static_<wbr>cast<int>(SliderRepres2D-><wbr>GetValue()));<br>
<br>
vtkSmartPointer<<wbr>vtkContourWidget> ContourWidget = vtkSmartPointer<<wbr>vtkContourWidget>::New();<br>
    vtkSmartPointer<<wbr>vtkOrientedGlyphContourReprese<wbr>ntation> rep = vtkSmartPointer<<wbr>vtkOrientedGlyphContourReprese<wbr>ntation>::New();<br>
    ContourWidget-><wbr>SetRepresentation(rep);<br>
<br>
    vtkSmartPointer<<wbr>vtkImageActorPointPlacer>  imageActorPointPlacer = vtkSmartPointer<<wbr>vtkImageActorPointPlacer>::<wbr>New();<br>
    imageActorPointPlacer-><wbr>SetImageActor(ImageViewer-><wbr>GetImageActor());<br>
    rep->SetPointPlacer(<wbr>imageActorPointPlacer);<br>
    rep->GetProperty()->SetColor(<wbr>0, 1, 0);<br>
<br>
    ContourWidget->SetInteractor(<wbr>iren);<br>
    ContourWidget->FollowCursorOn(<wbr>);<br>
    ContourWidget->SetEnabled(<wbr>true);<br>
    ContourWidget-><wbr>ProcessEventsOn();<br>
<br>
    iren->Start();<br>
<br>
<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Any idea what's causing this problem and eventually how to fix it ?
<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Any help would be really appreciated,
<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Thanks in advance, <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Iyas<u></u><u></u></p>
</div>
</div>
</div></div></div>
</div>

</blockquote></div><br></div>