⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frametuning.cpp

📁 3D reconstruction, medical image processing from colons, using intel image processing for based clas
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// FrameTuning.cpp : implementation file//#include "stdafx.h"#include "fusion.h"#include "FrameTuning.h"#include "FusionGlobal.h"#include "Regfunc.h"#include "PresetOTF.h"#include "Histogram.h"#include "BitmapStatic.h"#include "EditInt.h"#include "EditFloat.h"#include "Buttons.h"#include "FMWndVR.h"#include "dicomobject.h"#include <math.h>#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// RxFrameTuningRxFrameTuning::RxFrameTuning(){	m_pHistogramWnd[0]	= NULL;	m_pHistogramWnd[1]	= NULL;	m_pStcThreshold4	= NULL;	m_pEdThreshold1		= NULL;	m_pEdThreshold2		= NULL;	m_pEdThreshold3		= NULL;	m_pEdThreshold4		= NULL;	m_pBtnThreshold		= NULL;	m_pCBPresetOTF		= NULL;	m_pPresetOTF		= NULL;	m_pStcOTF			= NULL;	m_pBtnAddOTF		= NULL;	m_pBtnROI			= NULL;	m_pBtnDelOTF		= NULL;	m_pStcOpacity		= NULL;	m_pEdOpacity		= NULL;	m_pSBCOpacity		= NULL;}RxFrameTuning::~RxFrameTuning(){}BEGIN_MESSAGE_MAP(RxFrameTuning, RxFrameWnd)	//{{AFX_MSG_MAP(RxFrameTuning)	ON_WM_CREATE()	ON_WM_PAINT()	ON_WM_DESTROY()	//}}AFX_MSG_MAP	ON_MESSAGE_VOID(UM_INITIALUPDATE,		OnInitialUpdate)	ON_NOTIFY(OTF_POS_CHANGED,				IDF_TUNING_WND_HISTOGRAM_REF,	OnOTFPosChanged)	ON_NOTIFY(OTF_POS_CHANGED,				IDF_TUNING_WND_HISTOGRAM_FLT,	OnOTFPosChanged)	ON_NOTIFY(OTF_ACTIVE_CHANGED,			IDF_TUNING_WND_HISTOGRAM_REF,	OnOTFActiveChanged)	ON_NOTIFY(OTF_ACTIVE_CHANGED,			IDF_TUNING_WND_HISTOGRAM_FLT,	OnOTFActiveChanged)	ON_NOTIFY(OTF_COLOR_CHANGED,			IDF_TUNING_WND_HISTOGRAM_REF,	OnOTFColorChanged)	ON_NOTIFY(OTF_COLOR_CHANGED,			IDF_TUNING_WND_HISTOGRAM_FLT,	OnOTFColorChanged)	ON_NOTIFY(UDN_DELTAPOS,					IDF_TUNING_SBC_OPACITY,			OnDeltaposSpinOpacity)	ON_NOTIFY(EN_CHANGED_INT,				IDF_TUNING_ED_THRESHOLD1,		OnOTFEditChanged)	ON_NOTIFY(EN_CHANGED_INT,				IDF_TUNING_ED_THRESHOLD2,		OnOTFEditChanged)	ON_NOTIFY(EN_CHANGED_INT,				IDF_TUNING_ED_THRESHOLD3,		OnOTFEditChanged)	ON_NOTIFY(EN_CHANGED_INT,				IDF_TUNING_ED_THRESHOLD4,		OnOTFEditChanged)	ON_NOTIFY(EN_CHANGED_FLOAT,				IDF_TUNING_ED_OPACITY,			OnOpacityEditChanged)	ON_COMMAND(IDF_TUNING_BTN_THRESHOLD,	OnBtnThreshold)	ON_COMMAND(IDF_TUNING_BTN_ADD_OTF,		OnBtnAddOTF)	ON_COMMAND(IDF_TUNING_BTN_DEL_OTF,		OnBtnDelOTF)END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// RxFrameTuning message handlersBOOL RxFrameTuning::PreCreateWindow(CREATESTRUCT& cs) {	cs.dwExStyle |= WS_EX_CLIENTEDGE;		return RxFrameWnd::PreCreateWindow(cs);}void RxFrameTuning::OnInitialUpdate(){	RecalcLayout();	CClientDC	dc(this);	int		nHeight = -((dc.GetDeviceCaps(LOGPIXELSY) * 9) / 74);	m_Font.CreateFont(nHeight, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS,					CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, _T("Tahoma"));	m_pEdThreshold1->SetFont(&m_Font, FALSE);	m_pEdThreshold1->SetRange(-1024, 3071);	m_pEdThreshold2->SetFont(&m_Font, FALSE);	m_pEdThreshold2->SetRange(-1024, 3071);	m_pEdThreshold3->SetFont(&m_Font, FALSE);	m_pEdThreshold3->SetRange(-1024, 3071);	m_pEdThreshold4->SetFont(&m_Font, FALSE);	m_pEdThreshold4->SetRange(-1024, 3071);	m_pCBPresetOTF->SetFont(&m_Font, FALSE);	m_pEdOpacity->SetFont(&m_Font, FALSE);	m_pEdOpacity->SetRange(0.0f, 1.0f);}int RxFrameTuning::OnCreate(LPCREATESTRUCT lpCreateStruct) {	if (RxFrameWnd::OnCreate(lpCreateStruct) == -1)		return -1;	UINT		nStyle = WS_CHILD;	m_pHistogramWnd[0]	= new RxHistogram;	m_pHistogramWnd[0]->Create	(NULL, NULL, nStyle, CRect(0,0,0,0), this, IDF_TUNING_WND_HISTOGRAM_REF);	m_pHistogramWnd[1]	= new RxHistogram;	m_pHistogramWnd[1]->Create	(NULL, NULL, nStyle, CRect(0,0,0,0), this, IDF_TUNING_WND_HISTOGRAM_FLT);{	nStyle	= WS_CHILD;	m_pStcThreshold4	= new RxBitmapStatic;	m_pStcThreshold4->Create	(NULL, NULL, nStyle, CRect(0,0,0,0), this, IDC_STATIC);	m_pStcThreshold4->LoadBitmap(IDB_FTUNING_STC_THRESHOLD4);	nStyle	= WS_CHILD|WS_VISIBLE|WS_BORDER|ES_CENTER;	m_pEdThreshold1		= new RxEditInt;	m_pEdThreshold1->Create(nStyle, CRect( 81,  6,121, 23), m_pStcThreshold4, IDF_TUNING_ED_THRESHOLD1);	m_pEdThreshold2		= new RxEditInt;	m_pEdThreshold2->Create(nStyle, CRect(122,  6,162, 23), m_pStcThreshold4, IDF_TUNING_ED_THRESHOLD2);	m_pEdThreshold3		= new RxEditInt;	m_pEdThreshold3->Create(nStyle, CRect(163,  6,203, 23), m_pStcThreshold4, IDF_TUNING_ED_THRESHOLD3);	m_pEdThreshold4		= new RxEditInt;	m_pEdThreshold4->Create(nStyle, CRect(204,  6,244, 23), m_pStcThreshold4, IDF_TUNING_ED_THRESHOLD4);	nStyle	= WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON;	m_pBtnThreshold		= new RxBitmapButton;	m_pBtnThreshold->Create(NULL,   nStyle, CRect(245,  6,261,23), m_pStcThreshold4, IDF_TUNING_BTN_THRESHOLD);	m_pBtnThreshold->LoadBitmaps(IDB_FTUNING_BTN_THRESHOLD, CSize(16,17), BM_ALL&~BM_FOCUS);	nStyle = WS_CHILD|WS_VSCROLL|CBS_DROPDOWNLIST|CBS_AUTOHSCROLL|CBS_HASSTRINGS;	m_pCBPresetOTF		= new CComboBox;	m_pCBPresetOTF->Create(nStyle,	CRect(  0,  0,  0,  0), this, IDF_TUNING_CB_PRESET_OTF);	m_pPresetOTF		= new RxPresetOTF;}{	nStyle	= WS_CHILD;	m_pStcOTF			= new RxBitmapStatic;	m_pStcOTF->Create			(NULL, NULL, nStyle, CRect(0,0,0,0), this, IDC_STATIC);	m_pStcOTF->LoadBitmap(IDB_FTUNING_STC_OTF);	nStyle	= WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON;	m_pBtnAddOTF		= new RxBitmapButton;	m_pBtnAddOTF->Create(_T("Add"), nStyle, CRect( 81,  6,  0,  0), m_pStcOTF, IDF_TUNING_BTN_ADD_OTF);	m_pBtnAddOTF->LoadBitmaps(IDB_FTUNING_BTN_ADD_RECT, CSize(28,17), BM_ALL&~BM_FOCUS);	m_pBtnROI			= new RxBitmapButton;	m_pBtnROI->Create	(_T("ROI"), nStyle|WS_DISABLED, CRect(111,  6,  0,  0), m_pStcOTF, IDF_TUNING_BTN_ROI);	m_pBtnROI->LoadBitmaps(IDB_FTUNING_BTN_ROI, CSize(28,17), BM_ALL&~BM_FOCUS);	m_pBtnDelOTF		= new RxBitmapButton;	m_pBtnDelOTF->Create(_T("Del"), nStyle, CRect(141,  6,  0,  0), m_pStcOTF, IDF_TUNING_BTN_DEL_OTF);	m_pBtnDelOTF->LoadBitmaps(IDB_FTUNING_BTN_DEL_RECT, CSize(28,17), BM_ALL&~BM_FOCUS);}{	nStyle	= WS_CHILD;	m_pStcOpacity		= new RxBitmapStatic;	m_pStcOpacity->Create		(NULL, NULL, nStyle, CRect(0,0,0,0), this, IDC_STATIC);	m_pStcOpacity->LoadBitmap(IDB_FTUNING_STC_OPACITY);	nStyle	= WS_CHILD|WS_VISIBLE|WS_BORDER|ES_CENTER;	m_pEdOpacity		= new RxEditFloat;	m_pEdOpacity->Create		(nStyle, CRect( 80,  6,120, 23), m_pStcOpacity, IDF_TUNING_ED_OPACITY);	nStyle	= WS_CHILD|WS_VISIBLE;	m_pSBCOpacity		= new CSpinButtonCtrl;	m_pSBCOpacity->Create		(nStyle, CRect(120,  6,135, 23), m_pStcOpacity, IDF_TUNING_SBC_OPACITY);}	return 0;}void RxFrameTuning::OnDestroy() {	RxFrameWnd::OnDestroy();	if(m_pEdThreshold1)		delete m_pEdThreshold1;	if(m_pEdThreshold2)		delete m_pEdThreshold2;	if(m_pEdThreshold3)		delete m_pEdThreshold3;	if(m_pEdThreshold4)		delete m_pEdThreshold4;	if(m_pBtnThreshold)		delete m_pBtnThreshold;	if(m_pCBPresetOTF)		delete m_pCBPresetOTF;	if(m_pPresetOTF)		delete m_pPresetOTF;	if(m_pBtnAddOTF)		delete m_pBtnAddOTF;	if(m_pBtnROI)			delete m_pBtnROI;	if(m_pBtnDelOTF)		delete m_pBtnDelOTF;	if(m_pEdOpacity)		delete m_pEdOpacity;	if(m_pSBCOpacity)		delete m_pSBCOpacity;}void RxFrameTuning::OnPaint() {	CPaintDC dc(this); // device context for painting		CRect	rcClipBox;	dc.GetClipBox(rcClipBox);	CBrush	brush, *pOldBrush;	brush.CreateSolidBrush(RXCOLOR_11);	pOldBrush = dc.SelectObject(&brush);	dc.PatBlt(rcClipBox.left, rcClipBox.top, rcClipBox.Width(), rcClipBox.Height(), PATCOPY);	dc.SelectObject(pOldBrush);	brush.DeleteObject();	// Do not call RxFrameWnd::OnPaint() for painting messages}/////////////////////////////////////////////////////////////////////////////// 扁夯 牧飘费 困摹 汲沥void RxFrameTuning::RecalcLayout(){	CRect	rcFClient, rect;	RxGetMainFrame()->GetFrameRectTuning(rcFClient);	rect.SetRect( 10, 10, rcFClient.right-370, rcFClient.bottom-12);	m_pHistogramWnd[0]->MoveWindow(rect);	m_pHistogramWnd[1]->MoveWindow(rect);	rect.SetRect(rcFClient.right-340, 50, rcFClient.right-165, 80);	m_pStcOTF->MoveWindow(rect);	rect.SetRect(rcFClient.right-340, 85, rcFClient.right- 72,115);	m_pStcThreshold4->MoveWindow(rect);	rect.SetRect(rcFClient.right-259, 90, rcFClient.right- 79,300);	m_pCBPresetOTF->MoveWindow(rect);	rect.SetRect(rcFClient.right-340,120, rcFClient.right-200,150);	m_pStcOpacity->MoveWindow(rect);}// 檬扁 肺靛 滚瓢阑 喘范阑 版快void RxFrameTuning::OnOpenDicom(){	CString		strModality;	int			nType;	for (int nSeries = 0; nSeries < 2; nSeries ++)	{		m_pHistogramWnd[nSeries]->RemoveAllOTFPolygon();		RxVolumeData* pVolumeData = RxGetVolumeData(nSeries);		RxDicomObject Dcm = pVolumeData->m_pDicomInfo[nSeries];		Dcm.GetDicomInfo(DI_MODALITY, &strModality, &nType);		////////////////////////////////////		// Scroll Initialize		_SCROLL		stScroll;		if(strModality == _T("MR"))		{			stScroll.nRangeMinOut	= -200;			stScroll.nRangeMaxOut	= 4295;			stScroll.nRangeMinIn	= 0;			stScroll.nRangeMaxIn	= 4095;			stScroll.nPoMin			= 0;			stScroll.nPoMax			= 500;			stScroll.nMinSize		= 50;		}		else		{			stScroll.nRangeMinOut	= -1224;		stScroll.nRangeMaxOut	= 3271;			stScroll.nRangeMinIn	= -1024;		stScroll.nRangeMaxIn	= 3071;			stScroll.nPoMin			= 0;			stScroll.nPoMax			= 1000;			stScroll.nMinSize		= 50;		}		m_pHistogramWnd[nSeries]->SetScroll(&stScroll, TRUE);		////////////////////////////////////		// Histogram Initialize		unsigned short	*pRawVolume = pVolumeData->GetBigVolume();		int				volX, volY, volZ;		pVolumeData->GetBigVolumeDmsn(&volX, &volY, &volZ);		UINT			aiHistogram[4096];		memset(aiHistogram, 0, sizeof(int)*4096);		for(int i = 0; i < volX*volY*volZ; i++)			aiHistogram[pRawVolume[i]]++;		aiHistogram[0] = 0;				//0篮 air聪鳖 histogram 俊 钎矫富磊.		UINT			nMaxMagnitude = 0;		for(i = 0; i < 4096; i++)		{			// 力蚌辟栏肺 焊沥			aiHistogram[i] = (int)(sqrt((double)aiHistogram[i]));			nMaxMagnitude = max(nMaxMagnitude, aiHistogram[i]);		}		m_pHistogramWnd[nSeries]->SetHistogram(aiHistogram, 4096, nMaxMagnitude);		////////////////////////////////////		// OTF Initialize		AddOTFPolygon(nSeries);		RxLocalizerManager	*pLocalizerManager	= RxGetFrameMain()->m_pLocalizerManager[nSeries];		pVolumeData->GetVoxelShader()->SetSpectrumTable((__m128*)m_pHistogramWnd[nSeries]->GetSpectrum());		pLocalizerManager->SetChangedOTF(m_pHistogramWnd[nSeries]->GetSpectrum());	}}// 皋牢 徘捞 函版瞪 版快void RxFrameTuning::OnSwitchToMainMenu(BOOL bActive, int nOldMainMenuID, int nCurMainMenuID){	int		nSeries = RxGetCurSeries();	if(bActive)	{		if(nCurMainMenuID == IDF_TOP_LOAD)		{			;		}		else if(nCurMainMenuID == IDF_TOP_3DFUSION)		{			if(nSeries == RXSERIES_REF)			{				m_pHistogramWnd[1]->ShowWindow(SW_HIDE);				m_pHistogramWnd[0]->ShowWindow(SW_SHOW);				m_pStcOTF->ShowWindow(SW_SHOW);				m_pStcThreshold4->ShowWindow(SW_SHOW);				m_pStcOpacity->ShowWindow(SW_SHOW);			}			else if(nSeries == RXSERIES_FLT)			{				m_pHistogramWnd[0]->ShowWindow(SW_HIDE);				m_pHistogramWnd[1]->ShowWindow(SW_SHOW);				m_pStcOTF->ShowWindow(SW_SHOW);				m_pStcThreshold4->ShowWindow(SW_SHOW);				m_pStcOpacity->ShowWindow(SW_SHOW);			}			else

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -