vtkIGTLToMRMLBase.h

Go to the documentation of this file.
00001 /*==========================================================================
00002 
00003   Portions (c) Copyright 2008-2009 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:    $HeadURL: http://svn.slicer.org/Slicer3/trunk/Modules/OpenIGTLinkIF/vtkIGTLToMRMLBase.h $
00010   Date:      $Date: 2010-11-23 00:58:13 -0500 (Tue, 23 Nov 2010) $
00011   Version:   $Revision: 15552 $
00012 
00013 ==========================================================================*/
00014 
00015 #ifndef __vtkIGTLToMRMLBase_h
00016 #define __vtkIGTLToMRMLBase_h
00017 
00018 #include "vtkObject.h"
00019 #include "vtkOpenIGTLinkIFWin32Header.h" 
00020 #include "vtkMRMLScene.h"
00021 #include "vtkMRMLNode.h"
00022 #include "igtlMessageBase.h"
00023 #include <vector>
00024 #include <string>
00025 
00026 #ifdef OpenIGTLinkIF_USE_VERSION_2
00027 class vtkMRMLIGTLQueryNode;
00028 #endif //OpenIGTLinkIF_USE_VERSION_2
00029 
00030 class VTK_OPENIGTLINKIF_EXPORT vtkIGTLToMRMLBase : public vtkObject
00031 {
00032 
00033  public:
00034 
00035   // IGTL to MRML Converter types (returned values from GetConverterType())
00036   // NOTE: if you want to define a child class that can handle multiple types
00037   // of OpenIGTLink messages, override GetConverterType() method to return
00038   // TYPE_MULTI_IGTL_NAME.
00039   //BTX
00040   enum {
00041     TYPE_NORMAL,            // supports only single IGTL message type (default)
00042     TYPE_MULTI_IGTL_NAMES,  // supports multiple IGTL message names (device types)
00043   };
00044   //ETX
00045 
00046  public:
00047 
00048   static vtkIGTLToMRMLBase *New();
00049   vtkTypeRevisionMacro(vtkIGTLToMRMLBase,vtkObject);
00050 
00051   void PrintSelf(ostream& os, vtkIndent indent);
00052 
00053   virtual int          GetConverterType() { return TYPE_NORMAL; };
00054 
00055   // IGTL Device / MRML Tag names
00056   virtual const char*  GetIGTLName()      { return NULL;};
00057   virtual const char*  GetMRMLName()      { return NULL;};
00058 
00059   // Following functions are implemented only if exists in OpenIGTLink specification
00060   virtual const char*  GetIGTLStartQueryName() { return NULL; };
00061   virtual const char*  GetIGTLStopQueryName()  { return NULL; };
00062   virtual const char*  GetIGTLGetQueryName()   { return NULL; };
00063   virtual const char*  GetIGTLStatusName()     { return NULL; };
00064 
00065   // Description:
00066   // GetNodeEvents() returns a list of events, which an IGTLConnector should react to.
00067   // The first element should be an event to export data, although multiple events can be defined.
00068   virtual vtkIntArray* GetNodeEvents()    { return NULL; };
00069   virtual vtkMRMLNode* CreateNewNode(vtkMRMLScene* vtkNotUsed(scene), const char* vtkNotUsed(name))
00070     { return NULL; };
00071 
00072   // for TYPE_MULTI_IGTL_NAMES
00073   int                  GetNumberOfIGTLNames()   { return this->IGTLNames.size(); };
00074   const char*          GetIGTLName(int index)   { return this->IGTLNames[index].c_str(); };
00075 
00076   // Description:
00077   // Functions to convert OpenIGTLink message to MRML node.
00078   // If mrmlNode is QueryNode, the function will generate query node. (event is not used.)
00079   //BTX
00080   virtual int          IGTLToMRML(igtl::MessageBase::Pointer vtkNotUsed(buffer),
00081                                   vtkMRMLNode* vtkNotUsed(node)) { return 0; };
00082   //ETX
00083 
00084   // Description:
00085   // Functions to generate an OpenIGTLink message
00086   // If mrmlNode is QueryNode, the function will generate query node. (event is not used.)
00087   virtual int          MRMLToIGTL(unsigned long vtkNotUsed(event), vtkMRMLNode* vtkNotUsed(mrmlNode),
00088                                   int* vtkNotUsed(size), void** vtkNotUsed(igtlMsg)){ return 0; };
00089 
00090   // Check query que (called periodically by timer)
00091   // (implemeted only if ncessary)
00092   virtual int CheckQueryQue(double ctime) { return true; }
00093 
00094   vtkGetMacro( CheckCRC, int );
00095   vtkSetMacro( CheckCRC, int );
00096 
00097  protected:
00098   vtkIGTLToMRMLBase();
00099   ~vtkIGTLToMRMLBase();
00100 
00101  protected:
00102 
00103   //BTX
00104   // list of IGTL names (used only when the class supports multiple IGTL names)
00105   std::vector<std::string>  IGTLNames;
00106   //ETX
00107 
00108   int CheckCRC;
00109   
00110 };
00111 
00112 
00113 #endif //__vtkIGTLToMRMLBase_h

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1