vtkMRMLRobotNode.h

Go to the documentation of this file.
00001 /*=auto=========================================================================
00002 
00003   Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
00004 
00005   See Doc/copyright/copyright.txt
00006   or http://www.slicer.org/copyright/copyright.txt for details.
00007 
00008   Program:   3D Slicer
00009   Module:    $RCSfile: vtkMRMLCurveAnalysisNode.h,v $
00010   Date:      $Date: 2006/03/19 17:12:29 $
00011   Version:   $Revision: 1.3 $
00012 
00013 =========================================================================auto=*/
00014 #ifndef __vtkMRMLRobotNode_h
00015 #define __vtkMRMLRobotNode_h
00016 
00017 #include "vtkOpenIGTLinkIFWin32Header.h"
00018 #include "vtkMRML.h"
00019 #include "vtkMRMLNode.h"
00020 #include "vtkMRMLStorageNode.h"
00021 
00022 #include "vtkObject.h"
00023 #include "vtkProstateNavWin32Header.h" 
00024 
00025 #include "vtkMRMLLinearTransformNode.h"
00026 
00027 class vtkMRMLModelNode;
00028 class vtkMRMLScalarVolumeNode;
00029 class vtkSlicerApplication;
00030 class vtkProstateNavTargetDescriptor;
00031 struct NeedleDescriptorStruct;
00032 
00033 class VTK_PROSTATENAV_EXPORT vtkMRMLRobotNode : public vtkMRMLTransformableNode
00034 {
00035 
00036  public:
00037 
00038   //----------------------------------------------------------------
00039   // Constants Definitions
00040   //----------------------------------------------------------------
00041 
00042   //BTX
00043 
00044   // Events
00045   enum {
00046     ChangeStatusEvent     = 200907,
00047     ChangeTargetEvent     = 200908,
00048     RobotMovedEvent       = 200910
00049   };
00050 
00051   enum STATUS_ID {
00052     StatusOff=0,
00053     StatusOk,
00054     StatusWarning,
00055     StatusError
00056   };
00057 
00058   struct StatusDescriptor
00059   {
00060     std::string text;
00061     STATUS_ID indicator; // this determines the background color
00062   };
00063   //ETX
00064 
00068   virtual bool CanApplyNonLinearTransforms();
00069   virtual void ApplyTransform(vtkAbstractTransform* transform);
00070   virtual void ApplyTransform(vtkMatrix4x4* transformMatrix);
00071 
00072  public:
00073 
00074   //----------------------------------------------------------------
00075   // Standard methods for MRML nodes
00076   //----------------------------------------------------------------
00077 
00078   static vtkMRMLRobotNode *New();
00079   vtkTypeMacro(vtkMRMLRobotNode,vtkMRMLTransformableNode);  
00080   virtual vtkMRMLNode* CreateNodeInstance();
00081 
00082   void PrintSelf(ostream& os, vtkIndent indent);
00083 
00084   // Description:
00085   // Set node attributes
00086   virtual void ReadXMLAttributes( const char** atts);
00087 
00088   // Description:
00089   // Write this node's information to a MRML file in XML format.
00090   virtual void WriteXML(ostream& of, int indent);
00091 
00092   // Description:
00093   // Copy the node's attributes to this object
00094   virtual void Copy(vtkMRMLNode *node);
00095 
00096   // Description:
00097   // Updates other nodes in the scene depending on this node
00098   // or updates this node if it depends on other nodes
00099   virtual void UpdateScene(vtkMRMLScene *);
00100 
00101 // Description:
00102   // Update the stored reference to another node in the scene
00103   virtual void UpdateReferenceID(const char *oldID, const char *newID);
00104 
00105   // Description:
00106   // Updates this node if it depends on other nodes 
00107   // when the node is deleted in the scene
00108   virtual void UpdateReferences();
00109 
00110   virtual void RemoveChildNodes();
00111 
00112   // Description:
00113   // Get node XML tag name (like Volume, Model)
00114   virtual const char* GetNodeTagName()
00115     {return "Robot";};
00116 
00117   // method to propagate events generated in mrml
00118   virtual void ProcessMRMLEvents ( vtkObject *caller, unsigned long event, void *callData );
00119 
00120   virtual const char* GetWorkflowStepsString()
00121     {return "PointTargeting PointVerification"; };
00122 
00123   // Description:
00124   // Get/Set robot target (vtkMRMLLinearTransformNode)
00125   vtkGetStringMacro(TargetTransformNodeID);
00126   vtkMRMLTransformNode* GetTargetTransformNode();
00127   void SetAndObserveTargetTransformNodeID(const char *transformNodeID);
00128 
00129   virtual int Init(vtkSlicerApplication* app, const char* moduleShareDir);
00130 
00131   virtual int  MoveTo(const char *transformNodeId) { return 0; };
00132 
00133   virtual void SwitchStep(const char *stepName) {};
00134 
00135   virtual int OnTimer() {return 1; };
00136  
00137   // Computes needle orientation in unit vector, pointing towards then needle tip
00138   // when the robot targets the specified point.
00139   // needleDirection is a pointer to a double[3] array which is updated with the orientation
00140   // Returns false if the information cannot be determined.
00141   virtual bool GetNeedleDirectionAtTarget(vtkProstateNavTargetDescriptor *targetDesc, NeedleDescriptorStruct *needle, double* needleDirection) { return false; };
00142 
00143   virtual bool ShowRobotAtTarget(vtkProstateNavTargetDescriptor *targetDesc, NeedleDescriptorStruct *needle) { return false; };
00144   //BTX
00145   virtual std::string GetTargetInfoText(vtkProstateNavTargetDescriptor *targetDesc, NeedleDescriptorStruct *needle) { return ""; };
00146   // Split the full target info text (convert "main info*****additional info" to "main info"+"additional info")
00147   static void SplitTargetInfoText(const std::string targetInfoText, std::string &mainInfo, std::string &additionalInfo);
00148   static std::string GetTargetInfoSectionSeparator() { return "-----\n"; };
00149   //ETX
00150 
00151   // Description:
00152   // Sets the transform to a coordinate system that is aligned with the robot base.
00153   // This coordinate system is determined during the calibration and it is not changed after that.
00154   virtual bool GetRobotBaseTransform(vtkMatrix4x4* transform) { return false; };
00155 
00156   virtual int PerformRegistration(vtkMRMLScalarVolumeNode* volumeNode) { return 0; };
00157 
00158   // The following method is defined tentatively to pass registration parameter.
00159   virtual int PerformRegistration(vtkMRMLScalarVolumeNode* volumeNode, int param1, int param2) { return 0; };
00160 
00161   // Description:
00162   // Get calibration object (Z frame, fiducials, etc.) model and transform
00163   virtual const char* GetCalibrationObjectModelId() {return ""; };
00164   virtual const char* GetCalibrationObjectTransformId() { return ""; };
00165 
00166   // Description:
00167   // Get workspace object model (representing range of motion of the device)
00168   virtual const char* GetWorkspaceObjectModelId() {return ""; };
00169 
00170   // Description:
00171   // Get robot model (representing the robot with the needle guide, etc.)
00172   virtual const char* GetRobotModelId() {return ""; };
00173 
00174   int GetStatusDescriptorCount();
00175   
00176   // Description:
00177   // returns 0 if failed
00178   //BTX
00179   int GetStatusDescriptor(unsigned int index, std::string &text, STATUS_ID &indicator);
00180   //ETX
00181 
00182  protected:
00183   //----------------------------------------------------------------
00184   // Constructor and destructor
00185   //----------------------------------------------------------------
00186   
00187   vtkMRMLRobotNode();
00188   virtual ~vtkMRMLRobotNode();
00189   vtkMRMLRobotNode(const vtkMRMLRobotNode&);
00190   void operator=(const vtkMRMLRobotNode&);
00191 
00192   vtkSetReferenceStringMacro(TargetTransformNodeID);
00193   char *TargetTransformNodeID;
00194   vtkMRMLTransformNode* TargetTransformNode;
00195 
00196   //BTX
00197   std::vector<StatusDescriptor> StatusDescriptors;
00198   std::string ModuleShareDirectory; // needed for model files, etc.
00199   //ETX
00200 
00201  protected:
00202   //
00203   
00204   
00205 };
00206 
00207 #endif
00208 

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1