// TestRawViewerDlg.h : header file
//

#pragma once

#define IMAGE_SIZE_X          3052
#define IMAGE_SIZE_Y          3052
//#define IMAGE_SIZE_X          3072
//#define IMAGE_SIZE_Y          3072
//#define IMAGE_SIZE_X          1592
//#define IMAGE_SIZE_Y          1864 
#define IMAGE_MAX_VALUE_65535 65535
//#define IMAGE_MAX_VALUE_65535 16384


// CTestRawViewerDlg dialog
class CTestRawViewerDlg : public CDialog
{
// Construction
public:
	CTestRawViewerDlg(CWnd* pParent = NULL);	// standard constructor
	~CTestRawViewerDlg();	// destructor

	BITMAPINFO* pBitmapInfo;
	HBITMAP     hBitmap;
	
	BYTE * pDib;
//	unsigned short* pDib;
	unsigned short* pImage;
	unsigned short* pImage2;
//	BYTE * pImage;

//	unsigned short pImage[IMAGE_SIZE_X * IMAGE_SIZE_Y];//[500*500];
//	unsigned short pImage2[IMAGE_SIZE_X * IMAGE_SIZE_Y];//[500*500];

//	BYTE pDib [IMAGE_SIZE_X * IMAGE_SIZE_Y];
//	BYTE pDib2[IMAGE_SIZE_X * IMAGE_SIZE_Y];


	int miMIN;
	int miMAX;

	int mpImageValue[65536]  ;

//	int miSumValue[65536];

//	int miNormalizedValue[65536];

	unsigned short maImageValue1[65536];


	int nThreshold;


    void ufQuickSort(int arr[],unsigned short arr2[], int left, int right) ;

// Dialog Data
	enum { IDD = IDD_TESTRAWVIEWER_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnBnClickedButton1();
	afx_msg void OnBnClickedButton3();
	afx_msg void OnBnClickedButton2();
	afx_msg void OnBnClickedButton4();
	afx_msg void OnBnClickedButton5();
};
