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

mitkPseudocolorWidgetModelEx.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 #ifndef __mitkPseudocolorWidgetModelEx_h
00012 #define __mitkPseudocolorWidgetModelEx_h
00013 
00014 #include "mitkWidgetModel2D.h"
00015 #include "mitkColorTable.h"
00016 #include "mitkRCPtr.h"
00017 #include "mitkImageModel.h"
00018 
00031 class MITK_VISUALIZATION_API mitkPseudocolorWidgetModelEx : public mitkWidgetModel2D
00032 {
00033 public:
00034     MITK_TYPE(mitkPseudocolorWidgetModelEx, mitkWidgetModel2D)
00035 
00036     virtual void PrintSelf(ostream &os);
00037 
00038     mitkPseudocolorWidgetModelEx();
00039 
00046     virtual int Render(mitkScene *scene);
00047 
00053     virtual void Pick(const WidgetNames &names);
00054 
00058     virtual void Release();
00059 
00064     virtual void SetSourceModel(mitkDataModel *model);
00065 
00070     bool IsValid() { return m_EndPointSet; }
00071     
00081     void SetStartPoint(float x, float y);
00082 
00099     void SetStartPoint(int sx, int sy);
00100 
00110     void SetMovePoint(float x, float y);
00111 
00128     void SetMovePoint(int sx, int sy);
00129 
00139     void SetEndPoint(float x, float y);
00140 
00157     void SetEndPoint(int sx, int sy);
00158     
00163     void SetColorTable(mitkColorTable *ct) { m_ColorTable = ct; }
00164 
00169     mitkColorTable* GetColorTable();
00170 
00176     void GetLeftBottom(int &l, int &b) { l = m_RectLeft; b = m_RectBottom; }
00177 
00182     int GetRectWidthInImage() { return m_RectWidth; }
00183 
00188     int GetRectHeightInImage() { return m_RectHeight; }
00189     
00193     bool UpdatePseudocolorRect();
00194 
00198     void SetRectChanged() { m_RectChanged = true; }
00199 
00206     virtual mitkVolume* GetRegionMask();
00207 
00211     virtual void Update();
00212 
00213 protected:
00214     virtual ~mitkPseudocolorWidgetModelEx();
00215 
00216     virtual float* _getBounds();
00217 
00218     bool _mapColor();
00219     
00228     virtual void _onMouseDown(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00229 
00238     virtual void _onMouseUp(int mouseButton, bool ctrlDown, bool shiftDown, int xPos, int yPos);
00239 
00249     virtual void _onMouseMove(bool ctrlDown, bool shiftDown, int xPos, int yPos, int deltaX, int deltaY);
00250 
00251     void _init();
00252 
00253     void _updateRectParams();
00254 
00255     void _computeImageCoordinates();
00256 
00257     enum
00258     {
00259         unknown,
00260         rect,
00261         hsline,
00262         heline,
00263         vsline,
00264         veline,
00265         ssdot,
00266         esdot,
00267         eedot,
00268         sedot
00269     };
00270     
00271     mitkRCPtr<mitkColorTable> m_ColorTable;
00272 
00273     float m_DotColor[4];
00274     float m_LineColor[4];
00275     float m_PickedDotColor[4];
00276     float m_PickedLineColor[4];
00277 
00278     float m_DotSize;
00279 
00280     int m_RectLeft;
00281     int m_RectBottom;
00282     int m_RectWidth;
00283     int m_RectHeight;
00284     unsigned int m_RectBufSize;
00285     unsigned char *m_RectBuffer;
00286 
00287     int m_StartPoint[2];
00288     int m_EndPoint[2];
00289 
00290     float m_ObjStartPoint[2];
00291     float m_ObjEndPoint[2];
00292 
00293     mitkImageModel::ViewMode m_CurViewMode;
00294     int m_CurSliceIdx;
00295     void const *m_CurSrcSlice;
00296     void *m_SrcBuf;
00297 
00298     bool m_StartPointSet;
00299     bool m_EndPointSet;
00300     bool m_RectChanged;
00301 
00302 private:
00303     mitkPseudocolorWidgetModelEx(const mitkPseudocolorWidgetModelEx&);
00304     void operator = (const mitkPseudocolorWidgetModelEx&);
00305 
00306 };
00307 
00308 inline void mitkPseudocolorWidgetModelEx::SetEndPoint(int sx, int sy)
00309 {
00310     this->SetMovePoint(sx, sy);
00311     m_EndPointSet = true;
00312 }
00313 
00314 inline void mitkPseudocolorWidgetModelEx::SetEndPoint(float x, float y)
00315 {
00316     this->SetMovePoint(x, y);
00317     m_EndPointSet = true;
00318 }
00319 
00320 
00321 //#define DEFINED_mitkPseudocolorWidgetModelEx
00322 
00323 
00324 
00325 #endif
00326 

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