Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons, etc. More...
#include <mitkPlanarFigure.h>
Classes | |
struct | Feature |
Public Types | |
typedef PlanarFigure | Self |
typedef BaseData | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
typedef itk::VectorContainer < unsigned long, mitk::Point2D > | VertexContainerType |
typedef itk::VectorContainer < unsigned long, VertexContainerType::Pointer > | VertexContainerVectorType |
typedef itk::VectorContainer < unsigned long, bool > | BoolContainerType |
Public Member Functions | |
virtual const char * | GetClassName () const |
virtual void | SetGeometry2D (mitk::Geometry2D *geometry) |
Sets the 2D geometry on which this figure will be placed. | |
virtual const Geometry2D * | GetGeometry2D () const |
Returns (previously set) 2D geometry of this figure. | |
virtual bool | IsClosed () const |
True if the planar figure is closed. | |
virtual bool | IsPlaced () const |
True if the planar figure has been placed (and can be displayed/interacted with). | |
virtual void | PlaceFigure (const Point2D &point) |
Place figure at the given point (in 2D index coordinates) onto the given 2D geometry. | |
virtual bool | AddControlPoint (const Point2D &point) |
virtual bool | SetControlPoint (unsigned int index, const Point2D &point, bool createIfDoesNotExist=false) |
virtual bool | SetCurrentControlPoint (const Point2D &point) |
unsigned int | GetNumberOfControlPoints () const |
Returns the current number of 2D control points defining this figure. | |
virtual unsigned int | GetMinimumNumberOfControlPoints () const =0 |
Returns the minimum number of control points needed to represent this figure. | |
virtual unsigned int | GetMaximumNumberOfControlPoints () const =0 |
Returns the maximum number of control points allowed for this figure (e.g. 3 for triangles). | |
virtual bool | SelectControlPoint (unsigned int index) |
Selects currently active control points. | |
virtual void | DeselectControlPoint () |
Deselect control point; no control point active. | |
virtual int | GetSelectedControlPoint () const |
Return currently selected control point. | |
const VertexContainerType * | GetControlPoints () const |
Returns 2D control points vector. | |
VertexContainerType * | GetControlPoints () |
Returns 2D control points vector. | |
Point2D & | GetControlPoint (unsigned int index) const |
Returns specified control point in 2D world coordinates. | |
Point3D | GetWorldControlPoint (unsigned int index) const |
Returns specified control point in world coordinates. | |
VertexContainerType * | GetPolyLine (unsigned int index) |
Returns the polyline representing the planar figure (for rendering, measurements, etc.). | |
const VertexContainerType * | GetPolyLine (unsigned int index) const |
Returns the polyline representing the planar figure (for rendering, measurements, etc.). | |
const VertexContainerType * | GetHelperPolyLine (unsigned int index, double mmPerDisplayUnit, unsigned int displayHeight) |
Returns the polyline that should be drawn the same size at every scale (for text, angles, etc.). | |
virtual unsigned int | GetNumberOfFeatures () const |
Returns the number of features available for this PlanarFigure (such as, radius, area, ...). | |
const char * | GetFeatureName (unsigned int index) const |
Returns the name (identifier) of the specified features. | |
const char * | GetFeatureUnit (unsigned int index) const |
Returns the physical unit of the specified features. | |
double | GetQuantity (unsigned int index) const |
bool | IsFeatureActive (unsigned int index) const |
Returns true if the feature with the specified index exists and is active (an inactive feature may e.g. be the area of a non-closed polygon. | |
virtual void | EvaluateFeatures () |
Calculates quantities of all features of this planar figure. | |
virtual void | UpdateOutputInformation () |
Intherited from parent. | |
virtual void | SetRequestedRegionToLargestPossibleRegion () |
Intherited from parent. | |
virtual bool | RequestedRegionIsOutsideOfTheBufferedRegion () |
Intherited from parent. | |
virtual bool | VerifyRequestedRegion () |
Intherited from parent. | |
virtual void | SetRequestedRegion (itk::DataObject *data) |
Intherited from parent. | |
virtual unsigned short | GetPolyLinesSize () |
Returns the current number of polylines. | |
virtual unsigned short | GetHelperPolyLinesSize () |
Returns the current number of helperpolylines. | |
virtual bool | IsHelperToBePainted (unsigned int index) |
Returns whether a helper polyline should be painted or not. | |
virtual bool | ResetOnPointSelect () |
Returns true if the planar figure is reset to "add points" mode when a point is selected. | |
virtual void | RemoveLastControlPoint () |
Removes last control point. | |
void | DeepCopy (Self::Pointer oldFigure) |
Copies contents and state of a figre provided as parameter to the current object. Requires a matching type of both figures. | |
Protected Member Functions | |
PlanarFigure () | |
virtual | ~PlanarFigure () |
void | ResetNumberOfControlPoints (int numberOfControlPoints) |
Set the initial number of control points of the planar figure. | |
virtual Point2D | ApplyControlPointConstraints (unsigned int, const Point2D &point) |
Allow sub-classes to apply constraints on control points. | |
virtual unsigned int | AddFeature (const char *featureName, const char *unitName) |
void | SetFeatureName (unsigned int index, const char *featureName) |
void | SetFeatureUnit (unsigned int index, const char *unitName) |
void | SetQuantity (unsigned int index, double quantity) |
void | ActivateFeature (unsigned int index) |
void | DeactivateFeature (unsigned int index) |
virtual void | GeneratePolyLine ()=0 |
Generates the poly-line representation of the planar figure. Must be implemented in sub-classes. | |
virtual void | GenerateHelperPolyLine (double mmPerDisplayUnit, unsigned int displayHeight)=0 |
Generates the poly-lines that should be drawn the same size regardless of zoom. Must be implemented in sub-classes. | |
virtual void | EvaluateFeaturesInternal ()=0 |
Calculates quantities of all features of this planar figure. Must be implemented in sub-classes. | |
virtual void | InitializeTimeSlicedGeometry (unsigned int timeSteps=1) |
Initializes the TimeSlicedGeometry describing the (time-resolved) geometry of this figure. Note that each time step holds one Geometry2D. | |
virtual void | PrintSelf (std::ostream &os, itk::Indent indent) const |
Protected Attributes | |
VertexContainerType::Pointer | m_ControlPoints |
unsigned int | m_NumberOfControlPoints |
VertexContainerVectorType::Pointer | m_PolyLines |
VertexContainerVectorType::Pointer | m_HelperPolyLines |
BoolContainerType::Pointer | m_HelperPolyLinesToBePainted |
bool | m_FigurePlaced |
int | m_SelectedControlPoint |
Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons, etc.
Behavior and appearance of PlanarFigures are controlled by various properties; for a detailed list of appearance properties see mitk::PlanarFigureMapper2D
The following properties control general PlanarFigure behavior:
TODO: Implement local 2D transform (including center of rotation...)
Definition at line 54 of file mitkPlanarFigure.h.
typedef itk::VectorContainer< unsigned long, bool> mitk::PlanarFigure::BoolContainerType |
Definition at line 62 of file mitkPlanarFigure.h.
typedef itk::SmartPointer<const Self> mitk::PlanarFigure::ConstPointer |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
Definition at line 57 of file mitkPlanarFigure.h.
typedef itk::SmartPointer<Self> mitk::PlanarFigure::Pointer |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
Definition at line 57 of file mitkPlanarFigure.h.
typedef PlanarFigure mitk::PlanarFigure::Self |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
Definition at line 57 of file mitkPlanarFigure.h.
Reimplemented from mitk::BaseData.
Reimplemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
Definition at line 57 of file mitkPlanarFigure.h.
typedef itk::VectorContainer< unsigned long, mitk::Point2D > mitk::PlanarFigure::VertexContainerType |
Definition at line 57 of file mitkPlanarFigure.h.
typedef itk::VectorContainer< unsigned long, VertexContainerType::Pointer> mitk::PlanarFigure::VertexContainerVectorType |
Definition at line 61 of file mitkPlanarFigure.h.
mitk::PlanarFigure::PlanarFigure | ( | ) | [protected] |
Definition at line 24 of file mitkPlanarFigure.cpp.
References InitializeTimeSlicedGeometry(), m_ControlPoints, m_HelperPolyLines, m_HelperPolyLinesToBePainted, m_PolyLines, mitk::BoolProperty::New(), and mitk::BaseData::SetProperty().
: m_FigurePlaced( false ), m_SelectedControlPoint( -1 ), m_Geometry2D( NULL ), m_FeaturesMTime( 0 ) { m_ControlPoints = VertexContainerType::New(); m_PolyLines = VertexContainerVectorType::New(); m_HelperPolyLines = VertexContainerVectorType::New(); m_HelperPolyLinesToBePainted = BoolContainerType::New(); this->SetProperty( "closed", mitk::BoolProperty::New( false ) ); // Currently only single-time-step geometries are supported this->InitializeTimeSlicedGeometry( 1 ); }
mitk::PlanarFigure::~PlanarFigure | ( | ) | [protected, virtual] |
Definition at line 42 of file mitkPlanarFigure.cpp.
{ }
void mitk::PlanarFigure::ActivateFeature | ( | unsigned int | index ) | [protected] |
Sets the specified feature as active. INTERAL METHOD.
Definition at line 400 of file mitkPlanarFigure.cpp.
{ if ( index < m_Features.size() ) { m_Features[index].Active = true; } }
virtual bool mitk::PlanarFigure::AddControlPoint | ( | const Point2D & | point ) | [virtual] |
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
unsigned int mitk::PlanarFigure::AddFeature | ( | const char * | featureName, |
const char * | unitName | ||
) | [protected, virtual] |
Adds feature (e.g., circumference, radius, angle, ...) to feature vector of a planar figure object and returns integer ID for the feature element. Should be called in sub-class constructors.
Definition at line 362 of file mitkPlanarFigure.cpp.
{ unsigned int index = m_Features.size(); Feature newFeature( featureName, unitName ); m_Features.push_back( newFeature ); return index; }
mitk::Point2D mitk::PlanarFigure::ApplyControlPointConstraints | ( | unsigned int | , |
const Point2D & | point | ||
) | [protected, virtual] |
Allow sub-classes to apply constraints on control points.
Sub-classes can define spatial constraints to certain control points by overwriting this method and returning a constrained point. By default, the points are constrained by the image bounds.
Reimplemented in mitk::PlanarCross.
Definition at line 339 of file mitkPlanarFigure.cpp.
{ if ( m_Geometry2D == NULL ) { return point; } Point2D indexPoint; m_Geometry2D->WorldToIndex( point, indexPoint ); BoundingBox::BoundsArrayType bounds = m_Geometry2D->GetBounds(); if ( indexPoint[0] < bounds[0] ) { indexPoint[0] = bounds[0]; } if ( indexPoint[0] > bounds[1] ) { indexPoint[0] = bounds[1]; } if ( indexPoint[1] < bounds[2] ) { indexPoint[1] = bounds[2]; } if ( indexPoint[1] > bounds[3] ) { indexPoint[1] = bounds[3]; } Point2D constrainedPoint; m_Geometry2D->IndexToWorld( indexPoint, constrainedPoint ); return constrainedPoint; }
void mitk::PlanarFigure::DeactivateFeature | ( | unsigned int | index ) | [protected] |
Sets the specified feature as active. INTERAL METHOD.
Definition at line 409 of file mitkPlanarFigure.cpp.
{ if ( index < m_Features.size() ) { m_Features[index].Active = false; } }
void mitk::PlanarFigure::DeepCopy | ( | Self::Pointer | oldFigure ) |
Copies contents and state of a figre provided as parameter to the current object. Requires a matching type of both figures.
deep copy members
Definition at line 494 of file mitkPlanarFigure.cpp.
{ //DeepCopy only same types of planar figures //Notice to get typeid polymorph you have to use the *operator if(typeid(*oldFigure) != typeid(*this)) { itkExceptionMacro( << "DeepCopy(): Inconsistent type of source and destination figure!" ); return; } // clone base data members SetPropertyList(oldFigure->GetPropertyList()->Clone()); m_FigurePlaced = oldFigure->m_FigurePlaced; m_SelectedControlPoint = oldFigure->m_SelectedControlPoint; m_FeaturesMTime = oldFigure->m_FeaturesMTime; m_Features = oldFigure->m_Features; m_NumberOfControlPoints = oldFigure->m_NumberOfControlPoints; //copy geometry 2D of planar figure SetGeometry2D((mitk::Geometry2D*)oldFigure->m_Geometry2D->Clone().GetPointer()); m_ControlPoints = VertexContainerType::New(); for(unsigned long index=0; index < oldFigure->m_ControlPoints->Size(); index++) { m_ControlPoints->InsertElement(index, oldFigure->m_ControlPoints->ElementAt( index )); } //After setting the control points we can generate the polylines this->GeneratePolyLine(); }
void mitk::PlanarFigure::DeselectControlPoint | ( | ) | [virtual] |
Deselect control point; no control point active.
Definition at line 156 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
{ m_SelectedControlPoint = -1; }
void mitk::PlanarFigure::EvaluateFeatures | ( | ) | [virtual] |
Calculates quantities of all features of this planar figure.
Definition at line 290 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
{ if ( m_FeaturesMTime < m_ControlPoints->GetMTime() ) { this->EvaluateFeaturesInternal(); m_FeaturesMTime = m_ControlPoints->GetMTime(); } }
virtual void mitk::PlanarFigure::EvaluateFeaturesInternal | ( | ) | [protected, pure virtual] |
Calculates quantities of all features of this planar figure. Must be implemented in sub-classes.
Implemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
virtual void mitk::PlanarFigure::GenerateHelperPolyLine | ( | double | mmPerDisplayUnit, |
unsigned int | displayHeight | ||
) | [protected, pure virtual] |
Generates the poly-lines that should be drawn the same size regardless of zoom. Must be implemented in sub-classes.
Implemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
virtual void mitk::PlanarFigure::GeneratePolyLine | ( | ) | [protected, pure virtual] |
Generates the poly-line representation of the planar figure. Must be implemented in sub-classes.
Implemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
virtual const char* mitk::PlanarFigure::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
mitk::Point2D & mitk::PlanarFigure::GetControlPoint | ( | unsigned int | index ) | const |
Returns specified control point in 2D world coordinates.
Definition at line 176 of file mitkPlanarFigure.cpp.
Referenced by PlanarFigureIOTestClass::ComparePlanarFigures(), mitk::PlanarFigureInteractor::ExecuteAction(), and mitk::PlanarFigureMapper2D::Paint().
{ if ( index < m_NumberOfControlPoints ) { return m_ControlPoints->ElementAt( index ); } itkExceptionMacro( << "GetControlPoint(): Invalid index!" ); }
const mitk::PlanarFigure::VertexContainerType * mitk::PlanarFigure::GetControlPoints | ( | ) | const |
Returns 2D control points vector.
Definition at line 163 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureInteractor::IsPositionInsideMarker().
{ return m_ControlPoints; }
mitk::PlanarFigure::VertexContainerType * mitk::PlanarFigure::GetControlPoints | ( | ) |
Returns 2D control points vector.
Definition at line 170 of file mitkPlanarFigure.cpp.
{ return m_ControlPoints; }
const char * mitk::PlanarFigure::GetFeatureName | ( | unsigned int | index ) | const |
Returns the name (identifier) of the specified features.
Definition at line 238 of file mitkPlanarFigure.cpp.
Referenced by QmitkMeasurement::CopyToClipboard(), QmitkPlanarFiguresTableModel::data(), mitk::PlanarFigureInteractor::LogPrintPlanarFigureQuantities(), and QmitkMeasurement::PlanarFigureSelectionChanged().
{ if ( index < m_Features.size() ) { return m_Features[index].Name.c_str(); } else { return NULL; } }
const char * mitk::PlanarFigure::GetFeatureUnit | ( | unsigned int | index ) | const |
Returns the physical unit of the specified features.
Definition at line 251 of file mitkPlanarFigure.cpp.
Referenced by QmitkMeasurement::CopyToClipboard(), QmitkPlanarFiguresTableModel::data(), mitk::PlanarFigureInteractor::LogPrintPlanarFigureQuantities(), mitk::PlanarFigureMapper2D::Paint(), and QmitkMeasurement::PlanarFigureSelectionChanged().
{ if ( index < m_Features.size() ) { return m_Features[index].Unit.c_str(); } else { return NULL; } }
const mitk::Geometry2D * mitk::PlanarFigure::GetGeometry2D | ( | ) | const [virtual] |
Returns (previously set) 2D geometry of this figure.
Definition at line 54 of file mitkPlanarFigure.cpp.
Referenced by PlanarFigureIOTestClass::ComparePlanarFigures(), QmitkMeasurement::PlanarFigureSelectionChanged(), and QmitkImageStatistics::UpdateStatistics().
{
return m_Geometry2D;
}
const mitk::PlanarFigure::VertexContainerType * mitk::PlanarFigure::GetHelperPolyLine | ( | unsigned int | index, |
double | mmPerDisplayUnit, | ||
unsigned int | displayHeight | ||
) |
Returns the polyline that should be drawn the same size at every scale (for text, angles, etc.).
Definition at line 220 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureMapper2D::DrawHelperLines().
{ if ((m_HelperPolyLines->ElementAt( index )) && (m_HelperPolyLines->ElementAt( index )->GetMTime() < m_ControlPoints->GetMTime()) ) { this->GenerateHelperPolyLine(mmPerDisplayUnit, displayHeight); } return m_HelperPolyLines->ElementAt( index ); }
unsigned short mitk::PlanarFigure::GetHelperPolyLinesSize | ( | ) | [virtual] |
Returns the current number of helperpolylines.
Definition at line 470 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureMapper2D::DrawHelperLines().
{ return m_HelperPolyLines->size(); }
virtual unsigned int mitk::PlanarFigure::GetMaximumNumberOfControlPoints | ( | ) | const [pure virtual] |
Returns the maximum number of control points allowed for this figure (e.g. 3 for triangles).
Must be implemented in sub-classes.
Implemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
virtual unsigned int mitk::PlanarFigure::GetMinimumNumberOfControlPoints | ( | ) | const [pure virtual] |
Returns the minimum number of control points needed to represent this figure.
Must be implemented in sub-classes.
Implemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
unsigned int mitk::PlanarFigure::GetNumberOfControlPoints | ( | ) | const |
Returns the current number of 2D control points defining this figure.
Definition at line 134 of file mitkPlanarFigure.cpp.
Referenced by PlanarFigureIOTestClass::ComparePlanarFigures(), mitk::PlanarFigureInteractor::ExecuteAction(), and mitk::PlanarFigureMapper2D::Paint().
{ return m_NumberOfControlPoints; }
unsigned int mitk::PlanarFigure::GetNumberOfFeatures | ( | ) | const [virtual] |
Returns the number of features available for this PlanarFigure (such as, radius, area, ...).
Reimplemented in mitk::PlanarCross.
Definition at line 232 of file mitkPlanarFigure.cpp.
Referenced by QmitkMeasurement::CopyToClipboard(), QmitkPlanarFiguresTableModel::data(), mitk::PlanarFigureInteractor::LogPrintPlanarFigureQuantities(), mitk::PlanarFigureMapper2D::Paint(), and QmitkMeasurement::PlanarFigureSelectionChanged().
{
return m_Features.size();
}
mitk::PlanarFigure::VertexContainerType * mitk::PlanarFigure::GetPolyLine | ( | unsigned int | index ) |
Returns the polyline representing the planar figure (for rendering, measurements, etc.).
Definition at line 201 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureMapper2D::DrawMainLines(), and mitk::PlanarFigureInteractor::IsPositionOverFigure().
{ if ( !m_PolyLines->IndexExists( index ) || (m_PolyLines->ElementAt( index )->GetMTime() < m_ControlPoints->GetMTime()) ) { this->GeneratePolyLine(); } return m_PolyLines->ElementAt( index ); }
const mitk::PlanarFigure::VertexContainerType * mitk::PlanarFigure::GetPolyLine | ( | unsigned int | index ) | const |
Returns the polyline representing the planar figure (for rendering, measurements, etc.).
Definition at line 213 of file mitkPlanarFigure.cpp.
{ return m_PolyLines->ElementAt( index ); }
unsigned short mitk::PlanarFigure::GetPolyLinesSize | ( | ) | [virtual] |
Returns the current number of polylines.
Definition at line 460 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureMapper2D::DrawMainLines(), and mitk::PlanarFigureInteractor::IsPositionOverFigure().
{ if ( m_PolyLines->GetMTime() < m_ControlPoints->GetMTime() ) { this->GeneratePolyLine(); } return m_PolyLines->size(); }
double mitk::PlanarFigure::GetQuantity | ( | unsigned int | index ) | const |
Returns quantity of the specified feature (e.g., length, radius, area, ... )
Definition at line 264 of file mitkPlanarFigure.cpp.
Referenced by QmitkMeasurement::CopyToClipboard(), QmitkPlanarFiguresTableModel::data(), mitk::PlanarFigureInteractor::LogPrintPlanarFigureQuantities(), mitk::PlanarFigureMapper2D::Paint(), and QmitkMeasurement::PlanarFigureSelectionChanged().
{ if ( index < m_Features.size() ) { return m_Features[index].Quantity; } else { return 0.0; } }
virtual int mitk::PlanarFigure::GetSelectedControlPoint | ( | ) | const [inline, virtual] |
Return currently selected control point.
Definition at line 138 of file mitkPlanarFigure.h.
Referenced by mitk::PlanarFigureInteractor::CanHandleEvent(), and mitk::PlanarFigureMapper2D::Paint().
{ return m_SelectedControlPoint; }
mitk::Point3D mitk::PlanarFigure::GetWorldControlPoint | ( | unsigned int | index ) | const |
Returns specified control point in world coordinates.
Definition at line 187 of file mitkPlanarFigure.cpp.
Referenced by QmitkImageStatistics::ComputeIntensityProfile().
{ Point3D point3D; if ( (m_Geometry2D != NULL) && (index < m_NumberOfControlPoints) ) { m_Geometry2D->Map( m_ControlPoints->ElementAt( index ), point3D ); return point3D; } itkExceptionMacro( << "GetWorldControlPoint(): Invalid index!" ); }
void mitk::PlanarFigure::InitializeTimeSlicedGeometry | ( | unsigned int | timeSteps = 1 ) |
[protected, virtual] |
Initializes the TimeSlicedGeometry describing the (time-resolved) geometry of this figure. Note that each time step holds one Geometry2D.
Reimplemented from mitk::BaseData.
Definition at line 418 of file mitkPlanarFigure.cpp.
References mitk::Geometry2D::New().
Referenced by PlanarFigure().
{ mitk::TimeSlicedGeometry::Pointer timeGeometry = this->GetTimeSlicedGeometry(); mitk::Geometry2D::Pointer geometry2D = mitk::Geometry2D::New(); geometry2D->Initialize(); if ( timeSteps > 1 ) { mitk::ScalarType timeBounds[] = {0.0, 1.0}; geometry2D->SetTimeBounds( timeBounds ); } // The geometry is propagated automatically to all time steps, // if EvenlyTimed is true... timeGeometry->InitializeEvenlyTimed( geometry2D, timeSteps ); }
bool mitk::PlanarFigure::IsClosed | ( | ) | const [virtual] |
True if the planar figure is closed.
Default is false. The "closed" boolean property must be set in sub-classes.
Definition at line 60 of file mitkPlanarFigure.cpp.
References mitk::GenericProperty< T >::GetValue().
Referenced by mitk::PlanarFigureMapper2D::DrawMainLines(), and mitk::PlanarFigureInteractor::IsPositionOverFigure().
{ mitk::BoolProperty* closed = dynamic_cast< mitk::BoolProperty* >( this->GetProperty( "closed" ).GetPointer() ); if ( closed != NULL ) { return closed->GetValue(); } return false; }
bool mitk::PlanarFigure::IsFeatureActive | ( | unsigned int | index ) | const |
Returns true if the feature with the specified index exists and is active (an inactive feature may e.g. be the area of a non-closed polygon.
Definition at line 277 of file mitkPlanarFigure.cpp.
Referenced by QmitkMeasurement::CopyToClipboard(), mitk::PlanarFigureMapper2D::Paint(), and QmitkMeasurement::PlanarFigureSelectionChanged().
{ if ( index < m_Features.size() ) { return m_Features[index].Active; } else { return false; } }
bool mitk::PlanarFigure::IsHelperToBePainted | ( | unsigned int | index ) | [virtual] |
Returns whether a helper polyline should be painted or not.
Definition at line 476 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureMapper2D::DrawHelperLines().
{ return m_HelperPolyLinesToBePainted->GetElement( index ); }
virtual bool mitk::PlanarFigure::IsPlaced | ( | ) | const [inline, virtual] |
True if the planar figure has been placed (and can be displayed/interacted with).
Definition at line 86 of file mitkPlanarFigure.h.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction(), and mitk::PlanarFigureMapper2D::Paint().
{ return m_FigurePlaced; };
virtual void mitk::PlanarFigure::PlaceFigure | ( | const Point2D & | point ) | [virtual] |
Place figure at the given point (in 2D index coordinates) onto the given 2D geometry.
By default, the first two control points of the figure are set to the passed point. Further points can be set via AddControlPoint(), if the current number of control points is below the maximum number of control points.
Can be re-implemented in sub-classes as needed.
Reimplemented in mitk::PlanarRectangle.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
void mitk::PlanarFigure::PrintSelf | ( | std::ostream & | os, |
itk::Indent | indent | ||
) | const [protected, virtual] |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::PlanarAngle, mitk::PlanarArrow, mitk::PlanarCircle, mitk::PlanarCross, mitk::PlanarFourPointAngle, mitk::PlanarLine, mitk::PlanarPolygon, and mitk::PlanarRectangle.
Definition at line 437 of file mitkPlanarFigure.cpp.
{ Superclass::PrintSelf( os, indent ); os << indent << this->GetNameOfClass() << ":\n"; if (this->IsClosed()) os << indent << "This figure is closed\n"; else os << indent << "This figure is not closed\n"; os << indent << "Minimum number of control points: " << this->GetMinimumNumberOfControlPoints() << std::endl; os << indent << "Maximum number of control points: " << this->GetMaximumNumberOfControlPoints() << std::endl; os << indent << "Current number of control points: " << this->GetNumberOfControlPoints() << std::endl; os << indent << "Control points:" << std::endl; mitk::PlanarFigure::VertexContainerType::ConstIterator it; for ( unsigned int i = 0; i < this->GetNumberOfControlPoints(); ++i ) { os << indent.GetNextIndent() << i << ": " << m_ControlPoints->ElementAt( i ) << std::endl; } os << indent << "Geometry:\n"; this->GetGeometry2D()->Print(os, indent.GetNextIndent()); }
void mitk::PlanarFigure::RemoveLastControlPoint | ( | ) | [virtual] |
Removes last control point.
Definition at line 487 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
{ m_ControlPoints->DeleteIndex( this->GetNumberOfControlPoints()-1 ); this->ResetNumberOfControlPoints( this->GetNumberOfControlPoints()-1 ); this->GeneratePolyLine(); }
bool mitk::PlanarFigure::RequestedRegionIsOutsideOfTheBufferedRegion | ( | ) | [virtual] |
Intherited from parent.
Implements mitk::BaseData.
Definition at line 315 of file mitkPlanarFigure.cpp.
{ return false; }
void mitk::PlanarFigure::ResetNumberOfControlPoints | ( | int | numberOfControlPoints ) | [protected] |
Set the initial number of control points of the planar figure.
Definition at line 333 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarAngle::PlanarAngle(), mitk::PlanarArrow::PlanarArrow(), mitk::PlanarCircle::PlanarCircle(), mitk::PlanarCross::PlanarCross(), mitk::PlanarFourPointAngle::PlanarFourPointAngle(), mitk::PlanarLine::PlanarLine(), mitk::PlanarPolygon::PlanarPolygon(), and mitk::PlanarRectangle::PlanarRectangle().
{ m_NumberOfControlPoints = numberOfControlPoints; }
bool mitk::PlanarFigure::ResetOnPointSelect | ( | ) | [virtual] |
Returns true if the planar figure is reset to "add points" mode when a point is selected.
Default return value is false. Subclasses can overwrite this method and execute any reset / initialization statements required.
Reimplemented in mitk::PlanarCross.
Definition at line 482 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
{ return false; }
bool mitk::PlanarFigure::SelectControlPoint | ( | unsigned int | index ) | [virtual] |
Selects currently active control points.
Definition at line 142 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
{ if ( index < this->GetNumberOfControlPoints() ) { m_SelectedControlPoint = index; return true; } else { return false; } }
bool mitk::PlanarFigure::SetControlPoint | ( | unsigned int | index, |
const Point2D & | point, | ||
bool | createIfDoesNotExist = false |
||
) | [virtual] |
Reimplemented in mitk::PlanarCircle, and mitk::PlanarRectangle.
Definition at line 100 of file mitkPlanarFigure.cpp.
{ if (createIfDoesNotExist) { m_ControlPoints->InsertElement( index, this->ApplyControlPointConstraints( index, point ) ); if ( m_NumberOfControlPoints <= index ) { m_NumberOfControlPoints = index + 1; } return true; } else if ( index < m_NumberOfControlPoints ) { m_ControlPoints->InsertElement( index, this->ApplyControlPointConstraints( index, point ) ); return true; } else { return false; } }
bool mitk::PlanarFigure::SetCurrentControlPoint | ( | const Point2D & | point ) | [virtual] |
Definition at line 123 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
{ if ( (m_SelectedControlPoint < 0) || (m_SelectedControlPoint >= (int)m_NumberOfControlPoints) ) { return false; } return this->SetControlPoint(m_SelectedControlPoint, point, false); }
void mitk::PlanarFigure::SetFeatureName | ( | unsigned int | index, |
const char * | featureName | ||
) | [protected] |
Sets the name of the specified feature. INTERNAL METHOD.
Definition at line 373 of file mitkPlanarFigure.cpp.
{
if ( index < m_Features.size() )
{
m_Features[index].Name = featureName;
}
}
void mitk::PlanarFigure::SetFeatureUnit | ( | unsigned int | index, |
const char * | unitName | ||
) | [protected] |
Sets the physical unit of the specified feature. INTERNAL METHOD.
Definition at line 382 of file mitkPlanarFigure.cpp.
{
if ( index < m_Features.size() )
{
m_Features[index].Unit = unitName;
}
}
void mitk::PlanarFigure::SetGeometry2D | ( | mitk::Geometry2D * | geometry ) | [virtual] |
Sets the 2D geometry on which this figure will be placed.
In most cases, this is a Geometry already owned by another object, e.g. describing the slice of the image on which measurements will be performed.
Definition at line 47 of file mitkPlanarFigure.cpp.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction().
{ this->SetGeometry( geometry ); m_Geometry2D = geometry; }
void mitk::PlanarFigure::SetQuantity | ( | unsigned int | index, |
double | quantity | ||
) | [protected] |
Sets quantity of the specified feature. INTERNAL METHOD.
Definition at line 391 of file mitkPlanarFigure.cpp.
{
if ( index < m_Features.size() )
{
m_Features[index].Quantity = quantity;
}
}
void mitk::PlanarFigure::SetRequestedRegion | ( | itk::DataObject * | data ) | [virtual] |
Intherited from parent.
Implements mitk::BaseData.
Definition at line 327 of file mitkPlanarFigure.cpp.
{ }
void mitk::PlanarFigure::SetRequestedRegionToLargestPossibleRegion | ( | ) | [virtual] |
Intherited from parent.
Implements mitk::BaseData.
Definition at line 310 of file mitkPlanarFigure.cpp.
{ }
void mitk::PlanarFigure::UpdateOutputInformation | ( | ) | [virtual] |
Intherited from parent.
Reimplemented from mitk::BaseData.
Definition at line 301 of file mitkPlanarFigure.cpp.
{ // Bounds are NOT calculated here, since the Geometry2D defines a fixed // frame (= bounds) for the planar figure. Superclass::UpdateOutputInformation(); this->GetTimeSlicedGeometry()->UpdateInformation(); }
bool mitk::PlanarFigure::VerifyRequestedRegion | ( | ) | [virtual] |
Intherited from parent.
Implements mitk::BaseData.
Definition at line 321 of file mitkPlanarFigure.cpp.
{ return true; }
VertexContainerType::Pointer mitk::PlanarFigure::m_ControlPoints [protected] |
Definition at line 290 of file mitkPlanarFigure.h.
Referenced by PlanarFigure().
bool mitk::PlanarFigure::m_FigurePlaced [protected] |
Definition at line 298 of file mitkPlanarFigure.h.
VertexContainerVectorType::Pointer mitk::PlanarFigure::m_HelperPolyLines [protected] |
Definition at line 294 of file mitkPlanarFigure.h.
Referenced by mitk::PlanarAngle::PlanarAngle(), mitk::PlanarArrow::PlanarArrow(), mitk::PlanarCross::PlanarCross(), and PlanarFigure().
BoolContainerType::Pointer mitk::PlanarFigure::m_HelperPolyLinesToBePainted [protected] |
Definition at line 295 of file mitkPlanarFigure.h.
Referenced by mitk::PlanarAngle::PlanarAngle(), mitk::PlanarArrow::PlanarArrow(), mitk::PlanarCross::PlanarCross(), and PlanarFigure().
unsigned int mitk::PlanarFigure::m_NumberOfControlPoints [protected] |
Definition at line 291 of file mitkPlanarFigure.h.
VertexContainerVectorType::Pointer mitk::PlanarFigure::m_PolyLines [protected] |
Definition at line 293 of file mitkPlanarFigure.h.
Referenced by mitk::PlanarAngle::PlanarAngle(), mitk::PlanarArrow::PlanarArrow(), mitk::PlanarCircle::PlanarCircle(), PlanarFigure(), mitk::PlanarFourPointAngle::PlanarFourPointAngle(), mitk::PlanarLine::PlanarLine(), mitk::PlanarPolygon::PlanarPolygon(), and mitk::PlanarRectangle::PlanarRectangle().
int mitk::PlanarFigure::m_SelectedControlPoint [protected] |
Definition at line 301 of file mitkPlanarFigure.h.