Public Types | Public Member Functions | Protected Member Functions

mitk::FeedbackContourTool Class Reference
[Interaction ClassesClasses related to InteractiveSegmentation]

Base class for tools that use a contour for feedback. More...

#include <mitkFeedbackContourTool.h>

Inheritance diagram for mitk::FeedbackContourTool:
Inheritance graph
[legend]
Collaboration diagram for mitk::FeedbackContourTool:
Collaboration graph
[legend]

List of all members.

Public Types

typedef FeedbackContourTool Self
typedef SegTool2D Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const

Protected Member Functions

 FeedbackContourTool ()
 FeedbackContourTool (const char *)
virtual ~FeedbackContourTool ()
ContourGetFeedbackContour ()
void SetFeedbackContour (Contour &)
void SetFeedbackContourVisible (bool)
void SetFeedbackContourColor (float r, float g, float b)
 Provide values from 0.0 (black) to 1.0 (full color)
void SetFeedbackContourColorDefault ()
Contour::Pointer ProjectContourTo2DSlice (Image *slice, Contour *contourIn3D, bool correctionForIpSegmentation=false, bool constrainToInside=true)
 Projects a contour onto an image point by point. Converts from world to index coordinates.
Contour::Pointer BackProjectContourFrom2DSlice (Image *slice, Contour *contourIn2D, bool correctionForIpSegmentation=false)
 Projects a slice index coordinates of a contour back into world coordinates.
void FillContourInSlice (Contour *projectedContour, Image *sliceImage, int paintingPixelValue=1)
 Fill a contour in a 2D slice with a specified pixel value.

Detailed Description

Base class for tools that use a contour for feedback.

See also:
Tool
Contour

Implements helper methods, that might be of use to all kind of 2D segmentation tools that use a contour for user feedback.

These helper methods are actually implemented in ContourUtils now. FeedbackContourTool only forwards such requests.

Warning:
Only to be instantiated by mitk::ToolManager.
Author:
nolden

Definition at line 54 of file mitkFeedbackContourTool.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::FeedbackContourTool::ConstPointer
typedef itk::SmartPointer<Self> mitk::FeedbackContourTool::Pointer

Constructor & Destructor Documentation

mitk::FeedbackContourTool::FeedbackContourTool (  ) [protected]
mitk::FeedbackContourTool::FeedbackContourTool ( const char *  type ) [protected]

Definition at line 30 of file mitkFeedbackContourTool.cpp.

References mitk::RenderingManager::GetAllRegisteredRenderWindows(), mitk::BaseRenderer::GetInstance(), mitk::RenderingManager::GetInstance(), mitk::BaseRenderer::GetMapperID(), mitk::FloatProperty::New(), mitk::IntProperty::New(), mitk::BoolProperty::New(), mitk::StringProperty::New(), mitk::StateMachine::New(), SetFeedbackContourColorDefault(), and mitk::BaseRenderer::Standard3D.

:SegTool2D(type),
 m_FeedbackContourVisible(false),
 m_ContourUtils(ContourUtils::New())
{
  m_FeedbackContour = Contour::New();
  m_FeedbackContourNode = DataNode::New();
  m_FeedbackContourNode->SetData( m_FeedbackContour );
  m_FeedbackContourNode->SetProperty("name", StringProperty::New("One of FeedbackContourTool's feedback nodes"));
  m_FeedbackContourNode->SetProperty("visible", BoolProperty::New(true));
  m_FeedbackContourNode->SetProperty("helper object", BoolProperty::New(true));
  m_FeedbackContourNode->SetProperty("layer", IntProperty::New(1000));
  m_FeedbackContourNode->SetProperty("project", BoolProperty::New(true));
  m_FeedbackContourNode->SetProperty("Width", FloatProperty::New(1)); // uppercase! Slim line looks very accurate :-)

  // set explicitly visible=false for all 3D renderer (that exist already ...)
  const RenderingManager::RenderWindowVector& renderWindows = RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
  for (RenderingManager::RenderWindowVector::const_iterator iter = renderWindows.begin();
       iter != renderWindows.end();
       ++iter)
  {
    if ( mitk::BaseRenderer::GetInstance((*iter))->GetMapperID() == BaseRenderer::Standard3D )
    //if ( (*iter)->GetRenderer()->GetMapperID() == BaseRenderer::Standard3D )
    {
      m_FeedbackContourNode->SetProperty("visible", BoolProperty::New(false), mitk::BaseRenderer::GetInstance((*iter)));
    }
  }

  SetFeedbackContourColorDefault();
}
mitk::FeedbackContourTool::~FeedbackContourTool (  ) [protected, virtual]

Definition at line 61 of file mitkFeedbackContourTool.cpp.

{
}

Member Function Documentation

