EditTransferFunction.h

00001 #pragma once
00002 
00003 #include<vector>
00004 #include <string>
00005 
00036 /* */
00037 class CEditTransferFunction : public CDialog
00038 {
00039     DECLARE_DYNAMIC(CEditTransferFunction)
00040     #pragma pack (push)
00041     #pragma pack (1)
00042 
00043     struct {
00044             BYTE m_pcName[10];
00045             BYTE m_bNumber;
00046     } m_sTransHeader;
00047 
00048     struct {
00049             int m_nPoint;
00050             COLORREF m_pColor;
00051             int m_opacity;
00052     } m_sTransData;
00053 
00054 #pragma pack (pop)
00055 
00056 
00057 private:
00058     int m_width, m_height;                          //width and height of histogram drawing
00059     int startX, startY;                             //startposition of histogram drawing in this dialog
00060     double xratio;                                  //ratio of m_width and max intensity value of volume
00061     
00062     std::vector<short> vec;                         //stores the x values of user specified tf points (only needed for drawing)
00063     std::vector<short> vecY;                        //stores the y values of user specified tf points (only needed for drawing)
00064     std::map<int, COLORREF> m;                      //stores intensity value with color
00065     std::map<int, int> mOp;                         //stores intensity value with opacity
00066 
00067     CPen** myPen;                                   //array of pens, for drawing the bar showing the colors of the tf
00068     CVisualize3DDoc* m_doc;                         //document
00069 
00070     unsigned short* histogram;                      //histogram of volume (x: intensity values, y: how often value x appears)
00071     COLORREF cf;
00072     TransferFunction* tf;                           // transfer function class
00073     enum { IDD = IDD_EDIT_TRANSFERFUNCTION };
00074 
00075 private:
00076     void UpdatePens();                              //updates colors of myPen array to current tf colors
00077     afx_msg void OnBnClickedOk();                   //default: closes dialog
00078     afx_msg void OnPaint();                         //draws dialog, with histogram and transfer function
00079     afx_msg void OnLButtonUp( UINT nFlags,CPoint point ); //if user clicked in histogram, new transfer function point is created, tf is calculated and displayed
00080     afx_msg void OnBnClickedOk2();                  //resets and clears transfer function
00081     afx_msg void OnBnClickedSaveTf();               //saves tf to file
00082     afx_msg void OnBnClickedLoadTf();               //loads tf from file
00083     
00084 
00085 protected:
00086     virtual void DoDataExchange(CDataExchange* pDX);// DDX/DDV support
00087     DECLARE_MESSAGE_MAP()
00088 
00089 public:
00090     CEditTransferFunction(CWnd* pParent = NULL);   // standard constructor
00091     virtual ~CEditTransferFunction();
00092 
00093 
00094 };

Generated on Thu Dec 9 12:08:19 2004 for Visualize3D by doxygen 1.3.1 using KingsTools