vtkMRMLAnnotationAngleNode.h

Go to the documentation of this file.
00001 #ifndef __vtkMRMLAnnotationAngleNode_h
00002 #define __vtkMRMLAnnotationAngleNode_h
00003 
00004 #include "qSlicermiAnnotationModuleExport.h"
00005 #include "vtkMRMLAnnotationLinesNode.h" 
00006 
00007 class vtkMatrix4x4;
00008 class vtkAbstractTransform;
00009 class vtkMRMLScene;
00010 
00011 class  Q_SLICER_QTMODULES_ANNOTATIONS_EXPORT vtkMRMLAnnotationAngleNode : public vtkMRMLAnnotationLinesNode
00012 {
00013 public:
00014   static vtkMRMLAnnotationAngleNode *New();
00015   vtkTypeMacro(vtkMRMLAnnotationAngleNode,vtkMRMLAnnotationLinesNode);
00016   // Description:
00017   // Just prints short summary 
00018   void PrintAnnotationInfo(ostream& os, vtkIndent indent, int titleFlag = 1);
00019 
00020   //--------------------------------------------------------------------------
00021   // MRMLNode methods
00022   //--------------------------------------------------------------------------
00023 
00024   virtual vtkMRMLNode* CreateNodeInstance();
00025   // Description:
00026   // Get node XML tag name (like Volume, Model)
00027   virtual const char* GetNodeTagName() {return "AnnotationAngle";};
00028 
00029   // Description:
00030   // Read node attributes from XML file
00031   virtual void ReadXMLAttributes( const char** atts);
00032   
00033   // Description:
00034   // Write this node's information to a MRML file in XML format.
00035   virtual void WriteXML(ostream& of, int indent);
00036 
00037 
00038   // Description:
00039   // Copy the node's attributes to this object
00040   virtual void Copy(vtkMRMLNode *node);
00041 
00042   void UpdateScene(vtkMRMLScene *scene);
00043 
00044   // Description:
00045   // alternative method to propagate events generated in Display nodes
00046   virtual void ProcessMRMLEvents ( vtkObject * /*caller*/, 
00047                                    unsigned long /*event*/, 
00048                                    void * /*callData*/ );
00049 
00050   // Legacy code
00051   // Description:
00052   // get/set the first point position
00053   double* GetPosition1() {return this->GetControlPointCoordinates(0);}
00054 
00055   int SetPosition1(double newControl[3]) { return this->SetControlPoint(0, newControl) ; }
00056 
00057   int SetPosition1(double nC1, double nC2, double nC3) { 
00058    double newControl[3] = {nC1,nC2,nC3};
00059     return this->SetPosition1(newControl) ; 
00060   }
00061 
00062   double* GetPosition2() {return this->GetControlPointCoordinates(1);}
00063   int SetPosition2(double newControl[3]) { return this->SetControlPoint(1, newControl);}
00064 
00065   int SetPosition2(double nC1, double nC2, double nC3) { 
00066    double newControl[3] = {nC1,nC2,nC3};
00067     return this->SetPosition2(newControl) ; 
00068   }
00069 
00070   double* GetPositionCenter() { return this->GetControlPointCoordinates(2);}
00071   int SetPositionCenter(double newControl[3]) { return this->SetControlPoint(2, newControl);}
00072 
00073   int SetPositionCenter(double nC1, double nC2, double nC3) { 
00074    double newControl[3] = {nC1,nC2,nC3};
00075     return this->SetPositionCenter(newControl) ; 
00076   }
00077 
00078   // Description:
00079   // get/set the distance annotation format, it's in standard sprintf notation
00080   vtkGetStringMacro(LabelFormat);
00081   vtkSetStringMacro(LabelFormat);
00082 
00083   // Description:
00084   // KP Define - should be part of AnnotationAngleDisplayNode 
00085   double GetLabelScale();
00086   void SetLabelScale(double init);
00087 
00088   // Description:
00089   // get/set the distance annotation visbility
00090   int GetLabelVisibility();
00091   void SetLabelVisibility(int flag);
00092 
00093   int SetAngle(vtkIdType line1Id, vtkIdType line2Id, int sel, int vis);  
00094 
00095   // Description:
00096   int GetRay1Visibility() {return this->GetAnnotationAttribute(0,vtkMRMLAnnotationLinesNode::LINE_VISIBLE);} 
00097   void SetRay1Visibility(int flag) { this->SetAnnotationAttribute(0,vtkMRMLAnnotationLinesNode::LINE_VISIBLE,flag);} 
00098   int GetRay2Visibility() {return this->GetAnnotationAttribute(1,vtkMRMLAnnotationLinesNode::LINE_VISIBLE);} 
00099   void SetRay2Visibility(int flag) { this->SetAnnotationAttribute(1,vtkMRMLAnnotationLinesNode::LINE_VISIBLE,flag);} 
00100 
00101   int GetArcVisibility() { return this->GetLabelVisibility();}
00102   void SetArcVisibility(int flag) { this->SetLabelVisibility(flag);}
00103 
00104   // Description:
00105   // get/set the resolution (number of subdivisions) of the line.
00106   vtkGetMacro(Resolution, int);
00107   vtkSetMacro(Resolution, int);
00108 
00109   // Description:
00110   // get/set the point representation colour
00111   double *GetPointColour();
00112   void SetPointColour( double initColor[3]);
00113 
00114   // Description:
00115   // get/set the line representation colour
00116   double *GetLineColour();
00117   void SetLineColour(double newColor[3]);
00118 
00119   // Description:
00120   // get/set the distance annotation text colour
00121   double *GetLabelTextColour();
00122   void SetLabelTextColour(double initColor[3]);
00123 
00124  // Description:
00125   // transform utility functions
00126   virtual bool CanApplyNonLinearTransforms() { return true; }
00127   virtual void ApplyTransform(vtkMatrix4x4* transformMatrix);
00128   virtual void ApplyTransform(vtkAbstractTransform* transform);
00129 
00130   // Description:
00131   // Create default storage node or NULL if does not have one
00132   virtual vtkMRMLStorageNode* CreateDefaultStorageNode();  
00133 
00134   void Initialize(vtkMRMLScene* mrmlScene);
00135 
00136  // Description:
00137   // get/set the id of the model the ends of the widget are constrained upon
00138   vtkGetStringMacro(ModelID1);
00139   vtkSetStringMacro(ModelID1);
00140   vtkGetStringMacro(ModelID2);
00141   vtkSetStringMacro(ModelID2);
00142   vtkGetStringMacro(ModelIDCenter);
00143   vtkSetStringMacro(ModelIDCenter);
00144 
00145   // Just here for historic reasons to comply with vtkMRMLMeasurementsAngleNode
00146   int GetVisibility() {return this->GetVisible();}
00147   void SetVisibility(int flag) {this->SetVisible(flag);}
00148 
00149   void SetAngleMeasurement(double val);
00150   double GetAngleMeasurement();
00151 
00152   enum
00153   {
00154       AngleNodeAddedEvent = 0,
00155       ValueModifiedEvent,
00156   };
00157 
00158 protected:
00159   vtkMRMLAnnotationAngleNode();
00160   ~vtkMRMLAnnotationAngleNode();
00161   vtkMRMLAnnotationAngleNode(const vtkMRMLAnnotationAngleNode&);
00162   void operator=(const vtkMRMLAnnotationAngleNode&);
00163 
00164   // Description:
00165   // number of subdivisions on the line
00166   int Resolution;
00167   char* LabelFormat;
00168  
00169   int SetControlPoint(int id, double newControl[3]);
00170 
00171   int AddControlPoint(double newControl[3],int selectedFlag, int visibleFlag);
00172 
00173   // Description:
00174   // the model ids for the models that the ends of the widget are constrained
00175   // to
00176   char *ModelID1;
00177   char *ModelID2;
00178   char *ModelIDCenter;
00179   double angleMeasurement;
00180 
00181 };
00182 
00183 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1