2377 lines
66 KiB
C++
2377 lines
66 KiB
C++
// TestRawViewerDlg.cpp : implementation file
|
||
//
|
||
|
||
#include "stdafx.h"
|
||
#include "TestRawViewer.h"
|
||
#include "TestRawViewerDlg.h"
|
||
#include ".\testrawviewerdlg.h"
|
||
#include "TestRawViewGraph.h"
|
||
|
||
#ifdef _DEBUG
|
||
#define new DEBUG_NEW
|
||
#endif
|
||
|
||
|
||
// CAboutDlg dialog used for App About
|
||
|
||
class CAboutDlg : public CDialog
|
||
{
|
||
public:
|
||
CAboutDlg();
|
||
|
||
// Dialog Data
|
||
enum { IDD = IDD_ABOUTBOX };
|
||
|
||
protected:
|
||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||
|
||
// Implementation
|
||
protected:
|
||
DECLARE_MESSAGE_MAP()
|
||
};
|
||
|
||
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
||
{
|
||
}
|
||
|
||
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialog::DoDataExchange(pDX);
|
||
}
|
||
|
||
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||
END_MESSAGE_MAP()
|
||
|
||
|
||
// CTestRawViewerDlg dialog
|
||
|
||
|
||
|
||
CTestRawViewerDlg::CTestRawViewerDlg(CWnd* pParent /*=NULL*/)
|
||
: CDialog(CTestRawViewerDlg::IDD, pParent)
|
||
{
|
||
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||
|
||
hBitmap = NULL;
|
||
pBitmapInfo = NULL;
|
||
pDib = NULL;
|
||
pImage = NULL;
|
||
}
|
||
CTestRawViewerDlg::~CTestRawViewerDlg()
|
||
{
|
||
|
||
// delete(pImhBitmapage);
|
||
delete(pBitmapInfo);
|
||
|
||
// delete(pDib);
|
||
delete(pImage);
|
||
// delete(pImage2);
|
||
|
||
// delete(pImage);
|
||
// delete(mpImageValue);
|
||
// delete(mpImageValue22);
|
||
// delete(mpImageValue33);
|
||
// delete(mpImageValue44);
|
||
// delete(mpImageValue55);
|
||
|
||
}
|
||
|
||
void CTestRawViewerDlg::DoDataExchange(CDataExchange* pDX)
|
||
{
|
||
CDialog::DoDataExchange(pDX);
|
||
}
|
||
|
||
BEGIN_MESSAGE_MAP(CTestRawViewerDlg, CDialog)
|
||
ON_WM_SYSCOMMAND()
|
||
ON_WM_PAINT()
|
||
ON_WM_QUERYDRAGICON()
|
||
//}}AFX_MSG_MAP
|
||
ON_WM_TIMER()
|
||
ON_BN_CLICKED(IDC_BUTTON1, &CTestRawViewerDlg::OnBnClickedButton1)
|
||
ON_BN_CLICKED(IDC_BUTTON3, &CTestRawViewerDlg::OnBnClickedButton3)
|
||
ON_BN_CLICKED(IDC_BUTTON2, &CTestRawViewerDlg::OnBnClickedButton2)
|
||
ON_BN_CLICKED(IDC_BUTTON4, &CTestRawViewerDlg::OnBnClickedButton4)
|
||
ON_BN_CLICKED(IDC_BUTTON5, &CTestRawViewerDlg::OnBnClickedButton5)
|
||
END_MESSAGE_MAP()
|
||
|
||
|
||
// CTestRawViewerDlg message handlers
|
||
|
||
void CTestRawViewerDlg::ufQuickSort(int arr[],unsigned short arr2[], int left, int right)
|
||
{
|
||
int i = left, j = right;
|
||
|
||
int tmp;
|
||
unsigned short tmp2;
|
||
|
||
int pivot = arr[(left + right) / 2];
|
||
|
||
/* partition */
|
||
while (i <= j)
|
||
{
|
||
while (arr[i] < pivot) i++;
|
||
|
||
while (arr[j] > pivot) j--;
|
||
|
||
if (i <= j)
|
||
{
|
||
tmp = arr[i];
|
||
arr[i] = arr[j];
|
||
arr[j] = tmp;
|
||
|
||
tmp2 = arr2[i];
|
||
arr2[i] = arr2[j];
|
||
arr2[j] = tmp2;
|
||
|
||
i++;
|
||
j--;
|
||
}
|
||
};
|
||
|
||
/* recursion */
|
||
if (left < j) ufQuickSort(arr, arr2, left, j);
|
||
|
||
if (i < right) ufQuickSort(arr, arr2, i, right);
|
||
|
||
return;
|
||
}
|
||
BOOL CTestRawViewerDlg::OnInitDialog()
|
||
{
|
||
CDialog::OnInitDialog();
|
||
|
||
// Add "About..." menu item to system menu.
|
||
|
||
// IDM_ABOUTBOX must be in the system command range.
|
||
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
||
ASSERT(IDM_ABOUTBOX < 0xF000);
|
||
|
||
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
||
if (pSysMenu != NULL)
|
||
{
|
||
CString strAboutMenu;
|
||
strAboutMenu.LoadString(IDS_ABOUTBOX);
|
||
if (!strAboutMenu.IsEmpty())
|
||
{
|
||
pSysMenu->AppendMenu(MF_SEPARATOR);
|
||
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
||
}
|
||
}
|
||
|
||
// Set the icon for this dialog. The framework does this automatically
|
||
// when the application's main window is not a dialog
|
||
SetIcon(m_hIcon, TRUE); // Set big icon
|
||
SetIcon(m_hIcon, FALSE); // Set small icon
|
||
|
||
// TODO: Add extra initialization here
|
||
/*
|
||
int mpImageValue [IMAGE_MAX_VALUE_65535];
|
||
|
||
double wdSumValue [IMAGE_MAX_VALUE_65535];
|
||
double wdNormalizedValue[IMAGE_MAX_VALUE_65535];
|
||
|
||
int mpImageValue22[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue33[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue44[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue55[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue66[IMAGE_MAX_VALUE_65535];
|
||
*/
|
||
/*
|
||
unsigned short mpImageValue77[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue88[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue99[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue91[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue92[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue93[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue94[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue95[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue96[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue97[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue98[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue90[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue80[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue81[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue82[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue83[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue84[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue85[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue86[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue87[IMAGE_MAX_VALUE_65535];
|
||
unsigned short mpImageValue89[IMAGE_MAX_VALUE_65535];
|
||
*/
|
||
double wdScaleFactor;
|
||
|
||
int i, j, k;
|
||
|
||
int wiAvaiableImageCount;
|
||
int wiImageValue;
|
||
int wiLimitImageValue;
|
||
int wiLastAvaiableValue;
|
||
|
||
double wbDIB;
|
||
double wdSUM;
|
||
|
||
// BYTE pDib[3072 * 3072];
|
||
|
||
//====================================================================================================================
|
||
//####################################################################################################################
|
||
//====================================================================================================================
|
||
/*
|
||
pBitmapInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
|
||
|
||
pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||
pBitmapInfo->bmiHeader.biWidth = IMAGE_SIZE_X; //500;
|
||
pBitmapInfo->bmiHeader.biHeight = IMAGE_SIZE_Y;//500;
|
||
pBitmapInfo->bmiHeader.biPlanes = 1;
|
||
pBitmapInfo->bmiHeader.biBitCount = 8;
|
||
pBitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||
pBitmapInfo->bmiHeader.biSizeImage = IMAGE_SIZE_X * IMAGE_SIZE_Y; //500*500;
|
||
pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biClrUsed = 0;
|
||
pBitmapInfo->bmiHeader.biClrImportant = 0;
|
||
|
||
for(int i=0; i<256; i++)
|
||
{
|
||
pBitmapInfo->bmiColors[i].rgbRed = i;
|
||
pBitmapInfo->bmiColors[i].rgbGreen = i;
|
||
pBitmapInfo->bmiColors[i].rgbBlue = i;
|
||
pBitmapInfo->bmiColors[i].rgbReserved = 0;
|
||
}
|
||
|
||
hBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*)pBitmapInfo, DIB_RGB_COLORS, (void**)&pDib, NULL, NULL);
|
||
|
||
pImage = new unsigned short [IMAGE_SIZE_X*IMAGE_SIZE_Y];
|
||
pImage2 = new unsigned short [IMAGE_SIZE_X*IMAGE_SIZE_Y];
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = 0;
|
||
|
||
}
|
||
|
||
FILE *fp;
|
||
fp = fopen( "test.raw" , "rb" );
|
||
|
||
// fp = fopen( "Sample.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CSPINE_LAT.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\ABDOMEN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CHEST_LAT.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CHEST_PA_01.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CSPINE_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\ELBOW_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOOT_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\HAND_LAT.raw" , "rb" );
|
||
|
||
//fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\LSPINE_LAT.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\20121127\\DIAMOND\\DATABASE\\IMAGES\\20121123\\00000064.SR" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\20121127\\DIAMOND\\DATABASE\\IMAGES\\20121123\\00000155.SR" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\STITCH\\00000124.SR" , "rb" );
|
||
// fp = fopen( "C:\\DIAMOND\\DATABASE\\IMAGES\\20130104\\00000214.SR" , "rb" );
|
||
// fp = fopen( "C:\\DIAMOND\\DATABASE\\IMAGES\\20130104\\00000220.SR" , "rb" );
|
||
// fp = fopen( "C:\\DIAMOND\\DATABASE\\IMAGES\\20130104\\00000221.SR" , "rb" );
|
||
// fp = fopen( "D:\\RADMAX\\DATABASE\\IMAGES\20130930\\00032218.SR" , "rb" );
|
||
// fp = fopen( "C:\\DIAMOND\\DATABASE\\IMAGES\\20130104\\00000223.SR" , "rb" );
|
||
|
||
// C:\DIAMOND\DATABASE\IMAGES\20130104
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\STITCH\\00000125.SR" , "rb" );
|
||
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\3.raw" , "rb" );
|
||
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_5U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL0_10U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\mode_1_defect_map.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\2.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\20121115\\00000017.SR" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\Toshiba_60kV_50mA_100ms_5mAs_120SID_Sample_02.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DETECTOR\\Varian 4343R\\<5C><>ġCD_<44><5F><EFBFBD>纻20121114\\ReceptorInstallationDiscSNW2-T2265118NA02\\Receptor Test Data\\Dark Images\\Mode1_subtracted.viv" , "rb" );
|
||
|
||
// FD180_SID180_AL0_10U_PHAN
|
||
|
||
|
||
// fread( pImage , 500*500 , sizeof(BYTE) , fp );
|
||
fread( pImage , IMAGE_SIZE_X * IMAGE_SIZE_Y , sizeof(unsigned short) , fp );
|
||
fclose( fp );
|
||
|
||
int wIx, wJy, X, Y, K, L;
|
||
double wdXvaule,wdYvaule;
|
||
|
||
|
||
int wiMaxHValue = 180;
|
||
int wiMinHValue = 170;
|
||
|
||
int wiMaxPixelCount = 1526;
|
||
int wiMinPixelCount = wiMinHValue * wiMaxPixelCount / wiMaxHValue;
|
||
|
||
L = 0;
|
||
for(wIx = wiMaxPixelCount; wIx < wiMaxPixelCount + wiMinPixelCount; wIx++)
|
||
{
|
||
L = L + 1;
|
||
wdXvaule = L * (wiMaxHValue - wiMinHValue) / wiMinHValue;
|
||
|
||
X = wIx + (int)wdXvaule;
|
||
|
||
K = 0;
|
||
for(wJy = wiMaxPixelCount; wJy < wiMaxPixelCount + wiMinPixelCount; wJy++)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = K * (wiMaxHValue - wiMinHValue) / wiMinHValue;
|
||
|
||
Y = wJy + (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
|
||
K = 0;
|
||
for(wJy = wiMaxPixelCount; wJy > wiMaxPixelCount - wiMinPixelCount; wJy--)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = K * (wiMaxHValue - wiMinHValue) / wiMinHValue;
|
||
|
||
Y = wJy - (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
|
||
}
|
||
|
||
L = 0;
|
||
for(wIx = wiMaxPixelCount; wIx > wiMaxPixelCount - wiMinPixelCount; wIx--)
|
||
{
|
||
L = L + 1;
|
||
wdXvaule = L * (wiMaxHValue - wiMinHValue) / wiMinHValue;
|
||
|
||
X = wIx - (int)wdXvaule;
|
||
|
||
K = 0;
|
||
for(wJy = wiMaxPixelCount; wJy < wiMaxPixelCount + wiMinPixelCount; wJy++)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = K * (wiMaxHValue - wiMinHValue) / wiMinHValue;
|
||
|
||
Y = wJy + (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
|
||
K = 0;
|
||
for(wJy = wiMaxPixelCount; wJy > wiMaxPixelCount - wiMinPixelCount; wJy--)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = K * (wiMaxHValue - wiMinHValue) / wiMinHValue;
|
||
|
||
Y = wJy - (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = pImage2[i];
|
||
}
|
||
*/
|
||
/*
|
||
L = 0;
|
||
for(wIx = wiMinPixelCount; wIx < wiMinPixelCount * 2; wIx++)
|
||
{
|
||
L = L + 1;
|
||
wdXvaule = (double)L * ((double)wiMaxHValue - (double)wiMinHValue) / (double)wiMinHValue;
|
||
|
||
X = wIx + (int)wdXvaule;
|
||
|
||
K = 0;
|
||
for(wJy = wiMinPixelCount; wJy < wiMinPixelCount * 2; wJy++)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = (double)K * ((double)wiMaxHValue - (double)wiMinHValue) / (double)wiMinHValue;
|
||
|
||
Y = wJy + (int)wdYvaule;
|
||
|
||
|
||
// if(wdYvaule > 50) AfxMessageBox("kkkkkkkkkkkkkkkkkk");
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
|
||
K = 0;
|
||
for(wJy = wiMinPixelCount; wJy > 0; wJy--)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = (double)K * ((double)wiMaxHValue - (double)wiMinHValue) / (double)wiMinHValue;
|
||
|
||
Y = wJy - (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
|
||
}
|
||
|
||
|
||
L = 0;
|
||
for(wIx = wiMinPixelCount; wIx > 0; wIx--)
|
||
{
|
||
L = L + 1;
|
||
wdXvaule = L * ((double)wiMaxHValue - (double)wiMinHValue) / (double)wiMinHValue;
|
||
|
||
X = wIx - (int)wdXvaule;
|
||
|
||
K = 0;
|
||
for(wJy = wiMinPixelCount; wJy < wiMinPixelCount * 2; wJy++)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = (double)K * ((double)wiMaxHValue - (double)wiMinHValue) / (double)wiMinHValue;
|
||
|
||
Y = wJy + (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
|
||
K = 0;
|
||
for(wJy = wiMinPixelCount; wJy > 0; wJy--)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = (double)K * ((double)wiMaxHValue - (double)wiMinHValue) / (double)wiMinHValue;
|
||
|
||
Y = wJy - (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
|
||
}
|
||
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = pImage2[i];
|
||
}
|
||
*/
|
||
/*
|
||
L = 0;
|
||
for(wIx = 1441; wIx < 2882; wIx++)
|
||
{
|
||
L = L + 1;
|
||
wdXvaule = L * (180 - 170) / 170;
|
||
|
||
X = wIx + (int)wdXvaule;
|
||
|
||
K = 0;
|
||
for(wJy = 1441; wJy < 2882; wJy++)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = K * (180 - 170) / 170;
|
||
|
||
Y = wJy + (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
|
||
K = 0;
|
||
for(wJy = 1441; wJy > 0; wJy--)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = K * (180 - 170) / 170;
|
||
|
||
Y = wJy - (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
|
||
}
|
||
|
||
L = 0;
|
||
for(wIx = 1441; wIx > 0; wIx--)
|
||
{
|
||
L = L + 1;
|
||
wdXvaule = L * (180 - 170) / 170;
|
||
|
||
X = wIx - (int)wdXvaule;
|
||
|
||
K = 0;
|
||
for(wJy = 1441; wJy < 2882; wJy++)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = K * (180 - 170) / 170;
|
||
|
||
Y = wJy + (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
|
||
K = 0;
|
||
for(wJy = 1441; wJy > 0; wJy--)
|
||
{
|
||
K = K + 1;
|
||
wdYvaule = K * (180 - 170) / 170;
|
||
|
||
Y = wJy - (int)wdYvaule;
|
||
|
||
pImage2[wIx + wJy * 3052] = pImage[X + Y * 3052];
|
||
}
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = pImage2[i];
|
||
}
|
||
*/
|
||
|
||
|
||
//<2F><><EFBFBD>ö<EFBFBD><C3B6>þ<EFBFBD> <20><><EFBFBD><EFBFBD> start --------------------------------------------------------
|
||
/*
|
||
int wIx, wJx;
|
||
|
||
for(wIx = 1; wIx < IMAGE_SIZE_X - 1; wIx++)
|
||
{
|
||
for(wJx = 1; wJx < IMAGE_SIZE_Y - 1; wJx++)
|
||
{
|
||
pImage2[wIx + wJx * 3072] = pImage[wIx + wJx * 3072] * 2
|
||
// - pImage[wIx-1 + (wJx - 1) * 3072]
|
||
- pImage[wIx + (wJx - 1) * 3072]
|
||
// - pImage[wIx+1 + (wJx - 1) * 3072]
|
||
- pImage[wIx-1 + (wJx - 0) * 3072]
|
||
- pImage[wIx+1 + (wJx - 0) * 3072]
|
||
// - pImage[wIx-1 + (wJx + 1) * 3072]
|
||
- pImage[wIx + (wJx + 1) * 3072];
|
||
// - pImage[wIx+1 + (wJx + 1) * 3072];
|
||
}
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = pImage2[i];
|
||
}
|
||
*/
|
||
//<2F><><EFBFBD>ö<EFBFBD><C3B6>þ<EFBFBD> <20><><EFBFBD><EFBFBD> end----------------------------------------------------------
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>þ<EFBFBD> <20><><EFBFBD><EFBFBD> start --------------------------------------------------------
|
||
/*
|
||
double sigma = 0.7;
|
||
double PI = 3.14;
|
||
|
||
int x;
|
||
|
||
int wIx, wJx;
|
||
|
||
int dim = (int)max(3.0, 2*4*sigma + 1.0);
|
||
if(dim % 2 == 0) dim++;
|
||
int dim2 = (int) dim/2;
|
||
|
||
double sum1, sum2;
|
||
|
||
// double * wpMask = new double[dim];
|
||
double wpMask[9];
|
||
for(i = 0; i < dim; i++)
|
||
{
|
||
x = i - dim2;
|
||
wpMask[i] = exp(-(x*x)/(2*sigma*sigma))/(sqrt(2*PI)*sigma);
|
||
}
|
||
|
||
i = j = k = 0;
|
||
|
||
for(wIx = 0; wIx < IMAGE_SIZE_X; wIx++)
|
||
{
|
||
for(wJx = 0; wJx < IMAGE_SIZE_Y; wJx++)
|
||
{
|
||
// if(i == 5 && j == 5) AfxMessageBox("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||
|
||
sum1 = sum2 = 0.0;
|
||
|
||
k = 0;
|
||
for(i = max(0,wIx-1) ; i <= min(wIx+1,IMAGE_SIZE_X); i++)
|
||
{
|
||
for(j = max(0,wJx-1) ; j <= min(wJx+1,IMAGE_SIZE_Y); j++)
|
||
{
|
||
sum1 +=wpMask[k];
|
||
sum2 +=(wpMask[k] * pImage[i + j * 3072]);
|
||
k += 1;
|
||
|
||
}
|
||
}
|
||
pImage2[wIx + wJx * 3072] = (sum2/sum1);
|
||
}
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = pImage2[i];
|
||
}
|
||
*/
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>þ<EFBFBD> <20><><EFBFBD><EFBFBD> end----------------------------------------------------------
|
||
|
||
|
||
//Normalization start ----------------------------------------------------------
|
||
/*
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue [i] = 0;
|
||
wdSumValue [i] = 0;
|
||
wdNormalizedValue[i] = 0;
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
mpImageValue[pImage[i]] += 1;
|
||
}
|
||
|
||
wdScaleFactor = (double)IMAGE_MAX_VALUE_65535 / (double)(IMAGE_SIZE_X * IMAGE_SIZE_Y);
|
||
|
||
wdSUM = 0;
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
wdSUM = wdSUM + mpImageValue[i];
|
||
|
||
wdSumValue[i] = wdSUM;
|
||
wdNormalizedValue[i] = (int)((double)wdSumValue[i] * wdScaleFactor + 0.5);
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = wdNormalizedValue[pImage[i]]; // / 256;
|
||
}
|
||
|
||
//Normalization start ----------------------------------------------------------
|
||
|
||
miMIN = IMAGE_MAX_VALUE_65535;
|
||
miMAX = 0;
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue [i] = 0;
|
||
mpImageValue22[i] = 0;
|
||
mpImageValue33[i] = 0;
|
||
mpImageValue44[i] = 0;
|
||
mpImageValue55[i] = 0;
|
||
mpImageValue66[i] = 0;
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
mpImageValue[pImage[i]] += 1; //<2F>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>
|
||
}
|
||
|
||
wiAvaiableImageCount = 0;
|
||
// wiImageValue = 0;
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++) // <20>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
if(mpImageValue[i] > 0)
|
||
{
|
||
mpImageValue22[wiAvaiableImageCount] = mpImageValue[i]; //<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
mpImageValue33[wiAvaiableImageCount] = i; //<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
mpImageValue44[wiAvaiableImageCount] = wiAvaiableImageCount;//<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȭ <20>Ѵ<EFBFBD>
|
||
wiAvaiableImageCount = wiAvaiableImageCount + 1;
|
||
}
|
||
}
|
||
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
mpImageValue55[mpImageValue33[i]] = mpImageValue44[i]; //<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = mpImageValue55[pImage[i]];
|
||
}
|
||
|
||
miMIN = 0;
|
||
miMAX = wiAvaiableImageCount;
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)256;
|
||
// pDib[i] = (BYTE)wbDIB;
|
||
|
||
if(wbDIB < 236)
|
||
{
|
||
pDib[i] = (BYTE)wbDIB + 15;
|
||
}
|
||
else
|
||
{
|
||
switch((BYTE)wbDIB)
|
||
{
|
||
case 236 : pDib[i] = (BYTE)251; break;
|
||
case 237 : pDib[i] = (BYTE)251; break;
|
||
case 238 : pDib[i] = (BYTE)251; break;
|
||
case 239 : pDib[i] = (BYTE)251; break;
|
||
case 240 : pDib[i] = (BYTE)252; break;
|
||
case 241 : pDib[i] = (BYTE)252; break;
|
||
case 242 : pDib[i] = (BYTE)252; break;
|
||
case 243 : pDib[i] = (BYTE)252; break;
|
||
case 244 : pDib[i] = (BYTE)253; break;
|
||
case 245 : pDib[i] = (BYTE)253; break;
|
||
case 246 : pDib[i] = (BYTE)253; break;
|
||
case 247 : pDib[i] = (BYTE)253; break;
|
||
case 248 : pDib[i] = (BYTE)254; break;
|
||
case 249 : pDib[i] = (BYTE)254; break;
|
||
case 250 : pDib[i] = (BYTE)254; break;
|
||
case 251 : pDib[i] = (BYTE)254; break;
|
||
case 252 : pDib[i] = (BYTE)255; break;
|
||
case 253 : pDib[i] = (BYTE)255; break;
|
||
case 254 : pDib[i] = (BYTE)255; break;
|
||
case 255 : pDib[i] = (BYTE)255; break;
|
||
case 256 : pDib[i] = (BYTE)255; break;
|
||
}
|
||
}
|
||
}
|
||
*/
|
||
|
||
/*
|
||
double sigma = 1.0;
|
||
double PI = 3.14;
|
||
|
||
int x;
|
||
|
||
int dim = (int)max(3.0, 2*4*sigma + 1.0);
|
||
if(dim % 2 == 0) dim++;
|
||
int dim2 = (int) dim/2;
|
||
|
||
double sum1, sum2;
|
||
|
||
// double * wpMask = new double[dim];
|
||
double wpMask[9];
|
||
for(i = 0; i < dim; i++)
|
||
{
|
||
x = i - dim2;
|
||
wpMask[i] = exp(-(x*x)/(2*sigma*sigma))/(sqrt(2*PI)*sigma);
|
||
}
|
||
|
||
i = j = k = 0;
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X; i++)
|
||
{
|
||
for(j = 0; j < IMAGE_SIZE_Y; j++)
|
||
{
|
||
sum1 = sum2 = 0.0;
|
||
for(k = 0; k < dim; k++)
|
||
{
|
||
x = k - dim2 + j;
|
||
if(x >= 0 && x < IMAGE_SIZE_Y)
|
||
{
|
||
sum1 +=wpMask[k];
|
||
sum2 +=(wpMask[k] * pDib[i * 3072+j]);
|
||
}
|
||
}
|
||
pDib2[i * 3072 +j] = (sum2/sum1);
|
||
}
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pDib[i] = pDib2[i];
|
||
}
|
||
*/
|
||
|
||
// SetTimer( 1, 50 , NULL );
|
||
|
||
// CTestRawViewGraph pDLG(this);
|
||
|
||
// pDLG.DoModal();
|
||
|
||
|
||
//====================================================================================================================
|
||
//####################################################################################################################
|
||
//====================================================================================================================
|
||
|
||
//====================================================================================================================
|
||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<21><><EFBFBD><EFBFBD> <20>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>
|
||
//====================================================================================================================
|
||
/*
|
||
|
||
pBitmapInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
|
||
|
||
pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||
pBitmapInfo->bmiHeader.biWidth = IMAGE_SIZE_X; //500;
|
||
pBitmapInfo->bmiHeader.biHeight = IMAGE_SIZE_Y;//500;
|
||
pBitmapInfo->bmiHeader.biPlanes = 1;
|
||
pBitmapInfo->bmiHeader.biBitCount = 8;
|
||
pBitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||
pBitmapInfo->bmiHeader.biSizeImage = IMAGE_SIZE_X * IMAGE_SIZE_Y; //500*500;
|
||
pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biClrUsed = 0;
|
||
pBitmapInfo->bmiHeader.biClrImportant = 0;
|
||
|
||
for(int i=0; i<256; i++)
|
||
{
|
||
pBitmapInfo->bmiColors[i].rgbRed = i;
|
||
pBitmapInfo->bmiColors[i].rgbGreen = i;
|
||
pBitmapInfo->bmiColors[i].rgbBlue = i;
|
||
pBitmapInfo->bmiColors[i].rgbReserved = 0;
|
||
}
|
||
|
||
hBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*)pBitmapInfo, DIB_RGB_COLORS, (void**)&pDib, NULL, NULL);
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = 0;
|
||
|
||
}
|
||
|
||
FILE *fp;
|
||
// fp = fopen( "Sample.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CSPINE_LAT.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\ABDOMEN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CHEST_LAT.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CHEST_PA_01.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CSPINE_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\ELBOW_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOOT_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\HAND_LAT.raw" , "rb" );
|
||
|
||
//fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\LSPINE_LAT.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\3.raw" , "rb" );
|
||
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_5U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL0_10U_PHAN.raw" , "rb" );
|
||
fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\2.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\Toshiba_60kV_50mA_100ms_5mAs_120SID_Sample_02.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\SHOULDER_LAT.raw" , "rb" );
|
||
|
||
// FD180_SID180_AL0_10U_PHAN
|
||
|
||
|
||
// fread( pImage , 500*500 , sizeof(BYTE) , fp );
|
||
fread( pImage , IMAGE_SIZE_X * IMAGE_SIZE_Y , sizeof(unsigned short) , fp );
|
||
fclose( fp );
|
||
|
||
//Normalization start ----------------------------------------------------------
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue [i] = 0;
|
||
wdSumValue [i] = 0;
|
||
wdNormalizedValue[i] = 0;
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
mpImageValue[pImage[i]] += 1;
|
||
}
|
||
|
||
wdScaleFactor = (double)IMAGE_MAX_VALUE_65535 / (double)(IMAGE_SIZE_X * IMAGE_SIZE_Y);
|
||
|
||
wdSUM = 0;
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
wdSUM = wdSUM + mpImageValue[i];
|
||
|
||
wdSumValue[i] = wdSUM;
|
||
wdNormalizedValue[i] = (int)((double)wdSumValue[i] * wdScaleFactor + 0.5);
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = wdNormalizedValue[pImage[i]]; // / 256;
|
||
}
|
||
|
||
//Normalization start ----------------------------------------------------------
|
||
|
||
miMIN = IMAGE_MAX_VALUE_65535;
|
||
miMAX = 0;
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue [i] = 0;
|
||
mpImageValue22[i] = 0;
|
||
mpImageValue33[i] = 0;
|
||
mpImageValue44[i] = 0;
|
||
mpImageValue55[i] = 0;
|
||
mpImageValue66[i] = 0;
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
mpImageValue[pImage[i]] += 1; //<2F>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>
|
||
}
|
||
|
||
wiAvaiableImageCount = 0;
|
||
// wiImageValue = 0;
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++) // <20>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
if(mpImageValue[i] > 0)
|
||
{
|
||
mpImageValue22[wiAvaiableImageCount] = mpImageValue[i]; //<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
mpImageValue33[wiAvaiableImageCount] = i; //<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
mpImageValue44[wiAvaiableImageCount] = wiAvaiableImageCount;//<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȭ <20>Ѵ<EFBFBD>
|
||
wiAvaiableImageCount = wiAvaiableImageCount + 1;
|
||
}
|
||
}
|
||
|
||
// ufQuickSort(mpImageValue22,mpImageValue44, 0, wiAvaiableImageCount);
|
||
|
||
|
||
//<2F>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>¿<EFBFBD> <20><>Ī<EFBFBD>̵<EFBFBD> <20><><EFBFBD><EFBFBD>-----------------------
|
||
/*
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
j = 0;
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
j = i + 10;
|
||
|
||
if(j > wiAvaiableImageCount)
|
||
{
|
||
j = j - wiAvaiableImageCount;
|
||
}
|
||
mpImageValue66[i] = mpImageValue44[j];
|
||
}
|
||
* /
|
||
/* //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
|
||
j = 0;
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
j = i + 5;
|
||
|
||
if(j >= wiAvaiableImageCount)
|
||
{
|
||
j = j - wiAvaiableImageCount;
|
||
}
|
||
mpImageValue66[j] = mpImageValue44[i];
|
||
}
|
||
|
||
|
||
|
||
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
mpImageValue44[i] = mpImageValue66[i]; //<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
}
|
||
|
||
* /
|
||
//<2F>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>¿<EFBFBD> <20><>Ī<EFBFBD>̵<EFBFBD> <20><>-----------------------
|
||
|
||
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
mpImageValue55[mpImageValue33[i]] = mpImageValue44[i]; //<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
}
|
||
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = mpImageValue55[pImage[i]];
|
||
}
|
||
/ *
|
||
|
||
//==================================================================================
|
||
//==================================================================================
|
||
//==================================================================================
|
||
//==================================================================================
|
||
//==================================================================================
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue [i] = 0;
|
||
mpImageValue22[i] = 0;
|
||
mpImageValue33[i] = 0;
|
||
mpImageValue44[i] = 0;
|
||
mpImageValue55[i] = 0;
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
mpImageValue[pImage[i]] = mpImageValue[pImage[i]] + 1; //<2F>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>
|
||
}
|
||
|
||
wiAvaiableImageCount = 0;
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++) // <20>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
if(mpImageValue[i] > 0)
|
||
{
|
||
mpImageValue22[wiAvaiableImageCount] = mpImageValue[i]; //<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
mpImageValue33[wiAvaiableImageCount] = i; //<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
mpImageValue44[wiAvaiableImageCount] = wiAvaiableImageCount;//<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȭ <20>Ѵ<EFBFBD>
|
||
wiAvaiableImageCount = wiAvaiableImageCount + 1;
|
||
}
|
||
}
|
||
|
||
wiLimitImageValue = 5;
|
||
wiLastAvaiableValue = IMAGE_MAX_VALUE_65535;
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
if(mpImageValue22[i] >= wiLimitImageValue)
|
||
{
|
||
wiLastAvaiableValue = mpImageValue44[i];
|
||
}
|
||
else
|
||
{
|
||
mpImageValue44[i] = wiLastAvaiableValue;
|
||
for(k = i; k < wiAvaiableImageCount; k++)
|
||
{
|
||
if(mpImageValue22[k] >= wiLimitImageValue)
|
||
{
|
||
mpImageValue44[i] = mpImageValue44[k];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
mpImageValue55[mpImageValue33[i]] = mpImageValue44[i]; //<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = mpImageValue55[pImage[i]];
|
||
}
|
||
|
||
* /
|
||
miMIN = 0;
|
||
miMAX = wiAvaiableImageCount;
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)256;
|
||
pDib[i] = (BYTE)wbDIB;
|
||
/ *
|
||
|
||
if(wbDIB < 236)
|
||
{
|
||
pDib[i] = (BYTE)wbDIB + 15;
|
||
}
|
||
else
|
||
{
|
||
switch((BYTE)wbDIB)
|
||
{
|
||
case 236 : pDib[i] = (BYTE)251; break;
|
||
case 237 : pDib[i] = (BYTE)251; break;
|
||
case 238 : pDib[i] = (BYTE)251; break;
|
||
case 239 : pDib[i] = (BYTE)251; break;
|
||
case 240 : pDib[i] = (BYTE)252; break;
|
||
case 241 : pDib[i] = (BYTE)252; break;
|
||
case 242 : pDib[i] = (BYTE)252; break;
|
||
case 243 : pDib[i] = (BYTE)252; break;
|
||
case 244 : pDib[i] = (BYTE)253; break;
|
||
case 245 : pDib[i] = (BYTE)253; break;
|
||
case 246 : pDib[i] = (BYTE)253; break;
|
||
case 247 : pDib[i] = (BYTE)253; break;
|
||
case 248 : pDib[i] = (BYTE)254; break;
|
||
case 249 : pDib[i] = (BYTE)254; break;
|
||
case 250 : pDib[i] = (BYTE)254; break;
|
||
case 251 : pDib[i] = (BYTE)254; break;
|
||
case 252 : pDib[i] = (BYTE)255; break;
|
||
case 253 : pDib[i] = (BYTE)255; break;
|
||
case 254 : pDib[i] = (BYTE)255; break;
|
||
case 255 : pDib[i] = (BYTE)255; break;
|
||
case 256 : pDib[i] = (BYTE)255; break;
|
||
} //switch((BYTE)wbDIB)
|
||
} //if(wbDIB < 236)
|
||
* /
|
||
|
||
}
|
||
|
||
/ *
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue[i] = 0;
|
||
wdSumValue [i] = 0;
|
||
wdNormalizedValue[i] = 0;
|
||
}
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
mpImageValue[pDib[i]] = mpImageValue[pDib[i]] + 1;
|
||
}
|
||
|
||
wdScaleFactor = (double)255 / (double)9437100;
|
||
|
||
wdSumValue[0] = mpImageValue[0];
|
||
wdSUM = 0;
|
||
for(i = 0; i < 255; i++)
|
||
{
|
||
wdSUM = wdSUM + mpImageValue[i];
|
||
|
||
wdSumValue[i] = wdSUM;
|
||
wdNormalizedValue[i] = (int)((double)wdSumValue[i] * wdScaleFactor + 0.5);
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pDib[i] = wdNormalizedValue[pDib[i]]; // / 256;
|
||
}
|
||
* /
|
||
|
||
nThreshold = 1;
|
||
|
||
SetTimer( 1, 50 , NULL );
|
||
|
||
// CTestRawViewGraph pDLG(this);
|
||
|
||
// pDLG.DoModal();
|
||
|
||
|
||
//====================================================================================================================
|
||
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||
//====================================================================================================================
|
||
|
||
|
||
//====================================================================================================================
|
||
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
|
||
//====================================================================================================================
|
||
/*
|
||
|
||
pBitmapInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
|
||
|
||
pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||
pBitmapInfo->bmiHeader.biWidth = IMAGE_SIZE_X; //500;
|
||
pBitmapInfo->bmiHeader.biHeight = IMAGE_SIZE_Y;//500;
|
||
pBitmapInfo->bmiHeader.biPlanes = 1;
|
||
pBitmapInfo->bmiHeader.biBitCount = 8;
|
||
pBitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||
pBitmapInfo->bmiHeader.biSizeImage = IMAGE_SIZE_X * IMAGE_SIZE_Y; //500*500;
|
||
pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biClrUsed = 0;
|
||
pBitmapInfo->bmiHeader.biClrImportant = 0;
|
||
|
||
for(int i=0; i<256; i++)
|
||
{
|
||
pBitmapInfo->bmiColors[i].rgbRed = i;
|
||
pBitmapInfo->bmiColors[i].rgbGreen = i;
|
||
pBitmapInfo->bmiColors[i].rgbBlue = i;
|
||
pBitmapInfo->bmiColors[i].rgbReserved = 0;
|
||
}
|
||
|
||
hBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*)pBitmapInfo, DIB_RGB_COLORS, (void**)&pDib, NULL, NULL);
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = 0;
|
||
|
||
}
|
||
|
||
FILE *fp;
|
||
// fp = fopen( "Sample.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CSPINE_LAT.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\ABDOMEN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CHEST_LAT.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CHEST_PA_01.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\CSPINE_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\ELBOW_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOOT_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\HAND_LAT.raw" , "rb" );
|
||
|
||
//fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\LSPINE_LAT.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOREARM_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\3.raw" , "rb" );
|
||
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_5U_PHAN.raw" , "rb" );
|
||
fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL0_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\2.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\Toshiba_60kV_50mA_100ms_5mAs_120SID_Sample_02.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\SHOULDER_LAT.raw" , "rb" );
|
||
|
||
// FD180_SID180_AL0_10U_PHAN
|
||
|
||
|
||
// fread( pImage , 500*500 , sizeof(BYTE) , fp );
|
||
fread( pImage , IMAGE_SIZE_X * IMAGE_SIZE_Y , sizeof(unsigned short) , fp );
|
||
fclose( fp );
|
||
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue [i] = 0;
|
||
wdSumValue [i] = 0;
|
||
wdNormalizedValue[i] = 0;
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
mpImageValue[pImage[i]] = mpImageValue[pImage[i]] + 1;
|
||
wdSUM += 1;
|
||
}
|
||
|
||
|
||
wdScaleFactor = (double)IMAGE_MAX_VALUE_65535 / (double) (IMAGE_SIZE_X * IMAGE_SIZE_Y);
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
wdSUM = wdSUM + mpImageValue[i];
|
||
|
||
wdSumValue[i] = wdSUM;
|
||
wdNormalizedValue[i] = (int)((double)wdSumValue[i] * wdScaleFactor + 0.5);
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = wdNormalizedValue[pImage[i]]; // / 256;
|
||
}
|
||
|
||
|
||
miMIN = IMAGE_MAX_VALUE_65535;
|
||
miMAX = 0;
|
||
|
||
|
||
i = j = k = 0;
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue [i] = 0;
|
||
mpImageValue22[i] = 0;
|
||
mpImageValue33[i] = 0;
|
||
mpImageValue44[i] = 0;
|
||
mpImageValue55[i] = 0;
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
mpImageValue[pImage[i]] += 1; //<2F>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>
|
||
}
|
||
|
||
wiAvaiableImageCount = 0;
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++) // <20>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
if(mpImageValue[i] > 0)
|
||
{
|
||
mpImageValue22[wiAvaiableImageCount] = mpImageValue[i]; //<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
mpImageValue33[wiAvaiableImageCount] = i; //<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
mpImageValue44[wiAvaiableImageCount] = wiAvaiableImageCount;//<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȭ <20>Ѵ<EFBFBD>
|
||
|
||
// wiAvaiableImageCount = wiAvaiableImageCount + 50;
|
||
|
||
if(mpImageValue[i] > 80000 || mpImageValue[i] < 80)
|
||
// if(mpImageValue[i] > 100000)
|
||
{
|
||
wiAvaiableImageCount = wiAvaiableImageCount + 3;
|
||
}
|
||
else
|
||
{
|
||
wiAvaiableImageCount = wiAvaiableImageCount + 1;
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
wiLimitImageValue = 0;
|
||
wiLastAvaiableValue = IMAGE_MAX_VALUE_65535;
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
if(mpImageValue22[i] >= wiLimitImageValue)
|
||
{
|
||
wiLastAvaiableValue = mpImageValue44[i];
|
||
}
|
||
else
|
||
{
|
||
mpImageValue44[i] = wiLastAvaiableValue;
|
||
for(k = i; k < wiAvaiableImageCount; k++)
|
||
{
|
||
if(mpImageValue22[k] >= wiLimitImageValue)
|
||
{
|
||
mpImageValue44[i] = mpImageValue44[k];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
mpImageValue55[mpImageValue33[i]] = mpImageValue44[i]; //<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
}
|
||
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = mpImageValue55[pImage[i]];
|
||
}
|
||
|
||
|
||
|
||
/ *
|
||
|
||
//==================================================================================
|
||
//==================================================================================
|
||
//==================================================================================
|
||
//==================================================================================
|
||
//==================================================================================
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue [i] = 0;
|
||
mpImageValue22[i] = 0;
|
||
mpImageValue33[i] = 0;
|
||
mpImageValue44[i] = 0;
|
||
mpImageValue55[i] = 0;
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
mpImageValue[pImage[i]] = mpImageValue[pImage[i]] + 1; //<2F>̹<EFBFBD><CCB9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>
|
||
}
|
||
|
||
wiAvaiableImageCount = 0;
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++) // <20>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
{
|
||
if(mpImageValue[i] > 0)
|
||
{
|
||
mpImageValue22[wiAvaiableImageCount] = mpImageValue[i]; //<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
mpImageValue33[wiAvaiableImageCount] = i; //<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȼ<EFBFBD><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <20>̻<EFBFBD><CCBB>ΰ<CEB0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
mpImageValue44[wiAvaiableImageCount] = wiAvaiableImageCount;//<2F>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȭ <20>Ѵ<EFBFBD>
|
||
wiAvaiableImageCount = wiAvaiableImageCount + 1;
|
||
}
|
||
}
|
||
|
||
wiLimitImageValue = 5;
|
||
wiLastAvaiableValue = IMAGE_MAX_VALUE_65535;
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
if(mpImageValue22[i] >= wiLimitImageValue)
|
||
{
|
||
wiLastAvaiableValue = mpImageValue44[i];
|
||
}
|
||
else
|
||
{
|
||
mpImageValue44[i] = wiLastAvaiableValue;
|
||
for(k = i; k < wiAvaiableImageCount; k++)
|
||
{
|
||
if(mpImageValue22[k] >= wiLimitImageValue)
|
||
{
|
||
mpImageValue44[i] = mpImageValue44[k];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
for(i = 0; i < wiAvaiableImageCount; i++)
|
||
{
|
||
mpImageValue55[mpImageValue33[i]] = mpImageValue44[i]; //<2F><><EFBFBD>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD>
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pImage[i] = mpImageValue55[pImage[i]];
|
||
}
|
||
|
||
* /
|
||
miMIN = 0;
|
||
miMAX = wiAvaiableImageCount;
|
||
|
||
// miMIN = k;
|
||
// miMAX = j + k;
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)256;
|
||
// pDib[i] = (BYTE)wbDIB;
|
||
|
||
|
||
if(wbDIB < 236)
|
||
{
|
||
pDib[i] = (BYTE)wbDIB + 15;
|
||
}
|
||
else
|
||
{
|
||
switch((BYTE)wbDIB)
|
||
{
|
||
case 236 : pDib[i] = (BYTE)251; break;
|
||
case 237 : pDib[i] = (BYTE)251; break;
|
||
case 238 : pDib[i] = (BYTE)251; break;
|
||
case 239 : pDib[i] = (BYTE)251; break;
|
||
case 240 : pDib[i] = (BYTE)252; break;
|
||
case 241 : pDib[i] = (BYTE)252; break;
|
||
case 242 : pDib[i] = (BYTE)252; break;
|
||
case 243 : pDib[i] = (BYTE)252; break;
|
||
case 244 : pDib[i] = (BYTE)253; break;
|
||
case 245 : pDib[i] = (BYTE)253; break;
|
||
case 246 : pDib[i] = (BYTE)253; break;
|
||
case 247 : pDib[i] = (BYTE)253; break;
|
||
case 248 : pDib[i] = (BYTE)254; break;
|
||
case 249 : pDib[i] = (BYTE)254; break;
|
||
case 250 : pDib[i] = (BYTE)254; break;
|
||
case 251 : pDib[i] = (BYTE)254; break;
|
||
case 252 : pDib[i] = (BYTE)255; break;
|
||
case 253 : pDib[i] = (BYTE)255; break;
|
||
case 254 : pDib[i] = (BYTE)255; break;
|
||
case 255 : pDib[i] = (BYTE)255; break;
|
||
case 256 : pDib[i] = (BYTE)255; break;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
/ *
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue[i] = 0;
|
||
wdSumValue [i] = 0;
|
||
wdNormalizedValue[i] = 0;
|
||
}
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
mpImageValue[pDib[i]] = mpImageValue[pDib[i]] + 1;
|
||
}
|
||
|
||
wdScaleFactor = (double)255 / (double)9437100;
|
||
|
||
wdSumValue[0] = mpImageValue[0];
|
||
wdSUM = 0;
|
||
for(i = 0; i < 255; i++)
|
||
{
|
||
wdSUM = wdSUM + mpImageValue[i];
|
||
|
||
wdSumValue[i] = wdSUM;
|
||
wdNormalizedValue[i] = (int)((double)wdSumValue[i] * wdScaleFactor + 0.5);
|
||
}
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
pDib[i] = wdNormalizedValue[pDib[i]]; // / 256;
|
||
}
|
||
* /
|
||
|
||
nThreshold = 1;
|
||
|
||
SetTimer( 1, 50 , NULL );
|
||
|
||
// CTestRawViewGraph pDLG(this);
|
||
|
||
// pDLG.DoModal();
|
||
|
||
|
||
//====================================================================================================================
|
||
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
|
||
//====================================================================================================================
|
||
|
||
|
||
|
||
/*
|
||
pBitmapInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
|
||
|
||
pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||
pBitmapInfo->bmiHeader.biWidth = 3072; //500;
|
||
pBitmapInfo->bmiHeader.biHeight = 3072;//500;
|
||
pBitmapInfo->bmiHeader.biPlanes = 1;
|
||
pBitmapInfo->bmiHeader.biBitCount = 8;
|
||
pBitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||
pBitmapInfo->bmiHeader.biSizeImage = 3072 * 3072; //500*500;
|
||
pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biClrUsed = 0;
|
||
pBitmapInfo->bmiHeader.biClrImportant = 0;
|
||
|
||
for(int i=0; i<256; i++)
|
||
{
|
||
pBitmapInfo->bmiColors[i].rgbRed = i;
|
||
pBitmapInfo->bmiColors[i].rgbGreen = i;
|
||
pBitmapInfo->bmiColors[i].rgbBlue = i;
|
||
pBitmapInfo->bmiColors[i].rgbReserved = 0;
|
||
}
|
||
|
||
hBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*)pBitmapInfo, DIB_RGB_COLORS, (void**)&pDib, NULL, NULL);
|
||
|
||
pImage = new unsigned short[3072 * 3072];//[500*500];
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
pImage[i] = 0;
|
||
|
||
}
|
||
|
||
FILE *fp;
|
||
// fp = fopen( "Sample.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\1.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD150_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOOT_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_5U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL0_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\HAND_AP.raw" , "rb" );
|
||
fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\Toshiba_60kV_50mA_100ms_5mAs_120SID_Sample_02.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// FD180_SID180_AL0_10U_PHAN
|
||
|
||
|
||
// fread( pImage , 500*500 , sizeof(BYTE) , fp );
|
||
fread( pImage , 3072 * 3072 , sizeof(unsigned short) , fp );
|
||
fclose( fp );
|
||
|
||
miMIN = IMAGE_MAX_VALUE_65535;
|
||
miMAX = 0;
|
||
|
||
double wdScaleFactor;
|
||
|
||
int i, j, k;
|
||
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue[i] = 0;
|
||
wdSumValue [i] = 0;
|
||
wdNormalizedValue[i] = 0;
|
||
}
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
mpImageValue[pImage[i]] = mpImageValue[pImage[i]] + 1;
|
||
}
|
||
|
||
wdScaleFactor = (double)IMAGE_MAX_VALUE_65535 / (double)9437100;
|
||
|
||
wdSumValue[0] = mpImageValue[0];
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
wdSumValue[i+1] = wdSumValue[i] + mpImageValue[i];
|
||
|
||
wdNormalizedValue[i+1] = (int)((double)wdSumValue[i+1] * wdScaleFactor + 0.5);
|
||
}
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
pImage[i] = wdNormalizedValue[pImage[i]]; // / 256;
|
||
}
|
||
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue[i] = 0;
|
||
}
|
||
|
||
for(i = 20; i < 3052; i++)
|
||
{
|
||
for(j = 20; j < 3052; j++)
|
||
{
|
||
k = i * 3072 + j;
|
||
if(pImage[k] < miMIN) miMIN = pImage[k];
|
||
if(pImage[k] > miMAX) miMAX = pImage[k];
|
||
}
|
||
}
|
||
|
||
double wbDIB;
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)256;
|
||
pDib[i] = (BYTE)wbDIB;
|
||
}
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue[i] = 0;
|
||
wdSumValue [i] = 0;
|
||
wdNormalizedValue[i] = 0;
|
||
}
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
mpImageValue[pDib[i]] = mpImageValue[pDib[i]] + 1;
|
||
}
|
||
|
||
nThreshold = 1;
|
||
|
||
SetTimer( 1, 50 , NULL );
|
||
|
||
CTestRawViewGraph pDLG(this);
|
||
|
||
pDLG.DoModal();
|
||
*/
|
||
/*
|
||
pBitmapInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
|
||
|
||
pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||
pBitmapInfo->bmiHeader.biWidth = 3072; //500;
|
||
pBitmapInfo->bmiHeader.biHeight = 3072;//500;
|
||
pBitmapInfo->bmiHeader.biPlanes = 1;
|
||
pBitmapInfo->bmiHeader.biBitCount = 8;
|
||
pBitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||
pBitmapInfo->bmiHeader.biSizeImage = 3072 * 3072; //500*500;
|
||
pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biClrUsed = 0;
|
||
pBitmapInfo->bmiHeader.biClrImportant = 0;
|
||
|
||
for(int i=0; i<256; i++)
|
||
{
|
||
pBitmapInfo->bmiColors[i].rgbRed = i;
|
||
pBitmapInfo->bmiColors[i].rgbGreen = i;
|
||
pBitmapInfo->bmiColors[i].rgbBlue = i;
|
||
pBitmapInfo->bmiColors[i].rgbReserved = 0;
|
||
}
|
||
|
||
hBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*)pBitmapInfo, DIB_RGB_COLORS, (void**)&pDib, NULL, NULL);
|
||
|
||
pImage = new unsigned short[3072 * 3072];//[500*500];
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
pImage[i] = 0;
|
||
|
||
}
|
||
|
||
FILE *fp;
|
||
// fp = fopen( "Sample.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\1.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD150_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOOT_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_5U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL0_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\HAND_AP.raw" , "rb" );
|
||
fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\Toshiba_60kV_50mA_100ms_5mAs_120SID_Sample_02.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// FD180_SID180_AL0_10U_PHAN
|
||
|
||
|
||
// fread( pImage , 500*500 , sizeof(BYTE) , fp );
|
||
fread( pImage , 3072 * 3072 , sizeof(unsigned short) , fp );
|
||
fclose( fp );
|
||
|
||
int miMIN = IMAGE_MAX_VALUE_65535;
|
||
int miMAX = 0;
|
||
|
||
double wdScaleFactor;
|
||
|
||
int i, j, k;
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue[i] = 0;
|
||
}
|
||
|
||
for(i = 20; i < 3052; i++)
|
||
{
|
||
for(j = 20; j < 3052; j++)
|
||
{
|
||
k = i * 3072 + j;
|
||
if(pImage[k] < miMIN) miMIN = pImage[k];
|
||
if(pImage[k] > miMAX) miMAX = pImage[k];
|
||
}
|
||
}
|
||
|
||
double wbDIB;
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)256;
|
||
pDib[i] = (BYTE)wbDIB;
|
||
}
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
mpImageValue[pDib[i]] = mpImageValue[pDib[i]] + 1;
|
||
}
|
||
|
||
wdScaleFactor = (double)255 / (double)9437100;
|
||
|
||
wdSumValue[0] = mpImageValue[0];
|
||
for(i = 0; i < 255; i++)
|
||
{
|
||
wdSumValue[i+1] = wdSumValue[i] + mpImageValue[i];
|
||
|
||
wdNormalizedValue[i+1] = (int)((double)wdSumValue[i+1] * wdScaleFactor + 0.5);
|
||
}
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
pDib[i] = wdNormalizedValue[pDib[i]]; // / 256;
|
||
}
|
||
|
||
|
||
|
||
nThreshold = 1;
|
||
|
||
SetTimer( 1, 50 , NULL );
|
||
|
||
CTestRawViewGraph pDLG(this);
|
||
|
||
pDLG.DoModal();
|
||
*/
|
||
//===============================================================================================
|
||
|
||
/*
|
||
pBitmapInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
|
||
|
||
pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||
pBitmapInfo->bmiHeader.biWidth = 2304;
|
||
pBitmapInfo->bmiHeader.biHeight = 3200;
|
||
pBitmapInfo->bmiHeader.biPlanes = 1;
|
||
pBitmapInfo->bmiHeader.biBitCount = 8;
|
||
pBitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||
pBitmapInfo->bmiHeader.biSizeImage = 2304*3200;
|
||
pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biClrUsed = 0;
|
||
pBitmapInfo->bmiHeader.biClrImportant = 0;
|
||
|
||
for(int i=0; i<256; i++)
|
||
{
|
||
pBitmapInfo->bmiColors[i].rgbRed = i;
|
||
pBitmapInfo->bmiColors[i].rgbGreen = i;
|
||
pBitmapInfo->bmiColors[i].rgbBlue = i;
|
||
pBitmapInfo->bmiColors[i].rgbReserved = 0;
|
||
}
|
||
|
||
hBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*)pBitmapInfo, DIB_RGB_COLORS, (void**)&pDib, NULL, NULL);
|
||
|
||
pImage = new unsigned short[2304*3200];
|
||
// pImage = new BYTE[500*500];
|
||
|
||
for(int i = 0; i < 2304 * 3200; i++)
|
||
{
|
||
pImage[i] = 0;
|
||
}
|
||
|
||
FILE *fp;
|
||
// fp = fopen( "Sample.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\1.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD150_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOOT_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_5U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL0_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\HAND_AP.raw" , "rb" );
|
||
fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\LOG_Grid_X_AL_Filter_X_0_6mR_AL_x_11mR_linear.raw" , "rb" );
|
||
|
||
// FD180_SID180_AL0_10U_PHAN
|
||
|
||
|
||
// fread( pImage , 500*500 , sizeof(BYTE) , fp );
|
||
fread( pImage , 2304 * 3200 , sizeof(unsigned short) , fp );
|
||
fclose( fp );
|
||
|
||
miMIN = IMAGE_MAX_VALUE_65535;
|
||
miMAX = 0;
|
||
|
||
int i;
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue[i] = 0;
|
||
}
|
||
|
||
for(i = 0; i < 2304 * 3200; i++)
|
||
{
|
||
if(pImage[i] < miMIN) miMIN = pImage[i];
|
||
if(pImage[i] > miMAX) miMAX = pImage[i];
|
||
|
||
mpImageValue[pImage[i]] = mpImageValue[pImage[i]] + 1;
|
||
}
|
||
|
||
double wbDIB;
|
||
// miMIN = 74;
|
||
// miMAX = 4351;
|
||
|
||
for(int i = 0; i < 2304 * 3200; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)(256);
|
||
pDib[i] = (BYTE)wbDIB;
|
||
}
|
||
|
||
nThreshold = 1;
|
||
|
||
SetTimer( 1, 50 , NULL );
|
||
|
||
CTestRawViewGraph pDLG(this);
|
||
pDLG.DoModal();
|
||
*/
|
||
/*
|
||
pBitmapInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
|
||
|
||
pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||
pBitmapInfo->bmiHeader.biWidth = 3072; //500;
|
||
pBitmapInfo->bmiHeader.biHeight = 3072;//500;
|
||
pBitmapInfo->bmiHeader.biPlanes = 1;
|
||
pBitmapInfo->bmiHeader.biBitCount = 8;
|
||
pBitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||
pBitmapInfo->bmiHeader.biSizeImage = 3072 * 3072; //500*500;
|
||
pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biClrUsed = 0;
|
||
pBitmapInfo->bmiHeader.biClrImportant = 0;
|
||
|
||
for(int i=0; i<256; i++)
|
||
{
|
||
pBitmapInfo->bmiColors[i].rgbRed = i;
|
||
pBitmapInfo->bmiColors[i].rgbGreen = i;
|
||
pBitmapInfo->bmiColors[i].rgbBlue = i;
|
||
pBitmapInfo->bmiColors[i].rgbReserved = 0;
|
||
}
|
||
|
||
hBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*)pBitmapInfo, DIB_RGB_COLORS, (void**)&pDib, NULL, NULL);
|
||
|
||
pImage = new unsigned short[3072 * 3072];//[500*500];
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
pImage[i] = 0;
|
||
pImage[i] = 0;
|
||
|
||
}
|
||
|
||
FILE *fp;
|
||
// fp = fopen( "Sample.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\1.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD150_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOOT_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_5U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL0_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\HAND_AP.raw" , "rb" );
|
||
fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\Toshiba_60kV_50mA_100ms_5mAs_120SID_Sample_02.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// FD180_SID180_AL0_10U_PHAN
|
||
|
||
|
||
// fread( pImage , 500*500 , sizeof(BYTE) , fp );
|
||
fread( pImage , 3072 * 3072 , sizeof(unsigned short) , fp );
|
||
fclose( fp );
|
||
|
||
int miMIN = IMAGE_MAX_VALUE_65535;
|
||
int miMAX = 0;
|
||
|
||
int i, j, k;
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue[i] = 0;
|
||
}
|
||
|
||
for(i = 20; i < 3052; i++)
|
||
{
|
||
for(j = 20; j < 3052; j++)
|
||
{
|
||
k = i * 3072 + j;
|
||
if(pImage[k] < miMIN) miMIN = pImage[k];
|
||
if(pImage[k] > miMAX) miMAX = pImage[k];
|
||
|
||
mpImageValue[pImage[k]] = mpImageValue[pImage[k]] + 1;
|
||
}
|
||
}
|
||
|
||
double wbDIB;
|
||
|
||
for(int i = 0; i < 3072*3072; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)256;
|
||
pDib[i] = (BYTE)wbDIB;
|
||
}
|
||
|
||
nThreshold = 1;
|
||
|
||
SetTimer( 1, 50 , NULL );
|
||
|
||
CTestRawViewGraph pDLG(this);
|
||
|
||
pDLG.DoModal();
|
||
*/
|
||
|
||
// TODO: Add extra initialization here
|
||
/*
|
||
pBitmapInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
|
||
|
||
pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||
pBitmapInfo->bmiHeader.biWidth = 3052; //500;
|
||
pBitmapInfo->bmiHeader.biHeight = 3052;//500;
|
||
pBitmapInfo->bmiHeader.biPlanes = 1;
|
||
pBitmapInfo->bmiHeader.biBitCount = 8;
|
||
pBitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||
pBitmapInfo->bmiHeader.biSizeImage = 3052 * 3052; //500*500;
|
||
pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biClrUsed = 0;
|
||
pBitmapInfo->bmiHeader.biClrImportant = 0;
|
||
|
||
for(int i=0; i<256; i++)
|
||
{
|
||
pBitmapInfo->bmiColors[i].rgbRed = i;
|
||
pBitmapInfo->bmiColors[i].rgbGreen = i;
|
||
pBitmapInfo->bmiColors[i].rgbBlue = i;
|
||
pBitmapInfo->bmiColors[i].rgbReserved = 0;
|
||
}
|
||
|
||
hBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*)pBitmapInfo, DIB_RGB_COLORS, (void**)&pDib, NULL, NULL);
|
||
|
||
pImage = new unsigned short[3052 * 3052];//[500*500];
|
||
|
||
for(int i = 0; i < 3052*3052; i++)
|
||
{
|
||
pImage[i] = 0;
|
||
pImage[i] = 0;
|
||
|
||
}
|
||
|
||
FILE *fp;
|
||
// fp = fopen( "Sample.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\1.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD150_SID180_AL21_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FOOT_AP.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL21_5U_PHAN.raw" , "rb" );
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\FD180_SID180_AL0_10U_PHAN.raw" , "rb" );
|
||
|
||
// fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\HAND_AP.raw" , "rb" );
|
||
fp = fopen( "D:\\DRGEM\\DIAMOND\\RawData\\SHOULDER_AP.raw" , "rb" );
|
||
|
||
// FD180_SID180_AL0_10U_PHAN
|
||
|
||
|
||
// fread( pImage , 500*500 , sizeof(BYTE) , fp );
|
||
fread( pImage , 3052 * 3052 , sizeof(unsigned short) , fp );
|
||
fclose( fp );
|
||
|
||
miMIN = IMAGE_MAX_VALUE_65535;
|
||
miMAX = 0;
|
||
|
||
int i;
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue[i] = 0;
|
||
}
|
||
|
||
for(i = 0; i < 3052*3052; i++)
|
||
{
|
||
if(pImage[i] < miMIN) miMIN = pImage[i];
|
||
if(pImage[i] > miMAX) miMAX = pImage[i];
|
||
|
||
mpImageValue[pImage[i]] = mpImageValue[pImage[i]] + 1;
|
||
}
|
||
|
||
double wbDIB;
|
||
// miMIN = 74;
|
||
// miMAX = 4351;
|
||
|
||
for(int i = 0; i < 3052*3052; i++)
|
||
{
|
||
pDib[i] = pDib[i] + 10;
|
||
}
|
||
|
||
|
||
for(int i = 0; i < 3052*3052; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)(256);
|
||
pDib[i] = (BYTE)wbDIB;
|
||
}
|
||
|
||
|
||
nThreshold = 1;
|
||
|
||
SetTimer( 1, 50 , NULL );
|
||
|
||
CTestRawViewGraph pDLG(this);
|
||
|
||
// pDLG.DoModal();
|
||
*/
|
||
pBitmapInfo = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
|
||
|
||
pBitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||
pBitmapInfo->bmiHeader.biWidth = IMAGE_SIZE_X;//500;
|
||
pBitmapInfo->bmiHeader.biHeight = IMAGE_SIZE_Y;//500;
|
||
pBitmapInfo->bmiHeader.biPlanes = 1;
|
||
pBitmapInfo->bmiHeader.biBitCount = 8;
|
||
pBitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||
pBitmapInfo->bmiHeader.biSizeImage = ((((8 * IMAGE_SIZE_X) + 31) / 32) * 4) * IMAGE_SIZE_Y; //500*500;
|
||
pBitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||
pBitmapInfo->bmiHeader.biClrUsed = 0;
|
||
pBitmapInfo->bmiHeader.biClrImportant = 0;
|
||
|
||
for(int i=0; i<256; i++)
|
||
{
|
||
pBitmapInfo->bmiColors[i].rgbRed = i;
|
||
pBitmapInfo->bmiColors[i].rgbGreen = i;
|
||
pBitmapInfo->bmiColors[i].rgbBlue = i;
|
||
pBitmapInfo->bmiColors[i].rgbReserved = 0;
|
||
}
|
||
|
||
hBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*)pBitmapInfo, DIB_RGB_COLORS, (void**)&pDib, NULL, NULL);
|
||
|
||
pImage = new unsigned short[3072 * 3072 * 2];//[500*500];
|
||
|
||
ZeroMemory(pImage, IMAGE_SIZE_X*IMAGE_SIZE_Y*2);
|
||
|
||
//for(int i = 0; i < 3072*3072; i++)
|
||
//{
|
||
// pImage[i] = 0;
|
||
// pImage[i] = 0;
|
||
|
||
//}
|
||
|
||
for(i = 0; i < IMAGE_MAX_VALUE_65535; i++)
|
||
{
|
||
mpImageValue[i] = 0;
|
||
}
|
||
|
||
FILE *fp;
|
||
fp = fopen( "test.raw" , "rb" );
|
||
|
||
fread( pImage , sizeof(WORD) , IMAGE_SIZE_X * IMAGE_SIZE_Y, fp );
|
||
fclose( fp );
|
||
|
||
WORD nMin = 0xFFFF;
|
||
WORD nMax = 0;
|
||
WORD nTemp;
|
||
double dTemp;
|
||
|
||
// min, max Ž<><C5BD>
|
||
WORD *pWord = (WORD *)pImage;
|
||
for (UINT i=0; i<IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
// 2Byte <20><><EFBFBD><EFBFBD>
|
||
nTemp = pWord[i];// >> (16 - Type);
|
||
|
||
if( nTemp > nMax )
|
||
nMax = nTemp;
|
||
if( nTemp < nMin )
|
||
nMin = nTemp;
|
||
|
||
mpImageValue[pWord[i]] = mpImageValue[pWord[i]] + 1;
|
||
}
|
||
|
||
// min, max<61><78> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>
|
||
for (UINT i=0; i<IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
// 2Byte <20><><EFBFBD><EFBFBD>
|
||
nTemp = pWord[i];// >> (16 - Type);
|
||
|
||
dTemp = (((double)nTemp - (double)nMin) / ((double)nMax - (double)nMin)) * 0xFF /*8bit*/;
|
||
|
||
pWord[i] = (WORD)dTemp;
|
||
pDib[i] = (BYTE)pWord[i];
|
||
}
|
||
|
||
|
||
|
||
//memcpy(pDib, pImage, IMAGE_SIZE_X*IMAGE_SIZE_Y);
|
||
|
||
nThreshold = 1;
|
||
|
||
SetTimer( 1, 50 , NULL );
|
||
|
||
CTestRawViewGraph pDLG(this);
|
||
|
||
pDLG.DoModal();
|
||
|
||
return TRUE; // return TRUE unless you set the focus to a control
|
||
}
|
||
|
||
void CTestRawViewerDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||
{
|
||
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
||
{
|
||
CAboutDlg dlgAbout;
|
||
dlgAbout.DoModal();
|
||
}
|
||
else
|
||
{
|
||
CDialog::OnSysCommand(nID, lParam);
|
||
}
|
||
}
|
||
|
||
// If you add a minimize button to your dialog, you will need the code below
|
||
// to draw the icon. For MFC applications using the document/view model,
|
||
// this is automatically done for you by the framework.
|
||
|
||
void CTestRawViewerDlg::OnPaint()
|
||
{
|
||
if (IsIconic())
|
||
{
|
||
CPaintDC dc(this); // device context for painting
|
||
|
||
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
||
|
||
// Center icon in client rectangle
|
||
int cxIcon = GetSystemMetrics(SM_CXICON);
|
||
int cyIcon = GetSystemMetrics(SM_CYICON);
|
||
CRect rect;
|
||
GetClientRect(&rect);
|
||
int x = (rect.Width() - cxIcon + 1) / 2;
|
||
int y = (rect.Height() - cyIcon + 1) / 2;
|
||
|
||
// Draw the icon
|
||
dc.DrawIcon(x, y, m_hIcon);
|
||
}
|
||
else
|
||
{
|
||
CPaintDC dc(this); // device context for painting
|
||
|
||
HDC memDC;
|
||
|
||
if (hBitmap != NULL)
|
||
{
|
||
// ::SetDIBitsToDevice(dc.GetSafeHdc(), 0, 0, 500, 500, 0, 0, 0, 500, pDib, pBitmapInfo, DIB_RGB_COLORS);
|
||
|
||
// ::SetDIBitsToDevice(dc.GetSafeHdc(), 0, 0, 3052, 3052, 0, 0,0, 3052, pDib, pBitmapInfo, DIB_RGB_COLORS);
|
||
|
||
// ::SetDIBitsToDevice(dc.GetSafeHdc(), 0, 0, 1526, 1526, 0, 0,750, 1526, pDib, pBitmapInfo, DIB_RGB_COLORS);
|
||
|
||
// ::SetDIBitsToDevice(dc.GetSafeHdc(), 0, 0, 3072, 3072, 0, 0,0, 3072, pDib, pBitmapInfo, DIB_RGB_COLORS);
|
||
// ::SetDIBitsToDevice(dc.GetSafeHdc(), 0, 0, 3072, 3072, 0, 0,1000, 3072, pDib, pBitmapInfo, DIB_RGB_COLORS);
|
||
|
||
// ::SetDIBitsToDevice(dc.GetSafeHdc(), 0, 0, 3072, 1500, 0, 1500,1500, 1500, pDib, pBitmapInfo, DIB_RGB_COLORS);
|
||
// ::SetDIBitsToDevice(dc.GetSafeHdc(), <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> X<><58>ǥ, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Y<><59>ǥ, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> X<><58> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Y<><59> <20><><EFBFBD><EFBFBD>
|
||
// , <20>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD> X<><58>ǥ, <20>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD> Y<><59>ǥ,<2C>̹<EFBFBD><CCB9><EFBFBD><EFBFBD><EFBFBD> ù<><C3B9>°<EFBFBD><C2B0><EFBFBD>˶<EFBFBD><CBB6>ι<EFBFBD>ȣ, <20>̹<EFBFBD><CCB9><EFBFBD><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>μ<EFBFBD>
|
||
// , pDib, pBitmapInfo, DIB_RGB_COLORS);
|
||
|
||
|
||
::SetStretchBltMode(dc.GetSafeHdc(),HALFTONE);
|
||
::StretchDIBits(dc.GetSafeHdc(), 0, 0, 1024, 1024,0,0,IMAGE_SIZE_X, IMAGE_SIZE_Y, pDib, pBitmapInfo, DIB_RGB_COLORS, SRCCOPY);
|
||
//::StretchDIBits(dc.GetSafeHdc(), 0, 0, 3072, 3072,0,0,IMAGE_SIZE_X, IMAGE_SIZE_Y, pDib, pBitmapInfo, DIB_RGB_COLORS, SRCCOPY);
|
||
// ::StretchDIBits(dc.GetSafeHdc(), 0, 0, 3008, 3072,0,0,3008, 3072, pDib, pBitmapInfo, DIB_RGB_COLORS, SRCCOPY);
|
||
// ::StretchDIBits(dc.GetSafeHdc(), 0, 0, 1024, 1024,0,0,3052, 3052, pDib, pBitmapInfo, DIB_RGB_COLORS, SRCCOPY);
|
||
// ::StretchDIBits(dc.GetSafeHdc(), 0, 0, 1024, 1024,0,0,2304, 3200, pDib, pBitmapInfo, DIB_RGB_COLORS, SRCCOPY);
|
||
|
||
}
|
||
|
||
CDialog::OnPaint();
|
||
}
|
||
}
|
||
|
||
// The system calls this function to obtain the cursor to display while the user drags
|
||
// the minimized window.
|
||
HCURSOR CTestRawViewerDlg::OnQueryDragIcon()
|
||
{
|
||
return static_cast<HCURSOR>(m_hIcon);
|
||
}
|
||
|
||
void CTestRawViewerDlg::OnTimer(UINT nIDEvent)
|
||
{
|
||
/*
|
||
// memcpy( pDib , pImage , 500*500*sizeof(BYTE));
|
||
// memcpy( pDib , pImage , 3072*3072*sizeof(unsigned short));
|
||
// memcpy( pDib , pImage , 3052*3052*sizeof(unsigned short));
|
||
|
||
// for( int i=0 ; i<500*500 ; i++ ) if( pImage[i] < nThreshold ) pDib[i] = 0;
|
||
// for( int i=0 ; i<3072*3072; i++ ) if( pImage[i] < nThreshold ) pDib[i] = 0;
|
||
for( int i=0 ; i<3052*3052; i++ ) if( pImage[i] < nThreshold ) pDib[i] = 0;
|
||
|
||
if( nThreshold >= 255 ) nThreshold = 1;
|
||
else nThreshold += 1;
|
||
*/
|
||
Invalidate(FALSE);
|
||
|
||
CDialog::OnTimer(nIDEvent);
|
||
}
|
||
|
||
void CTestRawViewerDlg::OnBnClickedButton1()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
|
||
double wbDIB;
|
||
BYTE wbTEMP;
|
||
CString wsSTR;
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
wbTEMP = pDib[i] + 1;
|
||
if(wbTEMP >= 0 && wbTEMP < 255)
|
||
{
|
||
pDib[i] = wbTEMP;
|
||
}
|
||
else
|
||
{
|
||
pDib[i] = 254;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
/*
|
||
for(int i = 0; i < 3052*3052; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)(256);
|
||
pDib[i] = (BYTE)wbDIB;
|
||
}
|
||
*/
|
||
// wbTEMP = pDib[100];
|
||
|
||
// wsSTR.Format("%d",wbTEMP);
|
||
// AfxMessageBox(wsSTR);
|
||
|
||
Invalidate(FALSE);
|
||
|
||
}
|
||
|
||
void CTestRawViewerDlg::OnBnClickedButton2()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
/*
|
||
for(int i = 0; i < 3052*3052; i++)
|
||
{
|
||
pDib[i] = 0;
|
||
}
|
||
|
||
Invalidate(FALSE);
|
||
*/
|
||
double wbDIB;
|
||
BYTE wbTEMP;
|
||
CString wsSTR;
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
wbTEMP = pDib[i] - 1;
|
||
if(wbTEMP >= 0 && wbTEMP < 255)
|
||
{
|
||
pDib[i] = wbTEMP;
|
||
}
|
||
else
|
||
{
|
||
pDib[i] = 0;
|
||
}
|
||
|
||
}
|
||
/*
|
||
for(int i = 0; i < 3052*3052; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)(256);
|
||
pDib[i] = (BYTE)wbDIB;
|
||
}
|
||
*/
|
||
// wbTEMP = pDib[100];
|
||
|
||
// wsSTR.Format("%d",wbTEMP);
|
||
// AfxMessageBox(wsSTR);
|
||
|
||
Invalidate(FALSE);
|
||
|
||
|
||
}
|
||
|
||
void CTestRawViewerDlg::OnBnClickedButton3()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
double wbDIB;
|
||
BYTE wbTEMP;
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
wbTEMP = (BYTE)((float)pDib[i] * (float)1.1);
|
||
if(wbTEMP >= 0 && wbTEMP < 250) pDib[i] = wbTEMP;
|
||
}
|
||
/*
|
||
for(int i = 0; i < 3052*3052; i++)
|
||
{
|
||
wbDIB = ((double)(pImage[i] - miMIN) / (double)(miMAX - miMIN) ) * (double)(256);
|
||
pDib[i] = (BYTE)wbDIB;
|
||
}
|
||
*/
|
||
Invalidate(FALSE);
|
||
}
|
||
|
||
|
||
void CTestRawViewerDlg::OnBnClickedButton4()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
|
||
|
||
|
||
unsigned short wiINT;
|
||
|
||
for(int i = 0; i < IMAGE_SIZE_X*IMAGE_SIZE_Y; i++)
|
||
{
|
||
|
||
// wiINT = 256 - pDib[i];
|
||
|
||
|
||
|
||
pDib[i] = -1 * pDib[i];
|
||
|
||
}
|
||
Invalidate(FALSE);
|
||
|
||
}
|
||
|
||
void CTestRawViewerDlg::OnBnClickedButton5()
|
||
{
|
||
// TODO: Add your control notification handler code here
|
||
|
||
|
||
|
||
}
|