vtkProstateNavLogic.h

Go to the documentation of this file.
00001 /*=auto=========================================================================
00002 
00003   Portions (c) Copyright 2007 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: $
00010   Date:      $Date: $
00011   Version:   $Revision: $
00012 
00013 =========================================================================auto=*/
00014 
00015 // .NAME vtkProstateNavLogic - slicer logic class for Locator module 
00016 // .SECTION Description
00017 // This class manages the logic associated with tracking device for
00018 // IGT. 
00019 
00020 #ifndef __vtkProstateNavLogic_h
00021 #define __vtkProstateNavLogic_h
00022 
00023 #include "vtkProstateNavWin32Header.h"
00024 
00025 #include "vtkKWTkUtilities.h"
00026 
00027 #include "vtkSlicerBaseLogic.h"
00028 #include "vtkSlicerModuleLogic.h"
00029 #include "vtkSlicerApplication.h"
00030 #include "vtkCallbackCommand.h"
00031 
00032 #include "vtkMRMLFiducialListNode.h"
00033 #include "vtkMRMLSliceNode.h"
00034 
00035 #include "vtkMRMLProstateNavManagerNode.h"
00036 
00037 class vtkProstateNavGUI;
00038 
00039 class VTK_PROSTATENAV_EXPORT vtkProstateNavLogic : public vtkSlicerModuleLogic 
00040 {
00041   
00042  public:
00043 
00044    //BTX
00045    enum 
00046    {  // Events
00047      LocatorUpdateEvent      = 50000,
00048      StatusUpdateEvent       = 50001,
00049    };
00050    //ETX
00051 
00052   
00053   static vtkProstateNavLogic *New();
00054   
00055   vtkTypeRevisionMacro(vtkProstateNavLogic,vtkObject);
00056   
00057   void SetGUI(vtkProstateNavGUI* gui) { this->GUI = gui; };
00058   vtkProstateNavGUI* GetGUI()         { return this->GUI; };
00059 
00060   void PrintSelf(ostream&, vtkIndent);  
00061   
00062   int  Enter();
00063   void TimerHandler();
00064   
00065   int  RobotStop();
00066   int  RobotMoveTo(float px, float py, float pz,
00067                    float nx, float ny, float nz,
00068                    float tx, float ty, float tz);
00069   int  RobotMoveTo(float position[3], float orientation[4]);
00070 
00071   int  RobotMoveTo();
00072   
00073   int  ScanStart();
00074   int  ScanPause();
00075   int  ScanStop();
00076   
00077   //BTX
00078   //Image* ReadCalibrationImage(const char* filename, int* width, int* height,
00079   //                            std::vector<float>& position, std::vector<float>& orientation);
00080 
00081   bool AddTargetToNeedle(std::string needleType, float* rasLocation, unsigned int & targetDescIndex);
00082 
00083   // Description:
00084   // Add volume to MRML scene and return the MRML node.
00085   // If volumeType is specified, then the volume is also selected as the current Calibration
00086   // targeting or verification volume.
00087   vtkMRMLScalarVolumeNode *AddVolumeToScene(const char *fileName, VolumeType volumeType=VOL_GENERIC);
00088 
00089   // Description:
00090   // Set a specific role for a loaded volume.
00091   int SelectVolumeInScene(vtkMRMLScalarVolumeNode* volumeNode, VolumeType volumeType);
00092 
00093   // Description:
00094   // Show/hide robot workspace. Returns with 0 in case of failure.
00095   int ShowWorkspaceModel(bool show);
00096   bool IsWorkspaceModelShown();
00097 
00098   // Description:
00099   // Show/hide robot. Returns with 0 in case of failure.
00100   int ShowRobotModel(bool show);
00101   bool IsRobotModelShown();
00102 
00103   // Description:
00104   // Switch mouse interaction mode to activate target placement
00105   // by clicking on the image
00106   // vtkMRMLInteractionNode::Place = place fiducials
00107   // vtkMRMLInteractionNode::ViewTransform = rotate scene
00108   // Return value: zero if an error occurred
00109   int SetMouseInteractionMode(int mode);
00110 
00111   // Description:
00112   // Select the current fidicual list in the Fiducial module
00113   // If the user clicks on the image in Place interaction mode, then fiducials will be added to the current fiducial list.
00114   int SetCurrentFiducialList(vtkMRMLFiducialListNode* fidNode);
00115 
00116   //ETX
00117 
00118   void UpdateTargetListFromMRML();
00119 
00120   // Description:
00121   // Set Slicers's 2D view orientations from the image orientation.
00122   void SetSliceViewFromVolume(vtkMRMLVolumeNode *volumeNode);
00123   
00124  protected:
00125 
00126   //BTX
00127   std::string GetFoRStrFromVolumeNodeID(const char* volNodeID);
00128   //ETX
00129 
00130   // Description:
00131   // Link targets to fiducials (when no FiducialIDs are available), based on fiducial position and label
00132   void LinkTargetsToFiducials();
00133 
00134   // Description:
00135   // Helper method for loading a volume via the Volume module.
00136   vtkMRMLScalarVolumeNode *AddArchetypeVolume(const char* fileName, const char *volumeName);  
00137 
00138   void UpdateAll();
00139 
00140   vtkProstateNavLogic();
00141   ~vtkProstateNavLogic();
00142   vtkProstateNavLogic(const vtkProstateNavLogic&);
00143   void operator=(const vtkProstateNavLogic&);
00144   
00145   static void DataCallback(vtkObject*, unsigned long, void *, void *);
00146 
00147   /*
00148   void UpdateAll();
00149   void UpdateSliceDisplay();
00150   void UpdateLocator();
00151   */
00152 
00153   vtkCallbackCommand *DataCallbackCommand;
00154   
00155  private:
00156   
00157   int GetTargetIndexFromFiducialID(const char* fiducialID);
00158 
00159   int CreateCoverageVolume();
00160   void DeleteCoverageVolume();
00161   int UpdateCoverageVolumeImage();
00162 
00163   vtkMRMLRobotNode* GetRobotNode();
00164 
00165   vtkProstateNavGUI* GUI;
00166 
00167   /*
00168   bool  Connected;
00169   bool  RealtimeImageUpdate;
00170   */
00171 
00172   int   TimerOn;
00173 
00174 };
00175 
00176 #endif
00177 
00178 
00179   

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1