// WaveformAttributesDlg.cpp : implementation file // #include "stdafx.h" #include "dicwav.h" #include "WaveformAttributesDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CWaveformAttributesDlg dialog CWaveformAttributesDlg::CWaveformAttributesDlg(CWnd* pParent /*=NULL*/) : CDialog(CWaveformAttributesDlg::IDD, pParent) { //{{AFX_DATA_INIT(CWaveformAttributesDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_pWaveformGrp = NULL; } void CWaveformAttributesDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CWaveformAttributesDlg) DDX_Control(pDX, IDC_LIST_CHANNELATTRIBUTES, m_ChannelAttribs); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CWaveformAttributesDlg, CDialog) //{{AFX_MSG_MAP(CWaveformAttributesDlg) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CWaveformAttributesDlg message handlers BOOL CWaveformAttributesDlg::OnInitDialog() { CDialog::OnInitDialog(); // Add columns. m_ChannelAttribs.InsertColumn (0, _T ("Channel Sensitivity"), LVCFMT_LEFT, 110); m_ChannelAttribs.InsertColumn (1, _T ("Channel Sensitivity Units"), LVCFMT_LEFT, 130); m_ChannelAttribs.InsertColumn (2, _T ("Channel Source"),LVCFMT_LEFT, 96); m_ChannelAttribs.InsertColumn (3, _T ("Filter Low Freq."),LVCFMT_LEFT, 96); m_ChannelAttribs.InsertColumn (4, _T ("Filter High Freq."),LVCFMT_LEFT, 96); m_ChannelAttribs.InsertColumn (5, _T ("Waveform Annotation"),LVCFMT_LEFT, 150); if(m_pWaveformGrp && m_pWaveformGrp->GetNumberOfChannels()) { CWnd *pWnd; CString strTemp; LDicomWaveformChannel*pChannel = NULL; L_BOOL bIncluded = FALSE; L_DOUBLE dChannelSensitivity=0.0; DICOMCODESEQUENCEITEM ChannelSensitivityUnits={0}; L_UINT16 uRet; pDICOMCODESEQUENCEITEM pChannelSource; L_DOUBLE dLowFrequency; L_DOUBLE dHighFrequency; pDICOMWAVEFORMANNOTATION pAnnotation = NULL; pWnd = GetDlgItem(IDC_NUMBERWAVEFORMCHANNELS); if(pWnd) { strTemp.Format("%d",m_pWaveformGrp->GetNumberOfChannels()); pWnd->SetWindowText(strTemp); } pWnd = GetDlgItem(IDC_SAMPLINGFREQUENCY); if(pWnd) { strTemp.Format("%f",m_pWaveformGrp->GetSamplingFrequency()); pWnd->SetWindowText(strTemp); } pWnd = GetDlgItem(IDC_NUMBERWAVEFORMSAMPLES); if(pWnd) { strTemp.Format("%d",m_pWaveformGrp->GetNumberOfSamplesPerChannel()); pWnd->SetWindowText(strTemp); } pWnd = GetDlgItem(IDC_WAVEFORMSAMPLEINTERPRETATION); if(pWnd) { switch(m_pWaveformGrp->GetSampleInterpretation()) { case DICOM_SAMPLE_INTERPRETATION_SS: strTemp= "signed 16 bit linear"; break; case DICOM_SAMPLE_INTERPRETATION_US: strTemp= "unsigned 16 bit linear"; break; case DICOM_SAMPLE_INTERPRETATION_SB: strTemp= "signed 8 bit linear"; break; case DICOM_SAMPLE_INTERPRETATION_UB: strTemp= "unsigned 8 bit linear"; break; case DICOM_SAMPLE_INTERPRETATION_MB: strTemp= "8 bit mu-law"; break; case DICOM_SAMPLE_INTERPRETATION_AB: strTemp= "8 bit A-law"; break; } pWnd->SetWindowText(strTemp); } pWnd = GetDlgItem(IDC_WAVEFORMBITSALLOCATED); if(pWnd) { switch(m_pWaveformGrp->GetSampleInterpretation()) { case DICOM_SAMPLE_INTERPRETATION_SS: case DICOM_SAMPLE_INTERPRETATION_US: strTemp= "16"; break; case DICOM_SAMPLE_INTERPRETATION_SB: case DICOM_SAMPLE_INTERPRETATION_UB: case DICOM_SAMPLE_INTERPRETATION_MB: case DICOM_SAMPLE_INTERPRETATION_AB: strTemp= "8"; break; } pWnd->SetWindowText(strTemp); } pWnd = GetDlgItem(IDC_WAVEFORMPADDINGVALUE); if(pWnd) { L_INT32 nPaddingValue; if(m_pWaveformGrp->GetWaveformPaddingValue(&nPaddingValue)) { strTemp.Format("%d",nPaddingValue); pWnd->SetWindowText(strTemp); } } for(L_UINT32 uIndex = 0 ; uIndex < m_pWaveformGrp->GetNumberOfChannels(); uIndex++) { pChannel= m_pWaveformGrp->GetChannel(uIndex); if(pChannel) { uRet = pChannel->GetChannelSensitivity(&bIncluded, &dChannelSensitivity, &ChannelSensitivityUnits, sizeof(DICOMCODESEQUENCEITEM), NULL, NULL); if((uRet== DICOM_SUCCESS) && bIncluded && ChannelSensitivityUnits.pszCodeMeaning) { strTemp.Format("%f",dChannelSensitivity); m_ChannelAttribs.InsertItem (uIndex, strTemp, uIndex); m_ChannelAttribs.SetItemText (uIndex, 1,ChannelSensitivityUnits.pszCodeMeaning); pChannelSource= pChannel->GetChannelSource(); if(pChannelSource && pChannelSource->pszCodeMeaning) { m_ChannelAttribs.SetItemText (uIndex, 2,pChannelSource->pszCodeMeaning); } if(pChannel->GetFilterLowFrequency(&dLowFrequency)) { strTemp.Format("%f",dLowFrequency); m_ChannelAttribs.SetItemText (uIndex, 3,strTemp); } if(pChannel->GetFilterHighFrequency(&dHighFrequency)) { strTemp.Format("%f",dHighFrequency); m_ChannelAttribs.SetItemText (uIndex, 4,strTemp); } if(pChannel->GetAnnotationCount()) { pAnnotation = pChannel->GetAnnotation(0); if(pAnnotation) { if(pAnnotation->pszUnformattedTextValue) { m_ChannelAttribs.SetItemText (uIndex, 5,pAnnotation->pszUnformattedTextValue); } else { if(pAnnotation->pCodedName && pAnnotation->pCodedName->pszCodeMeaning) { m_ChannelAttribs.SetItemText (uIndex, 5,pAnnotation->pCodedName->pszCodeMeaning); } } } } } } } } return TRUE; }