mitk::Contour::Pointer mitk::FeedbackContourTool::BackProjectContourFrom2DSlice ( Image slice,
Contour contourIn2D,
bool  correctionForIpSegmentation = false 
) [protected]

Projects a slice index coordinates of a contour back into world coordinates.

Parameters:
correctionForIpSegmentationsubtracts 0.5 to x and y index coordinates (difference between ipSegmentation and MITK contours)

Definition at line 110 of file mitkFeedbackContourTool.cpp.

Referenced by mitk::PaintbrushTool::OnMouseMoved(), mitk::SetRegionTool::OnMousePressed(), mitk::RegionGrowingTool::OnMousePressedInside(), and mitk::RegionGrowingTool::PerformRegionGrowingAndUpdateContour().

{
  return m_ContourUtils->BackProjectContourFrom2DSlice(slice, contourIn2D, correctionForIpSegmentation);
}
void mitk::FeedbackContourTool::FillContourInSlice ( Contour projectedContour,
Image sliceImage,
int  paintingPixelValue = 1 
) [protected]

Fill a contour in a 2D slice with a specified pixel value.

Definition at line 115 of file mitkFeedbackContourTool.cpp.

Referenced by mitk::PaintbrushTool::OnMouseMoved(), mitk::SetRegionTool::OnMouseReleased(), mitk::RegionGrowingTool::OnMouseReleased(), and mitk::ContourTool::OnMouseReleased().

{
  m_ContourUtils->FillContourInSlice(projectedContour, sliceImage, paintingPixelValue);
}
virtual const char* mitk::FeedbackContourTool::GetClassName (  ) const [virtual]
mitk::Contour * mitk::FeedbackContourTool::GetFeedbackContour (  ) [protected]
mitk::Contour::Pointer mitk::FeedbackContourTool::ProjectContourTo2DSlice ( Image slice,
Contour contourIn3D,
bool  correctionForIpSegmentation = false,
bool  constrainToInside = true 
) [protected]

Projects a contour onto an image point by point. Converts from world to index coordinates.

Parameters:
correctionForIpSegmentationadds 0.5 to x and y index coordinates (difference between ipSegmentation and MITK contours)

Definition at line 105 of file mitkFeedbackContourTool.cpp.

Referenced by mitk::SetRegionTool::OnMouseReleased(), mitk::RegionGrowingTool::OnMouseReleased(), and mitk::ContourTool::OnMouseReleased().

{
  return m_ContourUtils->ProjectContourTo2DSlice(slice, contourIn3D, correctionForIpSegmentation, constrainToInside);
}
void mitk::FeedbackContourTool::SetFeedbackContour ( Contour contour ) [protected]

Definition at line 80 of file mitkFeedbackContourTool.cpp.

Referenced by mitk::SetRegionTool::OnInvertLogic(), mitk::SetRegionTool::OnMousePressed(), mitk::RegionGrowingTool::OnMousePressedInside(), and mitk::RegionGrowingTool::PerformRegionGrowingAndUpdateContour().

{
  m_FeedbackContour = &contour;
  m_FeedbackContourNode->SetData( m_FeedbackContour );
}
void mitk::FeedbackContourTool::SetFeedbackContourColor ( float  r,
float  g,
float  b 
) [protected]
void mitk::FeedbackContourTool::SetFeedbackContourColorDefault (  ) [protected]

Definition at line 70 of file mitkFeedbackContourTool.cpp.

References mitk::ColorProperty::New().

Referenced by FeedbackContourTool(), mitk::PaintbrushTool::OnInvertLogic(), and mitk::ContourTool::OnInvertLogic().

{
  m_FeedbackContourNode->SetProperty("color", ColorProperty::New(0.0/255.0, 255.0/255.0, 0.0/255.0));
}
void mitk::FeedbackContourTool::SetFeedbackContourVisible ( bool  visible ) [protected]

Definition at line 86 of file mitkFeedbackContourTool.cpp.

Referenced by mitk::PaintbrushTool::Activated(), mitk::PaintbrushTool::Deactivated(), mitk::SetRegionTool::OnMousePressed(), mitk::CorrectorTool2D::OnMousePressed(), mitk::ContourTool::OnMousePressed(), mitk::RegionGrowingTool::OnMousePressedInside(), mitk::RegionGrowingTool::OnMousePressedOutside(), mitk::SetRegionTool::OnMouseReleased(), mitk::RegionGrowingTool::OnMouseReleased(), mitk::CorrectorTool2D::OnMouseReleased(), and mitk::ContourTool::OnMouseReleased().

{
  if ( m_FeedbackContourVisible == visible ) return; // nothing changed

  if ( DataStorage* storage = m_ToolManager->GetDataStorage() )
  {
    if (visible)
    {
      storage->Add( m_FeedbackContourNode );
    }
    else
    {
      storage->Remove( m_FeedbackContourNode );
    }
  }

  m_FeedbackContourVisible = visible;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines