Hi Javier, not sure if this is exactly what you're looking for, but may help:<br><br><a href="http://devsample.org/index.php?option=com_content&task=view&id=50&Itemid=27">http://devsample.org/index.php?option=com_content&task=view&id=50&Itemid=27</a><br>
<br>Mark<br><br><div class="gmail_quote">On Tue, Nov 11, 2008 at 7:53 AM, Javier González González-Zabaleta <span dir="ltr"><<a href="mailto:jgonzabal@gmail.com">jgonzabal@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.<br>
<br>My firt code is <br><br>vtkMFCWindow *pvtkMFCWindow;<br> vtkRenderer *pvtkRenderer;<br> vtkActor2D *pvtkActor2D;<br> vtkTextMapper *pvtkTextMapper;<br> vtkImageMapper *pvtkImageMapper;<br> ConnectorType::Pointer connector;<br>
<br>this->connector->SetInput( InputImage );<br> this->connector->Update(); <br> this->pvtkImageMapper->SetInput(this->connector->GetOutput());<br> this->pvtkImageMapper->SetColorWindow(1000);<br>
this->pvtkImageMapper->SetColorLevel(500);<br> this->pvtkActor2D->SetPosition(this->coorX,this->coorY);<br> this->pvtkActor2D->SetMapper(this->pvtkImageMapper);<br> this->pvtkRenderer->AddActor(this->pvtkActor2D);<br>
this->pvtkRenderer->ResetCamera();<br><br>this->pvtkMFCWindow = new vtkMFCWindow(nID);<br> this->pvtkMFCWindow->GetRenderWindow()->AddRenderer(this->pvtkRenderer);<br> <br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>
iren->SetRenderWindow( this->pvtkMFCWindow->GetRenderWindow() );<br><br> vtkContourWidget *contourWidget = vtkContourWidget::New();<br> contourWidget->SetInteractor( iren );<br><br> vtkOrientedGlyphContourRepresentation *rep = vtkOrientedGlyphContourRepresentation::New();<br>
contourWidget->SetRepresentation( rep );<br> rep->GetLinesProperty()->SetColor(1, 0.2, 0);<br> rep->GetProperty()->SetColor(0, 0.2, 1);<br> rep->GetLinesProperty()->SetLineWidth( 3 );<br>
<br> contourWidget->On();<br><br> vtkPolyData * pd = vtkPolyData::New();<br><br> vtkPoints *points = vtkPoints::New();<br> vtkCellArray *lines = vtkCellArray::New();<br> vtkIdType *lineIndices = new vtkIdType[21];<br>
for (int i = 0; i< 20; i++)<br> {<br> const double angle = 2.0*vtkMath::Pi()*i/20.0;<br> points->InsertPoint(static_cast<vtkIdType>(i), 0.1*cos(angle),<br> 0.1*sin(angle), 0.0 );<br>
lineIndices[i] = static_cast<vtkIdType>(i);<br> }<br> <br> lineIndices[20] = 0;<br> lines->InsertNextCell(21,lineIndices);<br> delete [] lineIndices;<br> pd->SetPoints(points);<br>
pd->SetLines(lines);<br> points->Delete();<br> lines->Delete();<br> <br> contourWidget->Initialize(pd);<br> contourWidget->Render();<br><br> this->pvtkRenderer->SetBackground(1.0,1.0,1.0);<br>
this->pvtkRenderer->AddActor(this->pvtkActor2D);<br> this->pvtkRenderer->ResetCamera();<br><br> this->pvtkMFCWindow->GetRenderWindow()->Render();<br> <br> iren->Initialize();<br>
<br>If I charge the image I lose the contour and I don't know how obtain the information of the pixel into the contour.<br><br>I'm in the rigth way o should I change the method? Is there ahother widget better to this operation?<br>
<br>Thanks<br>
<br>_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>