本文整理汇总了C++中contourmodel::Pointer::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::Clear方法的具体用法?C++ Pointer::Clear怎么用?C++ Pointer::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类contourmodel::Pointer
的用法示例。
在下文中一共展示了Pointer::Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckIfCurrentSliceHasChanged
/**
Insert the point to the feedback contour,finish to build the contour and at the same time the painting function
*/
void mitk::PaintbrushTool::MouseMoved(mitk::InteractionEvent* interactionEvent, bool leftMouseButtonPressed)
{
mitk::InteractionPositionEvent* positionEvent = dynamic_cast<mitk::InteractionPositionEvent*>( interactionEvent );
CheckIfCurrentSliceHasChanged( positionEvent );
if ( m_LastContourSize != m_Size )
{
UpdateContour( positionEvent );
m_LastContourSize = m_Size;
}
Point3D worldCoordinates = positionEvent->GetPositionInWorld();
Point3D indexCoordinates;
m_WorkingSlice->GetGeometry()->WorldToIndex( worldCoordinates, indexCoordinates );
MITK_DEBUG << "Mouse at W " << worldCoordinates << std::endl;
MITK_DEBUG << "Mouse at I " << indexCoordinates << std::endl;
// round to nearest voxel center (abort if this hasn't changed)
if ( m_Size % 2 == 0 ) // even
{
indexCoordinates[0] = ROUND( indexCoordinates[0]);// /*+ 0.5*/) + 0.5;
indexCoordinates[1] = ROUND( indexCoordinates[1]);// /*+ 0.5*/ ) + 0.5;
}
else // odd
{
indexCoordinates[0] = ROUND( indexCoordinates[0] ) ;
indexCoordinates[1] = ROUND( indexCoordinates[1] ) ;
}
static Point3D lastPos; // uninitialized: if somebody finds out how this can be initialized in a one-liner, tell me
if ( fabs(indexCoordinates[0] - lastPos[0]) > mitk::eps ||
fabs(indexCoordinates[1] - lastPos[1]) > mitk::eps ||
fabs(indexCoordinates[2] - lastPos[2]) > mitk::eps ||
leftMouseButtonPressed
)
{
lastPos = indexCoordinates;
}
else
{
MITK_DEBUG << "." << std::flush;
return;
}
MITK_DEBUG << "Mouse at C " << indexCoordinates;
int timestep = positionEvent->GetSender()->GetTimeStep();
ContourModel::Pointer contour = ContourModel::New();
contour->Expand(timestep + 1);
contour->SetClosed(true, timestep);
ContourModel::VertexIterator it = m_MasterContour->Begin();
ContourModel::VertexIterator end = m_MasterContour->End();
while(it != end)
{
Point3D point = (*it)->Coordinates;
point[0] += indexCoordinates[ 0 ];
point[1] += indexCoordinates[ 1 ];
contour->AddVertex( point, timestep );
it++;
}
if (leftMouseButtonPressed)
{
FeedbackContourTool::FillContourInSlice( contour, timestep, m_WorkingSlice, m_PaintingPixelValue );
m_WorkingNode->SetData(m_WorkingSlice);
m_WorkingNode->Modified();
}
// visualize contour
ContourModel::Pointer displayContour = this->GetFeedbackContour();
displayContour->Clear();
ContourModel::Pointer tmp = FeedbackContourTool::BackProjectContourFrom2DSlice( m_WorkingSlice->GetGeometry(), /*displayContour*/contour );
// copy transformed contour into display contour
it = tmp->Begin();
end = tmp->End();
while(it != end)
{
Point3D point = (*it)->Coordinates;
displayContour->AddVertex( point, timestep );
it++;
}
m_FeedbackContourNode->GetData()->Modified();
assert( positionEvent->GetSender()->GetRenderWindow() );
//.........这里部分代码省略.........