[vtkusers] Region of Interest

Mark Wyszomierski markww at gmail.com
Tue Nov 11 08:55:33 EST 2008


Hi Javier, not sure if this is exactly what you're looking for, but may
help:

http://devsample.org/index.php?option=com_content&task=view&id=50&Itemid=27

Mark

On Tue, Nov 11, 2008 at 7:53 AM, Javier González González-Zabaleta <
jgonzabal at gmail.com> wrote:

> Hi, my name´s Javier González. I'm trying to select one o more regions into
> an 2D image to make some operations with their pixels. Now I'm using the
> contour widget, but I don't know how put the imagen and obtain the
> information.
>
> My firt code is
>
> vtkMFCWindow *pvtkMFCWindow;
>     vtkRenderer *pvtkRenderer;
>     vtkActor2D *pvtkActor2D;
>     vtkTextMapper *pvtkTextMapper;
>     vtkImageMapper *pvtkImageMapper;
>     ConnectorType::Pointer connector;
>
> this->connector->SetInput( InputImage );
>     this->connector->Update();
>     this->pvtkImageMapper->SetInput(this->connector->GetOutput());
>     this->pvtkImageMapper->SetColorWindow(1000);
>     this->pvtkImageMapper->SetColorLevel(500);
>     this->pvtkActor2D->SetPosition(this->coorX,this->coorY);
>     this->pvtkActor2D->SetMapper(this->pvtkImageMapper);
>     this->pvtkRenderer->AddActor(this->pvtkActor2D);
>     this->pvtkRenderer->ResetCamera();
>
> this->pvtkMFCWindow = new vtkMFCWindow(nID);
>
> this->pvtkMFCWindow->GetRenderWindow()->AddRenderer(this->pvtkRenderer);
>
>     vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>     iren->SetRenderWindow( this->pvtkMFCWindow->GetRenderWindow() );
>
>     vtkContourWidget *contourWidget = vtkContourWidget::New();
>     contourWidget->SetInteractor( iren );
>
>     vtkOrientedGlyphContourRepresentation *rep =
> vtkOrientedGlyphContourRepresentation::New();
>     contourWidget->SetRepresentation( rep );
>     rep->GetLinesProperty()->SetColor(1, 0.2, 0);
>     rep->GetProperty()->SetColor(0, 0.2, 1);
>     rep->GetLinesProperty()->SetLineWidth( 3 );
>
>     contourWidget->On();
>
>     vtkPolyData * pd = vtkPolyData::New();
>
>     vtkPoints    *points      = vtkPoints::New();
>     vtkCellArray *lines       = vtkCellArray::New();
>     vtkIdType    *lineIndices = new vtkIdType[21];
>     for (int i = 0; i< 20; i++)
>         {
>         const double angle = 2.0*vtkMath::Pi()*i/20.0;
>         points->InsertPoint(static_cast<vtkIdType>(i), 0.1*cos(angle),
>                             0.1*sin(angle), 0.0 );
>         lineIndices[i] = static_cast<vtkIdType>(i);
>         }
>
>     lineIndices[20] = 0;
>     lines->InsertNextCell(21,lineIndices);
>     delete [] lineIndices;
>     pd->SetPoints(points);
>     pd->SetLines(lines);
>     points->Delete();
>     lines->Delete();
>
>     contourWidget->Initialize(pd);
>     contourWidget->Render();
>
>     this->pvtkRenderer->SetBackground(1.0,1.0,1.0);
>     this->pvtkRenderer->AddActor(this->pvtkActor2D);
>     this->pvtkRenderer->ResetCamera();
>
>     this->pvtkMFCWindow->GetRenderWindow()->Render();
>
>     iren->Initialize();
>
> If I charge the image I lose the contour and I don't know how obtain the
> information of the pixel into the contour.
>
> I'm in the rigth way o should I change the method? Is there ahother widget
> better to this operation?
>
> Thanks
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081111/872ac931/attachment.htm>


More information about the vtkusers mailing list