TransferFunction.h

00001 
00002 #pragma once
00003 
00004 #ifndef __AFXWIN_H__
00005     #error 'stdafx.h' muss vor dieser Datei in PCH eingeschlossen werden.
00006 #endif
00007 
00008 #include "resource.h"     
00009 #include "Visualize3D.h"
00010 #include "Visualize3DDoc.h"
00011 #include <map>
00012 
00013 class CVisualize3DDoc;
00014 
00045 class TransferFunction 
00046 {
00047 
00048 private:
00049     
00050     double ratio;                                   //ratio between max intensity value and 255
00051     int m_max;                                      //max intensity value
00052     CVisualize3DDoc* m_doc;
00053     int startPos, endPos;                           //startValue and endValue for windowing function
00054 
00055     std::map<int, COLORREF> lastMap;                //last specified transfer function (intensity value, color)
00056     std::map<int, int> lastOpMap;                   //last specified (intensity value, opacity)
00057 
00058     typedef std::pair <int, COLORREF> tf_Pair;
00059     typedef std::pair <int, int> tf_OpPair;
00060 
00061     unsigned short* tf;                             /*transfer function array, for each value it stores: r,g,b,opacity
00062                                                     to access color for intensity: r = tf[intensity*4], g = tf[(intensity +1)*4]
00063                                                     */
00064 
00065 private:
00066     void CalcTF(int oldK, int newK, COLORREF oldV, COLORREF newV, int oldOp, int newOp); //interpolates colors and opacities between to specified points
00067 
00068 public:
00069     TransferFunction(CVisualize3DDoc *doc, int max);
00070     virtual ~TransferFunction();
00071 
00072     void CreateTransferFunction( std::map<int, COLORREF> m, std::map<int, int> mOp); //creates a transfer function of given input (entries with specified intensity value, color and opacity)
00073     unsigned short* GetTransferFunction();          //returns tf (transfer function array)
00074     void ResetTF();                                 //resets transfer function
00075     void CreateWindowingFunction(int min, int max); //does windowing (resets all values outside of window and calls CreateWindowingTransferFunction
00076     void CreateWindowingTransferFunction( std::map<int, COLORREF> m, std::map<int, int> mOp); //creates the transfer function within the windowing window
00077     
00078 };

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