Base class for tools that use a contour for feedback. More...
#include <mitkFeedbackContourTool.h>
Public Types | |
typedef FeedbackContourTool | Self |
typedef SegTool2D | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
virtual const char * | GetClassName () const |
Protected Member Functions | |
FeedbackContourTool () | |
FeedbackContourTool (const char *) | |
virtual | ~FeedbackContourTool () |
Contour * | GetFeedbackContour () |
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. |
Base class for tools that use a contour for feedback.
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.
Definition at line 54 of file mitkFeedbackContourTool.h.
typedef itk::SmartPointer<const Self> mitk::FeedbackContourTool::ConstPointer |
Reimplemented from mitk::SegTool2D.
Reimplemented in mitk::AddContourTool, mitk::ContourTool, mitk::CorrectorTool2D, mitk::DrawPaintbrushTool, mitk::ErasePaintbrushTool, mitk::EraseRegionTool, mitk::FillRegionTool, mitk::PaintbrushTool, mitk::RegionGrowingTool, mitk::SetRegionTool, and mitk::SubtractContourTool.
Definition at line 58 of file mitkFeedbackContourTool.h.
typedef itk::SmartPointer<Self> mitk::FeedbackContourTool::Pointer |
Reimplemented from mitk::SegTool2D.
Reimplemented in mitk::AddContourTool, mitk::ContourTool, mitk::CorrectorTool2D, mitk::DrawPaintbrushTool, mitk::ErasePaintbrushTool, mitk::EraseRegionTool, mitk::FillRegionTool, mitk::PaintbrushTool, mitk::RegionGrowingTool, mitk::SetRegionTool, and mitk::SubtractContourTool.
Definition at line 58 of file mitkFeedbackContourTool.h.
Reimplemented from mitk::SegTool2D.
Reimplemented in mitk::AddContourTool, mitk::ContourTool, mitk::CorrectorTool2D, mitk::DrawPaintbrushTool, mitk::ErasePaintbrushTool, mitk::EraseRegionTool, mitk::FillRegionTool, mitk::PaintbrushTool, mitk::RegionGrowingTool, mitk::SetRegionTool, and mitk::SubtractContourTool.
Definition at line 58 of file mitkFeedbackContourTool.h.
Reimplemented from mitk::SegTool2D.
Reimplemented in mitk::AddContourTool, mitk::ContourTool, mitk::CorrectorTool2D, mitk::DrawPaintbrushTool, mitk::ErasePaintbrushTool, mitk::EraseRegionTool, mitk::FillRegionTool, mitk::PaintbrushTool, mitk::RegionGrowingTool, mitk::SetRegionTool, and mitk::SubtractContourTool.
Definition at line 58 of file mitkFeedbackContourTool.h.
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.
{ }
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.
correctionForIpSegmentation | subtracts 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] |
Reimplemented from mitk::SegTool2D.
Reimplemented in mitk::AddContourTool, mitk::ContourTool, mitk::CorrectorTool2D, mitk::DrawPaintbrushTool, mitk::ErasePaintbrushTool, mitk::EraseRegionTool, mitk::FillRegionTool, mitk::PaintbrushTool, mitk::RegionGrowingTool, mitk::SetRegionTool, and mitk::SubtractContourTool.
mitk::Contour * mitk::FeedbackContourTool::GetFeedbackContour | ( | ) | [protected] |
Definition at line 75 of file mitkFeedbackContourTool.cpp.
Referenced by mitk::CorrectorTool2D::CorrectorTool2D(), mitk::CorrectorTool2D::OnMouseMoved(), mitk::ContourTool::OnMouseMoved(), mitk::CorrectorTool2D::OnMousePressed(), mitk::ContourTool::OnMousePressed(), mitk::SetRegionTool::OnMouseReleased(), mitk::RegionGrowingTool::OnMouseReleased(), mitk::CorrectorTool2D::OnMouseReleased(), and mitk::ContourTool::OnMouseReleased().
{
return m_FeedbackContour;
}
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.
correctionForIpSegmentation | adds 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] |
Provide values from 0.0 (black) to 1.0 (full color)
Definition at line 65 of file mitkFeedbackContourTool.cpp.
References mitk::ColorProperty::New().
Referenced by mitk::ErasePaintbrushTool::ErasePaintbrushTool(), mitk::EraseRegionTool::EraseRegionTool(), mitk::PaintbrushTool::OnInvertLogic(), mitk::ContourTool::OnInvertLogic(), and mitk::SubtractContourTool::SubtractContourTool().
{ m_FeedbackContourNode->SetProperty("color", ColorProperty::New(r, g, b)); }
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; }