[prev in list] [next in list] [prev in thread] [next in thread]
List: vtkusers
Subject: Re: [vtkusers] VTK contour Widget
From: Iyas Hamdan <iyas.hamdan () gmail ! com>
Date: 2017-08-25 14:52:41
Message-ID: CANH4YVj=qYL5rRou8ZpL7zyNQEiswohWcNuUV4UDVsVHmwncLA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Thank you Andras for your answer!
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).
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.
I'll take a look at the source code of these applications and see if I
could find what I need.
Thanks,
Iyas
On Fri, Aug 25, 2017 at 4:05 PM, Andras Lasso <lasso@queensu.ca> wrote:
> Hello Iyas,
>
>
>
> 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.
>
>
>
> For example:
>
> www.slicer.org
>
> www.itksnap.org
>
> www.mitk.org
>
>
>
> Andras
>
>
>
> *From:* vtkusers [mailto:vtkusers-bounces@vtk.org] *On Behalf Of *Iyas
> Hamdan
> *Sent:* Friday, August 25, 2017 9:51 AM
> *To:* VTK Users <vtkusers@vtk.org>
> *Subject:* [vtkusers] VTK contour Widget
>
>
>
> Hello,
>
> 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.
>
> 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.
>
>
>
> Here's a piece of the code i'm using:
>
> vtkSmartPointer<vtkImageViewer2> ImageViewer = vtkSmartPointer<
> vtkImageViewer2>::New();
> ImageViewer->SetInputData(reader->GetOutput());
> ImageViewer->SetColorLevel(127);
> ImageViewer->SetColorWindow(255);
>
> vtkSmartPointer<vtkRenderWindowInteractor> iren = vtkSmartPointer<
> vtkRenderWindowInteractor>::New();
> ImageViewer->SetupInteractor(iren);
> ImageViewer->Render();
> ImageViewer->GetRenderer()->ResetCamera();
> ImageViewer->Render();
>
> vtkSmartPointer<vtkSliderWidget> SliderWidget = vtkSmartPointer<
> vtkSliderWidget>::New();
> SliderWidget->SetInteractor(iren);
> SliderWidget->SetRepresentation(SliderRepres2D);
> SliderWidget->KeyPressActivationOff();
> SliderWidget->SetAnimationModeToAnimate();
> SliderWidget->SetEnabled(true);
>
> vtkSmartPointer<vtkSliderCallback> SliderCb = vtkSmartPointer<
> vtkSliderCallback>::New();
> SliderCb->SetImageViewer(ImageViewer);
> SliderWidget->AddObserver(vtkCommand::InteractionEvent, SliderCb);
>
> ImageViewer->SetSlice(static_cast<int>(SliderRepres2D->GetValue()));
>
> vtkSmartPointer<vtkContourWidget> ContourWidget = vtkSmartPointer<
> vtkContourWidget>::New();
> vtkSmartPointer<vtkOrientedGlyphContourRepresentation> rep =
> vtkSmartPointer<vtkOrientedGlyphContourRepresentation>::New();
> ContourWidget->SetRepresentation(rep);
>
> vtkSmartPointer<vtkImageActorPointPlacer> imageActorPointPlacer =
> vtkSmartPointer<vtkImageActorPointPlacer>::New();
> imageActorPointPlacer->SetImageActor(ImageViewer->GetImageActor());
> rep->SetPointPlacer(imageActorPointPlacer);
> rep->GetProperty()->SetColor(0, 1, 0);
>
> ContourWidget->SetInteractor(iren);
> ContourWidget->FollowCursorOn();
> ContourWidget->SetEnabled(true);
> ContourWidget->ProcessEventsOn();
>
> iren->Start();
>
> Any idea what's causing this problem and eventually how to fix it ?
>
> Any help would be really appreciated,
>
> Thanks in advance,
>
> Iyas
>
[Attachment #5 (text/html)]
<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>
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic