예제 #1
0
파일: DesignPage.cpp 프로젝트: sayrun/SOboe
void CDesignPage::OnDatafilesel() 
{
	// TODO: この位置にコントロール通知ハンドラ用のコードを追加してください
	UpdateData();

	DWORD dwLen = GetCurrentDirectory( 0, NULL);
	char*	pszFolder;
	dwLen++;
	pszFolder = new char[ dwLen];
	GetCurrentDirectory( dwLen, pszFolder);
	CString	cStrFolder = pszFolder;
	delete pszFolder;
	pszFolder = NULL;

	CString	cStrData;
	cStrData = m_cStrSaveFilePath;
	CFileDialog	cFileDlg( TRUE, "mrm", cStrData, OFN_HIDEREADONLY, "覚え書データファイル(*.mrm)|*.mrm||", this);

	int nResult = cFileDlg.DoModal();
	if( IDOK == nResult)
	{
		m_cStrSaveFilePath = cFileDlg.GetPathName();
		UpdateData( FALSE);
	}
	SetCurrentDirectory( cStrFolder);
}
// See ConfigDlg.h for documentation of this method.
void ConfigDlg::OnBnClickedButtonBrowse()
{
    CFileDialog cFileDlg(TRUE);

    cFileDlg.m_ofn.lpstrTitle = _T("Select the image file");
    cFileDlg.m_ofn.lpstrFilter = _T("Supported files(*.bin)\0*.bin;\0All files(*.*)\0*.*\0\0");
    if (IDOK == cFileDlg.DoModal())
    {
        CString fullPath = cFileDlg.GetPathName();
        if (file_exists(fullPath))
        {
            g_pHistoryData->InsertFile(fullPath);
            RefreshImageFileList();
        }
        else
        {
            PrintLog(_T("Invalid full path filename, or file doesn't exist.(%s)"), fullPath);
        }
    }
}
예제 #3
0
파일: DxlEdit.cpp 프로젝트: sayrun/SOboe
BOOL CDxlEdit::GetExtendDll(CString & cStrFile)
{
	DWORD dwLen = GetCurrentDirectory( 0, NULL);
	char*	pszFolder;
	dwLen++;
	pszFolder = new char[ dwLen];
	GetCurrentDirectory( dwLen, pszFolder);
	CString	cStrFolder = pszFolder;
	delete pszFolder;
	pszFolder = NULL;

	CString	cStrData;
	cStrData = cStrFile;
	CFileDialog	cFileDlg( TRUE, "dxl", cStrData, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, "描画拡張ライブラリィ(*.dxl)|*.dxl||", this);

	int nResult = cFileDlg.DoModal();
	if( IDOK == nResult)
	{
		cStrFile = cFileDlg.GetPathName();
	}
	SetCurrentDirectory( cStrFolder);

	return ( IDOK == nResult);
}
CArtifactsHandling::CArtifactsHandling(float* pfData, float* pfAdjustedData, int nDataSize, 
		float fSampleInterval, bool *pbExcluded, const EvlNode structEvlNode)
{
	int i;
	m_structEvlNode=structEvlNode;
	m_fAmplitudeThreshold=-15.f;
	m_fDeltaThreshold=-3.5f;
	m_fOppositeDirectionThreshold=0.7f;
	m_fRange=0.8f;
	m_pfData=pfData;
	m_pfAdjustedData=pfAdjustedData;
	m_nDataSize=nDataSize;
	m_fSampleInterval=fSampleInterval;
	m_pnLocalMinima=new int[m_nDataSize/2];
	m_pnLocalMaxima=new int[m_nDataSize/2];
	m_bDoNotConfirm=false;
	m_nMinArtifactInterval=600;
	m_nArtifactExtention=60;
	m_bBaselineDefined=false;
	m_pnBLMax=new int[1];
	m_pbExcluded=pbExcluded;
	int nAmpType=3;
	int nOppType=3;

	for(i=0;i<nDataSize;i++)
	{
		m_pbExcluded[i]=false;
	}

	GetThresholds();
	if(m_bReadFromFile)
	{	
		FILE* fp;
		CString sFileName;
		CFileDialog cFileDlg(true, NULL, "*.afr", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, NULL, NULL);
		CString sCriterian;
		int nIterations;
		int nTemp;
		if(cFileDlg.DoModal()==IDOK)
		{
			m_bEntireTrace=false;
			m_bDoNotConfirm=true;
			sFileName=cFileDlg.GetPathName();
			if(fp=fopen(sFileName,"r"))
			{

				m_lstArtifactSegments.clear();
				fscanf(fp,"%s%d",sCriterian,&nIterations);

				LocalExtrema(m_pfData,m_pnLocalMinima,m_pnLocalMaxima,m_nDataSize,
								 m_nNumOfLocalMinima,m_nNumOfLocalMaxima);

				for(int it=0;it<nIterations;it++)
				{
					fscanf(fp,"%s%d",sCriterian,&nTemp);
					if(nTemp!=0)
					{
						m_bBasedOnAdjustedData=true;
					}
					else
					{
						m_bBasedOnAdjustedData=false;
					}

					if(!m_bBasedOnAdjustedData)
					{
						for(i=0;i<m_nDataSize;i++)
						{
							*(m_pfAdjustedData+i)=*(m_pfData+i);
						}
					}
					else
					{
						for(i=0;i<m_nDataSize;i++)
						{
							*(m_pfData+i)=*(m_pfAdjustedData+i);
						}
					}



					fscanf(fp,"%s%d%s%f",sCriterian,&nAmpType,sCriterian,&m_fAmplitudeThreshold);
					if(nAmpType!=0)
					{
						m_bCheckAmplitude=true;
					}
					else
					{
						m_bCheckAmplitude=false;
					}

					fscanf(fp,"%s%d%s%f",sCriterian,&nTemp,sCriterian,&m_fDeltaThreshold);
					if(nTemp!=0)
					{
						m_bCheckDelta=true;
					}
					else
					{
						m_bCheckDelta=false;
					}

					fscanf(fp,"%s%d%s%f",sCriterian,&nOppType,
						sCriterian,&m_fOppositeDirectionThreshold);
										
					if(nOppType!=0)
					{
						m_bCheckOppositeDirrection=true;
					}
					else
					{
						m_bCheckOppositeDirrection=false;
					}


					fscanf(fp,"%s%d",sCriterian,&nTemp);
					if(nTemp!=0)
					{
						m_bCheckEvl=true;
					}
					else
					{
						m_bCheckEvl=false;
					}
					
					fscanf(fp,"%s%f%s%f",sCriterian,&m_fTime1,sCriterian,&m_fTime2);


					m_nBegin=int((m_fTime1*1000.f)/m_fSampleInterval);
					m_nEnd=int((m_fTime2*1000.f)/m_fSampleInterval);

					if(m_nEnd>m_nDataSize-1)
						m_nEnd=m_nDataSize-1;

					if(m_bCheckAmplitude)
					{
						CheckAbnormalValues(nAmpType);
        			}

					if(m_bCheckDelta)
					{
						CheckAbnormalTransition();
        			}
					
					if(m_bCheckOppositeDirrection)
					{
						CheckOppositeDirection(nOppType);
					}
										
       				if(m_bCheckEvl)
        			{
        				CheckEvl();
        			}

					RemoveArtifacts();

					m_lstArtifactSegments.clear();
				}
			}

		}

	}
	else
	{

		if(m_bBasedOnAdjustedData)
		{
			for(int i=0;i<m_nDataSize;i++)
			{
				*(m_pfData+i)=*(m_pfAdjustedData+i);
			}
		}
		else
		{
			for(int i=0;i<m_nDataSize;i++)
			{
				*(m_pfAdjustedData+i)=*(m_pfData+i);
			}
		}
		LocalExtrema(m_pfData,m_pnLocalMinima,m_pnLocalMaxima,m_nDataSize,
					m_nNumOfLocalMinima,m_nNumOfLocalMaxima);
		if(m_bCheckDelta)
		{
			CheckAbnormalTransition();
		}
		if(m_bCheckOppositeDirrection)
		{
			CheckOppositeDirection(nOppType);
		}
		if(m_bCheckAmplitude)
		{
			CheckAbnormalValues(nAmpType);
		}
		if(m_bCheckEvl)
		{
			CheckEvl();
		}
		RemoveArtifacts();
	}
}