00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "stdafx.h"
00016
00017 #include <cfl/resource.h>
00018
00019 #include <Camera/InterfaceDll.h>
00020
00021 #include <cfl/ScanFilterMinimum.h>
00022 #include <cfl/FilterDlg_Minimum.h>
00023 #include <cfl/ToolCilImage.h>
00024
00025 #include <cil/MinimumImageFilter.h>
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifdef _DEBUG
00038 #undef THIS_FILE
00039 static char THIS_FILE[]=__FILE__;
00040 #define new DEBUG_NEW
00041 #endif
00042
00043
00044
00045
00046 #ifdef CIL_MinimumImageFilter_USE_TYPE_HACK // ::Type hack
00047 typedef cil::MinimumImageFilter< Image >::Type MinimumFilterType;
00048 #else
00049 typedef cil::MinimumImageFilter< Image > MinimumFilterType;
00050 #endif
00051
00052 #define CFL_SCHEMAVERSION_FILTERMINIMUM 0
00053 // this filter's name
00054 LPCTSTR CScanFilterMinimum::m_lpcsFilterName = _T("Minimum");
00055
00056 LPCTSTR CScanFilterMinimum::m_lpcsShortFilterName = CScanFilterMinimum::m_lpcsFilterName;
00057
00058 IMPLEMENT_SERIAL(CScanFilterMinimum, CScanFilterRank, CFL_SCHEMAVERSION_FILTERMINIMUM)
00059
00060
00061
00062
00063
00064 CScanFilterMinimum::CScanFilterMinimum()
00065 {
00066
00067
00068 m_csFilterName = m_lpcsFilterName;
00069
00070 ReadFilterSettings();
00071 }
00072
00073
00074
00075
00076
00077 BOOL CScanFilterMinimum::RunModeless( CWnd* pParentWnd, CDocument* pDoc )
00078 {
00079
00080
00081 CFilterDlg_MinimumPtr pDlg = new CFilterDlg_Minimum();
00082
00083 if ( Q_INVALID( NULL == pDlg ) )
00084 return FALSE;
00085
00086 pDlg->SetParameters( this, pDoc );
00087
00088
00089
00090
00091
00092 pDlg->Create( IDD_FILTERDLG_MINIMUM, pParentWnd );
00093
00094 m_pDlg = pDlg;
00095
00096 BOOL bRet = Apply();
00097
00098 if ( bRet )
00099 {
00100 pDlg->UpdateView();
00101 }
00102
00103 return bRet;
00104 }
00105
00106
00107
00108
00109
00110
00111 BOOL CScanFilterMinimum::Apply()
00112 {
00113
00114
00115 if ( Q_INVALID( NULL == m_lpsbIn ) )
00116 return FALSE;
00117
00118 if ( Q_INVALID( NULL == m_lpsbOut ) )
00119 return FALSE;
00120
00121 if ( Q_INVALID( false == m_lpsbIn->IsCompleteFrame() ) )
00122 return FALSE;
00123
00124
00125
00126
00127 Q_RETURN( m_lpsbOut->CreateOutputBufferFor( *m_lpsbIn ) );
00128
00129 m_lpsbOut->m_csBufferName.Format( _T("%s - %s %d,%d"), m_lpsbIn->m_csBufferName, m_lpcsShortFilterName, GetSizeX(), GetSizeY() );
00130
00131 if ( IsInteractive() )
00132 {
00133 m_pDlg->SetDlgItemText( IDC_BUFFEROUTNAME, m_lpsbOut->m_csBufferName );
00134 }
00135
00136
00137
00138
00139 MinimumFilterType filter( ToRadius( m_cpSize.x, m_cpSize.y ) );
00140
00141 filter.Apply( ToImage( m_lpsbIn ), ToImage( m_lpsbOut ) );
00142
00143
00144
00145
00146 if ( m_lpsbIn->IsBidirectionalScan() && m_lpsbOut->IsBidirectionalScan() )
00147 {
00148 filter.Apply( ToImage( m_lpsbIn, true ), ToImage( m_lpsbOut, true ) );
00149 }
00150
00151 return TRUE;
00152 }
00153
00154
00155
00156