www.pudn.com > 医学图像处理示例源代码.rar > CommonProc.h


 
#define BOUND(x,min,max) ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x))) 
#define  PI  3.1415926535898 
#define  M_E 2.7182818284590 
 
#ifndef __PROGRESSDLG_H__ 
#define __PROGRESSDLG_H__ 
 
// ***************************************************************************** 
// Explanation of file structure: 
// [A Section] 
// A double Field = 0.23123 
// A int Field = 132432 
// A string Field = This is a string! 
// A multicolumn string Field = This is a 1st line string鐋This is a 2nd line string鐋This is a 3rd line string 
// [New Section] 
 
class CIni   
{ 
public: 
	void RemoveMultiLineItem(const int idx); 
	CString csLineEnd; 
	int FindItem(const int iSection, const char * cItem, CString &csVal); 
	int FindMultiItem(const int iSection, const char * cItem, CString &csVal); 
	bool RemoveSection(const char * cSection); 
	bool IsSection(const int iSection); 
	int InsertSection(const char * cSection); 
	int FindSection(const char * cSection); 
 
	bool SetMultiValue(const char * cSection, const char * cItem, const char * cVal); 
 
	//bool SetHospitalValue(const char * cSection, const char * cItem, const char * cVal); 
 
	bool SetValue(const char * cSection, const char * cItem, const COLORREF crVal); 
	bool SetValue(const char * cSection, const char * cItem, const bool bVal); 
	bool SetValue(const char * cSection, const char * cItem, const char * cVal); 
	bool SetValue(const char * cSection, const char * cItem, const double dbVal); 
	bool SetValue(const char * cSection, const char * cItem, const float fVal); 
	bool SetValue(const char * cSection, const char * cItem, const long lVal); 
	bool SetValue(const char * cSection, const char * cItem, const int iVal); 
	bool SetValue(const char * cSection, const char * cItem, const CRect rcVal); 
	bool SetValue(const char * cSection, const char * cItem, const CPoint ptVal); 
 
	bool GetMultiValue(const char * cSection, const char * cItem, CString &cVal); 
 
//	bool GetHospitalValue(const char * cSection, const char * cItem, CString &cVal);	 
 
	bool GetValue(const char * cSection, const char * cItem, COLORREF &crVal); 
	bool GetValue(const char * cSection, const char * cItem, bool &bVal); 
	bool GetValue(const char * cSection, const char * cItem, CString &cVal); 
	bool GetValue(const char * cSection, const char * cItem, double &dbVal); 
	bool GetValue(const char * cSection, const char * cItem, float &fVal); 
	bool GetValue(const char * cSection, const char * cItem, long &lVal); 
	bool GetValue(const char * cSection, const char * cItem, int &iVal); 
	bool GetValue(const char * cSection, const char * cItem, CRect &rcVal); 
	bool GetValue(const char * cSection, const char * cItem, CPoint &ptVal); 
 
	void Clear(); 
	bool Write(const char * cFileName); 
	bool Read(const char * cFileName); 
	CIni(); 
	virtual ~CIni(); 
	CStringArray	csList; 
 
}; 
class CProgressDlg : public CDialog  //this SubClass of CDialog isn't found in the classwizard 
{ 
// Construction / Destruction 
public: 
    CProgressDlg(UINT nCaptionID = 0);   // standard constructor 
    ~CProgressDlg(); 
 
    BOOL Create(CWnd *pParent=NULL); 
 
    // Checking for Cancel button 
    BOOL CheckCancelButton(); 
    // Progress Dialog manipulation 
    void SetStatus(LPCTSTR lpszMessage); 
    void SetRange(int nLower,int nUpper); 
    int  SetStep(int nStep); 
    int  SetPos(int nPos); 
    int  OffsetPos(int nPos); 
    int  StepIt(); 
    enum { IDD = 113 };    
      
// Dialog Data 
    //{{AFX_DATA(CProgressDlg) 
    CProgressCtrl	m_Progress; 
    //}}AFX_DATA 
 
// Overrides 
    // ClassWizard generated virtual function overrides 
    //{{AFX_VIRTUAL(CProgressDlg) 
    public: 
    virtual BOOL DestroyWindow(); 
    protected: 
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support 
    //}}AFX_VIRTUAL 
 
// Implementation 
public: 
	UINT m_nCaptionID; 
    int m_nLower; 
    int m_nUpper; 
    int m_nStep; 
     
    BOOL m_bCancel; 
    BOOL m_bParentDisabled; 
 
    void ReEnableParent(); 
 
    virtual void OnCancel(); 
    virtual void OnOK() {};  
    void UpdatePercent(int nCurrent); 
    void PumpMessages(); 
 
    // Generated message map functions 
    //{{AFX_MSG(CProgressDlg) 
    virtual BOOL OnInitDialog(); 
    //}}AFX_MSG 
    DECLARE_MESSAGE_MAP() 
}; 
#endif // __PROGRESSDLG_H__ 
 
 
CString	GetNextSerialFilename(CString Filename); 
CString	GetPrevSerialFilename(CString Filename); 
CString GetNameformFullPathName(CString FullPathName); 
 
CString GetCurrentDirectory(); 
BOOL    FindNextFile(CString &Filename); 
BOOL    FindPrevFile(CString &Filename); 
BOOL    IsExistFile(CString Filename); 
void    L_TraceRect(CString VarName, CRect rect); 
//---------- 字符型数据快速排序 -------------// 
void IntQuickSort(BYTE *p, int n); 
void IntSplit(BYTE *p, int n,  int *m); 
void pIntBubble(BYTE *p,  int n); 
//----- 将int 类型数据转换威  BYTE 类型 ------// 
void int_to_uchar(int *r,  BYTE *in,  int size); 
//---------------------------------------------- 
 
//-------- 将float 类型数据转换威 BYTE 类型 ------// 
void float_to_uchar(float *r,  BYTE *in,  int size); 
//---------------------------------------------- 
 
//---------- Canny edge detection method function -----------// 
// VGaussianKernel Generate a 1D Gaussian kernel. 
BOOL VGaussianKernel		(int ncoeffs, float *coeffs, float s); 
BOOL VGaussianD1Kernel		(int ncoeffs, float *coeffs, float s); 
BOOL VGaussianSplineKernel  (int ncoeffs, float *coeffs, float s); 
void Make_Rfilter_Mask(int masksize, float lambda,   
					   float *lpDmask, float *lpmask= NULL, float maxresponse= 1.0f); 
void Make_Second_Rfilter_Mask(int masksize, float lambda, float tau,  
							  float *lpDmask, float *lpmask= NULL, float maxresponse= 1.0f); 
void Make_GED_filter_mask(int masksize, float lambda, float tau,  
						  float *lpDmask, float *lpmask= NULL, float maxresponse= 1.0f); 
int GetDriveCount();