commit f160b9adf490c348fba59c7a6ec83a1bf1d4b2ff Author: chodadoo Date: Fri May 21 20:12:29 2021 +0900 1. 최초 커밋 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5f95e29 --- /dev/null +++ b/.gitignore @@ -0,0 +1,371 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*[.json, .xml, .info] + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +### VisualStudio Patch ### +# Additional files built by Visual Studio +*.tlog + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio \ No newline at end of file diff --git a/ReadMe.txt b/ReadMe.txt new file mode 100644 index 0000000..1abe9ff --- /dev/null +++ b/ReadMe.txt @@ -0,0 +1,94 @@ +================================================================================ + MICROSOFT FOUNDATION CLASS LIBRARY : TestRawViewer Project Overview +=============================================================================== + +The application wizard has created this TestRawViewer application for +you. This application not only demonstrates the basics of using the Microsoft +Foundation Classes but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your TestRawViewer application. + +TestRawViewer.vcproj + This is the main project file for VC++ projects generated using an application wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + application wizard. + +TestRawViewer.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CTestRawViewerApp application class. + +TestRawViewer.cpp + This is the main application source file that contains the application + class CTestRawViewerApp. + +TestRawViewer.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. Your project resources are in 1033. + +res\TestRawViewer.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file TestRawViewer.rc. + +res\TestRawViewer.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. + +///////////////////////////////////////////////////////////////////////////// + +The application wizard creates one dialog class: +TestRawViewerDlg.h, TestRawViewerDlg.cpp - the dialog + These files contain your CTestRawViewerDlg class. This class defines + the behavior of your application's main dialog. The dialog's template is + in TestRawViewer.rc, which can be edited in Microsoft Visual C++. +///////////////////////////////////////////////////////////////////////////// + +Other Features: + +ActiveX Controls + The application includes support to use ActiveX controls. + +Printing and Print Preview support + The application wizard has generated code to handle the print, print setup, and print preview + commands by calling member functions in the CView class from the MFC library. +///////////////////////////////////////////////////////////////////////////// + +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named TestRawViewer.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +TestRawViewer.manifest + Application manifest files are used by Windows XP to describe an applications + dependency on specific versions of Side-by-Side assemblies. The loader uses this + information to load the appropriate assembly from the assembly cache or private + from the application. The Application manifest maybe included for redistribution + as an external .manifest file that is installed in the same folder as the application + executable or it may be included in the executable in the form of a resource. +///////////////////////////////////////////////////////////////////////////// + +Other notes: + +The application wizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, and your application is in a +language other than the operating system's current language, you will need +to copy the corresponding localized resources MFC70XXX.DLL from the Microsoft +Visual C++ CD-ROM under the Win\System directory to your computer's system or +system32 directory, and rename it to be MFCLOC.DLL. ("XXX" stands for the +language abbreviation. For example, MFC70DEU.DLL contains resources +translated to German.) If you don't do this, some of the UI elements of +your application will remain in the language of the operating system. + +///////////////////////////////////////////////////////////////////////////// diff --git a/TestRawViewGraph.cpp b/TestRawViewGraph.cpp new file mode 100644 index 0000000..58ccd07 --- /dev/null +++ b/TestRawViewGraph.cpp @@ -0,0 +1,214 @@ +// TestRawViewGraph.cpp : implementation file +// + +#include "stdafx.h" +#include "TestRawViewer.h" +#include "TestRawViewGraph.h" +#include "TestRawViewerDlg.h" + + +// CTestRawViewGraph dialog + +IMPLEMENT_DYNAMIC(CTestRawViewGraph, CDialog) + +CTestRawViewGraph::CTestRawViewGraph(CWnd* pParent /*=NULL*/) + : CDialog(CTestRawViewGraph::IDD, pParent) +{ + +// CTestRawViewerDlg* pBaseWnd = (CTestRawViewerDlg*)AfxGetMainWnd(); + + mistandardWidth = 65535; + mistandardWidth = 3072; +// mistandardWidth = 255; +// mistandardWidth = ((CTestRawViewerDlg * )pParent)->miMAX; + mistandardHeight = 94371; + +} + +CTestRawViewGraph::~CTestRawViewGraph() +{ +} + +void CTestRawViewGraph::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(CTestRawViewGraph, CDialog) + ON_WM_PAINT() + ON_BN_CLICKED(IDC_BUTTON1, &CTestRawViewGraph::OnBnClickedButton1) +END_MESSAGE_MAP() + + +// CTestRawViewGraph message handlers + +BOOL CTestRawViewGraph::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); + } + } + + ::SetWindowPos(GetSafeHwnd(),HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); + + // Hide Application in TaskBar ------------------------ + + ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW); + + + ufDrawGraph(); + + return 0; + +} +BOOL CTestRawViewGraph::ufDrawGraph() +{ + COLORREF bColor; + bColor = RGB(0, 0, 0); + + CRect r; + CRect rect1; + + int wIx, wiXPoint,wiYPoint, X; + + this->GetClientRect(&r); + + CClientDC dc(this); + + CTestRawViewerDlg* pBaseWnd = (CTestRawViewerDlg*)AfxGetMainWnd(); + + mdScreenMappingRateWidth = (double)r.right / (double)mistandardWidth; + mdScreenMappingRateHeight = (double)r.bottom / (double)mistandardHeight; + +// for(wIx = 100; wIx <= 65535; wIx++) + for(wIx = 100; wIx <= 110; wIx++) + { + wiXPoint = (int)((double)wIx * mdScreenMappingRateWidth); + wiYPoint = (int)((double)pBaseWnd->mpImageValue[wIx] * mdScreenMappingRateHeight); + +// if(wiYPoint > 0) dc.SetPixel(wiXPoint, wiYPoint,bColor); +// dc.SetPixel(wiXPoint, wiYPoint,bColor); + dc.SetPixel(wiXPoint, 100,bColor); + + } + + +// dc.SetPixel(100, 100,bColor); +// dc.SetPixel(101, 100,bColor); +// dc.SetPixel(102, 100,bColor); + + + + return TRUE; // return TRUE unless you set the focus to a control +} + +void CTestRawViewGraph::OnPaint() +{ + CPaintDC dc(this); // device context for painting + // TODO: Add your message handler code here + // Do not call CDialog::OnPaint() for painting messages + + + ufDrawGraph(); + +} + +void CTestRawViewGraph::OnBnClickedButton1() +{ + // TODO: Add your control notification handler code here + + CTestRawViewerDlg* pBaseWnd = (CTestRawViewerDlg*)AfxGetMainWnd(); + + this->Invalidate(); + + int wiCNTArea1 = 0; + int wiCNTArea2 = 0; + int wiCNTArea3 = 0; + + int wIx; + + CString wsSTR; + + for(wIx = 0; wIx <= 65535; wIx++) + { +/* + if(pBaseWnd->miImageValue[wIx] > 40000) + { + wiCNTArea1 = wiCNTArea1 + pBaseWnd->miImageValue[wIx]; + } + else + { + wiCNTArea2 = wiCNTArea2 + pBaseWnd->miImageValue[wIx]; + } +*/ + if(wIx > 40000) + { + wiCNTArea1 = wiCNTArea1 + pBaseWnd->mpImageValue[wIx]; + } + else + { + wiCNTArea2 = wiCNTArea2 + pBaseWnd->mpImageValue[wIx]; + } + + + } +/* + wsSTR.Format("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d" + ,pBaseWnd->miImageValue[0] + ,pBaseWnd->miImageValue[1] + ,pBaseWnd->miImageValue[2] + ,pBaseWnd->miImageValue[3] + ,pBaseWnd->miImageValue[4] + ,pBaseWnd->miImageValue[5] + ,pBaseWnd->miImageValue[6] + ,pBaseWnd->miImageValue[7] + ,pBaseWnd->miImageValue[8] + ,pBaseWnd->miImageValue[9] + ,pBaseWnd->miImageValue[10] + ,pBaseWnd->miImageValue[11] + ,pBaseWnd->miImageValue[12] + ,pBaseWnd->miImageValue[13] + ,pBaseWnd->miImageValue[14] + ); + AfxMessageBox(wsSTR); + + wsSTR.Format("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d" + ,pBaseWnd->miSumValue[0] + ,pBaseWnd->miSumValue[1] + ,pBaseWnd->miSumValue[2] + ,pBaseWnd->miSumValue[3] + ,pBaseWnd->miSumValue[4] + ,pBaseWnd->miSumValue[5] + ,pBaseWnd->miSumValue[6] + ,pBaseWnd->miSumValue[7] + ,pBaseWnd->miSumValue[8] + ,pBaseWnd->miSumValue[9] + ,pBaseWnd->miSumValue[10] + ,pBaseWnd->miSumValue[11] + ,pBaseWnd->miSumValue[12] + ,pBaseWnd->miSumValue[13] + ,pBaseWnd->miSumValue[14] + ); +*/ + // wsSTR.Format("wiCNTArea1 = %d, wiCNTArea2 = %d", wiCNTArea1, wiCNTArea2); + + AfxMessageBox(wsSTR); + + +} diff --git a/TestRawViewGraph.h b/TestRawViewGraph.h new file mode 100644 index 0000000..0e01d87 --- /dev/null +++ b/TestRawViewGraph.h @@ -0,0 +1,41 @@ +#pragma once + + +// CTestRawViewGraph dialog + +class CTestRawViewGraph : public CDialog +{ + DECLARE_DYNAMIC(CTestRawViewGraph) + +public: + CTestRawViewGraph(CWnd* pParent = NULL); // standard constructor + virtual ~CTestRawViewGraph(); + + + + int mistandardWidth; + int mistandardHeight; + + int miScreenWidth ; + int miScreenHeight; + + double mdScreenMappingRateWidth ; + double mdScreenMappingRateHeight; + + BOOL ufDrawGraph(); + + +// Dialog Data + enum { IDD = IDD_DIALOG_GRAPH }; + +protected: + + virtual BOOL OnInitDialog(); + + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnPaint(); + afx_msg void OnBnClickedButton1(); +}; diff --git a/TestRawViewer.cpp b/TestRawViewer.cpp new file mode 100644 index 0000000..b111d70 --- /dev/null +++ b/TestRawViewer.cpp @@ -0,0 +1,73 @@ +// TestRawViewer.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "TestRawViewer.h" +#include "TestRawViewerDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CTestRawViewerApp + +BEGIN_MESSAGE_MAP(CTestRawViewerApp, CWinApp) + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + + +// CTestRawViewerApp construction + +CTestRawViewerApp::CTestRawViewerApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + + +// The one and only CTestRawViewerApp object + +CTestRawViewerApp theApp; + + +// CTestRawViewerApp initialization + +BOOL CTestRawViewerApp::InitInstance() +{ + // InitCommonControls() is required on Windows XP if an application + // manifest specifies use of ComCtl32.dll version 6 or later to enable + // visual styles. Otherwise, any window creation will fail. + InitCommonControls(); + + CWinApp::InitInstance(); + + AfxEnableControlContainer(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need + // Change the registry key under which our settings are stored + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + CTestRawViewerDlg dlg; + m_pMainWnd = &dlg; + INT_PTR nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + // TODO: Place code here to handle when the dialog is + // dismissed with OK + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} diff --git a/TestRawViewer.h b/TestRawViewer.h new file mode 100644 index 0000000..435c1d0 --- /dev/null +++ b/TestRawViewer.h @@ -0,0 +1,31 @@ +// TestRawViewer.h : main header file for the PROJECT_NAME application +// + +#pragma once + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + + +// CTestRawViewerApp: +// See TestRawViewer.cpp for the implementation of this class +// + +class CTestRawViewerApp : public CWinApp +{ +public: + CTestRawViewerApp(); + +// Overrides + public: + virtual BOOL InitInstance(); + +// Implementation + + DECLARE_MESSAGE_MAP() +}; + +extern CTestRawViewerApp theApp; \ No newline at end of file diff --git a/TestRawViewer.rc b/TestRawViewer.rc new file mode 100644 index 0000000..e82b268 --- /dev/null +++ b/TestRawViewer.rc @@ -0,0 +1,247 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Korean resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR) +#ifdef _WIN32 +LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT +#pragma code_page(949) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""res\\TestRawViewer.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON "res\\TestRawViewer.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG_GRAPH DIALOGEX 0, 0, 630, 394 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_OVERLAPPEDWINDOW +CAPTION "Dialog" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,519,373,50,14 + PUSHBUTTON "Cancel",IDCANCEL,573,373,50,14 + PUSHBUTTON "Button1",IDC_BUTTON1,450,366,61,21 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_DIALOG_GRAPH, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 623 + TOPMARGIN, 7 + BOTTOMMARGIN, 387 + END +END +#endif // APSTUDIO_INVOKED + +#endif // Korean resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About TestRawViewer" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 + LTEXT "TestRawViewer Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC,40,25,119,8 + DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP +END + +IDD_TESTRAWVIEWER_DIALOG DIALOGEX 0, 0, 610, 410 +STYLE DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_APPWINDOW +CAPTION "TestRawViewer" +FONT 8, "????????", 400, 0, 0x81 +BEGIN + PUSHBUTTON "+",IDC_BUTTON1,526,7,77,37 + PUSHBUTTON "-",IDC_BUTTON2,526,50,77,37 + PUSHBUTTON "Button3",IDC_BUTTON3,526,94,77,37 + PUSHBUTTON "REVERSE IMAGE",IDC_BUTTON4,526,138,77,37 + PUSHBUTTON "Button5",IDC_BUTTON5,528,181,77,37 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "TODO: " + VALUE "FileDescription", "TODO: " + VALUE "FileVersion", "1.0.0.1" + VALUE "InternalName", "TestRawViewer.exe" + VALUE "LegalCopyright", "TODO: (c) . All rights reserved." + VALUE "OriginalFilename", "TestRawViewer.exe" + VALUE "ProductName", "TODO: " + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 228 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END + + IDD_TESTRAWVIEWER_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 603 + TOPMARGIN, 7 + BOTTOMMARGIN, 403 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_ABOUTBOX "&About TestRawViewer..." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) +#include "res\TestRawViewer.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/TestRawViewer.sln b/TestRawViewer.sln new file mode 100644 index 0000000..1802fda --- /dev/null +++ b/TestRawViewer.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRawViewer", "TestRawViewer.vcxproj", "{62C55E61-DE8A-48ED-A605-3F91E60B246A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {62C55E61-DE8A-48ED-A605-3F91E60B246A}.Debug|Win32.ActiveCfg = Debug|Win32 + {62C55E61-DE8A-48ED-A605-3F91E60B246A}.Debug|Win32.Build.0 = Debug|Win32 + {62C55E61-DE8A-48ED-A605-3F91E60B246A}.Release|Win32.ActiveCfg = Release|Win32 + {62C55E61-DE8A-48ED-A605-3F91E60B246A}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/TestRawViewer.suo.old b/TestRawViewer.suo.old new file mode 100644 index 0000000..8678e27 Binary files /dev/null and b/TestRawViewer.suo.old differ diff --git a/TestRawViewer.vcproj b/TestRawViewer.vcproj new file mode 100644 index 0000000..3395cc7 --- /dev/null +++ b/TestRawViewer.vcproj @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TestRawViewer.vcxproj b/TestRawViewer.vcxproj new file mode 100644 index 0000000..d859918 --- /dev/null +++ b/TestRawViewer.vcxproj @@ -0,0 +1,159 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Template + Win32 + + + + {62C55E61-DE8A-48ED-A605-3F91E60B246A} + TestRawViewer + MFCProj + + + + Application + Dynamic + MultiByte + v142 + + + Application + Dynamic + MultiByte + v142 + + + v142 + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + Debug\ + Debug\ + true + Release\ + Release\ + false + + + + _DEBUG;%(PreprocessorDefinitions) + false + + + Disabled + WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + Use + Level3 + EditAndContinue + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + + + true + Windows + 10000000 + false + + + MachineX86 + + + + + NDEBUG;%(PreprocessorDefinitions) + false + + + WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) + false + MultiThreadedDLL + true + Use + Level3 + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + + + true + Windows + 0 + 0 + 999999999 + 0 + true + true + false + + + MachineX86 + + + + + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TestRawViewer.vcxproj.filters b/TestRawViewer.vcxproj.filters new file mode 100644 index 0000000..d089f3e --- /dev/null +++ b/TestRawViewer.vcxproj.filters @@ -0,0 +1,65 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx + + + + + 소스 파일 + + + 소스 파일 + + + 소스 파일 + + + 소스 파일 + + + + + 헤더 파일 + + + 헤더 파일 + + + 헤더 파일 + + + 헤더 파일 + + + 헤더 파일 + + + + + 리소스 파일 + + + 리소스 파일 + + + + + + 리소스 파일 + + + + + + \ No newline at end of file diff --git a/TestRawViewerDlg.cpp b/TestRawViewerDlg.cpp new file mode 100644 index 0000000..c92cdc3 --- /dev/null +++ b/TestRawViewerDlg.cpp @@ -0,0 +1,2376 @@ +// 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\\\\20121127\\DIAMOND\\DATABASE\\IMAGES\\20121123\\00000064.SR" , "rb" ); +// fp = fopen( "D:\\DRGEM\\\\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\\ġCD_纻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]; + } +*/ + + +//öþ ͸ 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]; + } +*/ +//öþ ͸ end---------------------------------------------------------- + +//þ ͸ 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(""); + + 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]; + } +*/ +//þ ͸ 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; //̹ ȼ Ѵ + } + + wiAvaiableImageCount = 0; +// wiImageValue = 0; + for(i = 0; i < IMAGE_MAX_VALUE_65535; i++) // ̹ ȼ 0 ̻ΰ͸ + { + if(mpImageValue[i] > 0) + { + mpImageValue22[wiAvaiableImageCount] = mpImageValue[i]; //̹ ȼ 0 ̻ΰ͸ //̹ + mpImageValue33[wiAvaiableImageCount] = i; //̹ ȼ 0 ̻ΰ͸ //̹ + mpImageValue44[wiAvaiableImageCount] = wiAvaiableImageCount;//̹ ȭ Ѵ + wiAvaiableImageCount = wiAvaiableImageCount + 1; + } + } + + for(i = 0; i < wiAvaiableImageCount; i++) + { + mpImageValue55[mpImageValue33[i]] = mpImageValue44[i]; //̹ + } + + 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(); + + +//==================================================================================================================== +//#################################################################################################################### +//==================================================================================================================== + +//==================================================================================================================== +//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!͸ ϱ +//==================================================================================================================== +/* + + 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; //̹ ȼ Ѵ + } + + wiAvaiableImageCount = 0; +// wiImageValue = 0; + for(i = 0; i < IMAGE_MAX_VALUE_65535; i++) // ̹ ȼ 0 ̻ΰ͸ + { + if(mpImageValue[i] > 0) + { + mpImageValue22[wiAvaiableImageCount] = mpImageValue[i]; //̹ ȼ 0 ̻ΰ͸ //̹ + mpImageValue33[wiAvaiableImageCount] = i; //̹ ȼ 0 ̻ΰ͸ //̹ + mpImageValue44[wiAvaiableImageCount] = wiAvaiableImageCount;//̹ ȭ Ѵ + wiAvaiableImageCount = wiAvaiableImageCount + 1; + } + } + +// ufQuickSort(mpImageValue22,mpImageValue44, 0, wiAvaiableImageCount); + + +//̹ ¿ Ī̵ ----------------------- +/* + // + j = 0; + for(i = 0; i < wiAvaiableImageCount; i++) + { + j = i + 10; + + if(j > wiAvaiableImageCount) + { + j = j - wiAvaiableImageCount; + } + mpImageValue66[i] = mpImageValue44[j]; + } +* / +/* // + 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]; //̹ + } + +* / +//̹ ¿ Ī̵ ----------------------- + + + for(i = 0; i < wiAvaiableImageCount; i++) + { + mpImageValue55[mpImageValue33[i]] = mpImageValue44[i]; //̹ + } + + + 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; //̹ ȼ Ѵ + } + + wiAvaiableImageCount = 0; + for(i = 0; i < IMAGE_MAX_VALUE_65535; i++) // ̹ ȼ 0 ̻ΰ͸ + { + if(mpImageValue[i] > 0) + { + mpImageValue22[wiAvaiableImageCount] = mpImageValue[i]; //̹ ȼ 0 ̻ΰ͸ //̹ + mpImageValue33[wiAvaiableImageCount] = i; //̹ ȼ 0 ̻ΰ͸ //̹ + mpImageValue44[wiAvaiableImageCount] = wiAvaiableImageCount;//̹ ȭ Ѵ + 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]; //̹ + } + + 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; //̹ ȼ Ѵ + } + + wiAvaiableImageCount = 0; + for(i = 0; i < IMAGE_MAX_VALUE_65535; i++) // ̹ ȼ 0 ̻ΰ͸ + { + if(mpImageValue[i] > 0) + { + mpImageValue22[wiAvaiableImageCount] = mpImageValue[i]; //̹ ȼ 0 ̻ΰ͸ //̹ + mpImageValue33[wiAvaiableImageCount] = i; //̹ ȼ 0 ̻ΰ͸ //̹ + mpImageValue44[wiAvaiableImageCount] = wiAvaiableImageCount;//̹ ȭ Ѵ + +// 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]; //̹ + } + + + 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; //̹ ȼ Ѵ + } + + wiAvaiableImageCount = 0; + for(i = 0; i < IMAGE_MAX_VALUE_65535; i++) // ̹ ȼ 0 ̻ΰ͸ + { + if(mpImageValue[i] > 0) + { + mpImageValue22[wiAvaiableImageCount] = mpImageValue[i]; //̹ ȼ 0 ̻ΰ͸ //̹ + mpImageValue33[wiAvaiableImageCount] = i; //̹ ȼ 0 ̻ΰ͸ //̹ + mpImageValue44[wiAvaiableImageCount] = wiAvaiableImageCount;//̹ ȭ Ѵ + 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]; //̹ + } + + 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 Ž + WORD *pWord = (WORD *)pImage; + for (UINT i=0; i> (16 - Type); + + if( nTemp > nMax ) + nMax = nTemp; + if( nTemp < nMin ) + nMin = nTemp; + + mpImageValue[pWord[i]] = mpImageValue[pWord[i]] + 1; + } + + // min, max + for (UINT i=0; 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(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(), Xǥ, Yǥ, X , Y + // , ̹ Xǥ, ̹ Yǥ,̹ ù°˶ιȣ, ̹ǽ μ + // , 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(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 + + + +} diff --git a/TestRawViewerDlg.h b/TestRawViewerDlg.h new file mode 100644 index 0000000..e22a58a --- /dev/null +++ b/TestRawViewerDlg.h @@ -0,0 +1,81 @@ +// 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(); +}; diff --git a/res/TestRawViewer.ico b/res/TestRawViewer.ico new file mode 100644 index 0000000..8a84ca3 Binary files /dev/null and b/res/TestRawViewer.ico differ diff --git a/res/TestRawViewer.manifest b/res/TestRawViewer.manifest new file mode 100644 index 0000000..35a2a32 --- /dev/null +++ b/res/TestRawViewer.manifest @@ -0,0 +1,22 @@ + + + +Your app description here + + + + + + diff --git a/res/TestRawViewer.rc2 b/res/TestRawViewer.rc2 new file mode 100644 index 0000000..6562a1a --- /dev/null +++ b/res/TestRawViewer.rc2 @@ -0,0 +1,13 @@ +// +// TestRawViewer.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/resource.h b/resource.h new file mode 100644 index 0000000..0370542 --- /dev/null +++ b/resource.h @@ -0,0 +1,26 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by TestRawViewer.rc +// +#define IDM_ABOUTBOX 0x0010 +#define IDD_ABOUTBOX 100 +#define IDS_ABOUTBOX 101 +#define IDD_TESTRAWVIEWER_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDD_DIALOG_GRAPH 129 +#define IDC_BUTTON1 1000 +#define IDC_BUTTON2 1001 +#define IDC_BUTTON3 1002 +#define IDC_BUTTON4 1003 +#define IDC_BUTTON5 1004 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1005 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/stdafx.cpp b/stdafx.cpp new file mode 100644 index 0000000..6a4cead --- /dev/null +++ b/stdafx.cpp @@ -0,0 +1,7 @@ +// stdafx.cpp : source file that includes just the standard includes +// TestRawViewer.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + diff --git a/stdafx.h b/stdafx.h new file mode 100644 index 0000000..052e873 --- /dev/null +++ b/stdafx.h @@ -0,0 +1,43 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. +#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. +#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#endif + +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. +#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. +#endif + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC Automation classes + +#include // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + + \ No newline at end of file diff --git a/test.raw b/test.raw new file mode 100644 index 0000000..963159d Binary files /dev/null and b/test.raw differ diff --git a/test1.raw b/test1.raw new file mode 100644 index 0000000..6b5146d Binary files /dev/null and b/test1.raw differ