00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "stdafx.h"
00017 #include <afxdllx.h>
00018
00019 #include <cfl/resource.h>
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #if defined( USE_VISUAL_LEAK_DETECTOR )
00032 #include <vld.h>
00033 #endif
00034
00035 #include <cfl/version.h>
00036
00037 #include <cfl/ScanBaseBuffer.h>
00038 #include <cfl/ScanFilter.h>
00039 #include <cfl/ProgressDlg.h>
00040
00041 #include <cfl/ScanFilterClip.h>
00042 #include <cfl/ScanFilterClad.h>
00043 #include <cfl/ScanFilterShift.h>
00044
00045 #include <cfl/ScanFilterMean.h>
00046 #include <cfl/ScanFilterMedian.h>
00047 #include <cfl/ScanFilterMinimum.h>
00048 #include <cfl/ScanFilterMaximum.h>
00049 #include <cfl/ScanFilterKuwahara.h>
00050 #include <cfl/ScanFilterCustom.h>
00051 #include <cfl/ScanFilterLinearRegression.h>
00052
00053 #include <cfl/ScanFilterThreshold.h>
00054 #include <cfl/ScanFilterBinaryThreshold.h>
00055
00056 #include <cfl/ScanFilterNull.h>
00057 #include <cfl/ScanFilterTest.h>
00058
00059 #include <cfl/ScanFilterErosion.h>
00060 #include <cfl/ScanFilterDilation.h>
00061
00062 #include <cfl/ScanFilterDifferential_LbL.h>
00063 #include <cfl/ScanFilterDifferential.h>
00064
00065 #include <cfl/ScanFilterBGS_LbL.h>
00066 #include <cfl/ScanFilterBGS_Planar.h>
00067 #include <cfl/ScanFilterBGS_MCN.h>
00068
00069 #include <cfl/ScanFilterMath.h>
00070 #include <cfl/ScanFilterDZ.h>
00071 #include <cfl/ScanFilterNCCFFT.h>
00072
00073 #include <cfl/ScanFilterCrossCorrelate.h>
00074 #if defined( USE_NEW_DEVELOPMENT )
00075
00076 #endif
00077
00078 #include <cfl/ScanFilterFFT.h>
00079 #include <cfl/ScanFilterFFTInverse.h>
00080
00081 #include <cfl/ScanFilterSwapQuadrants.h>
00082 #include <cfl/ScanFilterLowPass.h>
00083 #include <cfl/ScanFilterHighPass.h>
00084 #include <cfl/ScanFilterAutoCorrelateF.h>
00085 #include <cfl/ScanFilterCrossCorrelateF.h>
00086
00087 #include <cfl/ScanFilterBgsDiff.h>
00088 #include <cfl/ScanFilterBgsDiff_LbL.h>
00089
00090 #include <cfl/CalculatorImageShift.h>
00091
00092 #ifdef _DEBUG
00093 #define new DEBUG_NEW
00094 #undef THIS_FILE
00095 static char THIS_FILE[] = __FILE__;
00096 #endif
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 const char* gCflRegistrySubkey = CFL_REGISTRY_SUBKEY;
00118
00119
00120
00121
00122 extern LPCTSTR GetFilterLibraryName()
00123 {
00124 return PRODUCT_NAME;
00125 }
00126
00127
00128
00129
00130 extern LPCTSTR GetFilterLibraryDescription()
00131 {
00132 return FILE_DESCRIPTION;
00133 }
00134
00135
00136
00137
00138 extern LPCTSTR GetFilterLibraryVersionString()
00139 {
00140 return COMMENT_STRING;
00141 }
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 static AFX_EXTENSION_MODULE CFiltLibDLL = { NULL, NULL };
00170
00171
00172
00173
00174 extern "C" int APIENTRY DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
00175 {
00176
00177
00178
00179
00180 UNREFERENCED_PARAMETER( lpReserved );
00181
00182 if ( dwReason == DLL_PROCESS_ATTACH )
00183 {
00184 Q_SET_MODULE( _T( "CFiltLib.dll" ) );
00185
00186 TRACE0( "CFILTLIB.DLL Initializing!\n" );
00187
00188
00189
00190
00191
00192 if ( !AfxInitExtensionModule( CFiltLibDLL, hInstance ) )
00193 return 0;
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207 new CDynLinkLibrary( CFiltLibDLL );
00208 }
00209 else if ( dwReason == DLL_PROCESS_DETACH )
00210 {
00211 TRACE0( "CFILTLIB.DLL Terminating!\n" );
00212
00213
00214
00215
00216
00217 AfxTermExtensionModule( CFiltLibDLL );
00218 }
00219
00220 return TRUE;
00221 }
00222
00223 #define EDIT TRUE
00224 #define edit FALSE
00225 #define ONLN TRUE
00226 #define onln FALSE
00227 #define VIEW TRUE
00228 #define view FALSE
00229 #define IACT TRUE
00230 #define iact FALSE
00231
00232
00233
00234
00235 _tFilterList g_FilterDefTable[] =
00236 {
00237
00238
00239
00240
00241
00242 { edit, onln, view, IACT, _T("Clip (crop)") , CScanFilterClip::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterClip) },
00243 { edit, onln, view, IACT, _T("Clad...") , CScanFilterClad::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterClad) },
00244 { edit, onln, view, IACT, _T("Shift (move)...") , CScanFilterShift::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterShift) },
00245 { edit, onln, view, IACT, _T("Clip, clad, shift") , NULL , NULL },
00246
00247 #if defined( USE_NEW_DEVELOPMENT )
00248 { edit, onln, view, IACT, _T("Normalize (not implemented)") , "X" , RUNTIME_CLASS(CScanFilterNull) },
00249 { edit, onln, view, IACT, _T("Rescale... (not implemented)") , "X" , RUNTIME_CLASS(CScanFilterNull) },
00250 { edit, onln, view, IACT, _T("Shift Scale... (not implemented)") , "X" , RUNTIME_CLASS(CScanFilterNull) },
00251 { edit, onln, view, IACT, _T("Sigmoid... (not implemented)") , "X" , RUNTIME_CLASS(CScanFilterNull) },
00252 { edit, onln, view, IACT, _T("Scale") , NULL , NULL },
00253 #endif
00254
00255 { edit, onln, view, IACT, _T("Binary Threshold...") , CScanFilterBinaryThreshold::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterBinaryThreshold) },
00256 { edit, onln, view, IACT, _T("General Threshold...") , CScanFilterThreshold::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterThreshold) },
00257 { edit, onln, view, IACT, _T("Threshold") , NULL , NULL },
00258
00259 { edit, onln, view, IACT, _T("Mean...") , CScanFilterMean::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterMean) },
00260 { edit, onln, view, IACT, _T("Median...") , CScanFilterMedian::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterMedian) },
00261 { edit, onln, view, IACT, _T("Minimum...") , CScanFilterMinimum::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterMinimum) },
00262 { edit, onln, view, IACT, _T("Maximum...") , CScanFilterMaximum::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterMaximum) },
00263 { edit, onln, view, IACT, _T("Kuwahara") , CScanFilterKuwahara::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterKuwahara) },
00264 { edit, onln, view, IACT, _T("Custom...") , CScanFilterCustom::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterCustom) },
00265 { edit, onln, view, IACT, _T("Linear Regression...") , CScanFilterLinearRegression::m_lpcsFilterName, RUNTIME_CLASS(CScanFilterLinearRegression) },
00266 { edit, onln, view, IACT, _T("Smooth, Sharpen") , NULL , NULL },
00267
00268 { edit, onln, view, IACT, _T("Dilation") , CScanFilterDilation::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterDilation) },
00269 { edit, onln, view, IACT, _T("Erosion") , CScanFilterErosion::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterErosion) },
00270 { edit, onln, view, IACT, _T("Morphology") , NULL , NULL },
00271
00272 { EDIT, ONLN, VIEW, IACT, _T("Differential (Line)...") , CScanFilterDifferential_LbL::m_lpcsFilterName, RUNTIME_CLASS(CScanFilterDifferential_LbL) },
00273 { EDIT, ONLN, VIEW, IACT, _T("Differential (Plane)...") , CScanFilterDifferential::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterDifferential) },
00274 { edit, onln, view, IACT, _T("Derivative") , NULL , NULL },
00275
00276 { edit, ONLN, VIEW, IACT, _T("Linear Regression (&Line)") , CScanFilterBGS_LbL::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterBGS_LbL) },
00277 { EDIT, ONLN, VIEW, IACT, _T("Linear Regression (&Plane)...") , CScanFilterBGS_Planar::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterBGS_Planar) },
00278 { EDIT, ONLN, VIEW, IACT, _T("Most Common Normal...") , CScanFilterBGS_MCN::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterBGS_MCN) },
00279 #if defined( USE_NEW_DEVELOPMENT )
00280 { edit, onln, view, IACT, _T("Area... (not implemented)") , "X" , RUNTIME_CLASS(CScanFilterNull) },
00281 { edit, onln, view, IACT, _T("Line path... (not implemented)") , "X" , RUNTIME_CLASS(CScanFilterNull) },
00282 { edit, onln, view, IACT, _T("Manual... (not implemented)") , "X" , RUNTIME_CLASS(CScanFilterNull) },
00283 #endif
00284 { edit, onln, view, IACT, _T("Background") , NULL , NULL },
00285
00286 { edit, onln, view, IACT, _T("Math...") , CScanFilterMath::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterMath) },
00287 { edit, onln, view, IACT, _T("DZ-Correction...") , CScanFilterDZ::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterDZ) },
00288 { edit, onln, view, IACT, _T("Fast Normalized Cross-Correlation..."), CScanFilterNCCFFT::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterNCCFFT) },
00289
00290 { edit, onln, view, IACT, _T("Cross-Correlate (Spatial Domain)...") , CScanFilterCrossCorrelate::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterCrossCorrelate) },
00291 #if defined( USE_NEW_DEVELOPMENT )
00292
00293 #endif
00294 { edit, onln, view, IACT, _T("Double buffer") , NULL , NULL },
00295
00296
00297
00298 { edit, onln, view, IACT, _T("Fourier &Transform") , CScanFilterFFT::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterFFT) },
00299 { edit, onln, view, IACT, _T("&Inverse Fourier Transform") , CScanFilterFFTInverse::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterFFTInverse) },
00300 { edit, onln, view, IACT, _T("&Swap Quadrants") , CScanFilterSwapQuadrants::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterSwapQuadrants) },
00301 { edit, onln, view, IACT, _T("Low-Pass...") , CScanFilterLowPass::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterLowPass) },
00302 { edit, onln, view, IACT, _T("High-Pass...") , CScanFilterHighPass::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterHighPass) },
00303 { edit, onln, view, IACT, _T("Auto-Correlate") , CScanFilterAutoCorrelate::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterAutoCorrelate) },
00304 { edit, onln, view, IACT, _T("Cross-Correlate...") , CScanFilterCrossCorrelateF::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterCrossCorrelateF) },
00305 { edit, onln, view, IACT, _T("Frequency Domain") , NULL , NULL },
00306
00307 { edit, onln, view, IACT, _T("Null Filter...") , CScanFilterNull::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterNull) },
00308 { edit, onln, view, IACT, _T("Test Filter...") , CScanFilterTest::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterTest) },
00309 { edit, ONLN, VIEW, IACT, _T("Linear Regression + Diff (Line)") , CScanFilterBgsDiff_LbL::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterBgsDiff_LbL) },
00310 { edit, ONLN, VIEW, IACT, _T("Linear Regression + Diff (Plane)") , CScanFilterBgsDiff::m_lpcsFilterName , RUNTIME_CLASS(CScanFilterBgsDiff) },
00311
00312
00313 { edit, onln, view, iact, _T("Image shift calculator") , CCalculatorImageShift::m_lpcsFilterName , RUNTIME_CLASS(CCalculatorImageShift) },
00314 };
00315
00316
00317
00318
00319 const DWORD g_dwNrOfFiltersInDll = dim( g_FilterDefTable );
00320
00321
00322
00323
00324
00325 extern int GetTotalNumberOfFilters()
00326 {
00327 return g_dwNrOfFiltersInDll;
00328 }
00329
00330
00331
00332
00333 extern int GetNumberOfEditModelessFilters()
00334 {
00335 int count = 0;
00336 for ( DWORD i = 0; i < g_dwNrOfFiltersInDll; i++ )
00337 {
00338 if ( g_FilterDefTable[i].bHasEditModeless )
00339 {
00340 ++count;
00341 }
00342 }
00343
00344 return count;
00345 }
00346
00347
00348
00349
00350 extern int GetNumberOfOnlineFilters()
00351 {
00352 int count = 0;
00353 for ( DWORD i = 0; i < g_dwNrOfFiltersInDll; i++ )
00354 {
00355 if ( g_FilterDefTable[i].bIsOnlineFilter )
00356 {
00357 ++count;
00358 }
00359 }
00360
00361 return count;
00362 }
00363
00364
00365
00366
00367 extern int GetNumberOfViewingFilters()
00368 {
00369 int count = 0;
00370 for ( DWORD i = 0; i < g_dwNrOfFiltersInDll; i++ )
00371 {
00372 if ( g_FilterDefTable[i].bIsViewingFilter )
00373 {
00374 ++count;
00375 }
00376 }
00377
00378 return count;
00379 }
00380
00381
00382
00383
00384 extern int GetNumberOfInteractiveFilters()
00385 {
00386 int count = 0;
00387 for ( DWORD i = 0; i < g_dwNrOfFiltersInDll; i++ )
00388 {
00389 if ( g_FilterDefTable[i].bIsInteractiveFilter )
00390 {
00391 ++count;
00392 }
00393 }
00394
00395 return count;
00396 }
00397
00398
00399
00400
00401
00402 extern BOOL GetAllFilters( FilterListType* lpList, DWORD& count )
00403 {
00404
00405
00406
00407 count = ( count < g_dwNrOfFiltersInDll ) ? count : g_dwNrOfFiltersInDll;
00408
00409 DWORD i = 0;
00410 for ( ; i < count; ++i )
00411 {
00412
00413
00414
00415 lpList[ i ] = g_FilterDefTable[ i ];
00416 }
00417
00418 count = i;
00419
00420 return TRUE;
00421 }
00422
00423
00424
00425
00426
00427 extern BOOL GetEditModelessFilters( FilterListType* lpList, DWORD& count )
00428 {
00429 DWORD n = 0;
00430 for ( DWORD i = 0; i < g_dwNrOfFiltersInDll && n < count; ++i )
00431 {
00432 if ( g_FilterDefTable[i].bHasEditModeless )
00433 {
00434
00435
00436
00437 lpList[ n++ ] = g_FilterDefTable[ i ];
00438 }
00439 }
00440
00441
00442
00443
00444 count = n;
00445
00446 return TRUE;
00447 }
00448
00449
00450
00451
00452
00453 extern BOOL GetOnlineFilters( FilterListType* lpList, DWORD& count )
00454 {
00455 DWORD n = 0;
00456 for ( DWORD i = 0; i < g_dwNrOfFiltersInDll && n < count; ++i )
00457 {
00458 if ( g_FilterDefTable[i].bIsOnlineFilter )
00459 {
00460
00461
00462
00463 lpList[ n++ ] = g_FilterDefTable[ i ];
00464 }
00465 }
00466
00467
00468
00469
00470 count = n;
00471
00472 return TRUE;
00473 }
00474
00475
00476
00477
00478
00479 extern BOOL GetViewingFilters( FilterListType* lpList, DWORD& count )
00480 {
00481 DWORD n = 0;
00482 for ( DWORD i = 0; i < g_dwNrOfFiltersInDll && n < count; ++i )
00483 {
00484 if ( g_FilterDefTable[i].bIsViewingFilter )
00485 {
00486
00487
00488
00489 lpList[ n++ ] = g_FilterDefTable[ i ];
00490 }
00491 }
00492
00493
00494
00495
00496 count = n;
00497
00498 return TRUE;
00499 }
00500
00501
00502
00503
00504
00505 extern BOOL GetInteractiveFilters( FilterListType* lpList, DWORD& count )
00506 {
00507 DWORD n = 0;
00508 for ( DWORD i = 0; i < g_dwNrOfFiltersInDll && n < count; ++i )
00509 {
00510 if ( g_FilterDefTable[i].bIsInteractiveFilter )
00511 {
00512
00513
00514
00515 lpList[ n++ ] = g_FilterDefTable[ i ];
00516 }
00517 }
00518
00519
00520
00521
00522 count = n;
00523
00524 return TRUE;
00525 }
00526
00527
00528
00529
00530 extern CRuntimeClass* GetImageShiftCalculator()
00531 {
00532 return RUNTIME_CLASS( CCalculatorImageShift );
00533 }
00534
00535
00536
00537
00538
00539