Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkPseudocolorWidgetModel.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 
00011 
00012 #ifndef __mitkPseudocolorWidgetModel_h
00013 #define __mitkPseudocolorWidgetModel_h
00014 
00015 #include "mitkWidgetModel2D.h"
00016 
00025 class MITK_VISUALIZATION_API mitkPseudocolorWidgetModel : public mitkWidgetModel2D
00026 {
00027 public:
00028     enum { COLOR_TABLE_SIZE = 256 };
00029 
00030     MITK_TYPE(mitkPseudocolorWidgetModel, mitkWidgetModel2D)
00031 
00032     virtual void PrintSelf(ostream &os);
00033 
00034     mitkPseudocolorWidgetModel();
00035 
00042     virtual int Render(mitkScene *scene);
00043 
00049     virtual void Pick(const WidgetNames &names);
00050 
00054     virtual void Release();
00055 
00061     void SetStartPoint(int x, int y);
00062 
00068     void SetMovePoint(int x, int y);
00069 
00075     void SetEndPoint(int x, int y);
00076 
00081     int GetWidth() { return m_Right - m_Left + 1; }
00082 
00087     int GetHeight() { return m_Top - m_Bottom + 1; }
00088 
00093     int GetLeft() { return m_Left; }
00094     
00099     int GetRight() { return m_Right; }
00100 
00105     int GetBottom() { return m_Bottom; }
00106 
00111     int GetTop() { return m_Top; }
00112 
00118     void GetStartPoint(int &sx, int &sy) { sx = m_StartPoint[0]; sy = m_StartPoint[1]; }
00119 
00125     void GetStartPoint(int p[2]) { this->GetStartPoint(p[0], p[1]); }
00126 
00132     void GetEndPoint(int &ex, int &ey) { ex = m_EndPoint[0]; ey = m_EndPoint[1]; }
00133 
00139     void GetEndPoint(int p[2]) { this->GetEndPoint(p[0], p[1]); }
00140 
00145     bool IsValid() { return m_EndPointSet; }
00146 
00158     int SetColorTable(unsigned char table[][3], int colorNum = COLOR_TABLE_SIZE);
00159 
00163     void ResetColorTable();
00164 
00172     int GetColorTable(unsigned char table[][3], int colorNum = COLOR_TABLE_SIZE);
00173 
00180     virtual mitkVolume* GetRegionMask();
00181 
00182 protected:
00183     virtual ~mitkPseudocolorWidgetModel();
00184     virtual float* _getBounds();
00185     
00194     virtual void _onMouseDown(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00195 
00204     virtual void _onMouseUp(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00205 
00215     virtual void _onMouseMove(bool ctrlDown, bool shiftDown, int xPos, int yPos, int deltaX, int deltaY);
00216 
00217     void _init();
00218 
00219     void _drawColorRect();
00220     void _resetRect();
00221 
00222     enum
00223     {
00224         unknown,
00225         image,
00226         hsline,
00227         heline,
00228         vsline,
00229         veline,
00230         ssdot,
00231         esdot,
00232         eedot,
00233         sedot
00234     };
00235     
00236     float m_DotColor[4];
00237     float m_LineColor[4];
00238     float m_PickedDotColor[4];
00239     float m_PickedLineColor[4];
00240 
00241     float m_DotSize;
00242 
00243     unsigned char  m_ColorTable[COLOR_TABLE_SIZE][3];
00244     unsigned char *m_PixelBuffer;
00245     unsigned int   m_BufferSize;
00246 
00247     int m_StartPoint[2];
00248     int m_EndPoint[2];
00249     int m_Left;
00250     int m_Bottom;
00251     int m_Right;
00252     int m_Top;
00253 
00254     bool m_StartPointSet;
00255     bool m_EndPointSet;
00256 
00257 private:
00258     mitkPseudocolorWidgetModel(const mitkPseudocolorWidgetModel&);
00259     void operator = (const mitkPseudocolorWidgetModel&);
00260 
00261 };
00262 
00263 
00264 //#define DEFINED_mitkPseudocolorWidgetModel
00265 
00266 
00267 
00268 #endif
00269 

Generated on Tue Feb 25 15:00:37 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3