add: width of ROI

This commit is contained in:
liuyihui 2022-06-03 01:47:52 +08:00
parent 921570809e
commit 2e03506916
8 changed files with 16 additions and 8 deletions

View File

@ -22,6 +22,7 @@ CControlView::CControlView()
, m_nPartCount(0)
, m_nMaxCount(0)
, m_nLC(4)
, m_nWidth(1024)
, m_nCursor1(0)
, m_nCursor2(1023)
, m_nCursorROI(0)
@ -44,6 +45,7 @@ void CControlView::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX, IDC_MODE, m_ComboMode);
DDX_Control(pDX, IDC_AXIS, m_ComboAxis);
DDX_Text(pDX, IDC_RANGE, m_nLC);
DDX_Text(pDX, IDC_WIDTH, m_nWidth);
DDX_Text(pDX, IDC_CURSOR1, m_nCursor1);
DDX_Text(pDX, IDC_CURSOR2, m_nCursor2);
DDX_Text(pDX, IDC_CURSORROI, m_nCursorROI);

View File

@ -45,6 +45,7 @@ public:
int m_nLC;
// 光标信息
int m_nWidth;
int m_nCursor1;
int m_nCursor2;
int m_nCursorROI;

View File

@ -135,6 +135,7 @@ void CDetailView::OnRButtonDown(UINT nFlags, CPoint point)
if (pView == NULL) pView = (CControlView*)pDoc->GetView(RUNTIME_CLASS(CControlView));
pView->m_nCursor1 = 0;
pView->m_nCursor2 = 1023;
pView->m_nWidth = 1024;
pView->UpdateData(FALSE);
pDoc->UpdateAllViews(NULL);
CView::OnRButtonDown(nFlags, point);

Binary file not shown.

View File

@ -315,6 +315,7 @@ BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
if (pMsg->wParam == VK_RIGHT) pView->m_nCursorROI = min(pView->m_nCursor2, pView->m_nCursorROI + 1);
if (pMsg->wParam == VK_UP) OnRangeM2();
if (pMsg->wParam == VK_DOWN) OnRangeD2();
pView->m_nWidth = pView->m_nCursor2 - pView->m_nCursor1 + 1;
pView->m_nCursorROICount = pDoc->m_nChannelCount[pView->m_nCursorROI];
pView->UpdateData(FALSE);
pDoc->UpdateAllViews(NULL);
@ -665,9 +666,8 @@ void CMainFrame::OnDataPeak()
int L = pView->m_nCursor1;
int R = pView->m_nCursor2;
int n = R - L + 1;
if (n > 256) {
if (pView->m_nWidth > 256) {
AfxMessageBox((CString)"ROI区域太大需≤256");
return ;
}
@ -727,6 +727,11 @@ void CMainFrame::OnDataPeak()
if (maxV < 1e-5) break;
}
if (amplitude < 0 || mean < 0 || sigma < 0) {
AfxMessageBox((CString)"拟合失败");
return ;
}
CString strText;
strText.Format(_T("幅值%.3f\n均值%.3f\n标准差%.3f"), amplitude, mean, sigma);
AfxMessageBox(strText);

View File

@ -195,8 +195,8 @@ matrix matrix::I() {
return mInv;
}
for (int j = 0; j < n; j++)
for (int k = 0; k < m; k++) mMir.element[j][k] = element[j][k];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) mMir.element[i][j] = element[i][j];
LUPDescomposition(mMir, mL, mU, P);
for (int i = 0; i < n; i++) {

View File

@ -28,9 +28,8 @@
#define IDC_RANGE 1025
#define IDC_MCOUNT 1026
#define IDC_AXIS 1027
#define IDC_CURSOR1_COUNT 1028
#define IDC_CURSOR2 1029
#define IDC_CURSOR2_COUNT 1030
#define IDC_WIDTH 1030
#define IDC_CURSORROI 1031
#define IDC_PCOUNT 1032
#define ID_ARROW_RIGHT 32805
@ -55,8 +54,6 @@
#define ID_STA_CLEAR 32837
#define ID_OPT_SAVE 32840
#define ID_OPT_OPEN 32841
#define ID_32842 32842
#define ID_ 32843
#define ID_DATA_PEAK 32844
// Next default values for new objects

View File

@ -120,6 +120,7 @@ void CTotalView::OnLButtonDown(UINT nFlags, CPoint point)
int nX = (point.x - 1) / 2;
if (nX < pView->m_nCursor2) {
pView->m_nCursor1 = nX;
pView->m_nWidth = pView->m_nCursor2 - pView->m_nCursor1 + 1;
pView->m_nCursorROI = max(pView->m_nCursor1, pView->m_nCursorROI);
}
pView->UpdateData(FALSE);
@ -134,6 +135,7 @@ void CTotalView::OnRButtonDown(UINT nFlags, CPoint point)
int nX = (point.x - 1) / 2;
if (nX > pView->m_nCursor1) {
pView->m_nCursor2 = nX;
pView->m_nWidth = pView->m_nCursor2 - pView->m_nCursor1 + 1;
pView->m_nCursorROI = min(pView->m_nCursor2, pView->m_nCursorROI);
}
pView->UpdateData(FALSE);