IGSTK

/build/buildd/igstk-4.2.0/Source/igstkFrame.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Image Guided Surgery Software Toolkit
00004   Module:    $RCSfile: igstkFrame.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-06-18 20:05:14 $
00007   Version:   $Revision: 1.2 $
00008 
00009   Copyright (c) ISC  Insight Software Consortium.  All rights reserved.
00010   See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __igstkFrame_h
00019 #define __igstkFrame_h
00020 
00021 #include "itkVector.h"
00022 #include "itkVersor.h"
00023 
00024 #include "igstkTimeStamp.h"
00025 #include "igstkMacros.h"
00026 #include "itkStdStreamLogOutput.h"
00027 
00028 class vtkImageData;
00029 
00030 namespace igstk
00031 {
00032 
00049 class Frame
00050 {
00051 public:
00052 
00053   friend class VideoImager;
00054   friend class VideoImagerTool;
00055 
00056   igstkLoggerMacro();
00057 
00058   typedef TimeStamp::TimePeriodType   TimePeriodType;
00059 
00060   igstkSetMacro( Width, unsigned int );
00061   igstkGetMacro( Width, unsigned int );
00062 
00063   igstkSetMacro( Height, unsigned int );
00064   igstkGetMacro( Height, unsigned int );
00065 
00066   igstkSetMacro( NumberOfChannels, unsigned int );
00067   igstkGetMacro( NumberOfChannels, unsigned int );
00068 
00070   Frame();
00071   Frame(unsigned int width, unsigned int height, unsigned int channels);
00072   Frame( const Frame & t );
00073   virtual ~Frame();
00074 
00075   void * GetImagePtr();
00076 
00084   TimePeriodType GetStartTime() const;
00085 
00086 
00094   TimePeriodType GetExpirationTime() const;
00095 
00096   void SetTimeToExpiration( TimePeriodType millisecondsToExpiration );
00097 
00106   bool IsValidAtTime( TimePeriodType timeToTestInMilliseconds ) const;
00107 
00113   bool IsValidNow() const;
00114 
00116   void Print(std::ostream& os, itk::Indent indent) const;
00117 
00118 protected:
00119 
00120   void PrintHeader(std::ostream& os, itk::Indent indent) const;
00121 
00122   void PrintTrailer(std::ostream& itkNotUsed(os),
00123                                           itk::Indent itkNotUsed(indent)) const;
00124 
00126   virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
00127 
00128 private:
00129 
00130   void SetFrameDimensions( unsigned int, unsigned int, unsigned int);
00131   void SetImagePtr( void*, TimePeriodType millisecondsToExpiration);
00132 
00133   std::vector< unsigned char > *m_Image;
00134   TimeStamp                     m_TimeStamp;
00135   void*                         m_ImagePtr;
00136   unsigned int                  m_Width;
00137   unsigned int                  m_Height;
00138   unsigned int                  m_NumberOfChannels;
00139 
00140 };
00141 
00142 std::ostream& operator<<(std::ostream& os, const igstk::Frame& o);
00143 }
00144 
00145 #endif