Filter Library Camera Interface Physics

CFiltLib.cpp

00001 /*
00002  * CFiltLib.cpp - AFX extension DLL module main part.
00003  *
00004  * This file is part of the Camera Filter Library.
00005  * Computer Aided Measurement Environment for Realtime Atomic imaging (Camera)
00006  *
00007  * Copyright (C) 2004-2006, Leiden Probe Microscopy.
00008  * Copyright (C) 2000-2004, Universiteit Leiden.
00009  * Copyright (C) 1999-2000, FOM Institute for Atomic and Molecular Physics, Amsterdam.
00010  *
00011  * Authors: M. Seynen (initial version, 03/10/2000), Martin J. Moene
00012  *
00013  * $Id: CFiltLib.cpp 508 2007-02-26 10:28:58Z moene $
00014  */
00015 
00016 #include "stdafx.h"                             // for common (pre-compiled) headers
00017 #include <afxdllx.h>                            // for using MFC in a DLL that multiple running applications can share
00018 //#include <cfl/stdafx.h>                         // for common (pre-compiled) headers
00019 #include <cfl/resource.h>                       // for messages and other resources
00020 
00021 /*
00022  * Configuration:
00023  */
00024 // #define USE_NEW_DEVELOPMENT                     // include/exclude new developments
00025 // #define USE_VISUAL_LEAK_DETECTOR                // for Visual Leak detector
00026 
00027 /*
00028  * End configuration
00029  */
00030 
00031 #if defined( USE_VISUAL_LEAK_DETECTOR )
00032 #include <vld.h>                                // for Visual Leak Detector
00033 #endif
00034 
00035 #include <cfl/version.h>                        // for PRODUCT_NAME etc.
00036 
00037 #include <cfl/ScanBaseBuffer.h>                 // Filter buffers
00038 #include <cfl/ScanFilter.h>                     // Include overall FilterBaseClass
00039 #include <cfl/ProgressDlg.h>                    // Progress Dialog
00040 
00041 #include <cfl/ScanFilterClip.h>                 // Clip Filter
00042 #include <cfl/ScanFilterClad.h>                 // Clad Filter
00043 #include <cfl/ScanFilterShift.h>                // Shift Filter
00044 
00045 #include <cfl/ScanFilterMean.h>                 // Mean Filter
00046 #include <cfl/ScanFilterMedian.h>               // Median Filter
00047 #include <cfl/ScanFilterMinimum.h>              // Minimum Filter
00048 #include <cfl/ScanFilterMaximum.h>              // Maximum Filter
00049 #include <cfl/ScanFilterKuwahara.h>             // Kuwahara Filter
00050 #include <cfl/ScanFilterCustom.h>               // Custom Filter
00051 #include <cfl/ScanFilterLinearRegression.h>     // Linear Regression
00052 
00053 #include <cfl/ScanFilterThreshold.h>            // General Threshold filter
00054 #include <cfl/ScanFilterBinaryThreshold.h>      // Binary threshold filter
00055 
00056 #include <cfl/ScanFilterNull.h>                 // Null Filter (filter template)
00057 #include <cfl/ScanFilterTest.h>                 // TestFilter, our first one in this Lib.
00058 
00059 #include <cfl/ScanFilterErosion.h>              // Erosion Filter
00060 #include <cfl/ScanFilterDilation.h>             // Dilation Filter
00061 
00062 #include <cfl/ScanFilterDifferential_LbL.h>     // Differential Filter (Line by Line)
00063 #include <cfl/ScanFilterDifferential.h>         // Differential Filter
00064 
00065 #include <cfl/ScanFilterBGS_LbL.h>              // Background Subtract (Line)
00066 #include <cfl/ScanFilterBGS_Planar.h>           // Background Subtract (Plane)
00067 #include <cfl/ScanFilterBGS_MCN.h>              // Most Common Normal (MSN) Background Subtraction
00068 
00069 #include <cfl/ScanFilterMath.h>                 // Math Filter
00070 #include <cfl/ScanFilterDZ.h>                   // DZ Filter
00071 #include <cfl/ScanFilterNCCFFT.h>               // Fast Normalized Cross-Correlation
00072 // #include <cfl/ScanFilterNCCFFTOld.h>               // Fast Normalized Cross-Correlation
00073 #include <cfl/ScanFilterCrossCorrelate.h>       // Cross-Correlate
00074 #if defined( USE_NEW_DEVELOPMENT )
00075 //#include <cfl/ScanFilterCrossCorrelate2.h>       // Cross-Correlate
00076 #endif
00077 
00078 #include <cfl/ScanFilterFFT.h>                  // Fast Fourier Transform
00079 #include <cfl/ScanFilterFFTInverse.h>           // Inverse Fast Fourier Transform
00080 
00081 #include <cfl/ScanFilterSwapQuadrants.h>        // Swap Quadrants (for FFT--Correlate--IFFT)
00082 #include <cfl/ScanFilterLowPass.h>              // LowPass Fourier spectrum
00083 #include <cfl/ScanFilterHighPass.h>             // HighPass Fourier spectrum
00084 #include <cfl/ScanFilterAutoCorrelateF.h>       // Auto-Correlate Fourier spectrum
00085 #include <cfl/ScanFilterCrossCorrelateF.h>      // Cross-Correlate Fourier spectrum
00086 
00087 #include <cfl/ScanFilterBgsDiff.h>              // On-line Background Subtract plus Differential filter (Frame)
00088 #include <cfl/ScanFilterBgsDiff_LbL.h>          // On-line Background Subtract plus Differential filter (Line)
00089 
00090 #include <cfl/CalculatorImageShift.h>           // On-line image stabilization (Frame)
00091 
00092 #ifdef _DEBUG
00093 #define new DEBUG_NEW
00094 #undef THIS_FILE
00095 static char THIS_FILE[] = __FILE__;
00096 #endif
00097 
00098 /* *
00099  * \file CFiltLib.cpp
00100  * \brief AFX Extension Module main part.
00101  * \author M. Seynen (03/10/2000, Initial version)
00102  */
00103 
00104 /**
00105  * \addtogroup cfl_cfiltlib AFX Extension DLL module
00106  * \brief AFX Extension Module main part.
00107  * \author M. Seynen (03/10/2000, Initial version)
00108  *
00109  * Doxygen conversion and update by Martin J. Moene.
00110  *
00111  * @{
00112  */
00113 
00114 /**
00115  * Camera application registry subkey for filter settings.
00116  */
00117 const char* gCflRegistrySubkey = CFL_REGISTRY_SUBKEY;
00118 
00119 /**
00120  * the product name.
00121  */
00122 extern LPCTSTR GetFilterLibraryName()
00123 {
00124    return PRODUCT_NAME;
00125 }
00126 
00127 /**
00128  * the product description.
00129  */
00130 extern LPCTSTR GetFilterLibraryDescription()
00131 {
00132    return FILE_DESCRIPTION;
00133 }
00134 
00135 /**
00136  * the product version string.
00137  */
00138 extern LPCTSTR GetFilterLibraryVersionString()
00139 {
00140    return COMMENT_STRING;
00141 }
00142 
00143 /**
00144  * structure to hold the state of of MFC extension DLL module.
00145  *
00146  * \code
00147  * struct AFX_EXTENSION_MODULE
00148  * {
00149  *    BOOL bInitialized;
00150  *    HMODULE hModule;
00151  *    HMODULE hResource;
00152  *    CRuntimeClass* pFirstSharedClass;
00153  *    COleObjectFactory* pFirstSharedFactory;
00154  * };
00155  *
00156  * static AFX_EXTENSION_MODULE extensionDLL;
00157  *
00158  * extern "C" int APIENTRY
00159  * DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID )
00160  * {
00161  *    if ( dwReason == DLL_PROCESS_ATTACH )
00162  *    {
00163  *       // Extension DLL one-time initialization
00164  *       if ( !AfxInitExtensionModule( extensionDLL, hInstance ) )
00165  *          return 0;
00166  * ...
00167  * \endcode
00168  */
00169 static AFX_EXTENSION_MODULE CFiltLibDLL = { NULL, NULL };       // FIXME: remove initializer?
00170 
00171 /**
00172  * the extension's main entry.
00173  */
00174 extern "C" int APIENTRY DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
00175 {
00176    /*
00177     * Remove this if you use lpReserved
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        * Extension DLL one-time initialization
00190        */
00191 
00192       if ( !AfxInitExtensionModule( CFiltLibDLL, hInstance ) )
00193          return 0;
00194 
00195       // Insert this DLL into the resource chain
00196       // NOTE: If this Extension DLL is being implicitly linked to by
00197       //  an MFC Regular DLL (such as an ActiveX Control)
00198       //  instead of an MFC application, then you will want to
00199       //  remove this line from DllMain and put it in a separate
00200       //  function exported from this Extension DLL.  The Regular DLL
00201       //  that uses this Extension DLL should then explicitly call that
00202       //  function to initialize this Extension DLL.  Otherwise,
00203       //  the CDynLinkLibrary object will not be attached to the
00204       //  Regular DLL's resource chain, and serious problems will
00205       //  result.
00206 
00207       new CDynLinkLibrary( CFiltLibDLL );
00208    }
00209    else if ( dwReason == DLL_PROCESS_DETACH )
00210    {
00211       TRACE0( "CFILTLIB.DLL Terminating!\n" );
00212 
00213       /*
00214        * Terminate the library before destructors are called
00215        */
00216 
00217       AfxTermExtensionModule( CFiltLibDLL );
00218    }
00219 
00220    return TRUE;                         // Ok
00221 }
00222 
00223 #define EDIT TRUE       ///< has EditModeless()
00224 #define edit FALSE      ///< does not have EditModeless()
00225 #define ONLN TRUE       ///< is online filter
00226 #define onln FALSE      ///< is not online filter
00227 #define VIEW TRUE       ///< is viewing filter
00228 #define view FALSE      ///< is not viewing filter
00229 #define IACT TRUE       ///< is interactive filter
00230 #define iact FALSE      ///< is not interactive filter
00231 
00232 /**
00233  * the scanfilter list.
00234  */
00235 _tFilterList g_FilterDefTable[] =
00236 {
00237    // EditModeless
00238    //    | is online filter
00239    //    |     | is viewing filter
00240    //    |     |     | is interactive filter
00241    //    |     |     |     | menu name                                 | filter name                                   | filter class
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" /* NormalizeImageFilter */               , RUNTIME_CLASS(CScanFilterNull)             },
00249    { edit, onln, view, IACT, _T("Rescale...     (not implemented)")    , "X" /* RescaleIntensityImageFilter */        , RUNTIME_CLASS(CScanFilterNull)             },
00250    { edit, onln, view, IACT, _T("Shift Scale... (not implemented)")    , "X" /* ShiftScaleImageFilter */              , RUNTIME_CLASS(CScanFilterNull)             },
00251    { edit, onln, view, IACT, _T("Sigmoid...     (not implemented)")    , "X" /* SigmoidImageFilter */                 , 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" /* Manual background subtraction. */     , RUNTIME_CLASS(CScanFilterNull)             },
00281    { edit, onln, view, IACT, _T("Line path...      (not implemented)") , "X" /* Manual background subtraction. */     , RUNTIME_CLASS(CScanFilterNull)             },
00282    { edit, onln, view, IACT, _T("Manual...         (not implemented)") , "X" /* Manual background subtraction. */     , 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 //   { edit, onln, view, IACT, _T("Fast Normalized Cross-Correlation...  [old development]"), CScanFilterNCCFFTOld::m_lpcsFilterName          , RUNTIME_CLASS(CScanFilterNCCFFTOld)           },
00290    { edit, onln, view, IACT, _T("Cross-Correlate (Spatial Domain)...") , CScanFilterCrossCorrelate::m_lpcsFilterName  , RUNTIME_CLASS(CScanFilterCrossCorrelate)   },
00291 #if defined( USE_NEW_DEVELOPMENT )
00292 //   { edit, onln, view, IACT, _T("Cross-Correlate (Spatial Domain)...*"), CScanFilterCrossCorrelate2::m_lpcsFilterName  , RUNTIME_CLASS(CScanFilterCrossCorrelate2)   },
00293 #endif
00294    { edit, onln, view, IACT, _T("Double buffer")               /*---*/ , NULL                                         , NULL                                       },
00295 
00296 //    { edit, onln, view, IACT, _T("Fourier &Transform-")                 , CScanFilterFourier::m_lpcsFilterName         , RUNTIME_CLASS(CScanFilterFourier)          },
00297 //    { edit, onln, view, IACT, _T("&Inverse Fourier Transform-")         , CScanFilterInvFourier::m_lpcsFilterName      , RUNTIME_CLASS(CScanFilterInvFourier)       },
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 //   { edit, onln, view, IACT, _T("More")                      /*---*/ , NULL                                         , NULL                                       },
00312 
00313    { edit, onln, view, iact, _T("Image shift calculator")              , CCalculatorImageShift::m_lpcsFilterName      , RUNTIME_CLASS(CCalculatorImageShift)       },
00314 };
00315 
00316 /**
00317  * the number of scanfilters in the list.
00318  */
00319 const DWORD g_dwNrOfFiltersInDll = dim( g_FilterDefTable );
00320 
00321 /**
00322  * the number of available filters: online, viewing, other filters and
00323  * submenu titles.
00324  */
00325 extern int GetTotalNumberOfFilters()
00326 {
00327    return g_dwNrOfFiltersInDll;
00328 }
00329 
00330 /**
00331  * the number of filters that implement EditModeless().
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  * the number of online filters.
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  * the number of viewing filters.
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  * the number of filters in the filter menu.
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  * obtain all filters: online, viewing and other filters;
00400  * reports actual number of filters obtained in count.
00401  */
00402 extern BOOL GetAllFilters( FilterListType* lpList, DWORD& count )
00403 {
00404    /*
00405     * count = min( count, g_dwNrOfFiltersInDll )
00406     */
00407    count = ( count < g_dwNrOfFiltersInDll ) ? count : g_dwNrOfFiltersInDll;
00408 
00409    DWORD i = 0;
00410    for ( ; i < count; ++i )
00411    {
00412       /*
00413        * default compiler struct copy:
00414        */
00415       lpList[ i ] = g_FilterDefTable[ i ];
00416    }
00417 
00418    count = i;
00419 
00420    return TRUE;
00421 }
00422 
00423 /**
00424  * obtain filters that implement EditModeless();
00425  * reports actual number of filters obtained in count.
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           * default compiler struct copy:
00436           */
00437          lpList[ n++ ] = g_FilterDefTable[ i ];
00438       }
00439    }
00440 
00441    /*
00442     * report actual number of filters obtained:
00443     */
00444    count = n;
00445 
00446    return TRUE;
00447 }
00448 
00449 /**
00450  * obtain online filters;
00451  * reports actual number of filters obtained in count.
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           * default compiler struct copy:
00462           */
00463          lpList[ n++ ] = g_FilterDefTable[ i ];
00464       }
00465    }
00466 
00467    /*
00468     * report actual number of filters obtained:
00469     */
00470    count = n;
00471 
00472    return TRUE;
00473 }
00474 
00475 /**
00476  * obtain viewing filters;
00477  * reports actual number of filters obtained in count.
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           * default compiler struct copy:
00488           */
00489          lpList[ n++ ] = g_FilterDefTable[ i ];
00490       }
00491    }
00492 
00493    /*
00494     * report actual number of filters obtained:
00495     */
00496    count = n;
00497 
00498    return TRUE;
00499 }
00500 
00501 /**
00502  * obtain interactive filters;
00503  * reports actual number of filters obtained in count.
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           * default compiler struct copy:
00514           */
00515          lpList[ n++ ] = g_FilterDefTable[ i ];
00516       }
00517    }
00518 
00519    /*
00520     * report actual number of filters obtained:
00521     */
00522    count = n;
00523 
00524    return TRUE;
00525 }
00526 
00527 /**
00528  * obtain an image shift calculator object.
00529  */
00530 extern CRuntimeClass* GetImageShiftCalculator()
00531 {
00532    return RUNTIME_CLASS( CCalculatorImageShift );
00533 }
00534 
00535 /// @} cfl_cfiltlib
00536 
00537 /*
00538  * end of file
00539  */

Camera Filter Library documentation © 2004-2007 by Leiden Probe Microscopy