Slicer 4.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLAnnotationLinesNode.h
Go to the documentation of this file.
00001 // .NAME vtkMRMLAnnotationLinesNode - MRML node to represent a fiber bundle from tractography in DTI data.
00002 // .SECTION Description
00003 // Annotation nodes contains control points, internally represented as vtkPolyData.
00004 // A Annotation node contains many control points  and forms the smallest logical unit of tractography 
00005 // that MRML will manage/read/write. Each control point has accompanying data.  
00006 // Visualization parameters for these nodes are controlled by the vtkMRMLAnnotationLineDisplayNode class.
00007 //
00008 
00009 #ifndef __vtkMRMLAnnotationLinesNode_h
00010 #define __vtkMRMLAnnotationLinesNode_h
00011 
00012 #include "vtkMRMLAnnotationControlPointsNode.h"
00013 
00014 class vtkMRMLAnnotationLineDisplayNode;
00015 
00017 class  VTK_SLICER_ANNOTATIONS_MODULE_MRML_EXPORT vtkMRMLAnnotationLinesNode : public vtkMRMLAnnotationControlPointsNode
00018 {
00019 public:
00020   static vtkMRMLAnnotationLinesNode *New();
00021   vtkTypeMacro(vtkMRMLAnnotationLinesNode,vtkMRMLAnnotationControlPointsNode);
00022   // void PrintSelf(ostream& os, vtkIndent indent);
00023   // Description:
00024   // Just prints short summary 
00025   virtual void PrintAnnotationInfo(ostream& os, vtkIndent indent, int titleFlag = 1);
00026 
00027   //--------------------------------------------------------------------------
00028   // MRMLNode methods
00029   //--------------------------------------------------------------------------
00030 
00031   virtual vtkMRMLNode* CreateNodeInstance();
00032   // Description:
00033   // Get node XML tag name (like Volume, Model)
00034   virtual const char* GetNodeTagName() {return "AnnotationLines";};
00035 
00036   // Description:
00037   // Read node attributes from XML file
00038   virtual void ReadXMLAttributes( const char** atts);
00039   
00040   // Description:
00041   // Write this node's information to a MRML file in XML format.
00042   virtual void WriteXML(ostream& of, int indent);
00043 
00044 
00045   // Description:
00046   // Copy the node's attributes to this object
00047   virtual void Copy(vtkMRMLNode *node);
00048 
00049   void UpdateScene(vtkMRMLScene *scene);
00050 
00051   // Description:
00052   // alternative method to propagate events generated in Display nodes
00053   virtual void ProcessMRMLEvents ( vtkObject * /*caller*/, 
00054                                    unsigned long /*event*/, 
00055                                    void * /*callData*/ );
00056 
00057 
00058   // Description:
00059   // get associated display node or NULL if not set
00060   vtkMRMLAnnotationLineDisplayNode* GetAnnotationLineDisplayNode();
00061 
00062   // Description:
00063   // Create default storage node or NULL if does not have one
00064   virtual vtkMRMLStorageNode* CreateDefaultStorageNode();  
00065 
00066   // Define line between control points 
00067   int  AddLine(int ctrlPtIdStart, int ctrlPtIdEnd,int selectedFlag, int visibleFlag);
00068   int SetLine(int id, int ctrlPtIdStart, int ctrlPtIdEnd, int selectedFlag, int visibleFlag);
00069 
00070   int SetControlPoint(int id, double newControl[3],int selectedFlag, int visibleFlag);
00071 
00072   int SetControlPointWorldCoordinates(int id, double newControl[3],int selectedFlag, int visibleFlag)
00073     {
00074     double localPoint[4]={0,0,0,1};
00075     this->TransformPointFromWorld(newControl, localPoint);
00076     return this->SetControlPoint(id, localPoint, selectedFlag, visibleFlag);
00077     }
00078 
00079   void DeleteLine(int id);
00080   int GetEndPointsId(vtkIdType lineID, vtkIdType ctrlPtID[2]);
00081   int GetNumberOfLines();
00082 
00083   // Description:
00084   // add line display node if not already present
00085   void CreateAnnotationLineDisplayNode();
00086 
00087   enum 
00088   {
00089     LINE_SELECTED = vtkMRMLAnnotationControlPointsNode::NUM_CP_ATTRIBUTE_TYPES,
00090     LINE_VISIBLE,
00091     NUM_LINE_ATTRIBUTE_TYPES
00092   };
00093   
00094   const char *GetAttributeTypesEnumAsString(int val);
00095 
00096   // Description:
00097   // Initializes all variables associated with annotations
00098   virtual void ResetAnnotations();
00099 
00100   void Initialize(vtkMRMLScene* mrmlScene); 
00101 
00102 protected:
00103   vtkMRMLAnnotationLinesNode();
00104   ~vtkMRMLAnnotationLinesNode();
00105   vtkMRMLAnnotationLinesNode(const vtkMRMLAnnotationLinesNode&);
00106   void operator=(const vtkMRMLAnnotationLinesNode&);
00107 
00108   // Description:
00109   // Create Poly data with substructures necessary for this class 
00110   void CreatePolyData();
00111 
00112   // Description:
00113   // Initializes control pointes as well as attributes
00114   void ResetLines(); 
00115 
00116   // Description:
00117   // Initializes all attributes 
00118   void ResetLinesAttributesAll(); 
00119 
00120   bool InitializeLinesFlag;
00121 };
00122 
00123 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines