Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _MITK_PLANAR_FIGURE_H_
00020 #define _MITK_PLANAR_FIGURE_H_
00021
00022 #include "PlanarFigureExports.h"
00023 #include "mitkBaseData.h"
00024 #include "mitkCommon.h"
00025
00026
00027 namespace mitk
00028 {
00029
00030 class Geometry2D;
00031
00054 class PlanarFigure_EXPORT PlanarFigure : public BaseData
00055 {
00056 public:
00057 mitkClassMacro( PlanarFigure, BaseData );
00058
00059
00060 typedef itk::VectorContainer< unsigned long, mitk::Point2D > VertexContainerType;
00061 typedef itk::VectorContainer< unsigned long, VertexContainerType::Pointer> VertexContainerVectorType;
00062 typedef itk::VectorContainer< unsigned long, bool> BoolContainerType;
00063
00064
00071 virtual void SetGeometry2D( mitk::Geometry2D *geometry );
00072
00073
00075 virtual const Geometry2D *GetGeometry2D() const;
00076
00077
00081 virtual bool IsClosed() const;
00082
00083
00086 virtual bool IsPlaced() const { return m_FigurePlaced; };
00087
00088
00099 virtual void PlaceFigure( const Point2D& point );
00100
00101
00102 virtual bool AddControlPoint( const Point2D& point );
00103
00104 virtual bool SetControlPoint( unsigned int index, const Point2D& point, bool createIfDoesNotExist = false);
00105
00106 virtual bool SetCurrentControlPoint( const Point2D& point );
00107
00108
00110 unsigned int GetNumberOfControlPoints() const;
00111
00112
00118 virtual unsigned int GetMinimumNumberOfControlPoints() const = 0;
00119
00120
00126 virtual unsigned int GetMaximumNumberOfControlPoints() const = 0;
00127
00128
00130 virtual bool SelectControlPoint( unsigned int index );
00131
00132
00134 virtual void DeselectControlPoint();
00135
00136
00138 virtual int GetSelectedControlPoint() const { return m_SelectedControlPoint; }
00139
00140
00141
00143 const VertexContainerType *GetControlPoints() const;
00144
00145
00147 VertexContainerType *GetControlPoints();
00148
00149
00151 Point2D& GetControlPoint( unsigned int index ) const;
00152
00153
00155 Point3D GetWorldControlPoint( unsigned int index ) const;
00156
00157
00160 VertexContainerType *GetPolyLine(unsigned int index);
00161
00164 const VertexContainerType *GetPolyLine(unsigned int index) const;
00165
00168 const VertexContainerType *GetHelperPolyLine(unsigned int index, double mmPerDisplayUnit, unsigned int displayHeight);
00169
00172 virtual unsigned int GetNumberOfFeatures() const;
00173
00174
00176 const char *GetFeatureName( unsigned int index ) const;
00177
00178
00180 const char *GetFeatureUnit( unsigned int index ) const;
00181
00182
00185 double GetQuantity( unsigned int index ) const;
00186
00187
00191 bool IsFeatureActive( unsigned int index ) const;
00192
00193
00195 virtual void EvaluateFeatures();
00196
00197
00199 virtual void UpdateOutputInformation();
00200
00202 virtual void SetRequestedRegionToLargestPossibleRegion();
00203
00205 virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
00206
00208 virtual bool VerifyRequestedRegion();
00209
00211 virtual void SetRequestedRegion(itk::DataObject *data);
00212
00214 virtual unsigned short GetPolyLinesSize();
00215
00217 virtual unsigned short GetHelperPolyLinesSize();
00218
00220 virtual bool IsHelperToBePainted(unsigned int index);
00221
00227 virtual bool ResetOnPointSelect();
00228
00230 virtual void RemoveLastControlPoint();
00231
00234 void DeepCopy(Self::Pointer oldFigure);
00235
00236
00237 protected:
00238 PlanarFigure();
00239 virtual ~PlanarFigure();
00240
00242 void ResetNumberOfControlPoints( int numberOfControlPoints );
00243
00249 virtual Point2D ApplyControlPointConstraints( unsigned int , const Point2D& point );
00250
00254 virtual unsigned int AddFeature( const char *featureName, const char *unitName );
00255
00257 void SetFeatureName( unsigned int index, const char *featureName );
00258
00260 void SetFeatureUnit( unsigned int index, const char *unitName );
00261
00263 void SetQuantity( unsigned int index, double quantity );
00264
00266 void ActivateFeature( unsigned int index );
00267
00269 void DeactivateFeature( unsigned int index );
00270
00273 virtual void GeneratePolyLine() = 0;
00274
00277 virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) = 0;
00278
00281 virtual void EvaluateFeaturesInternal() = 0;
00282
00285 virtual void InitializeTimeSlicedGeometry( unsigned int timeSteps = 1 );
00286
00287 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
00288
00289
00290 VertexContainerType::Pointer m_ControlPoints;
00291 unsigned int m_NumberOfControlPoints;
00292
00293 VertexContainerVectorType::Pointer m_PolyLines;
00294 VertexContainerVectorType::Pointer m_HelperPolyLines;
00295 BoolContainerType::Pointer m_HelperPolyLinesToBePainted;
00296
00297
00298 bool m_FigurePlaced;
00299
00300
00301 int m_SelectedControlPoint;
00302
00303
00304 private:
00305
00306 struct Feature
00307 {
00308 Feature( const char *name, const char *unit )
00309 : Name( name ), Unit( unit ), Quantity( 0.0 ), Active( true )
00310 {
00311 };
00312
00313 std::string Name;
00314 std::string Unit;
00315 double Quantity;
00316 bool Active;
00317 };
00318
00319 Geometry2D *m_Geometry2D;
00320
00321
00322
00323 typedef std::vector< Feature > FeatureVectorType;
00324 FeatureVectorType m_Features;
00325
00326 unsigned long m_FeaturesMTime;
00327
00328 };
00329
00330 }
00331
00332 #endif //_MITK_PLANAR_FIGURE_H_