<div>Hi all,</div><div><br></div><div>I used vtkContourWidget to label a contour on an image. And it also need to compute the area of contour. I tired by an example that first converted the contour by vtkTriangleFilter, and then use the vtkMassProperties to compute the area. The detailed code in a Callback function as follows:</div><div>////////////////</div><div><div><span class="Apple-tab-span" style="white-space:pre">  </span>void SetObject(vtkContourWidget * contour){</div><div><span class="Apple-tab-span" style="white-space:pre">          </span>m_contour = contour;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div></div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">    </span>virtual void Execute(vtkObject *caller, unsigned long eventId, void *callData){</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">             </span>int Num = m_contour->GetContourRepresentation()->GetNumberOfNodes();</div><div><span class="Apple-tab-span" style="white-space:pre">           </span>std::cout<<"NumOfNodes:"<<Num<<" "<<m_contour->GetContourRepresentation()->GetClosedLoop()<<endl;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">           </span>if (m_contour->GetContourRepresentation()->GetClosedLoop())</div><div><span class="Apple-tab-span" style="white-space:pre">            </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                    </span></div><div><span class="Apple-tab-span" style="white-space:pre">                     </span>vtkSmartPointer<vtkTriangleFilter> triangleFileter = </div><div><span class="Apple-tab-span" style="white-space:pre">                             </span>vtkSmartPointer<vtkTriangleFilter>::New();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                    </span>triangleFileter->SetInput(m_contour->GetContourRepresentation()->GetContourRepresentationAsPolyData());</div><div><span class="Apple-tab-span" style="white-space:pre">                     </span></div><div><span class="Apple-tab-span" style="white-space:pre">                     </span>vtkSmartPointer<vtkMassProperties> massProp = </div><div><span class="Apple-tab-span" style="white-space:pre">                            </span>vtkSmartPointer<vtkMassProperties>::New();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                    </span>//massProp->SetInput(triangleFileter->GetOutput());</div><div><span class="Apple-tab-span" style="white-space:pre">                    </span>massProp->SetInputConnection(triangleFileter->GetOutputPort());</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                       </span>double area = massProp->GetSurfaceArea();</div><div><span class="Apple-tab-span" style="white-space:pre">                 </span>//double area = 12;</div><div><span class="Apple-tab-span" style="white-space:pre">                  </span>std::cout<<"Counter Area:"<<area<<" um2"<<endl;</div><div><span class="Apple-tab-span" style="white-space:pre">          </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">    </span>}</div></div><div>//////////////////////</div><div>When run the project, it will output some warring information in a vtkOutputWindow tha t"Warning: In ..\..\VTK5.10.1\Graphics\vtkMassProperties.cxx, line 120 vtkMassProperties (03636DC8): Input data type must be VTK_TRIANGLE not 3"</div><div><br></div><div>When is the problem? Or is there some other way to compute the area of contour made be vtkContourWidget?</div><div><br></div><div>Thanks</div><div>Yihui Cao</div><div><br></div><div><br></div><div><br></div>