[pktools] 01/07: Imported Upstream version 2.6.6

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Fri Jan 22 12:08:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository pktools.

commit a9e3ebd71347b53499104cdf19e1728c26768923
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri Jan 22 11:48:20 2016 +0100

    Imported Upstream version 2.6.6
---
 ChangeLog                                          |   26 +-
 configure                                          |   22 +-
 configure.ac                                       |    4 +-
 doc/Doxyfile                                       |    4 +-
 doc/apps.dox                                       |    2 +
 doc/{apps.dox => apps.dox~}                        |    3 +
 doc/examples_pkkalman.dox                          |   31 +
 doc/examples_pkkalman.dox~                         |   14 +
 doc/{ => figures}/logo.odg                         |  Bin
 doc/{ => figures}/logo.png                         |  Bin
 doc/html/ConfusionMatrix_8cc_source.html           |    4 +-
 doc/html/ConfusionMatrix_8h_source.html            |    4 +-
 doc/html/CostFactorySVM_8cc_source.html            |    4 +-
 doc/html/CostFactorySVM_8h_source.html             |    4 +-
 doc/html/CostFactory_8h_source.html                |    4 +-
 doc/html/Egcs_8cc_source.html                      |    4 +-
 doc/html/Egcs_8h_source.html                       |    4 +-
 doc/html/FeatureSelector_8h_source.html            |    6 +-
 doc/html/FileReaderAscii_8cc_source.html           |    4 +-
 doc/html/FileReaderAscii_8h_source.html            |    4 +-
 doc/html/FileReaderLas_8cc_source.html             |    4 +-
 doc/html/FileReaderLas_8h_source.html              |    4 +-
 doc/html/Filter2d_8cc_source.html                  | 1701 +++++-----
 doc/html/Filter2d_8h_source.html                   | 2460 +++++++--------
 doc/html/Filter_8cc_source.html                    | 1391 ++++----
 doc/html/Filter_8h_source.html                     | 1540 ++++-----
 doc/html/Filter__old_8h_source.html                |    8 +-
 ...fsann_8h_source.html => ImgGdal_8h_source.html} |   78 +-
 doc/html/ImgRasterGdal_8cc_source.html             |  414 +++
 doc/html/ImgRasterGdal_8h_source.html              |  175 ++
 doc/html/ImgReaderGdal_8cc_source.html             | 1054 +++----
 doc/html/ImgReaderGdal_8h_source.html              |  528 ++--
 doc/html/ImgReaderOgr_8cc_source.html              |  736 ++---
 doc/html/ImgReaderOgr_8h_source.html               | 1761 +++++------
 doc/html/ImgRegression_8cc_source.html             |    6 +-
 doc/html/ImgRegression_8h_source.html              |    6 +-
 ..._source.html => ImgUpdaterGdal_8cc_source.html} |   53 +-
 ...h_source.html => ImgUpdaterGdal_8h_source.html} |   67 +-
 doc/html/ImgWriterGdal_8cc_source.html             |  733 ++---
 doc/html/ImgWriterGdal_8h_source.html              |  390 ++-
 doc/html/ImgWriterOgr_8cc_source.html              | 1128 +++----
 doc/html/ImgWriterOgr_8h_source.html               |   49 +-
 doc/html/IndexValue_8h_source.html                 |    4 +-
 doc/html/OptFactory_8h_source.html                 |    4 +-
 doc/html/Optionpk_8h_source.html                   |    4 +-
 doc/html/PosValue_8h_source.html                   |    4 +-
 doc/html/ProcessingPktoolsPlugin_8py_source.html   |    4 +-
 doc/html/StatFactory_8h_source.html                | 2877 +++++++++--------
 ..._pkdsm2shadow.html => Vector2d_8cc_source.html} |   27 +-
 doc/html/Vector2d_8h_source.html                   |    4 +-
 doc/html/____init_____8py_source.html              |    4 +-
 doc/html/annotated.html                            |   58 +-
 ...gui-gcc-Debug_2moc__mainwindow_8cpp_source.html |    4 +-
 ...e__gui-gcc-Debug_2ui__mainwindow_8h_source.html |    4 +-
 ...i-gcc-Release_2moc__mainwindow_8cpp_source.html |    4 +-
 ..._gui-gcc-Release_2ui__mainwindow_8h_source.html |    4 +-
 ...gui-gcc-Debug_2moc__mainwindow_8cpp_source.html |    4 +-
 ...p__gui-gcc-Debug_2ui__mainwindow_8h_source.html |    4 +-
 ...i-gcc-Release_2moc__mainwindow_8cpp_source.html |    4 +-
 ..._gui-gcc-Release_2ui__mainwindow_8h_source.html |    4 +-
 ...gui-gcc-Debug_2moc__mainwindow_8cpp_source.html |    4 +-
 ...f__gui-gcc-Debug_2ui__mainwindow_8h_source.html |    4 +-
 ...i-gcc-Release_2moc__mainwindow_8cpp_source.html |    4 +-
 ..._gui-gcc-Release_2ui__mainwindow_8h_source.html |    4 +-
 ...gui-gcc-Debug_2moc__mainwindow_8cpp_source.html |    4 +-
 ...t__gui-gcc-Debug_2ui__mainwindow_8h_source.html |    4 +-
 ...i-gcc-Release_2moc__mainwindow_8cpp_source.html |    4 +-
 ..._gui-gcc-Release_2ui__mainwindow_8h_source.html |    4 +-
 ...gui-gcc-Debug_2moc__mainwindow_8cpp_source.html |    4 +-
 ...m__gui-gcc-Debug_2ui__mainwindow_8h_source.html |    4 +-
 ...i-gcc-Release_2moc__mainwindow_8cpp_source.html |    4 +-
 ..._gui-gcc-Release_2ui__mainwindow_8h_source.html |    4 +-
 doc/html/classBadConversion-members.html           |    4 +-
 doc/html/classBadConversion.html                   |    4 +-
 doc/html/classCache-members.html                   |    4 +-
 doc/html/classCache.html                           |    4 +-
 doc/html/classCompare__IndexValue-members.html     |    4 +-
 doc/html/classCompare__IndexValue.html             |    4 +-
 doc/html/classCompare__PosValue-members.html       |    4 +-
 doc/html/classCompare__PosValue.html               |    4 +-
 doc/html/classCostFactory-members.html             |    4 +-
 doc/html/classCostFactory.html                     |    4 +-
 doc/html/classCostFactoryANN-members.html          |    4 +-
 doc/html/classCostFactoryANN.html                  |    4 +-
 doc/html/classCostFactorySVM-members.html          |    4 +-
 doc/html/classCostFactorySVM.html                  |    4 +-
 doc/html/classDataModel-members.html               |    4 +-
 doc/html/classDataModel.html                       |    4 +-
 doc/html/classDecrease__IndexValue-members.html    |    4 +-
 doc/html/classDecrease__IndexValue.html            |    4 +-
 doc/html/classDecrease__PosValue-members.html      |    4 +-
 doc/html/classDecrease__PosValue.html              |    4 +-
 doc/html/classEgcs-members.html                    |    4 +-
 doc/html/classEgcs.html                            |    4 +-
 doc/html/classFANN_1_1neural__net-members.html     |    4 +-
 doc/html/classFANN_1_1neural__net.html             |    4 +-
 doc/html/classFANN_1_1training__data-members.html  |    4 +-
 doc/html/classFANN_1_1training__data.html          |    4 +-
 doc/html/classFeatureSelector-members.html         |    4 +-
 doc/html/classFeatureSelector.html                 |    4 +-
 doc/html/classFileReaderAscii-members.html         |    4 +-
 doc/html/classFileReaderAscii.html                 |    4 +-
 doc/html/classFileReaderLas-members.html           |    4 +-
 doc/html/classFileReaderLas.html                   |    4 +-
 doc/html/classImgRasterGdal-members.html           |  126 +
 doc/html/classImgRasterGdal.html                   |  257 ++
 ...aph.map => classImgRasterGdal__coll__graph.map} |    2 +-
 doc/html/classImgRasterGdal__coll__graph.md5       |    1 +
 doc/html/classImgRasterGdal__coll__graph.png       |  Bin 0 -> 9624 bytes
 doc/html/classImgRasterGdal__inherit__graph.map    |    5 +
 doc/html/classImgRasterGdal__inherit__graph.md5    |    1 +
 doc/html/classImgRasterGdal__inherit__graph.png    |  Bin 0 -> 12506 bytes
 doc/html/classImgReaderGdal-members.html           |  134 +-
 doc/html/classImgReaderGdal.html                   |  299 +-
 doc/html/classImgReaderGdal__coll__graph.map       |    5 +-
 doc/html/classImgReaderGdal__coll__graph.md5       |    2 +-
 doc/html/classImgReaderGdal__coll__graph.png       |  Bin 11843 -> 14605 bytes
 doc/html/classImgReaderGdal__inherit__graph.map    |    4 +
 doc/html/classImgReaderGdal__inherit__graph.md5    |    1 +
 doc/html/classImgReaderGdal__inherit__graph.png    |  Bin 0 -> 6726 bytes
 doc/html/classImgReaderOgr-members.html            |    4 +-
 doc/html/classImgReaderOgr.html                    |    4 +-
 doc/html/classImgUpdaterGdal-members.html          |  178 ++
 doc/html/classImgUpdaterGdal.html                  |  445 +++
 doc/html/classImgUpdaterGdal__coll__graph.map      |    7 +
 doc/html/classImgUpdaterGdal__coll__graph.md5      |    1 +
 doc/html/classImgUpdaterGdal__coll__graph.png      |  Bin 0 -> 34794 bytes
 doc/html/classImgUpdaterGdal__inherit__graph.map   |    5 +
 doc/html/classImgUpdaterGdal__inherit__graph.md5   |    1 +
 doc/html/classImgUpdaterGdal__inherit__graph.png   |  Bin 0 -> 12542 bytes
 doc/html/classImgWriterGdal-members.html           |  116 +-
 doc/html/classImgWriterGdal.html                   |  239 +-
 doc/html/classImgWriterGdal__coll__graph.map       |    5 +-
 doc/html/classImgWriterGdal__coll__graph.md5       |    2 +-
 doc/html/classImgWriterGdal__coll__graph.png       |  Bin 14112 -> 16361 bytes
 doc/html/classImgWriterGdal__inherit__graph.map    |    4 +
 doc/html/classImgWriterGdal__inherit__graph.md5    |    1 +
 doc/html/classImgWriterGdal__inherit__graph.png    |  Bin 0 -> 6909 bytes
 doc/html/classImgWriterOgr-members.html            |    4 +-
 doc/html/classImgWriterOgr.html                    |    4 +-
 doc/html/classIncrease__IndexValue-members.html    |    4 +-
 doc/html/classIncrease__IndexValue.html            |    4 +-
 doc/html/classIncrease__PosValue-members.html      |    4 +-
 doc/html/classIncrease__PosValue.html              |    4 +-
 doc/html/classKernel-members.html                  |    4 +-
 doc/html/classKernel.html                          |    4 +-
 doc/html/classLastReturnFilter-members.html        |    4 +-
 doc/html/classLastReturnFilter.html                |    4 +-
 doc/html/classMainWindow-members.html              |    4 +-
 doc/html/classMainWindow.html                      |    4 +-
 doc/html/classONE__CLASS__Q-members.html           |    4 +-
 doc/html/classONE__CLASS__Q.html                   |    4 +-
 doc/html/classOptFactory-members.html              |    4 +-
 doc/html/classOptFactory.html                      |    4 +-
 doc/html/classOptionpk-members.html                |   30 +-
 doc/html/classOptionpk.html                        |   29 +-
 doc/html/classQMatrix-members.html                 |    4 +-
 doc/html/classQMatrix.html                         |    4 +-
 doc/html/classSVC__Q-members.html                  |    4 +-
 doc/html/classSVC__Q.html                          |    4 +-
 doc/html/classSVR__Q-members.html                  |    4 +-
 doc/html/classSVR__Q.html                          |    4 +-
 doc/html/classSolver-members.html                  |    4 +-
 doc/html/classSolver.html                          |    4 +-
 doc/html/classSolver__NU-members.html              |    4 +-
 doc/html/classSolver__NU.html                      |    4 +-
 doc/html/classUi_1_1MainWindow-members.html        |    4 +-
 doc/html/classUi_1_1MainWindow.html                |    4 +-
 doc/html/classUi__MainWindow-members.html          |    4 +-
 doc/html/classUi__MainWindow.html                  |    4 +-
 doc/html/classVector2d-members.html                |    4 +-
 doc/html/classVector2d.html                        |    4 +-
 ...confusionmatrix_1_1ConfusionMatrix-members.html |    4 +-
 .../classconfusionmatrix_1_1ConfusionMatrix.html   |    4 +-
 doc/html/classes.html                              |   84 +-
 doc/html/classfilter2d_1_1Filter2d-members.html    |    4 +-
 doc/html/classfilter2d_1_1Filter2d.html            |    4 +-
 doc/html/classfilter_1_1Filter-members.html        |   28 +-
 doc/html/classfilter_1_1Filter.html                |   16 +-
 ...lassimgregression_1_1ImgRegression-members.html |    4 +-
 doc/html/classimgregression_1_1ImgRegression.html  |    4 +-
 ...sPlugin_1_1ProcessingPktoolsPlugin-members.html |    4 +-
 ...ngPktoolsPlugin_1_1ProcessingPktoolsPlugin.html |    4 +-
 ...qgis_1_1pkcomposite_1_1pkcomposite-members.html |    4 +-
 .../classqgis_1_1pkcomposite_1_1pkcomposite.html   |    4 +-
 .../classqgis_1_1pkcrop_1_1pkcrop-members.html     |    4 +-
 doc/html/classqgis_1_1pkcrop_1_1pkcrop.html        |    4 +-
 ...diff__accuracy_1_1pkdiff__accuracy-members.html |    4 +-
 ...is_1_1pkdiff__accuracy_1_1pkdiff__accuracy.html |    4 +-
 ...lassqgis_1_1pkextract_1_1pkextract-members.html |    4 +-
 doc/html/classqgis_1_1pkextract_1_1pkextract.html  |    4 +-
 ...pkextract__grid_1_1pkextract__grid-members.html |    4 +-
 ...qgis_1_1pkextract__grid_1_1pkextract__grid.html |    4 +-
 ...tract__random_1_1pkextract__random-members.html |    4 +-
 ..._1_1pkextract__random_1_1pkextract__random.html |    4 +-
 ...lter__spatial_1_1pkfilter__spatial-members.html |    4 +-
 ..._1_1pkfilter__spatial_1_1pkfilter__spatial.html |    4 +-
 ...er__spectral_1_1pkfilter__spectral-members.html |    4 +-
 ..._1pkfilter__spectral_1_1pkfilter__spectral.html |    4 +-
 ...qgis_1_1pkfilterdem_1_1pkfilterdem-members.html |    4 +-
 .../classqgis_1_1pkfilterdem_1_1pkfilterdem.html   |    4 +-
 ...lassqgis_1_1pkgetmask_1_1pkgetmask-members.html |    4 +-
 doc/html/classqgis_1_1pkgetmask_1_1pkgetmask.html  |    4 +-
 ...lassqgis_1_1pklas2img_1_1pklas2img-members.html |    4 +-
 doc/html/classqgis_1_1pklas2img_1_1pklas2img.html  |    4 +-
 ...lassqgis_1_1pkreclass_1_1pkreclass-members.html |    4 +-
 doc/html/classqgis_1_1pkreclass_1_1pkreclass.html  |    4 +-
 ...lassqgis_1_1pksetmask_1_1pksetmask-members.html |    4 +-
 doc/html/classqgis_1_1pksetmask_1_1pksetmask.html  |    4 +-
 doc/html/classqgis_1_1pksvm_1_1pksvm-members.html  |    4 +-
 doc/html/classqgis_1_1pksvm_1_1pksvm.html          |    4 +-
 ...orithmProvider_1_1pktoolsAlgorithmProvider.html |    4 +-
 ...toolsAlgorithm_1_1pktoolsAlgorithm-members.html |    4 +-
 ...is_1_1pktoolsAlgorithm_1_1pktoolsAlgorithm.html |    4 +-
 ...is_1_1pktoolsUtils_1_1pktoolsUtils-members.html |    4 +-
 .../classqgis_1_1pktoolsUtils_1_1pktoolsUtils.html |    4 +-
 ...ools_1_1pkcomposite_1_1pkcomposite-members.html |    4 +-
 ...s_1_1pktools_1_1pkcomposite_1_1pkcomposite.html |    4 +-
 ...gis_1_1pktools_1_1pkcrop_1_1pkcrop-members.html |    4 +-
 .../classqgis_1_1pktools_1_1pkcrop_1_1pkcrop.html  |    4 +-
 ...diff__accuracy_1_1pkdiff__accuracy-members.html |    4 +-
 ...ls_1_1pkdiff__accuracy_1_1pkdiff__accuracy.html |    4 +-
 ...1pktools_1_1pkextract_1_1pkextract-members.html |    4 +-
 ...sqgis_1_1pktools_1_1pkextract_1_1pkextract.html |    4 +-
 ...pkextract__grid_1_1pkextract__grid-members.html |    4 +-
 ...ools_1_1pkextract__grid_1_1pkextract__grid.html |    4 +-
 ...tract__random_1_1pkextract__random-members.html |    4 +-
 ..._1_1pkextract__random_1_1pkextract__random.html |    4 +-
 ...lter__spatial_1_1pkfilter__spatial-members.html |    4 +-
 ..._1_1pkfilter__spatial_1_1pkfilter__spatial.html |    4 +-
 ...er__spectral_1_1pkfilter__spectral-members.html |    4 +-
 ..._1pkfilter__spectral_1_1pkfilter__spectral.html |    4 +-
 ...ools_1_1pkfilterdem_1_1pkfilterdem-members.html |    4 +-
 ...s_1_1pktools_1_1pkfilterdem_1_1pkfilterdem.html |    4 +-
 ...1pktools_1_1pkgetmask_1_1pkgetmask-members.html |    4 +-
 ...sqgis_1_1pktools_1_1pkgetmask_1_1pkgetmask.html |    4 +-
 ...1pktools_1_1pklas2img_1_1pklas2img-members.html |    4 +-
 ...sqgis_1_1pktools_1_1pklas2img_1_1pklas2img.html |    4 +-
 ...1pktools_1_1pkreclass_1_1pkreclass-members.html |    4 +-
 ...sqgis_1_1pktools_1_1pkreclass_1_1pkreclass.html |    4 +-
 ...1pktools_1_1pksetmask_1_1pksetmask-members.html |    4 +-
 ...sqgis_1_1pktools_1_1pksetmask_1_1pksetmask.html |    4 +-
 ...sqgis_1_1pktools_1_1pksvm_1_1pksvm-members.html |    4 +-
 .../classqgis_1_1pktools_1_1pksvm_1_1pksvm.html    |    4 +-
 ...toolsAlgorithm_1_1pktoolsAlgorithm-members.html |    4 +-
 ...ls_1_1pktoolsAlgorithm_1_1pktoolsAlgorithm.html |    4 +-
 ...ls_1_1pktoolsUtils_1_1pktoolsUtils-members.html |    4 +-
 ...1_1pktools_1_1pktoolsUtils_1_1pktoolsUtils.html |    4 +-
 .../classstatfactory_1_1StatFactory-members.html   |  151 +-
 doc/html/classstatfactory_1_1StatFactory.html      |   16 +-
 doc/html/config_8h_source.html                     |   10 +-
 doc/html/dir_0af1587c8378955de40f48b4bd1869f0.html |    6 +-
 doc/html/dir_0f38b5d14ac73b43e2a48a75f9e70be8.html |    4 +-
 doc/html/dir_0f63d6441a2c250919e1e8723011eb2f.html |    4 +-
 doc/html/dir_2676862852e3d558e3597542a81ecc63.html |    4 +-
 doc/html/dir_280a0ba2820d23d6529bf494f1ea3ddd.html |    4 +-
 doc/html/dir_35acdce8930fac877097c845a64519e5.html |    4 +-
 doc/html/dir_41d189c72498e24f979b227eb8e138b1.html |    4 +-
 doc/html/dir_4dfaa1fe1382d1276d1c80b1d5035ade.html |    4 +-
 doc/html/dir_53adf0b982dc8545998aae3f283a5a58.html |    8 +-
 doc/html/dir_5785acc8d2e42f8795bdbe936856f26d.html |    4 +-
 doc/html/dir_5f1e10fd305b434def78aaf73fd56d60.html |    4 +-
 doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html |    4 +-
 doc/html/dir_6d2fd95b0bd390617ad5a1eb4a537b4a.html |   14 +-
 doc/html/dir_849702d4228bd835bdf1201002937cb3.html |    4 +-
 doc/html/dir_89a0bd85ecec8fbb2c320310670be290.html |    4 +-
 doc/html/dir_ab1bbd5a6b4bd6507847335527b029bb.html |    4 +-
 doc/html/dir_b66e135988e27fdc966ddddb8708f514.html |    4 +-
 doc/html/dir_b6b6de371025fb67c6b8623f3d3cd2ce.html |    4 +-
 doc/html/dir_b7cc22b4453454f1e686d9a2e78d988d.html |    4 +-
 doc/html/dir_b8eb6544d8d9ffceba16909a7b9d17d7.html |    4 +-
 doc/html/dir_d7b2ebecdb5f44d7fa09bdedebc881a7.html |    4 +-
 doc/html/dir_e28b2035b152bb51229fe7a0fca4e376.html |    4 +-
 doc/html/dir_e61db0d85028141ec5940fd7f2a6e0fc.html |    4 +-
 doc/html/dir_e6df591b0639d4c4807ef64d058833e2.html |    4 +-
 doc/html/dir_ed1df9621940d6aa1183c365ad1750d2.html |    4 +-
 doc/html/dir_f92e37ed5759424bff98155847b1034b.html |    4 +-
 doc/html/files.html                                |   58 +-
 doc/html/functions.html                            |    4 +-
 doc/html/functions_func.html                       |    4 +-
 doc/html/functions_rela.html                       |    4 +-
 doc/html/graph_legend.html                         |    4 +-
 doc/html/hierarchy.html                            |  175 +-
 doc/html/index.html                                |    4 +-
 doc/html/inherit_graph_18.map                      |    5 +-
 doc/html/inherit_graph_18.md5                      |    2 +-
 doc/html/inherit_graph_18.png                      |  Bin 1492 -> 8335 bytes
 doc/html/inherit_graph_21.map                      |    2 +-
 doc/html/inherit_graph_21.md5                      |    2 +-
 doc/html/inherit_graph_21.png                      |  Bin 1671 -> 1481 bytes
 doc/html/inherit_graph_22.map                      |    2 +-
 doc/html/inherit_graph_22.md5                      |    2 +-
 doc/html/inherit_graph_22.png                      |  Bin 1481 -> 1737 bytes
 doc/html/inherit_graph_23.map                      |    2 +-
 doc/html/inherit_graph_23.md5                      |    2 +-
 doc/html/inherit_graph_23.png                      |  Bin 1737 -> 1754 bytes
 doc/html/inherit_graph_24.map                      |    2 +-
 doc/html/inherit_graph_24.md5                      |    2 +-
 doc/html/inherit_graph_24.png                      |  Bin 1754 -> 1346 bytes
 doc/html/inherit_graph_25.map                      |    2 +-
 doc/html/inherit_graph_25.md5                      |    2 +-
 doc/html/inherit_graph_25.png                      |  Bin 1346 -> 1822 bytes
 doc/html/inherit_graph_26.map                      |    2 +-
 doc/html/inherit_graph_26.md5                      |    2 +-
 doc/html/inherit_graph_26.png                      |  Bin 1822 -> 2329 bytes
 doc/html/inherit_graph_27.map                      |    2 +-
 doc/html/inherit_graph_27.md5                      |    2 +-
 doc/html/inherit_graph_27.png                      |  Bin 2329 -> 1572 bytes
 doc/html/inherit_graph_28.map                      |    5 +-
 doc/html/inherit_graph_28.md5                      |    2 +-
 doc/html/inherit_graph_28.png                      |  Bin 1572 -> 7860 bytes
 doc/html/inherit_graph_29.map                      |    5 +-
 doc/html/inherit_graph_29.md5                      |    2 +-
 doc/html/inherit_graph_29.png                      |  Bin 7860 -> 1411 bytes
 doc/html/inherit_graph_30.map                      |   29 +-
 doc/html/inherit_graph_30.md5                      |    2 +-
 doc/html/inherit_graph_30.png                      |  Bin 1411 -> 167041 bytes
 doc/html/inherit_graph_31.map                      |   30 +-
 doc/html/inherit_graph_31.md5                      |    2 +-
 doc/html/inherit_graph_31.png                      |  Bin 167041 -> 5862 bytes
 doc/html/inherit_graph_32.map                      |    4 +-
 doc/html/inherit_graph_32.md5                      |    2 +-
 doc/html/inherit_graph_32.png                      |  Bin 5862 -> 9013 bytes
 doc/html/inherit_graph_33.map                      |    3 +-
 doc/html/inherit_graph_33.md5                      |    2 +-
 doc/html/inherit_graph_33.png                      |  Bin 9013 -> 1956 bytes
 doc/html/inherit_graph_34.map                      |    2 +-
 doc/html/inherit_graph_34.md5                      |    2 +-
 doc/html/inherit_graph_34.png                      |  Bin 1956 -> 2724 bytes
 doc/html/inherit_graph_35.map                      |    2 +-
 doc/html/inherit_graph_35.md5                      |    2 +-
 doc/html/inherit_graph_35.png                      |  Bin 2724 -> 1915 bytes
 doc/html/inherit_graph_36.map                      |    2 +-
 doc/html/inherit_graph_36.md5                      |    2 +-
 doc/html/inherit_graph_36.png                      |  Bin 1915 -> 2334 bytes
 doc/html/inherit_graph_37.map                      |    6 +-
 doc/html/inherit_graph_37.md5                      |    2 +-
 doc/html/inherit_graph_37.png                      |  Bin 2334 -> 8435 bytes
 doc/html/inherit_graph_38.map                      |    7 +-
 doc/html/inherit_graph_38.md5                      |    2 +-
 doc/html/inherit_graph_38.png                      |  Bin 8435 -> 1729 bytes
 doc/html/inherit_graph_39.map                      |    3 +-
 doc/html/inherit_graph_39.md5                      |    2 +-
 doc/html/inherit_graph_39.png                      |  Bin 1729 -> 1477 bytes
 doc/html/inherit_graph_40.map                      |    2 +-
 doc/html/inherit_graph_40.md5                      |    2 +-
 doc/html/inherit_graph_40.png                      |  Bin 1477 -> 1721 bytes
 doc/html/inherit_graph_41.map                      |    2 +-
 doc/html/inherit_graph_41.md5                      |    2 +-
 doc/html/inherit_graph_41.png                      |  Bin 1721 -> 1134 bytes
 doc/html/inherit_graph_42.map                      |    2 +-
 doc/html/inherit_graph_42.md5                      |    2 +-
 doc/html/inherit_graph_42.png                      |  Bin 1134 -> 1161 bytes
 doc/html/inherit_graph_43.map                      |    2 +-
 doc/html/inherit_graph_43.md5                      |    2 +-
 doc/html/inherit_graph_43.png                      |  Bin 1161 -> 1350 bytes
 doc/html/inherit_graph_44.map                      |    2 +-
 doc/html/inherit_graph_44.md5                      |    2 +-
 doc/html/inherit_graph_44.png                      |  Bin 1350 -> 1221 bytes
 doc/html/inherit_graph_45.map                      |    3 +-
 doc/html/inherit_graph_45.md5                      |    2 +-
 doc/html/inherit_graph_45.png                      |  Bin 1221 -> 2164 bytes
 doc/html/inherits.html                             |   64 +-
 doc/html/md_apps.html                              |    6 +-
 doc/html/md_description_pkstat.html                |    4 +-
 doc/html/md_examples_pkann.html                    |    4 +-
 doc/html/md_examples_pkascii2img.html              |    4 +-
 doc/html/md_examples_pkascii2ogr.html              |    4 +-
 doc/html/md_examples_pkcomposite.html              |    4 +-
 doc/html/md_examples_pkcreatect.html               |    4 +-
 doc/html/md_examples_pkcrop.html                   |    4 +-
 doc/html/md_examples_pkdiff.html                   |    4 +-
 doc/html/md_examples_pkdsm2shadow.html             |    4 +-
 doc/html/md_examples_pkdumpimg.html                |    4 +-
 doc/html/md_examples_pkdumpogr.html                |    4 +-
 doc/html/md_examples_pkextract.html                |    4 +-
 doc/html/md_examples_pkfilter.html                 |    4 +-
 doc/html/md_examples_pkgetmask.html                |    4 +-
 doc/html/md_examples_pkinfo.html                   |    4 +-
 doc/html/md_examples_pkkalman.html                 |   75 +
 doc/html/md_examples_pkpolygonize.html             |    4 +-
 doc/html/md_examples_pkreclass.html                |    4 +-
 doc/html/md_examples_pksetmask.html                |    4 +-
 doc/html/md_examples_pksieve.html                  |    4 +-
 doc/html/md_examples_pkstatogr.html                |    4 +-
 doc/html/md_examples_pksvm.html                    |    4 +-
 doc/html/md_faq_pkcomposite.html                   |    4 +-
 doc/html/md_faq_pksetmask.html                     |    4 +-
 doc/html/md_header.html                            |    4 +-
 doc/html/md_installation_linux.html                |   27 +-
 doc/html/md_installation_plugins.html              |    4 +-
 doc/html/md_installation_windows.html              |   38 +-
 doc/html/md_mainpage.html                          |    4 +-
 doc/html/myfann__cpp_8h_source.html                |    4 +-
 doc/html/pages.html                                |   96 +-
 doc/html/pkann.html                                |    6 +-
 doc/html/pkann_8cc_source.html                     | 2400 +++++++-------
 doc/html/pkascii2img.html                          |    4 +-
 doc/html/pkascii2img_8cc_source.html               |    6 +-
 doc/html/pkascii2ogr.html                          |    4 +-
 doc/html/pkascii2ogr_8cc_source.html               |    4 +-
 doc/html/pkcomposite.html                          |   12 +-
 doc/html/pkcomposite_8cc_source.html               | 2282 +++++++-------
 doc/html/pkcomposite_8py_source.html               |    4 +-
 doc/html/pkcomposite__gui_2main_8cc_source.html    |    4 +-
 .../pkcomposite__gui_2mainwindow_8cc_source.html   |    4 +-
 .../pkcomposite__gui_2mainwindow_8h_source.html    |    4 +-
 doc/html/pkcreatect.html                           |    6 +-
 doc/html/pkcreatect_8cc_source.html                |   10 +-
 doc/html/pkcrop.html                               |   14 +-
 doc/html/pkcrop_8cc_source.html                    | 1402 +++++----
 doc/html/pkcrop_8py_source.html                    |    4 +-
 doc/html/pkcrop__gui_2main_8cc_source.html         |    4 +-
 doc/html/pkcrop__gui_2mainwindow_8cc_source.html   |    4 +-
 doc/html/pkcrop__gui_2mainwindow_8h_source.html    |    4 +-
 doc/html/pkdiff.html                               |    6 +-
 doc/html/pkdiff_8cc_source.html                    | 1728 +++++-----
 doc/html/pkdiff__accuracy_8py_source.html          |    4 +-
 doc/html/pkdiff__gui_2main_8cpp_source.html        |    4 +-
 doc/html/pkdiff__gui_2mainwindow_8cpp_source.html  |    4 +-
 doc/html/pkdiff__gui_2mainwindow_8h_source.html    |    4 +-
 doc/html/pkdsm2shadow.html                         |    6 +-
 doc/html/pkdsm2shadow_8cc_source.html              |   12 +-
 doc/html/pkdumpimg.html                            |    4 +-
 doc/html/pkdumpimg_8cc_source.html                 |    6 +-
 doc/html/pkdumpogr.html                            |    4 +-
 doc/html/pkdumpogr_8cc_source.html                 |    4 +-
 doc/html/pkdumpogr_8h_source.html                  |    4 +-
 doc/html/pkeditogr_8cc_source.html                 |    4 +-
 doc/html/pkegcs.html                               |    4 +-
 doc/html/pkegcs_8cc_source.html                    |    6 +-
 doc/html/pkenhance_8cc_source.html                 |    8 +-
 doc/html/pkextract.html                            |    4 +-
 doc/html/pkextract_8cc_source.html                 | 3209 +++++++++----------
 doc/html/pkextract_8py_source.html                 |    4 +-
 doc/html/pkextract__grid_8py_source.html           |    4 +-
 doc/html/pkextract__gui_2main_8cpp_source.html     |    4 +-
 .../pkextract__gui_2mainwindow_8cpp_source.html    |    4 +-
 doc/html/pkextract__gui_2mainwindow_8h_source.html |    4 +-
 doc/html/pkextract__random_8py_source.html         |    4 +-
 doc/html/pkfillnodata.html                         |    4 +-
 doc/html/pkfillnodata_8cc_source.html              |    4 +-
 doc/html/pkfilter.html                             |   10 +-
 doc/html/pkfilter_8cc_source.html                  | 1863 +++++------
 doc/html/pkfilter__spatial_8py_source.html         |    4 +-
 doc/html/pkfilter__spectral_8py_source.html        |    4 +-
 doc/html/pkfilterascii.html                        |    4 +-
 doc/html/pkfilterascii_8cc_source.html             |    4 +-
 doc/html/pkfilterdem.html                          |    6 +-
 doc/html/pkfilterdem_8cc_source.html               |   12 +-
 doc/html/pkfilterdem_8py_source.html               |    4 +-
 doc/html/pkfsann.html                              |    4 +-
 doc/html/pkfsann_8cc_source.html                   |    8 +-
 doc/html/pkfsann_8h_source.html                    |    4 +-
 doc/html/pkfssvm.html                              |    4 +-
 doc/html/pkfssvm_8cc_source.html                   |    8 +-
 doc/html/pkgetmask.html                            |    6 +-
 doc/html/pkgetmask_8cc_source.html                 |   12 +-
 doc/html/pkgetmask_8py_source.html                 |    4 +-
 doc/html/pkinfo.html                               |    4 +-
 doc/html/pkinfo_8cc_source.html                    |   10 +-
 doc/html/pkkalman.html                             |  117 +-
 doc/html/pkkalman1_8cc_source.html                 |    8 +-
 doc/html/pkkalman_8cc_source.html                  | 3304 +++++++++++---------
 doc/html/pklas2img.html                            |    6 +-
 doc/html/pklas2img_8cc_source.html                 |   12 +-
 doc/html/pklas2img_8py_source.html                 |    6 +-
 doc/html/pkndvi_8cc_source.html                    |    6 +-
 doc/html/pkoptsvm.html                             |    4 +-
 doc/html/pkoptsvm_8cc_source.html                  | 1203 ++++---
 doc/html/pkpolygonize.html                         |    4 +-
 doc/html/pkpolygonize_8cc_source.html              |    6 +-
 doc/html/pkreclass.html                            |    6 +-
 doc/html/pkreclass_8cc_source.html                 |  660 ++--
 doc/html/pkreclass_8py_source.html                 |    4 +-
 doc/html/pkregann.html                             |    4 +-
 doc/html/pkregann_8cc_source.html                  |    4 +-
 doc/html/pksensormodel_8h_source.html              |    4 +-
 doc/html/pksetmask.html                            |    6 +-
 doc/html/pksetmask_8cc_source.html                 |   12 +-
 doc/html/pksetmask_8py_source.html                 |    4 +-
 doc/html/pksieve.html                              |    4 +-
 doc/html/pksieve_8cc_source.html                   |    8 +-
 doc/html/pkstat.html                               |    4 +-
 doc/html/pkstat_8cc_source.html                    | 1781 ++++++-----
 doc/html/pkstatascii.html                          |    4 +-
 doc/html/pkstatascii_8cc_source.html               |    4 +-
 doc/html/pkstatogr.html                            |    4 +-
 doc/html/pkstatogr_8cc_source.html                 |    4 +-
 doc/html/{pkdsm2shadow.html => pkstatprofile.html} |   78 +-
 ...c_source.html => pkstatprofile_8cc_source.html} |  284 +-
 doc/html/{pkdsm2shadow.html => pkstatz.html}       |   78 +-
 doc/html/pksvm.html                                |    8 +-
 doc/html/pksvm_8cc_source.html                     | 2449 +++++++--------
 doc/html/pksvm_8py_source.html                     |    4 +-
 doc/html/pksvm__gui_2main_8cpp_source.html         |    4 +-
 doc/html/pksvm__gui_2mainwindow_8cpp_source.html   |    4 +-
 doc/html/pksvm__gui_2mainwindow_8h_source.html     |    4 +-
 doc/html/pktestOption_8cc_source.html              |    4 +-
 doc/html/pktoolsAlgorithmProvider_8py_source.html  |    4 +-
 doc/html/pktoolsAlgorithm_8py_source.html          |    4 +-
 doc/html/pktoolsUtils_8py_source.html              |    4 +-
 ...ktools_2ProcessingPktoolsPlugin_8py_source.html |    4 +-
 doc/html/pktools_2____init_____8py_source.html     |    4 +-
 doc/html/pktools_2pkcomposite_8py_source.html      |    4 +-
 doc/html/pktools_2pkcrop_8py_source.html           |    4 +-
 doc/html/pktools_2pkdiff__accuracy_8py_source.html |    4 +-
 doc/html/pktools_2pkextract_8py_source.html        |    4 +-
 doc/html/pktools_2pkextract__grid_8py_source.html  |    4 +-
 .../pktools_2pkextract__random_8py_source.html     |    4 +-
 .../pktools_2pkfilter__spatial_8py_source.html     |    4 +-
 .../pktools_2pkfilter__spectral_8py_source.html    |    4 +-
 doc/html/pktools_2pkfilterdem_8py_source.html      |    4 +-
 doc/html/pktools_2pkgetmask_8py_source.html        |    4 +-
 doc/html/pktools_2pklas2img_8py_source.html        |    4 +-
 doc/html/pktools_2pkreclass_8py_source.html        |    4 +-
 doc/html/pktools_2pksetmask_8py_source.html        |    4 +-
 doc/html/pktools_2pksvm_8py_source.html            |    4 +-
 ...tools_2pktoolsAlgorithmProvider_8py_source.html |    4 +-
 doc/html/pktools_2pktoolsAlgorithm_8py_source.html |    4 +-
 doc/html/pktools_2pktoolsUtils_8py_source.html     |    4 +-
 doc/html/structIndexValue-members.html             |    4 +-
 doc/html/structIndexValue.html                     |    4 +-
 doc/html/structPosValue-members.html               |    4 +-
 doc/html/structPosValue.html                       |    4 +-
 doc/html/structSolver_1_1SolutionInfo-members.html |    4 +-
 doc/html/structSolver_1_1SolutionInfo.html         |    4 +-
 doc/html/structdecision__function-members.html     |    4 +-
 doc/html/structdecision__function.html             |    4 +-
 doc/html/structsvm__model-members.html             |    4 +-
 doc/html/structsvm__model.html                     |    4 +-
 doc/html/structsvm__node-members.html              |    4 +-
 doc/html/structsvm__node.html                      |    4 +-
 doc/html/structsvm__parameter-members.html         |    4 +-
 doc/html/structsvm__parameter.html                 |    4 +-
 doc/html/structsvm__problem-members.html           |    4 +-
 doc/html/structsvm__problem.html                   |    4 +-
 doc/html/svm_8cpp_source.html                      |    4 +-
 doc/html/svm_8h_source.html                        |    4 +-
 doc/installation_linux.dox                         |   45 +
 doc/installation_windows.dox                       |   41 +-
 src/algorithms/FeatureSelector.h                   |    2 +-
 src/apps/Makefile.am                               |    4 +-
 src/apps/Makefile.in                               |   41 +-
 src/apps/pkann.cc                                  |   46 +-
 src/apps/pkcomposite.cc                            |   29 +-
 src/apps/pkcrop.cc                                 |   38 +-
 src/apps/pkextract.cc                              |   77 +-
 src/apps/pkfsann.cc                                |    4 +-
 src/apps/pkfssvm.cc                                |    4 +-
 src/apps/pkinfo.cc                                 |    2 +-
 src/apps/pkkalman.cc                               | 2491 ++++++++-------
 src/apps/pkoptsvm.cc                               |    4 +-
 src/apps/pkstatprofile.cc                          |   20 +-
 src/apps/pksvm.cc                                  |   43 +-
 src/imageclasses/ImgRasterGdal.cc                  |  342 ++
 src/imageclasses/ImgRasterGdal.h                   |  100 +
 src/imageclasses/ImgReaderGdal.cc                  |  331 +-
 src/imageclasses/ImgReaderGdal.h                   |   67 +-
 src/imageclasses/ImgReaderOgr.cc                   |   31 +-
 src/imageclasses/ImgUpdaterGdal.cc                 |   45 +
 src/imageclasses/ImgUpdaterGdal.h                  |   39 +
 src/imageclasses/ImgWriterGdal.cc                  |  262 +-
 src/imageclasses/ImgWriterGdal.h                   |   39 +-
 src/imageclasses/Makefile.am                       |    4 +-
 src/imageclasses/Makefile.in                       |   11 +-
 566 files changed, 25773 insertions(+), 23107 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3e819ef..5ae0525 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -418,7 +418,9 @@ version 2.6.4
 version 2.6.5
  - GTiff default output image format for all applications
  - ImgReaderOgr.h patch for gdal 2.0 (ticket #46270), thanks to Bas Couwenberg
- - ImgReaderOgr.cc patch for gdal 2.0 (ticket #46270), thanks to Bas Couwenberg
+ - ImgReaderOgr.cc
+	patch for gdal 2.0 (ticket #46270), thanks to Bas Couwenberg
+	read features (bands) in readDataImageOgr should be [bB][0-9]
  - ImgWriterOgr.h patch for gdal 2.0 (ticket #46270), thanks to Bas Couwenberg
  - ImgWriterOgr.cc patch for gdal 2.0 (ticket #46270), thanks to Bas Couwenberg
  - cmake support, thanks to Peter Bunting and Kris Vanhoof
@@ -435,7 +437,23 @@ version 2.6.5
 	performace gain: keep all input images open and read line for all inputs at once. Warning for large number of input: 1) memory issues, 2) GDAL_MAX_DATASET_POOL_SIZE which defaults to 100 3) restriction in Linux: number of file handles that can be opened by a process is generally limited to 1024.
  - pkstatprofile
 	Calculate statistical functions on temporal/spectral profile (multi-band rater dataset), replaces some functionality in pkfilter -dz 1. Supports multiple functions to produced multi-band output
-Todo:
- - todo for API
-	ImgReaderGdal (ImgWriterGdal) open in update mode (check gdal_edit.py: http://searchcode.com/codesearch/view/18938404)
+
+version 2.6.6
+ - pkcrop
+	support -align option to align output bounding box to input image
+ - pkcrop
+	support -align option to align output bounding box to first input image
+ - pkkalman
+	bug loop icol beyond limits and start counting from jcol (ticket #46880)
+ - ImgRasterGdal
+	new base class for ImgReaderGdal and ImgWriterGdal
+ - ImgUpdaterGdal
+	new class for reading GDAL raster datasets in update mode
+ - ImgReaderGdal
+	derived from base class ImgRasterGdal
+ - ImgWriterGdal
+	derived from base class ImgRasterGdal
+ - pkkalman
+	first release
+	support multi-band input and output
 
diff --git a/configure b/configure
index 3bc9b17..09f39d2 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pktools 2.6.5.
+# Generated by GNU Autoconf 2.69 for pktools 2.6.6.
 #
 # Report bugs to <kempenep at gmail.com>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='pktools'
 PACKAGE_TARNAME='pktools'
-PACKAGE_VERSION='2.6.5'
-PACKAGE_STRING='pktools 2.6.5'
+PACKAGE_VERSION='2.6.6'
+PACKAGE_STRING='pktools 2.6.6'
 PACKAGE_BUGREPORT='kempenep at gmail.com'
 PACKAGE_URL=''
 
@@ -1366,7 +1366,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures pktools 2.6.5 to adapt to many kinds of systems.
+\`configure' configures pktools 2.6.6 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1436,7 +1436,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of pktools 2.6.5:";;
+     short | recursive ) echo "Configuration of pktools 2.6.6:";;
    esac
   cat <<\_ACEOF
 
@@ -1562,7 +1562,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-pktools configure 2.6.5
+pktools configure 2.6.6
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2323,7 +2323,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by pktools $as_me 2.6.5, which was
+It was created by pktools $as_me 2.6.6, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3187,7 +3187,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='pktools'
- VERSION='2.6.5'
+ VERSION='2.6.6'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -19597,7 +19597,7 @@ fi
 # For information on how to properly maintain the library version information,
 # refer to the libtool manual, section "Updating library version information":
 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
-PKTOOLS_SO_VERSION=1:5:0
+PKTOOLS_SO_VERSION=1:6:0
 
 
 # files to generate via autotools (.am or .in source files)
@@ -20175,7 +20175,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by pktools $as_me 2.6.5, which was
+This file was extended by pktools $as_me 2.6.6, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20241,7 +20241,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-pktools config.status 2.6.5
+pktools config.status 2.6.6
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 4b7cdd1..909a3ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([pktools], [2.6.5], [kempenep at gmail.com])
+AC_INIT([pktools], [2.6.6], [kempenep at gmail.com])
 #AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 AM_INIT_AUTOMAKE([-Wall -Wno-extra-portability foreign])
 #AM_INIT_AUTOMAKE([subdir-objects]) #not working due to bug in autoconf, see Debian list: Bug #752993)
@@ -114,7 +114,7 @@ AC_SUBST([LIBS])
 # For information on how to properly maintain the library version information,
 # refer to the libtool manual, section "Updating library version information":
 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
-AC_SUBST([PKTOOLS_SO_VERSION], [1:5:0])
+AC_SUBST([PKTOOLS_SO_VERSION], [1:6:0])
 
 # files to generate via autotools (.am or .in source files)
 AC_CONFIG_HEADERS([config.h])
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 6892989..628836d 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -38,7 +38,7 @@ PROJECT_NAME           = pktools
 # could be handy for archiving the generated documentation or if some version
 # control system is used.
 
-PROJECT_NUMBER         = 2.6.5
+PROJECT_NUMBER         = 2.6.6
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer a
@@ -51,7 +51,7 @@ PROJECT_BRIEF          = "Processing Kernel for geospatial data"
 # and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
 # to the output directory.
 
-PROJECT_LOGO           = logo.png
+PROJECT_LOGO           = figures/logo.png
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
 # into which the generated documentation will be written. If a relative path is
diff --git a/doc/apps.dox b/doc/apps.dox
index b30b3f2..b0ee58a 100644
--- a/doc/apps.dox
+++ b/doc/apps.dox
@@ -19,6 +19,7 @@
 - \ref pkfssvm  feature selection for support vector machine classifier pksvm
 - \ref pkgetmask  program to create mask image based on values in input raster image
 - \ref pkinfo  Report basic information from raster datasets (similar to gdalinfo)
+- \ref pkkalman  produce kalman filtered raster time series
 - \ref pklas2img  Rasterize LAS/LAZ point clouds with filtering/compositing options
 - \ref pkoptsvm  program to optimize parameters for support vector machine classifier pksvm
 - \ref pkpolygonize  program to make vector file from raster image
@@ -29,4 +30,5 @@
 - \ref pkstatascii  program to calculate basic statistics from text file
 - \ref pkstat  program to calculate basic statistics from raster dataset
 - \ref pkstatogr  program to calculate basic statistics from vector file
+- \ref pkstatprofile  program to calculate statistics in temporal or spectral profile
 - \ref pksvm  classify raster image using Support Vector Machine
diff --git a/doc/apps.dox b/doc/apps.dox~
similarity index 93%
copy from doc/apps.dox
copy to doc/apps.dox~
index b30b3f2..836cf34 100644
--- a/doc/apps.dox
+++ b/doc/apps.dox~
@@ -19,6 +19,8 @@
 - \ref pkfssvm  feature selection for support vector machine classifier pksvm
 - \ref pkgetmask  program to create mask image based on values in input raster image
 - \ref pkinfo  Report basic information from raster datasets (similar to gdalinfo)
+- \ref pkkalman1 
+- \ref pkkalman  produce kalman filtered raster time series
 - \ref pklas2img  Rasterize LAS/LAZ point clouds with filtering/compositing options
 - \ref pkoptsvm  program to optimize parameters for support vector machine classifier pksvm
 - \ref pkpolygonize  program to make vector file from raster image
@@ -29,4 +31,5 @@
 - \ref pkstatascii  program to calculate basic statistics from text file
 - \ref pkstat  program to calculate basic statistics from raster dataset
 - \ref pkstatogr  program to calculate basic statistics from vector file
+- \ref pkstatprofile  program to calculate statistics in temporal or spectral profile
 - \ref pksvm  classify raster image using Support Vector Machine
diff --git a/doc/examples_pkkalman.dox b/doc/examples_pkkalman.dox
new file mode 100644
index 0000000..c0a26cf
--- /dev/null
+++ b/doc/examples_pkkalman.dox
@@ -0,0 +1,31 @@
+\section examples_pkkalman Examples of pkkalman
+
+Assimilate fine spatial resolution NDVI time series acquired at (100 m) with median spatial resolution NDVI time series (300 m). Both time series consist of ten acquisitions in time (provided as a multi-band raster dataset), but fine spatial resolution data are sparse due to cloud coverage. Missing data are characterized by the option -obsnodata. Coarse spatial resolution data have occasional cloud cover too (-modnodata 255). The spatial coverage of the model must be at least the spatial [...]
+
+\code
+pkkalman -obs fine_10band.tif -mod coarse_10band.tif -obsnodata 255 -modnodata 255 -dir forward -ofw fine_filled.tif
+\endcode
+
+Same as above, but run in forward, backward and smooth mode. Here we provide output filenames for the uncertainties of the predicted time series.
+
+\code
+pkkalman -obs fine_10band.tif -mod coarse_10band.tif -obsnodata 255 -modnodata 255 -dir forward -ofw fine_forward_10band.tif -u_ofw fine_forward_uncert_10band.tif -dir backward -ofb fine_backward_10band.tif -u_obw fine_backward_uncert_10band.tif -dir smooth -ofw fine_smooth_10band.tif -u_ofb fine_smooth_uncert_10band.tif
+\endcode
+
+If the observation time series is not complete, i.e., has less acquisitions than the model, we must explicitly provide the time sequence. Here, the observation at fine spatial resolution is based on two acquisitions only (at times 3 and 8). The model at coarse spatial resolution is based on ten acquisitions (at times 1-10).
+
+\code
+pkkalman -obs fine_2band.tif -mod coarse_10band.tif -obsnodata 255 -modnodata 255 -dir forward -ofw fine_forward_10band.tif -tmod 1 -tmod 2 -tmod 3 -tmod 4 -tmod 5 -tmod 6 -tmod 7 -tmod 8 -tmod 9 -tmod 10 -tobs 3 -tobs 8
+\endcode
+
+In the following example the missing data are not coded within the observations, but read from an external mask:
+
+\code
+pkkalman -obs fine_10band.tif -mod coarse_10band.tif -obsmask finemask_10band.tif -modmask coarsemask_10band.tif -msknodata 1 -mskband 0 -dir forward -ofw fine_forward_10band.tif
+\endcode
+
+The observations and model can be provided as multiple single-band raster datasets. The time sequence for the two observations and ten model inputs are explicitly provided via the options -tobs and tmod.
+
+\code
+pkkalman -obs fine_1.tif -obs fine_2.tif -obsmask finemask_1.tif -obs finemask_2.tif -mod coarse_1.tif -mod coarse_2.tif -mod coarse_3.tif -mod coarse_4.tif -mod coarse_5.tif -mod coarse_6.tif -mod coarse_7.tif -mod coarse_8.tif -mod coarse_9.tif -mod coarse_10.tif -modmask coarsemask_1.tif -modmask coarsemask_2.tif -modmask coarsemask_3.tif -modmask coarsemask_4.tif -modmask coarsemask_5.tif -modmask coarsemask_6.tif -modmask coarsemask_7.tif -modmask coarsemask_8.tif -modmask coarsemas [...]
+\endcode
diff --git a/doc/examples_pkkalman.dox~ b/doc/examples_pkkalman.dox~
new file mode 100644
index 0000000..9cf0f99
--- /dev/null
+++ b/doc/examples_pkkalman.dox~
@@ -0,0 +1,14 @@
+\section examples_pkkalman Examples of pkkalman
+
+Assimilate fine spatial resolution NDVI time series acquired at (100 m) with median spatial resolution NDVI time series (300 m). Both time series have temporal resolution of 10 days, but fine spatial resolution data are sparse due to cloud coverage (missing data characterized by -obsnodata 255). Coarse spatial resolution data have occasional cloud cover too (-modnodata 255). Run the kalman filter in forward mode only.
+
+\code
+pkkalman -obs fine.tif -mod coarse.tif -obsnodata 255 -modnodata 255 -dir forward -ofw fine_filled.tif
+\endcode
+
+Same as above, but run in forward, backward and smooth mode. Write uncertainties of predicted time series as fine_forward_uncert.tif.
+
+\code
+pkkalman -obs fine.tif -mod coarse.tif -obsnodata 255 -modnodata 255 -dir forward -ofw fine_forward.tif -dir backward -ofb fine_backward.tif -dir smooth -ofw fine_smooth.tif -u_ofw fine_forward_uncert.tif -u_obw fine_backward_uncert.tif -u_ofb fine_smooth_uncert.tif
+\endcode
+
diff --git a/doc/logo.odg b/doc/figures/logo.odg
similarity index 100%
rename from doc/logo.odg
rename to doc/figures/logo.odg
diff --git a/doc/logo.png b/doc/figures/logo.png
similarity index 100%
rename from doc/logo.png
rename to doc/figures/logo.png
diff --git a/doc/html/ConfusionMatrix_8cc_source.html b/doc/html/ConfusionMatrix_8cc_source.html
index 5a93722..15b696c 100644
--- a/doc/html/ConfusionMatrix_8cc_source.html
+++ b/doc/html/ConfusionMatrix_8cc_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -342,7 +342,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:26 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:05 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/ConfusionMatrix_8h_source.html b/doc/html/ConfusionMatrix_8h_source.html
index 45bb08e..aa1cccd 100644
--- a/doc/html/ConfusionMatrix_8h_source.html
+++ b/doc/html/ConfusionMatrix_8h_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -256,7 +256,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:26 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:05 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/CostFactorySVM_8cc_source.html b/doc/html/CostFactorySVM_8cc_source.html
index ac006d5..1984842 100644
--- a/doc/html/CostFactorySVM_8cc_source.html
+++ b/doc/html/CostFactorySVM_8cc_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -240,7 +240,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:26 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:05 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/CostFactorySVM_8h_source.html b/doc/html/CostFactorySVM_8h_source.html
index 5a90967..653bf06 100644
--- a/doc/html/CostFactorySVM_8h_source.html
+++ b/doc/html/CostFactorySVM_8h_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -115,7 +115,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:26 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:05 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/CostFactory_8h_source.html b/doc/html/CostFactory_8h_source.html
index 793631d..dd35020 100644
--- a/doc/html/CostFactory_8h_source.html
+++ b/doc/html/CostFactory_8h_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -121,7 +121,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:26 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:05 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/Egcs_8cc_source.html b/doc/html/Egcs_8cc_source.html
index 2c29ee3..d85a99d 100644
--- a/doc/html/Egcs_8cc_source.html
+++ b/doc/html/Egcs_8cc_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -264,7 +264,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:26 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:05 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/Egcs_8h_source.html b/doc/html/Egcs_8h_source.html
index ec92fd3..8a47643 100644
--- a/doc/html/Egcs_8h_source.html
+++ b/doc/html/Egcs_8h_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -112,7 +112,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:26 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:05 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/FeatureSelector_8h_source.html b/doc/html/FeatureSelector_8h_source.html
index 02f7eae..34b6759 100644
--- a/doc/html/FeatureSelector_8h_source.html
+++ b/doc/html/FeatureSelector_8h_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -403,7 +403,7 @@
 <div class="line"><a name="l00349"></a><span class="lineno">  349</span>     }</div>
 <div class="line"><a name="l00350"></a><span class="lineno">  350</span>     tmpset.push_front(last);</div>
 <div class="line"><a name="l00351"></a><span class="lineno">  351</span>   }</div>
-<div class="line"><a name="l00352"></a><span class="lineno">  352</span>   <span class="keywordflow">if</span>(maxCost<0){<span class="comment">//all levels removed were catched</span></div>
+<div class="line"><a name="l00352"></a><span class="lineno">  352</span>   <span class="keywordflow">if</span>(maxCost<0){<span class="comment">//all levels removed were caught</span></div>
 <div class="line"><a name="l00353"></a><span class="lineno">  353</span>     subset=catchset;</div>
 <div class="line"><a name="l00354"></a><span class="lineno">  354</span>   }</div>
 <div class="line"><a name="l00355"></a><span class="lineno">  355</span>   <span class="comment">//test: assert list contains no duplicate elements</span></div>
@@ -424,7 +424,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:26 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:05 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/FileReaderAscii_8cc_source.html b/doc/html/FileReaderAscii_8cc_source.html
index 2070eba..828f1c2 100644
--- a/doc/html/FileReaderAscii_8cc_source.html
+++ b/doc/html/FileReaderAscii_8cc_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -297,7 +297,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:27 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:06 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/FileReaderAscii_8h_source.html b/doc/html/FileReaderAscii_8h_source.html
index 6587f87..69ac361 100644
--- a/doc/html/FileReaderAscii_8h_source.html
+++ b/doc/html/FileReaderAscii_8h_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -358,7 +358,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:27 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:06 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/FileReaderLas_8cc_source.html b/doc/html/FileReaderLas_8cc_source.html
index 4080306..125f4c6 100644
--- a/doc/html/FileReaderLas_8cc_source.html
+++ b/doc/html/FileReaderLas_8cc_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -237,7 +237,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:27 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:06 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/FileReaderLas_8h_source.html b/doc/html/FileReaderLas_8h_source.html
index 15bf5eb..6f6a68e 100644
--- a/doc/html/FileReaderLas_8h_source.html
+++ b/doc/html/FileReaderLas_8h_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -130,7 +130,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:27 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:06 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/Filter2d_8cc_source.html b/doc/html/Filter2d_8cc_source.html
index 3e54bce..7714075 100644
--- a/doc/html/Filter2d_8cc_source.html
+++ b/doc/html/Filter2d_8cc_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -508,874 +508,877 @@
 <div class="line"><a name="l00454"></a><span class="lineno">  454</span>       }</div>
 <div class="line"><a name="l00455"></a><span class="lineno">  455</span>         }</div>
 <div class="line"><a name="l00456"></a><span class="lineno">  456</span>         <span class="keywordflow">switch</span>(getFilterType(method)){</div>
-<div class="line"><a name="l00457"></a><span class="lineno">  457</span>         <span class="keywordflow">case</span>(filter2d::median):</div>
-<div class="line"><a name="l00458"></a><span class="lineno">  458</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00459"></a><span class="lineno">  459</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00460"></a><span class="lineno">  460</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00461"></a><span class="lineno">  461</span>             outBuffer[x/down]=stat.median(windowBuffer);</div>
-<div class="line"><a name="l00462"></a><span class="lineno">  462</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00463"></a><span class="lineno">  463</span>         <span class="keywordflow">case</span>(filter2d::var):{</div>
-<div class="line"><a name="l00464"></a><span class="lineno">  464</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00465"></a><span class="lineno">  465</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00466"></a><span class="lineno">  466</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00467"></a><span class="lineno">  467</span>             outBuffer[x/down]=stat.var(windowBuffer);</div>
-<div class="line"><a name="l00468"></a><span class="lineno">  468</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00469"></a><span class="lineno">  469</span>         }</div>
-<div class="line"><a name="l00470"></a><span class="lineno">  470</span>         <span class="keywordflow">case</span>(filter2d::stdev):{</div>
-<div class="line"><a name="l00471"></a><span class="lineno">  471</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00472"></a><span class="lineno">  472</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00473"></a><span class="lineno">  473</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00474"></a><span class="lineno">  474</span>             outBuffer[x/down]=sqrt(stat.var(windowBuffer));</div>
-<div class="line"><a name="l00475"></a><span class="lineno">  475</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00476"></a><span class="lineno">  476</span>         }</div>
-<div class="line"><a name="l00477"></a><span class="lineno">  477</span>         <span class="keywordflow">case</span>(filter2d::mean):{</div>
-<div class="line"><a name="l00478"></a><span class="lineno">  478</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00479"></a><span class="lineno">  479</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00480"></a><span class="lineno">  480</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00481"></a><span class="lineno">  481</span>             outBuffer[x/down]=stat.mean(windowBuffer);</div>
-<div class="line"><a name="l00482"></a><span class="lineno">  482</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00483"></a><span class="lineno">  483</span>         }</div>
-<div class="line"><a name="l00484"></a><span class="lineno">  484</span>         <span class="keywordflow">case</span>(filter2d::min):{</div>
-<div class="line"><a name="l00485"></a><span class="lineno">  485</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00486"></a><span class="lineno">  486</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00487"></a><span class="lineno">  487</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00488"></a><span class="lineno">  488</span>            outBuffer[x/down]=stat.mymin(windowBuffer);</div>
-<div class="line"><a name="l00489"></a><span class="lineno">  489</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00490"></a><span class="lineno">  490</span>         }</div>
-<div class="line"><a name="l00491"></a><span class="lineno">  491</span>         <span class="keywordflow">case</span>(filter2d::ismin):{</div>
-<div class="line"><a name="l00492"></a><span class="lineno">  492</span>            <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00493"></a><span class="lineno">  493</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00494"></a><span class="lineno">  494</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00495"></a><span class="lineno">  495</span>             outBuffer[x/down]=(stat.mymin(windowBuffer)==windowBuffer[centre])? 1:0;</div>
-<div class="line"><a name="l00496"></a><span class="lineno">  496</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00497"></a><span class="lineno">  497</span>         }</div>
-<div class="line"><a name="l00498"></a><span class="lineno">  498</span>         <span class="keywordflow">case</span>(filter2d::minmax):{<span class="comment">//is the same as homog?</span></div>
-<div class="line"><a name="l00499"></a><span class="lineno">  499</span>           <span class="keywordtype">double</span> min=0;</div>
-<div class="line"><a name="l00500"></a><span class="lineno">  500</span>           <span class="keywordtype">double</span> max=0;</div>
-<div class="line"><a name="l00501"></a><span class="lineno">  501</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00502"></a><span class="lineno">  502</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00503"></a><span class="lineno">  503</span>           <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00504"></a><span class="lineno">  504</span>             stat.minmax(windowBuffer,windowBuffer.begin(),windowBuffer.end(),min,max);</div>
-<div class="line"><a name="l00505"></a><span class="lineno">  505</span>             <span class="keywordflow">if</span>(min!=max)</div>
-<div class="line"><a name="l00506"></a><span class="lineno">  506</span>               outBuffer[x/down]=0;</div>
-<div class="line"><a name="l00507"></a><span class="lineno">  507</span>             <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00508"></a><span class="lineno">  508</span>               outBuffer[x/down]=windowBuffer[centre];<span class="comment">//centre pixels</span></div>
-<div class="line"><a name="l00509"></a><span class="lineno">  509</span>           }</div>
-<div class="line"><a name="l00510"></a><span class="lineno">  510</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00511"></a><span class="lineno">  511</span>         }</div>
-<div class="line"><a name="l00512"></a><span class="lineno">  512</span>         <span class="keywordflow">case</span>(filter2d::max):{</div>
-<div class="line"><a name="l00513"></a><span class="lineno">  513</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00514"></a><span class="lineno">  514</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00515"></a><span class="lineno">  515</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00516"></a><span class="lineno">  516</span>             outBuffer[x/down]=stat.mymax(windowBuffer);</div>
-<div class="line"><a name="l00517"></a><span class="lineno">  517</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00518"></a><span class="lineno">  518</span>         }</div>
-<div class="line"><a name="l00519"></a><span class="lineno">  519</span>         <span class="keywordflow">case</span>(filter2d::ismax):{</div>
-<div class="line"><a name="l00520"></a><span class="lineno">  520</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00521"></a><span class="lineno">  521</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00522"></a><span class="lineno">  522</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00523"></a><span class="lineno">  523</span>             outBuffer[x/down]=(stat.mymax(windowBuffer)==windowBuffer[centre])? 1:0;</div>
-<div class="line"><a name="l00524"></a><span class="lineno">  524</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00525"></a><span class="lineno">  525</span>         }</div>
-<div class="line"><a name="l00526"></a><span class="lineno">  526</span>         <span class="keywordflow">case</span>(filter2d::order):{</div>
-<div class="line"><a name="l00527"></a><span class="lineno">  527</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00528"></a><span class="lineno">  528</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00529"></a><span class="lineno">  529</span>           <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00530"></a><span class="lineno">  530</span>             <span class="keywordtype">double</span> lbound=0;</div>
-<div class="line"><a name="l00531"></a><span class="lineno">  531</span>             <span class="keywordtype">double</span> ubound=dimX*dimY;</div>
-<div class="line"><a name="l00532"></a><span class="lineno">  532</span>             <span class="keywordtype">double</span> theMin=stat.mymin(windowBuffer);</div>
-<div class="line"><a name="l00533"></a><span class="lineno">  533</span>             <span class="keywordtype">double</span> theMax=stat.mymax(windowBuffer);</div>
-<div class="line"><a name="l00534"></a><span class="lineno">  534</span>             <span class="keywordtype">double</span> scale=(ubound-lbound)/(theMax-theMin);</div>
-<div class="line"><a name="l00535"></a><span class="lineno">  535</span>             outBuffer[x/down]=<span class="keyword">static_cast<</span><span class="keywordtype">short</span><span class="keyword">></span>(scale*(windowBuffer[centre]-theMin)+lbound);</div>
-<div class="line"><a name="l00536"></a><span class="lineno">  536</span>           }</div>
-<div class="line"><a name="l00537"></a><span class="lineno">  537</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00538"></a><span class="lineno">  538</span>         }</div>
-<div class="line"><a name="l00539"></a><span class="lineno">  539</span>         <span class="keywordflow">case</span>(filter2d::sum):{</div>
-<div class="line"><a name="l00540"></a><span class="lineno">  540</span>           outBuffer[x/down]=stat.sum(windowBuffer);</div>
-<div class="line"><a name="l00541"></a><span class="lineno">  541</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00542"></a><span class="lineno">  542</span>         }</div>
-<div class="line"><a name="l00543"></a><span class="lineno">  543</span>     <span class="keywordflow">case</span>(filter2d::percentile):{</div>
-<div class="line"><a name="l00544"></a><span class="lineno">  544</span>       assert(m_threshold.size());</div>
-<div class="line"><a name="l00545"></a><span class="lineno">  545</span>       outBuffer[x/down]=stat.percentile(windowBuffer,windowBuffer.begin(),windowBuffer.end(),m_threshold[0]);</div>
-<div class="line"><a name="l00546"></a><span class="lineno">  546</span>       <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00547"></a><span class="lineno">  547</span>     }</div>
-<div class="line"><a name="l00548"></a><span class="lineno">  548</span>         <span class="keywordflow">case</span>(filter2d::proportion):{</div>
-<div class="line"><a name="l00549"></a><span class="lineno">  549</span>       <span class="keywordflow">if</span>(windowBuffer.size()){</div>
-<div class="line"><a name="l00550"></a><span class="lineno">  550</span>         <span class="keywordtype">double</span> sum=stat.sum(windowBuffer);</div>
-<div class="line"><a name="l00551"></a><span class="lineno">  551</span>         <span class="keywordflow">if</span>(sum)</div>
-<div class="line"><a name="l00552"></a><span class="lineno">  552</span>           outBuffer[x/down]=100.0*windowBuffer[centre]/stat.sum(windowBuffer);</div>
-<div class="line"><a name="l00553"></a><span class="lineno">  553</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00554"></a><span class="lineno">  554</span>           outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00555"></a><span class="lineno">  555</span>       }</div>
-<div class="line"><a name="l00556"></a><span class="lineno">  556</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00557"></a><span class="lineno">  557</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00558"></a><span class="lineno">  558</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00559"></a><span class="lineno">  559</span>     }</div>
-<div class="line"><a name="l00560"></a><span class="lineno">  560</span>         <span class="keywordflow">case</span>(filter2d::homog):</div>
-<div class="line"><a name="l00561"></a><span class="lineno">  561</span>       <span class="keywordflow">if</span>(occurrence.size()==1)<span class="comment">//all values in window are the same</span></div>
-<div class="line"><a name="l00562"></a><span class="lineno">  562</span>         outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l00563"></a><span class="lineno">  563</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00564"></a><span class="lineno">  564</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00565"></a><span class="lineno">  565</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00566"></a><span class="lineno">  566</span>         <span class="keywordflow">case</span>(filter2d::heterog):{</div>
-<div class="line"><a name="l00567"></a><span class="lineno">  567</span>       <span class="keywordflow">if</span>(occurrence.size()==windowBuffer.size())</div>
-<div class="line"><a name="l00568"></a><span class="lineno">  568</span>         outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l00569"></a><span class="lineno">  569</span>       <span class="keywordflow">else</span>      </div>
-<div class="line"><a name="l00570"></a><span class="lineno">  570</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00571"></a><span class="lineno">  571</span>       <span class="comment">// if(occurrence.size()==1)//all values in window are the same</span></div>
-<div class="line"><a name="l00572"></a><span class="lineno">  572</span>       <span class="comment">//   outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</span></div>
-<div class="line"><a name="l00573"></a><span class="lineno">  573</span>       <span class="comment">// else</span></div>
-<div class="line"><a name="l00574"></a><span class="lineno">  574</span>       <span class="comment">//   outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</span></div>
-<div class="line"><a name="l00575"></a><span class="lineno">  575</span>           <span class="comment">// break;</span></div>
-<div class="line"><a name="l00576"></a><span class="lineno">  576</span>           <span class="comment">// for(std::vector<double>::const_iterator wit=windowBuffer.begin();wit!=windowBuffer.end();++wit){</span></div>
-<div class="line"><a name="l00577"></a><span class="lineno">  577</span>           <span class="comment">//   if(wit==windowBuffer.begin()+windowBuffer.size()/2)</span></div>
-<div class="line"><a name="l00578"></a><span class="lineno">  578</span>           <span class="comment">//     continue;</span></div>
-<div class="line"><a name="l00579"></a><span class="lineno">  579</span>           <span class="comment">//   else if(*wit!=inBuffer[(dimY-1)/2][x]){</span></div>
-<div class="line"><a name="l00580"></a><span class="lineno">  580</span>           <span class="comment">//     outBuffer[x/down]=1;</span></div>
-<div class="line"><a name="l00581"></a><span class="lineno">  581</span>       <span class="comment">//     break;</span></div>
-<div class="line"><a name="l00582"></a><span class="lineno">  582</span>       <span class="comment">//   }</span></div>
-<div class="line"><a name="l00583"></a><span class="lineno">  583</span>           <span class="comment">//   else if(*wit==inBuffer[(dimY-1)/2][x]){//todo:wit mag niet central pixel zijn</span></div>
-<div class="line"><a name="l00584"></a><span class="lineno">  584</span>           <span class="comment">//     outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</span></div>
-<div class="line"><a name="l00585"></a><span class="lineno">  585</span>           <span class="comment">//     break;</span></div>
-<div class="line"><a name="l00586"></a><span class="lineno">  586</span>           <span class="comment">//   }</span></div>
-<div class="line"><a name="l00587"></a><span class="lineno">  587</span>           <span class="comment">// }</span></div>
-<div class="line"><a name="l00588"></a><span class="lineno">  588</span>           <span class="comment">// break;</span></div>
-<div class="line"><a name="l00589"></a><span class="lineno">  589</span>         }</div>
-<div class="line"><a name="l00590"></a><span class="lineno">  590</span>         <span class="keywordflow">case</span>(filter2d::density):{</div>
-<div class="line"><a name="l00591"></a><span class="lineno">  591</span>       <span class="keywordflow">if</span>(windowBuffer.size()){</div>
-<div class="line"><a name="l00592"></a><span class="lineno">  592</span>         std::vector<short>::const_iterator vit=m_class.begin();</div>
-<div class="line"><a name="l00593"></a><span class="lineno">  593</span>         <span class="keywordflow">while</span>(vit!=m_class.end())</div>
-<div class="line"><a name="l00594"></a><span class="lineno">  594</span>           outBuffer[x/down]+=100.0*occurrence[*(vit++)]/windowBuffer.size();</div>
-<div class="line"><a name="l00595"></a><span class="lineno">  595</span>       }</div>
-<div class="line"><a name="l00596"></a><span class="lineno">  596</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00597"></a><span class="lineno">  597</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00598"></a><span class="lineno">  598</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00599"></a><span class="lineno">  599</span>     }</div>
-<div class="line"><a name="l00600"></a><span class="lineno">  600</span>         <span class="keywordflow">case</span>(filter2d::countid):{</div>
-<div class="line"><a name="l00601"></a><span class="lineno">  601</span>       <span class="keywordflow">if</span>(windowBuffer.size())</div>
-<div class="line"><a name="l00602"></a><span class="lineno">  602</span>         outBuffer[x/down]=occurrence.size();</div>
-<div class="line"><a name="l00603"></a><span class="lineno">  603</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00604"></a><span class="lineno">  604</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00605"></a><span class="lineno">  605</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00606"></a><span class="lineno">  606</span>     }</div>
-<div class="line"><a name="l00607"></a><span class="lineno">  607</span>         <span class="keywordflow">case</span>(filter2d::mode):{</div>
-<div class="line"><a name="l00608"></a><span class="lineno">  608</span>       <span class="keywordflow">if</span>(occurrence.size()){</div>
-<div class="line"><a name="l00609"></a><span class="lineno">  609</span>             std::map<long int,int>::const_iterator maxit=occurrence.begin();</div>
-<div class="line"><a name="l00610"></a><span class="lineno">  610</span>             <span class="keywordflow">for</span>(std::map<long int,int>::const_iterator mit=occurrence.begin();mit!=occurrence.end();++mit){</div>
-<div class="line"><a name="l00611"></a><span class="lineno">  611</span>               <span class="keywordflow">if</span>(mit->second>maxit->second)</div>
-<div class="line"><a name="l00612"></a><span class="lineno">  612</span>                 maxit=mit;</div>
-<div class="line"><a name="l00613"></a><span class="lineno">  613</span>             }</div>
-<div class="line"><a name="l00614"></a><span class="lineno">  614</span>             <span class="keywordflow">if</span>(occurrence[inBuffer[(dimY-1)/2][x]]<maxit->second)<span class="comment">//</span></div>
-<div class="line"><a name="l00615"></a><span class="lineno">  615</span>               outBuffer[x/down]=maxit->first;</div>
-<div class="line"><a name="l00616"></a><span class="lineno">  616</span>             <span class="keywordflow">else</span><span class="comment">//favorize original value in case of ties</span></div>
-<div class="line"><a name="l00617"></a><span class="lineno">  617</span>               outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l00618"></a><span class="lineno">  618</span>       }</div>
-<div class="line"><a name="l00619"></a><span class="lineno">  619</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00620"></a><span class="lineno">  620</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00621"></a><span class="lineno">  621</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00622"></a><span class="lineno">  622</span>         }</div>
-<div class="line"><a name="l00623"></a><span class="lineno">  623</span>         <span class="keywordflow">case</span>(filter2d::threshold):{</div>
-<div class="line"><a name="l00624"></a><span class="lineno">  624</span>           assert(m_class.size()==m_threshold.size());</div>
-<div class="line"><a name="l00625"></a><span class="lineno">  625</span>       <span class="keywordflow">if</span>(windowBuffer.size()){</div>
-<div class="line"><a name="l00626"></a><span class="lineno">  626</span>             outBuffer[x/down]=inBuffer[(dimY-1)/2][x];<span class="comment">//initialize with original value (in case thresholds not met)</span></div>
-<div class="line"><a name="l00627"></a><span class="lineno">  627</span>             <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
-<div class="line"><a name="l00628"></a><span class="lineno">  628</span>               <span class="keywordflow">if</span>(100.0*(occurrence[m_class[iclass]])/windowBuffer.size()>m_threshold[iclass])</div>
-<div class="line"><a name="l00629"></a><span class="lineno">  629</span>                 outBuffer[x/down]=m_class[iclass];</div>
-<div class="line"><a name="l00630"></a><span class="lineno">  630</span>             }</div>
-<div class="line"><a name="l00631"></a><span class="lineno">  631</span>           }</div>
-<div class="line"><a name="l00632"></a><span class="lineno">  632</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00633"></a><span class="lineno">  633</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00634"></a><span class="lineno">  634</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00635"></a><span class="lineno">  635</span>         }</div>
-<div class="line"><a name="l00636"></a><span class="lineno">  636</span>         <span class="keywordflow">case</span>(filter2d::scramble):{<span class="comment">//could be done more efficiently window by window with random shuffling entire buffer and assigning entire buffer at once to output image...</span></div>
-<div class="line"><a name="l00637"></a><span class="lineno">  637</span>       <span class="keywordflow">if</span>(windowBuffer.size()){</div>
-<div class="line"><a name="l00638"></a><span class="lineno">  638</span>             <span class="keywordtype">int</span> randomIndex=std::rand()%windowBuffer.size();</div>
-<div class="line"><a name="l00639"></a><span class="lineno">  639</span>         <span class="keywordflow">if</span>(randomIndex>=windowBuffer.size())</div>
-<div class="line"><a name="l00640"></a><span class="lineno">  640</span>           outBuffer[x/down]=windowBuffer.back();</div>
-<div class="line"><a name="l00641"></a><span class="lineno">  641</span>         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(randomIndex<0)</div>
-<div class="line"><a name="l00642"></a><span class="lineno">  642</span>           outBuffer[x/down]=windowBuffer[0];</div>
-<div class="line"><a name="l00643"></a><span class="lineno">  643</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00644"></a><span class="lineno">  644</span>           outBuffer[x/down]=windowBuffer[randomIndex];</div>
-<div class="line"><a name="l00645"></a><span class="lineno">  645</span>           }</div>
-<div class="line"><a name="l00646"></a><span class="lineno">  646</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00647"></a><span class="lineno">  647</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
-<div class="line"><a name="l00648"></a><span class="lineno">  648</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00649"></a><span class="lineno">  649</span>         }</div>
-<div class="line"><a name="l00650"></a><span class="lineno">  650</span>         <span class="keywordflow">case</span>(filter2d::mixed):{</div>
-<div class="line"><a name="l00651"></a><span class="lineno">  651</span>           <span class="keyword">enum</span> Type { BF=11, CF=12, MF=13, NF=20, W=30 };</div>
-<div class="line"><a name="l00652"></a><span class="lineno">  652</span>           <span class="keywordtype">double</span> nBF=occurrence[BF];</div>
-<div class="line"><a name="l00653"></a><span class="lineno">  653</span>           <span class="keywordtype">double</span> nCF=occurrence[CF];</div>
-<div class="line"><a name="l00654"></a><span class="lineno">  654</span>           <span class="keywordtype">double</span> nMF=occurrence[MF];</div>
-<div class="line"><a name="l00655"></a><span class="lineno">  655</span>           <span class="keywordtype">double</span> nNF=occurrence[NF];</div>
-<div class="line"><a name="l00656"></a><span class="lineno">  656</span>           <span class="keywordtype">double</span> nW=occurrence[W];</div>
-<div class="line"><a name="l00657"></a><span class="lineno">  657</span>       <span class="keywordflow">if</span>(windowBuffer.size()){</div>
-<div class="line"><a name="l00658"></a><span class="lineno">  658</span>             <span class="keywordflow">if</span>((nBF+nCF+nMF)&&(nBF+nCF+nMF>=nNF+nW)){<span class="comment">//forest</span></div>
-<div class="line"><a name="l00659"></a><span class="lineno">  659</span>               <span class="keywordflow">if</span>(nBF/(nBF+nCF)>=0.75)</div>
-<div class="line"><a name="l00660"></a><span class="lineno">  660</span>                 outBuffer[x/down]=BF;</div>
-<div class="line"><a name="l00661"></a><span class="lineno">  661</span>               <span class="keywordflow">else</span> <span class="keywordflow">if</span>(nCF/(nBF+nCF)>=0.75)</div>
-<div class="line"><a name="l00662"></a><span class="lineno">  662</span>                 outBuffer[x/down]=CF;</div>
-<div class="line"><a name="l00663"></a><span class="lineno">  663</span>               <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00664"></a><span class="lineno">  664</span>                 outBuffer[x/down]=MF;</div>
-<div class="line"><a name="l00665"></a><span class="lineno">  665</span>             }</div>
-<div class="line"><a name="l00666"></a><span class="lineno">  666</span>             <span class="keywordflow">else</span>{<span class="comment">//non-forest</span></div>
-<div class="line"><a name="l00667"></a><span class="lineno">  667</span>               <span class="keywordflow">if</span>(nW&&(nW>=nNF))</div>
-<div class="line"><a name="l00668"></a><span class="lineno">  668</span>                 outBuffer[x/down]=W;</div>
-<div class="line"><a name="l00669"></a><span class="lineno">  669</span>               <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00670"></a><span class="lineno">  670</span>                 outBuffer[x/down]=NF;</div>
-<div class="line"><a name="l00671"></a><span class="lineno">  671</span>             }</div>
-<div class="line"><a name="l00672"></a><span class="lineno">  672</span>           }</div>
-<div class="line"><a name="l00673"></a><span class="lineno">  673</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00674"></a><span class="lineno">  674</span>         outBuffer[x/down]=inBuffer[indexJ][indexI];</div>
-<div class="line"><a name="l00675"></a><span class="lineno">  675</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00676"></a><span class="lineno">  676</span>         }</div>
-<div class="line"><a name="l00677"></a><span class="lineno">  677</span>         <span class="keywordflow">default</span>:{</div>
-<div class="line"><a name="l00678"></a><span class="lineno">  678</span>       std::ostringstream ess;</div>
-<div class="line"><a name="l00679"></a><span class="lineno">  679</span>       ess << <span class="stringliteral">"Error: filter method "</span> << method << <span class="stringliteral">" not supported"</span> << std::endl;</div>
-<div class="line"><a name="l00680"></a><span class="lineno">  680</span>       <span class="keywordflow">throw</span>(ess.str());</div>
-<div class="line"><a name="l00681"></a><span class="lineno">  681</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00682"></a><span class="lineno">  682</span>     }</div>
-<div class="line"><a name="l00683"></a><span class="lineno">  683</span>         }</div>
-<div class="line"><a name="l00684"></a><span class="lineno">  684</span>       }</div>
-<div class="line"><a name="l00685"></a><span class="lineno">  685</span>       progress=(1.0+y/down);</div>
-<div class="line"><a name="l00686"></a><span class="lineno">  686</span>       progress+=(output.nrOfRow()*iband);</div>
-<div class="line"><a name="l00687"></a><span class="lineno">  687</span>       progress/=output.nrOfBand()*output.nrOfRow();</div>
-<div class="line"><a name="l00688"></a><span class="lineno">  688</span>       pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00689"></a><span class="lineno">  689</span>       <span class="comment">//write outBuffer to file</span></div>
-<div class="line"><a name="l00690"></a><span class="lineno">  690</span>       <span class="keywordflow">try</span>{</div>
-<div class="line"><a name="l00691"></a><span class="lineno">  691</span>         output.writeData(outBuffer,GDT_Float64,y/down,iband);</div>
-<div class="line"><a name="l00692"></a><span class="lineno">  692</span>       }</div>
-<div class="line"><a name="l00693"></a><span class="lineno">  693</span>       <span class="keywordflow">catch</span>(std::string errorstring){</div>
-<div class="line"><a name="l00694"></a><span class="lineno">  694</span>     std::cerr << errorstring << <span class="stringliteral">"in band "</span> << iband << <span class="stringliteral">", line "</span> << y << std::endl;</div>
+<div class="line"><a name="l00457"></a><span class="lineno">  457</span>         <span class="keywordflow">case</span>(filter2d::nvalid):</div>
+<div class="line"><a name="l00458"></a><span class="lineno">  458</span>       outBuffer[x/down]=stat.nvalid(windowBuffer);</div>
+<div class="line"><a name="l00459"></a><span class="lineno">  459</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00460"></a><span class="lineno">  460</span>         <span class="keywordflow">case</span>(filter2d::median):</div>
+<div class="line"><a name="l00461"></a><span class="lineno">  461</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00462"></a><span class="lineno">  462</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00463"></a><span class="lineno">  463</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00464"></a><span class="lineno">  464</span>             outBuffer[x/down]=stat.median(windowBuffer);</div>
+<div class="line"><a name="l00465"></a><span class="lineno">  465</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00466"></a><span class="lineno">  466</span>         <span class="keywordflow">case</span>(filter2d::var):{</div>
+<div class="line"><a name="l00467"></a><span class="lineno">  467</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00468"></a><span class="lineno">  468</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00469"></a><span class="lineno">  469</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00470"></a><span class="lineno">  470</span>             outBuffer[x/down]=stat.var(windowBuffer);</div>
+<div class="line"><a name="l00471"></a><span class="lineno">  471</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00472"></a><span class="lineno">  472</span>         }</div>
+<div class="line"><a name="l00473"></a><span class="lineno">  473</span>         <span class="keywordflow">case</span>(filter2d::stdev):{</div>
+<div class="line"><a name="l00474"></a><span class="lineno">  474</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00475"></a><span class="lineno">  475</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00476"></a><span class="lineno">  476</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00477"></a><span class="lineno">  477</span>             outBuffer[x/down]=sqrt(stat.var(windowBuffer));</div>
+<div class="line"><a name="l00478"></a><span class="lineno">  478</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00479"></a><span class="lineno">  479</span>         }</div>
+<div class="line"><a name="l00480"></a><span class="lineno">  480</span>         <span class="keywordflow">case</span>(filter2d::mean):{</div>
+<div class="line"><a name="l00481"></a><span class="lineno">  481</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00482"></a><span class="lineno">  482</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00483"></a><span class="lineno">  483</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00484"></a><span class="lineno">  484</span>             outBuffer[x/down]=stat.mean(windowBuffer);</div>
+<div class="line"><a name="l00485"></a><span class="lineno">  485</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00486"></a><span class="lineno">  486</span>         }</div>
+<div class="line"><a name="l00487"></a><span class="lineno">  487</span>         <span class="keywordflow">case</span>(filter2d::min):{</div>
+<div class="line"><a name="l00488"></a><span class="lineno">  488</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00489"></a><span class="lineno">  489</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00490"></a><span class="lineno">  490</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00491"></a><span class="lineno">  491</span>            outBuffer[x/down]=stat.mymin(windowBuffer);</div>
+<div class="line"><a name="l00492"></a><span class="lineno">  492</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00493"></a><span class="lineno">  493</span>         }</div>
+<div class="line"><a name="l00494"></a><span class="lineno">  494</span>         <span class="keywordflow">case</span>(filter2d::ismin):{</div>
+<div class="line"><a name="l00495"></a><span class="lineno">  495</span>            <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00496"></a><span class="lineno">  496</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00497"></a><span class="lineno">  497</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00498"></a><span class="lineno">  498</span>             outBuffer[x/down]=(stat.mymin(windowBuffer)==windowBuffer[centre])? 1:0;</div>
+<div class="line"><a name="l00499"></a><span class="lineno">  499</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00500"></a><span class="lineno">  500</span>         }</div>
+<div class="line"><a name="l00501"></a><span class="lineno">  501</span>         <span class="keywordflow">case</span>(filter2d::minmax):{<span class="comment">//is the same as homog?</span></div>
+<div class="line"><a name="l00502"></a><span class="lineno">  502</span>           <span class="keywordtype">double</span> min=0;</div>
+<div class="line"><a name="l00503"></a><span class="lineno">  503</span>           <span class="keywordtype">double</span> max=0;</div>
+<div class="line"><a name="l00504"></a><span class="lineno">  504</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00505"></a><span class="lineno">  505</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00506"></a><span class="lineno">  506</span>           <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00507"></a><span class="lineno">  507</span>             stat.minmax(windowBuffer,windowBuffer.begin(),windowBuffer.end(),min,max);</div>
+<div class="line"><a name="l00508"></a><span class="lineno">  508</span>             <span class="keywordflow">if</span>(min!=max)</div>
+<div class="line"><a name="l00509"></a><span class="lineno">  509</span>               outBuffer[x/down]=0;</div>
+<div class="line"><a name="l00510"></a><span class="lineno">  510</span>             <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00511"></a><span class="lineno">  511</span>               outBuffer[x/down]=windowBuffer[centre];<span class="comment">//centre pixels</span></div>
+<div class="line"><a name="l00512"></a><span class="lineno">  512</span>           }</div>
+<div class="line"><a name="l00513"></a><span class="lineno">  513</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00514"></a><span class="lineno">  514</span>         }</div>
+<div class="line"><a name="l00515"></a><span class="lineno">  515</span>         <span class="keywordflow">case</span>(filter2d::max):{</div>
+<div class="line"><a name="l00516"></a><span class="lineno">  516</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00517"></a><span class="lineno">  517</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00518"></a><span class="lineno">  518</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00519"></a><span class="lineno">  519</span>             outBuffer[x/down]=stat.mymax(windowBuffer);</div>
+<div class="line"><a name="l00520"></a><span class="lineno">  520</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00521"></a><span class="lineno">  521</span>         }</div>
+<div class="line"><a name="l00522"></a><span class="lineno">  522</span>         <span class="keywordflow">case</span>(filter2d::ismax):{</div>
+<div class="line"><a name="l00523"></a><span class="lineno">  523</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00524"></a><span class="lineno">  524</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00525"></a><span class="lineno">  525</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00526"></a><span class="lineno">  526</span>             outBuffer[x/down]=(stat.mymax(windowBuffer)==windowBuffer[centre])? 1:0;</div>
+<div class="line"><a name="l00527"></a><span class="lineno">  527</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00528"></a><span class="lineno">  528</span>         }</div>
+<div class="line"><a name="l00529"></a><span class="lineno">  529</span>         <span class="keywordflow">case</span>(filter2d::order):{</div>
+<div class="line"><a name="l00530"></a><span class="lineno">  530</span>           <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00531"></a><span class="lineno">  531</span>             outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00532"></a><span class="lineno">  532</span>           <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00533"></a><span class="lineno">  533</span>             <span class="keywordtype">double</span> lbound=0;</div>
+<div class="line"><a name="l00534"></a><span class="lineno">  534</span>             <span class="keywordtype">double</span> ubound=dimX*dimY;</div>
+<div class="line"><a name="l00535"></a><span class="lineno">  535</span>             <span class="keywordtype">double</span> theMin=stat.mymin(windowBuffer);</div>
+<div class="line"><a name="l00536"></a><span class="lineno">  536</span>             <span class="keywordtype">double</span> theMax=stat.mymax(windowBuffer);</div>
+<div class="line"><a name="l00537"></a><span class="lineno">  537</span>             <span class="keywordtype">double</span> scale=(ubound-lbound)/(theMax-theMin);</div>
+<div class="line"><a name="l00538"></a><span class="lineno">  538</span>             outBuffer[x/down]=<span class="keyword">static_cast<</span><span class="keywordtype">short</span><span class="keyword">></span>(scale*(windowBuffer[centre]-theMin)+lbound);</div>
+<div class="line"><a name="l00539"></a><span class="lineno">  539</span>           }</div>
+<div class="line"><a name="l00540"></a><span class="lineno">  540</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00541"></a><span class="lineno">  541</span>         }</div>
+<div class="line"><a name="l00542"></a><span class="lineno">  542</span>         <span class="keywordflow">case</span>(filter2d::sum):{</div>
+<div class="line"><a name="l00543"></a><span class="lineno">  543</span>           outBuffer[x/down]=stat.sum(windowBuffer);</div>
+<div class="line"><a name="l00544"></a><span class="lineno">  544</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00545"></a><span class="lineno">  545</span>         }</div>
+<div class="line"><a name="l00546"></a><span class="lineno">  546</span>     <span class="keywordflow">case</span>(filter2d::percentile):{</div>
+<div class="line"><a name="l00547"></a><span class="lineno">  547</span>       assert(m_threshold.size());</div>
+<div class="line"><a name="l00548"></a><span class="lineno">  548</span>       outBuffer[x/down]=stat.percentile(windowBuffer,windowBuffer.begin(),windowBuffer.end(),m_threshold[0]);</div>
+<div class="line"><a name="l00549"></a><span class="lineno">  549</span>       <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00550"></a><span class="lineno">  550</span>     }</div>
+<div class="line"><a name="l00551"></a><span class="lineno">  551</span>         <span class="keywordflow">case</span>(filter2d::proportion):{</div>
+<div class="line"><a name="l00552"></a><span class="lineno">  552</span>       <span class="keywordflow">if</span>(windowBuffer.size()){</div>
+<div class="line"><a name="l00553"></a><span class="lineno">  553</span>         <span class="keywordtype">double</span> sum=stat.sum(windowBuffer);</div>
+<div class="line"><a name="l00554"></a><span class="lineno">  554</span>         <span class="keywordflow">if</span>(sum)</div>
+<div class="line"><a name="l00555"></a><span class="lineno">  555</span>           outBuffer[x/down]=100.0*windowBuffer[centre]/stat.sum(windowBuffer);</div>
+<div class="line"><a name="l00556"></a><span class="lineno">  556</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00557"></a><span class="lineno">  557</span>           outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00558"></a><span class="lineno">  558</span>       }</div>
+<div class="line"><a name="l00559"></a><span class="lineno">  559</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00560"></a><span class="lineno">  560</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00561"></a><span class="lineno">  561</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00562"></a><span class="lineno">  562</span>     }</div>
+<div class="line"><a name="l00563"></a><span class="lineno">  563</span>         <span class="keywordflow">case</span>(filter2d::homog):</div>
+<div class="line"><a name="l00564"></a><span class="lineno">  564</span>       <span class="keywordflow">if</span>(occurrence.size()==1)<span class="comment">//all values in window are the same</span></div>
+<div class="line"><a name="l00565"></a><span class="lineno">  565</span>         outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l00566"></a><span class="lineno">  566</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00567"></a><span class="lineno">  567</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00568"></a><span class="lineno">  568</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00569"></a><span class="lineno">  569</span>         <span class="keywordflow">case</span>(filter2d::heterog):{</div>
+<div class="line"><a name="l00570"></a><span class="lineno">  570</span>       <span class="keywordflow">if</span>(occurrence.size()==windowBuffer.size())</div>
+<div class="line"><a name="l00571"></a><span class="lineno">  571</span>         outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l00572"></a><span class="lineno">  572</span>       <span class="keywordflow">else</span>      </div>
+<div class="line"><a name="l00573"></a><span class="lineno">  573</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00574"></a><span class="lineno">  574</span>       <span class="comment">// if(occurrence.size()==1)//all values in window are the same</span></div>
+<div class="line"><a name="l00575"></a><span class="lineno">  575</span>       <span class="comment">//   outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</span></div>
+<div class="line"><a name="l00576"></a><span class="lineno">  576</span>       <span class="comment">// else</span></div>
+<div class="line"><a name="l00577"></a><span class="lineno">  577</span>       <span class="comment">//   outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</span></div>
+<div class="line"><a name="l00578"></a><span class="lineno">  578</span>           <span class="comment">// break;</span></div>
+<div class="line"><a name="l00579"></a><span class="lineno">  579</span>           <span class="comment">// for(std::vector<double>::const_iterator wit=windowBuffer.begin();wit!=windowBuffer.end();++wit){</span></div>
+<div class="line"><a name="l00580"></a><span class="lineno">  580</span>           <span class="comment">//   if(wit==windowBuffer.begin()+windowBuffer.size()/2)</span></div>
+<div class="line"><a name="l00581"></a><span class="lineno">  581</span>           <span class="comment">//     continue;</span></div>
+<div class="line"><a name="l00582"></a><span class="lineno">  582</span>           <span class="comment">//   else if(*wit!=inBuffer[(dimY-1)/2][x]){</span></div>
+<div class="line"><a name="l00583"></a><span class="lineno">  583</span>           <span class="comment">//     outBuffer[x/down]=1;</span></div>
+<div class="line"><a name="l00584"></a><span class="lineno">  584</span>       <span class="comment">//     break;</span></div>
+<div class="line"><a name="l00585"></a><span class="lineno">  585</span>       <span class="comment">//   }</span></div>
+<div class="line"><a name="l00586"></a><span class="lineno">  586</span>           <span class="comment">//   else if(*wit==inBuffer[(dimY-1)/2][x]){//todo:wit mag niet central pixel zijn</span></div>
+<div class="line"><a name="l00587"></a><span class="lineno">  587</span>           <span class="comment">//     outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</span></div>
+<div class="line"><a name="l00588"></a><span class="lineno">  588</span>           <span class="comment">//     break;</span></div>
+<div class="line"><a name="l00589"></a><span class="lineno">  589</span>           <span class="comment">//   }</span></div>
+<div class="line"><a name="l00590"></a><span class="lineno">  590</span>           <span class="comment">// }</span></div>
+<div class="line"><a name="l00591"></a><span class="lineno">  591</span>           <span class="comment">// break;</span></div>
+<div class="line"><a name="l00592"></a><span class="lineno">  592</span>         }</div>
+<div class="line"><a name="l00593"></a><span class="lineno">  593</span>         <span class="keywordflow">case</span>(filter2d::density):{</div>
+<div class="line"><a name="l00594"></a><span class="lineno">  594</span>       <span class="keywordflow">if</span>(windowBuffer.size()){</div>
+<div class="line"><a name="l00595"></a><span class="lineno">  595</span>         std::vector<short>::const_iterator vit=m_class.begin();</div>
+<div class="line"><a name="l00596"></a><span class="lineno">  596</span>         <span class="keywordflow">while</span>(vit!=m_class.end())</div>
+<div class="line"><a name="l00597"></a><span class="lineno">  597</span>           outBuffer[x/down]+=100.0*occurrence[*(vit++)]/windowBuffer.size();</div>
+<div class="line"><a name="l00598"></a><span class="lineno">  598</span>       }</div>
+<div class="line"><a name="l00599"></a><span class="lineno">  599</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00600"></a><span class="lineno">  600</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00601"></a><span class="lineno">  601</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00602"></a><span class="lineno">  602</span>     }</div>
+<div class="line"><a name="l00603"></a><span class="lineno">  603</span>         <span class="keywordflow">case</span>(filter2d::countid):{</div>
+<div class="line"><a name="l00604"></a><span class="lineno">  604</span>       <span class="keywordflow">if</span>(windowBuffer.size())</div>
+<div class="line"><a name="l00605"></a><span class="lineno">  605</span>         outBuffer[x/down]=occurrence.size();</div>
+<div class="line"><a name="l00606"></a><span class="lineno">  606</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00607"></a><span class="lineno">  607</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00608"></a><span class="lineno">  608</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00609"></a><span class="lineno">  609</span>     }</div>
+<div class="line"><a name="l00610"></a><span class="lineno">  610</span>         <span class="keywordflow">case</span>(filter2d::mode):{</div>
+<div class="line"><a name="l00611"></a><span class="lineno">  611</span>       <span class="keywordflow">if</span>(occurrence.size()){</div>
+<div class="line"><a name="l00612"></a><span class="lineno">  612</span>             std::map<long int,int>::const_iterator maxit=occurrence.begin();</div>
+<div class="line"><a name="l00613"></a><span class="lineno">  613</span>             <span class="keywordflow">for</span>(std::map<long int,int>::const_iterator mit=occurrence.begin();mit!=occurrence.end();++mit){</div>
+<div class="line"><a name="l00614"></a><span class="lineno">  614</span>               <span class="keywordflow">if</span>(mit->second>maxit->second)</div>
+<div class="line"><a name="l00615"></a><span class="lineno">  615</span>                 maxit=mit;</div>
+<div class="line"><a name="l00616"></a><span class="lineno">  616</span>             }</div>
+<div class="line"><a name="l00617"></a><span class="lineno">  617</span>             <span class="keywordflow">if</span>(occurrence[inBuffer[(dimY-1)/2][x]]<maxit->second)<span class="comment">//</span></div>
+<div class="line"><a name="l00618"></a><span class="lineno">  618</span>               outBuffer[x/down]=maxit->first;</div>
+<div class="line"><a name="l00619"></a><span class="lineno">  619</span>             <span class="keywordflow">else</span><span class="comment">//favorize original value in case of ties</span></div>
+<div class="line"><a name="l00620"></a><span class="lineno">  620</span>               outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l00621"></a><span class="lineno">  621</span>       }</div>
+<div class="line"><a name="l00622"></a><span class="lineno">  622</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00623"></a><span class="lineno">  623</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00624"></a><span class="lineno">  624</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00625"></a><span class="lineno">  625</span>         }</div>
+<div class="line"><a name="l00626"></a><span class="lineno">  626</span>         <span class="keywordflow">case</span>(filter2d::threshold):{</div>
+<div class="line"><a name="l00627"></a><span class="lineno">  627</span>           assert(m_class.size()==m_threshold.size());</div>
+<div class="line"><a name="l00628"></a><span class="lineno">  628</span>       <span class="keywordflow">if</span>(windowBuffer.size()){</div>
+<div class="line"><a name="l00629"></a><span class="lineno">  629</span>             outBuffer[x/down]=inBuffer[(dimY-1)/2][x];<span class="comment">//initialize with original value (in case thresholds not met)</span></div>
+<div class="line"><a name="l00630"></a><span class="lineno">  630</span>             <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
+<div class="line"><a name="l00631"></a><span class="lineno">  631</span>               <span class="keywordflow">if</span>(100.0*(occurrence[m_class[iclass]])/windowBuffer.size()>m_threshold[iclass])</div>
+<div class="line"><a name="l00632"></a><span class="lineno">  632</span>                 outBuffer[x/down]=m_class[iclass];</div>
+<div class="line"><a name="l00633"></a><span class="lineno">  633</span>             }</div>
+<div class="line"><a name="l00634"></a><span class="lineno">  634</span>           }</div>
+<div class="line"><a name="l00635"></a><span class="lineno">  635</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00636"></a><span class="lineno">  636</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00637"></a><span class="lineno">  637</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00638"></a><span class="lineno">  638</span>         }</div>
+<div class="line"><a name="l00639"></a><span class="lineno">  639</span>         <span class="keywordflow">case</span>(filter2d::scramble):{<span class="comment">//could be done more efficiently window by window with random shuffling entire buffer and assigning entire buffer at once to output image...</span></div>
+<div class="line"><a name="l00640"></a><span class="lineno">  640</span>       <span class="keywordflow">if</span>(windowBuffer.size()){</div>
+<div class="line"><a name="l00641"></a><span class="lineno">  641</span>             <span class="keywordtype">int</span> randomIndex=std::rand()%windowBuffer.size();</div>
+<div class="line"><a name="l00642"></a><span class="lineno">  642</span>         <span class="keywordflow">if</span>(randomIndex>=windowBuffer.size())</div>
+<div class="line"><a name="l00643"></a><span class="lineno">  643</span>           outBuffer[x/down]=windowBuffer.back();</div>
+<div class="line"><a name="l00644"></a><span class="lineno">  644</span>         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(randomIndex<0)</div>
+<div class="line"><a name="l00645"></a><span class="lineno">  645</span>           outBuffer[x/down]=windowBuffer[0];</div>
+<div class="line"><a name="l00646"></a><span class="lineno">  646</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00647"></a><span class="lineno">  647</span>           outBuffer[x/down]=windowBuffer[randomIndex];</div>
+<div class="line"><a name="l00648"></a><span class="lineno">  648</span>           }</div>
+<div class="line"><a name="l00649"></a><span class="lineno">  649</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00650"></a><span class="lineno">  650</span>         outBuffer[x/down]=(m_noDataValues.size())? m_noDataValues[0] : 0;</div>
+<div class="line"><a name="l00651"></a><span class="lineno">  651</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00652"></a><span class="lineno">  652</span>         }</div>
+<div class="line"><a name="l00653"></a><span class="lineno">  653</span>         <span class="keywordflow">case</span>(filter2d::mixed):{</div>
+<div class="line"><a name="l00654"></a><span class="lineno">  654</span>           <span class="keyword">enum</span> Type { BF=11, CF=12, MF=13, NF=20, W=30 };</div>
+<div class="line"><a name="l00655"></a><span class="lineno">  655</span>           <span class="keywordtype">double</span> nBF=occurrence[BF];</div>
+<div class="line"><a name="l00656"></a><span class="lineno">  656</span>           <span class="keywordtype">double</span> nCF=occurrence[CF];</div>
+<div class="line"><a name="l00657"></a><span class="lineno">  657</span>           <span class="keywordtype">double</span> nMF=occurrence[MF];</div>
+<div class="line"><a name="l00658"></a><span class="lineno">  658</span>           <span class="keywordtype">double</span> nNF=occurrence[NF];</div>
+<div class="line"><a name="l00659"></a><span class="lineno">  659</span>           <span class="keywordtype">double</span> nW=occurrence[W];</div>
+<div class="line"><a name="l00660"></a><span class="lineno">  660</span>       <span class="keywordflow">if</span>(windowBuffer.size()){</div>
+<div class="line"><a name="l00661"></a><span class="lineno">  661</span>             <span class="keywordflow">if</span>((nBF+nCF+nMF)&&(nBF+nCF+nMF>=nNF+nW)){<span class="comment">//forest</span></div>
+<div class="line"><a name="l00662"></a><span class="lineno">  662</span>               <span class="keywordflow">if</span>(nBF/(nBF+nCF)>=0.75)</div>
+<div class="line"><a name="l00663"></a><span class="lineno">  663</span>                 outBuffer[x/down]=BF;</div>
+<div class="line"><a name="l00664"></a><span class="lineno">  664</span>               <span class="keywordflow">else</span> <span class="keywordflow">if</span>(nCF/(nBF+nCF)>=0.75)</div>
+<div class="line"><a name="l00665"></a><span class="lineno">  665</span>                 outBuffer[x/down]=CF;</div>
+<div class="line"><a name="l00666"></a><span class="lineno">  666</span>               <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00667"></a><span class="lineno">  667</span>                 outBuffer[x/down]=MF;</div>
+<div class="line"><a name="l00668"></a><span class="lineno">  668</span>             }</div>
+<div class="line"><a name="l00669"></a><span class="lineno">  669</span>             <span class="keywordflow">else</span>{<span class="comment">//non-forest</span></div>
+<div class="line"><a name="l00670"></a><span class="lineno">  670</span>               <span class="keywordflow">if</span>(nW&&(nW>=nNF))</div>
+<div class="line"><a name="l00671"></a><span class="lineno">  671</span>                 outBuffer[x/down]=W;</div>
+<div class="line"><a name="l00672"></a><span class="lineno">  672</span>               <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00673"></a><span class="lineno">  673</span>                 outBuffer[x/down]=NF;</div>
+<div class="line"><a name="l00674"></a><span class="lineno">  674</span>             }</div>
+<div class="line"><a name="l00675"></a><span class="lineno">  675</span>           }</div>
+<div class="line"><a name="l00676"></a><span class="lineno">  676</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00677"></a><span class="lineno">  677</span>         outBuffer[x/down]=inBuffer[indexJ][indexI];</div>
+<div class="line"><a name="l00678"></a><span class="lineno">  678</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00679"></a><span class="lineno">  679</span>         }</div>
+<div class="line"><a name="l00680"></a><span class="lineno">  680</span>         <span class="keywordflow">default</span>:{</div>
+<div class="line"><a name="l00681"></a><span class="lineno">  681</span>       std::ostringstream ess;</div>
+<div class="line"><a name="l00682"></a><span class="lineno">  682</span>       ess << <span class="stringliteral">"Error: filter method "</span> << method << <span class="stringliteral">" not supported"</span> << std::endl;</div>
+<div class="line"><a name="l00683"></a><span class="lineno">  683</span>       <span class="keywordflow">throw</span>(ess.str());</div>
+<div class="line"><a name="l00684"></a><span class="lineno">  684</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00685"></a><span class="lineno">  685</span>     }</div>
+<div class="line"><a name="l00686"></a><span class="lineno">  686</span>         }</div>
+<div class="line"><a name="l00687"></a><span class="lineno">  687</span>       }</div>
+<div class="line"><a name="l00688"></a><span class="lineno">  688</span>       progress=(1.0+y/down);</div>
+<div class="line"><a name="l00689"></a><span class="lineno">  689</span>       progress+=(output.nrOfRow()*iband);</div>
+<div class="line"><a name="l00690"></a><span class="lineno">  690</span>       progress/=output.nrOfBand()*output.nrOfRow();</div>
+<div class="line"><a name="l00691"></a><span class="lineno">  691</span>       pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00692"></a><span class="lineno">  692</span>       <span class="comment">//write outBuffer to file</span></div>
+<div class="line"><a name="l00693"></a><span class="lineno">  693</span>       <span class="keywordflow">try</span>{</div>
+<div class="line"><a name="l00694"></a><span class="lineno">  694</span>         output.writeData(outBuffer,GDT_Float64,y/down,iband);</div>
 <div class="line"><a name="l00695"></a><span class="lineno">  695</span>       }</div>
-<div class="line"><a name="l00696"></a><span class="lineno">  696</span>     }</div>
-<div class="line"><a name="l00697"></a><span class="lineno">  697</span>   }</div>
-<div class="line"><a name="l00698"></a><span class="lineno">  698</span>   pfnProgress(1.0,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00699"></a><span class="lineno">  699</span> }</div>
-<div class="line"><a name="l00700"></a><span class="lineno">  700</span> </div>
-<div class="line"><a name="l00701"></a><span class="lineno">  701</span> <span class="keywordtype">void</span> filter2d::Filter2d::mrf(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keywordtype">int</span> dimX, <span class="keywordtype">int</span> dimY, <span class="keywordtype">double</span> beta, <span class="keywordtype">bool [...]
-<div class="line"><a name="l00702"></a><span class="lineno">  702</span>   assert(m_class.size()>1);</div>
-<div class="line"><a name="l00703"></a><span class="lineno">  703</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> fullBeta(m_class.size(),m_class.size());</div>
-<div class="line"><a name="l00704"></a><span class="lineno">  704</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass1=0;iclass1<m_class.size();++iclass1)</div>
-<div class="line"><a name="l00705"></a><span class="lineno">  705</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass2=0;iclass2<m_class.size();++iclass2)</div>
-<div class="line"><a name="l00706"></a><span class="lineno">  706</span>       fullBeta[iclass1][iclass2]=beta;</div>
-<div class="line"><a name="l00707"></a><span class="lineno">  707</span>   mrf(input,output,dimX,dimY,fullBeta,eightConnectivity,down,verbose);</div>
-<div class="line"><a name="l00708"></a><span class="lineno">  708</span> }</div>
-<div class="line"><a name="l00709"></a><span class="lineno">  709</span> </div>
-<div class="line"><a name="l00710"></a><span class="lineno">  710</span> <span class="comment">//beta[classTo][classFrom]</span></div>
-<div class="line"><a name="l00711"></a><span class="lineno">  711</span> <span class="keywordtype">void</span> filter2d::Filter2d::mrf(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keywordtype">int</span> dimX, <span class="keywordtype">int</span> dimY, <a class="code" href="classVector2d.html">Vector2d<double></a> beta, < [...]
-<div class="line"><a name="l00712"></a><span class="lineno">  712</span> {</div>
-<div class="line"><a name="l00713"></a><span class="lineno">  713</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l00714"></a><span class="lineno">  714</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l00715"></a><span class="lineno">  715</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l00716"></a><span class="lineno">  716</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l00717"></a><span class="lineno">  717</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00718"></a><span class="lineno">  718</span> </div>
-<div class="line"><a name="l00719"></a><span class="lineno">  719</span>   assert(dimX);</div>
-<div class="line"><a name="l00720"></a><span class="lineno">  720</span>   assert(dimY);</div>
+<div class="line"><a name="l00696"></a><span class="lineno">  696</span>       <span class="keywordflow">catch</span>(std::string errorstring){</div>
+<div class="line"><a name="l00697"></a><span class="lineno">  697</span>     std::cerr << errorstring << <span class="stringliteral">"in band "</span> << iband << <span class="stringliteral">", line "</span> << y << std::endl;</div>
+<div class="line"><a name="l00698"></a><span class="lineno">  698</span>       }</div>
+<div class="line"><a name="l00699"></a><span class="lineno">  699</span>     }</div>
+<div class="line"><a name="l00700"></a><span class="lineno">  700</span>   }</div>
+<div class="line"><a name="l00701"></a><span class="lineno">  701</span>   pfnProgress(1.0,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00702"></a><span class="lineno">  702</span> }</div>
+<div class="line"><a name="l00703"></a><span class="lineno">  703</span> </div>
+<div class="line"><a name="l00704"></a><span class="lineno">  704</span> <span class="keywordtype">void</span> filter2d::Filter2d::mrf(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keywordtype">int</span> dimX, <span class="keywordtype">int</span> dimY, <span class="keywordtype">double</span> beta, <span class="keywordtype">bool [...]
+<div class="line"><a name="l00705"></a><span class="lineno">  705</span>   assert(m_class.size()>1);</div>
+<div class="line"><a name="l00706"></a><span class="lineno">  706</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> fullBeta(m_class.size(),m_class.size());</div>
+<div class="line"><a name="l00707"></a><span class="lineno">  707</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass1=0;iclass1<m_class.size();++iclass1)</div>
+<div class="line"><a name="l00708"></a><span class="lineno">  708</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass2=0;iclass2<m_class.size();++iclass2)</div>
+<div class="line"><a name="l00709"></a><span class="lineno">  709</span>       fullBeta[iclass1][iclass2]=beta;</div>
+<div class="line"><a name="l00710"></a><span class="lineno">  710</span>   mrf(input,output,dimX,dimY,fullBeta,eightConnectivity,down,verbose);</div>
+<div class="line"><a name="l00711"></a><span class="lineno">  711</span> }</div>
+<div class="line"><a name="l00712"></a><span class="lineno">  712</span> </div>
+<div class="line"><a name="l00713"></a><span class="lineno">  713</span> <span class="comment">//beta[classTo][classFrom]</span></div>
+<div class="line"><a name="l00714"></a><span class="lineno">  714</span> <span class="keywordtype">void</span> filter2d::Filter2d::mrf(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keywordtype">int</span> dimX, <span class="keywordtype">int</span> dimY, <a class="code" href="classVector2d.html">Vector2d<double></a> beta, < [...]
+<div class="line"><a name="l00715"></a><span class="lineno">  715</span> {</div>
+<div class="line"><a name="l00716"></a><span class="lineno">  716</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l00717"></a><span class="lineno">  717</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l00718"></a><span class="lineno">  718</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l00719"></a><span class="lineno">  719</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l00720"></a><span class="lineno">  720</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
 <div class="line"><a name="l00721"></a><span class="lineno">  721</span> </div>
-<div class="line"><a name="l00722"></a><span class="lineno">  722</span>   <a class="code" href="classVector2d.html">Vector2d<short></a> inBuffer(dimY,input.nrOfCol());</div>
-<div class="line"><a name="l00723"></a><span class="lineno">  723</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> outBuffer(m_class.size(),(input.nrOfCol()+down-1)/down);</div>
-<div class="line"><a name="l00724"></a><span class="lineno">  724</span>   assert(input.nrOfBand()==1);</div>
-<div class="line"><a name="l00725"></a><span class="lineno">  725</span>   assert(output.nrOfBand()==m_class.size());</div>
-<div class="line"><a name="l00726"></a><span class="lineno">  726</span>   assert(m_class.size()>1);</div>
-<div class="line"><a name="l00727"></a><span class="lineno">  727</span>   assert(beta.size()==m_class.size());</div>
-<div class="line"><a name="l00728"></a><span class="lineno">  728</span>   <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l00729"></a><span class="lineno">  729</span>   <span class="keywordtype">int</span> indexJ=0;</div>
-<div class="line"><a name="l00730"></a><span class="lineno">  730</span>   <span class="comment">//initialize last half of inBuffer</span></div>
-<div class="line"><a name="l00731"></a><span class="lineno">  731</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00732"></a><span class="lineno">  732</span>     <span class="keywordflow">try</span>{</div>
-<div class="line"><a name="l00733"></a><span class="lineno">  733</span>       input.readData(inBuffer[indexJ],GDT_Int16,abs(j));</div>
-<div class="line"><a name="l00734"></a><span class="lineno">  734</span>     }</div>
-<div class="line"><a name="l00735"></a><span class="lineno">  735</span>     <span class="keywordflow">catch</span>(std::string errorstring){</div>
-<div class="line"><a name="l00736"></a><span class="lineno">  736</span>       std::cerr << errorstring << <span class="stringliteral">"in line "</span> << indexJ << std::endl;</div>
+<div class="line"><a name="l00722"></a><span class="lineno">  722</span>   assert(dimX);</div>
+<div class="line"><a name="l00723"></a><span class="lineno">  723</span>   assert(dimY);</div>
+<div class="line"><a name="l00724"></a><span class="lineno">  724</span> </div>
+<div class="line"><a name="l00725"></a><span class="lineno">  725</span>   <a class="code" href="classVector2d.html">Vector2d<short></a> inBuffer(dimY,input.nrOfCol());</div>
+<div class="line"><a name="l00726"></a><span class="lineno">  726</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> outBuffer(m_class.size(),(input.nrOfCol()+down-1)/down);</div>
+<div class="line"><a name="l00727"></a><span class="lineno">  727</span>   assert(input.nrOfBand()==1);</div>
+<div class="line"><a name="l00728"></a><span class="lineno">  728</span>   assert(output.nrOfBand()==m_class.size());</div>
+<div class="line"><a name="l00729"></a><span class="lineno">  729</span>   assert(m_class.size()>1);</div>
+<div class="line"><a name="l00730"></a><span class="lineno">  730</span>   assert(beta.size()==m_class.size());</div>
+<div class="line"><a name="l00731"></a><span class="lineno">  731</span>   <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l00732"></a><span class="lineno">  732</span>   <span class="keywordtype">int</span> indexJ=0;</div>
+<div class="line"><a name="l00733"></a><span class="lineno">  733</span>   <span class="comment">//initialize last half of inBuffer</span></div>
+<div class="line"><a name="l00734"></a><span class="lineno">  734</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00735"></a><span class="lineno">  735</span>     <span class="keywordflow">try</span>{</div>
+<div class="line"><a name="l00736"></a><span class="lineno">  736</span>       input.readData(inBuffer[indexJ],GDT_Int16,abs(j));</div>
 <div class="line"><a name="l00737"></a><span class="lineno">  737</span>     }</div>
-<div class="line"><a name="l00738"></a><span class="lineno">  738</span>     ++indexJ;</div>
-<div class="line"><a name="l00739"></a><span class="lineno">  739</span>   }</div>
-<div class="line"><a name="l00740"></a><span class="lineno">  740</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nrOfRow();++y){</div>
-<div class="line"><a name="l00741"></a><span class="lineno">  741</span>     <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
-<div class="line"><a name="l00742"></a><span class="lineno">  742</span>       <span class="comment">//erase first line from inBuffer</span></div>
-<div class="line"><a name="l00743"></a><span class="lineno">  743</span>       <span class="keywordflow">if</span>(dimY>1)</div>
-<div class="line"><a name="l00744"></a><span class="lineno">  744</span>     inBuffer.erase(inBuffer.begin());</div>
-<div class="line"><a name="l00745"></a><span class="lineno">  745</span>       <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
-<div class="line"><a name="l00746"></a><span class="lineno">  746</span>       <span class="keywordflow">if</span>(y+dimY/2<input.nrOfRow()){</div>
-<div class="line"><a name="l00747"></a><span class="lineno">  747</span>         <span class="comment">//allocate buffer</span></div>
-<div class="line"><a name="l00748"></a><span class="lineno">  748</span>     <span class="keywordflow">if</span>(dimY>1)</div>
-<div class="line"><a name="l00749"></a><span class="lineno">  749</span>       inBuffer.push_back(inBuffer.back());</div>
-<div class="line"><a name="l00750"></a><span class="lineno">  750</span>         <span class="keywordflow">try</span>{</div>
-<div class="line"><a name="l00751"></a><span class="lineno">  751</span>           input.readData(inBuffer[inBuffer.size()-1],GDT_Int16,y+dimY/2);</div>
-<div class="line"><a name="l00752"></a><span class="lineno">  752</span>         }</div>
-<div class="line"><a name="l00753"></a><span class="lineno">  753</span>         <span class="keywordflow">catch</span>(std::string errorstring){</div>
-<div class="line"><a name="l00754"></a><span class="lineno">  754</span>           std::cerr << errorstring << <span class="stringliteral">"in line "</span> << y << std::endl;</div>
+<div class="line"><a name="l00738"></a><span class="lineno">  738</span>     <span class="keywordflow">catch</span>(std::string errorstring){</div>
+<div class="line"><a name="l00739"></a><span class="lineno">  739</span>       std::cerr << errorstring << <span class="stringliteral">"in line "</span> << indexJ << std::endl;</div>
+<div class="line"><a name="l00740"></a><span class="lineno">  740</span>     }</div>
+<div class="line"><a name="l00741"></a><span class="lineno">  741</span>     ++indexJ;</div>
+<div class="line"><a name="l00742"></a><span class="lineno">  742</span>   }</div>
+<div class="line"><a name="l00743"></a><span class="lineno">  743</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nrOfRow();++y){</div>
+<div class="line"><a name="l00744"></a><span class="lineno">  744</span>     <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
+<div class="line"><a name="l00745"></a><span class="lineno">  745</span>       <span class="comment">//erase first line from inBuffer</span></div>
+<div class="line"><a name="l00746"></a><span class="lineno">  746</span>       <span class="keywordflow">if</span>(dimY>1)</div>
+<div class="line"><a name="l00747"></a><span class="lineno">  747</span>     inBuffer.erase(inBuffer.begin());</div>
+<div class="line"><a name="l00748"></a><span class="lineno">  748</span>       <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
+<div class="line"><a name="l00749"></a><span class="lineno">  749</span>       <span class="keywordflow">if</span>(y+dimY/2<input.nrOfRow()){</div>
+<div class="line"><a name="l00750"></a><span class="lineno">  750</span>         <span class="comment">//allocate buffer</span></div>
+<div class="line"><a name="l00751"></a><span class="lineno">  751</span>     <span class="keywordflow">if</span>(dimY>1)</div>
+<div class="line"><a name="l00752"></a><span class="lineno">  752</span>       inBuffer.push_back(inBuffer.back());</div>
+<div class="line"><a name="l00753"></a><span class="lineno">  753</span>         <span class="keywordflow">try</span>{</div>
+<div class="line"><a name="l00754"></a><span class="lineno">  754</span>           input.readData(inBuffer[inBuffer.size()-1],GDT_Int16,y+dimY/2);</div>
 <div class="line"><a name="l00755"></a><span class="lineno">  755</span>         }</div>
-<div class="line"><a name="l00756"></a><span class="lineno">  756</span>       }</div>
-<div class="line"><a name="l00757"></a><span class="lineno">  757</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00758"></a><span class="lineno">  758</span>         <span class="keywordtype">int</span> over=y+dimY/2-input.nrOfRow();</div>
-<div class="line"><a name="l00759"></a><span class="lineno">  759</span>         <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
-<div class="line"><a name="l00760"></a><span class="lineno">  760</span>         assert(index>=0);</div>
-<div class="line"><a name="l00761"></a><span class="lineno">  761</span>         assert(index<inBuffer.size());</div>
-<div class="line"><a name="l00762"></a><span class="lineno">  762</span>         inBuffer.push_back(inBuffer[index]);</div>
-<div class="line"><a name="l00763"></a><span class="lineno">  763</span>       }</div>
-<div class="line"><a name="l00764"></a><span class="lineno">  764</span>     }</div>
-<div class="line"><a name="l00765"></a><span class="lineno">  765</span>     <span class="keywordflow">if</span>((y+1+down/2)%down)</div>
-<div class="line"><a name="l00766"></a><span class="lineno">  766</span>       <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l00767"></a><span class="lineno">  767</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nrOfCol();++x){</div>
-<div class="line"><a name="l00768"></a><span class="lineno">  768</span>       <span class="keywordflow">if</span>((x+1+down/2)%down)</div>
-<div class="line"><a name="l00769"></a><span class="lineno">  769</span>         <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l00770"></a><span class="lineno">  770</span>       std::vector<short> potential(m_class.size());</div>
-<div class="line"><a name="l00771"></a><span class="lineno">  771</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
-<div class="line"><a name="l00772"></a><span class="lineno">  772</span>         potential[iclass]=0;</div>
-<div class="line"><a name="l00773"></a><span class="lineno">  773</span>         outBuffer[iclass][x/down]=0;</div>
-<div class="line"><a name="l00774"></a><span class="lineno">  774</span>       }</div>
-<div class="line"><a name="l00775"></a><span class="lineno">  775</span>       std::vector<double> windowBuffer;</div>
-<div class="line"><a name="l00776"></a><span class="lineno">  776</span>       <span class="keywordtype">int</span> centre=dimX*(dimY-1)/2+(dimX-1)/2;</div>
-<div class="line"><a name="l00777"></a><span class="lineno">  777</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00778"></a><span class="lineno">  778</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
-<div class="line"><a name="l00779"></a><span class="lineno">  779</span>           <span class="keywordflow">if</span>(i!=0&&j!=0&&!eightConnectivity)</div>
-<div class="line"><a name="l00780"></a><span class="lineno">  780</span>             <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l00781"></a><span class="lineno">  781</span>           <span class="keywordflow">if</span>(i==0&&j==0)</div>
-<div class="line"><a name="l00782"></a><span class="lineno">  782</span>             <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l00783"></a><span class="lineno">  783</span>           indexI=x+i;</div>
-<div class="line"><a name="l00784"></a><span class="lineno">  784</span>           <span class="comment">//check if out of bounds</span></div>
-<div class="line"><a name="l00785"></a><span class="lineno">  785</span>           <span class="keywordflow">if</span>(indexI<0)</div>
-<div class="line"><a name="l00786"></a><span class="lineno">  786</span>             indexI=-indexI;</div>
-<div class="line"><a name="l00787"></a><span class="lineno">  787</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=input.nrOfCol())</div>
-<div class="line"><a name="l00788"></a><span class="lineno">  788</span>             indexI=input.nrOfCol()-i;</div>
-<div class="line"><a name="l00789"></a><span class="lineno">  789</span>           <span class="keywordflow">if</span>(y+j<0)</div>
-<div class="line"><a name="l00790"></a><span class="lineno">  790</span>             indexJ=-j;</div>
-<div class="line"><a name="l00791"></a><span class="lineno">  791</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=input.nrOfRow())</div>
-<div class="line"><a name="l00792"></a><span class="lineno">  792</span>             indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
-<div class="line"><a name="l00793"></a><span class="lineno">  793</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00794"></a><span class="lineno">  794</span>             indexJ=(dimY-1)/2+j;</div>
-<div class="line"><a name="l00795"></a><span class="lineno">  795</span>           <span class="keywordtype">bool</span> masked=<span class="keyword">false</span>;</div>
-<div class="line"><a name="l00796"></a><span class="lineno">  796</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
-<div class="line"><a name="l00797"></a><span class="lineno">  797</span>             <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_noDataValues[imask]){</div>
-<div class="line"><a name="l00798"></a><span class="lineno">  798</span>               masked=<span class="keyword">true</span>;</div>
-<div class="line"><a name="l00799"></a><span class="lineno">  799</span>               <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00800"></a><span class="lineno">  800</span>             }</div>
-<div class="line"><a name="l00801"></a><span class="lineno">  801</span>           }</div>
-<div class="line"><a name="l00802"></a><span class="lineno">  802</span>           <span class="keywordflow">if</span>(!masked){</div>
-<div class="line"><a name="l00803"></a><span class="lineno">  803</span>             <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
-<div class="line"><a name="l00804"></a><span class="lineno">  804</span>               <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_class[iclass])</div>
-<div class="line"><a name="l00805"></a><span class="lineno">  805</span>                 potential[iclass]+=1;</div>
-<div class="line"><a name="l00806"></a><span class="lineno">  806</span>             }</div>
-<div class="line"><a name="l00807"></a><span class="lineno">  807</span>           }</div>
-<div class="line"><a name="l00808"></a><span class="lineno">  808</span>         }</div>
-<div class="line"><a name="l00809"></a><span class="lineno">  809</span>       }</div>
-<div class="line"><a name="l00810"></a><span class="lineno">  810</span>       <span class="keywordtype">double</span> norm=0;</div>
-<div class="line"><a name="l00811"></a><span class="lineno">  811</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass1=0;iclass1<m_class.size();++iclass1){</div>
-<div class="line"><a name="l00812"></a><span class="lineno">  812</span>     assert(beta[iclass1].size()==m_class.size());</div>
-<div class="line"><a name="l00813"></a><span class="lineno">  813</span>         <span class="keywordtype">double</span> pot=0;</div>
-<div class="line"><a name="l00814"></a><span class="lineno">  814</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass2=0;iclass2<m_class.size();++iclass2)</div>
-<div class="line"><a name="l00815"></a><span class="lineno">  815</span>       <span class="keywordflow">if</span>(iclass2!=iclass1)</div>
-<div class="line"><a name="l00816"></a><span class="lineno">  816</span>         pot+=potential[iclass2]*beta[iclass1][iclass2];</div>
-<div class="line"><a name="l00817"></a><span class="lineno">  817</span>         <span class="keywordtype">double</span> prior=exp(-pot);</div>
-<div class="line"><a name="l00818"></a><span class="lineno">  818</span>         outBuffer[iclass1][x/down]=prior;</div>
-<div class="line"><a name="l00819"></a><span class="lineno">  819</span>         norm+=prior;</div>
-<div class="line"><a name="l00820"></a><span class="lineno">  820</span>       }</div>
-<div class="line"><a name="l00821"></a><span class="lineno">  821</span>       <span class="keywordflow">if</span>(norm){</div>
-<div class="line"><a name="l00822"></a><span class="lineno">  822</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass1=0;iclass1<m_class.size();++iclass1)</div>
-<div class="line"><a name="l00823"></a><span class="lineno">  823</span>           outBuffer[iclass1][x/down]/=norm;</div>
-<div class="line"><a name="l00824"></a><span class="lineno">  824</span>       }</div>
-<div class="line"><a name="l00825"></a><span class="lineno">  825</span>     }</div>
-<div class="line"><a name="l00826"></a><span class="lineno">  826</span>     progress=(1.0+y/down)/output.nrOfRow();</div>
-<div class="line"><a name="l00827"></a><span class="lineno">  827</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00828"></a><span class="lineno">  828</span>     <span class="comment">//write outBuffer to file</span></div>
-<div class="line"><a name="l00829"></a><span class="lineno">  829</span>     assert(outBuffer.size()==m_class.size());</div>
-<div class="line"><a name="l00830"></a><span class="lineno">  830</span>     assert(y<output.nrOfRow());</div>
-<div class="line"><a name="l00831"></a><span class="lineno">  831</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
-<div class="line"><a name="l00832"></a><span class="lineno">  832</span>       assert(outBuffer[iclass].size()==output.nrOfCol());</div>
-<div class="line"><a name="l00833"></a><span class="lineno">  833</span>       <span class="keywordflow">try</span>{</div>
-<div class="line"><a name="l00834"></a><span class="lineno">  834</span>         output.writeData(outBuffer[iclass],GDT_Float64,y/down,iclass);</div>
-<div class="line"><a name="l00835"></a><span class="lineno">  835</span>       }</div>
-<div class="line"><a name="l00836"></a><span class="lineno">  836</span>       <span class="keywordflow">catch</span>(std::string errorstring){</div>
-<div class="line"><a name="l00837"></a><span class="lineno">  837</span>         std::cerr << errorstring << <span class="stringliteral">"in class "</span> << iclass << <span class="stringliteral">", line "</span> << y << std::endl;</div>
+<div class="line"><a name="l00756"></a><span class="lineno">  756</span>         <span class="keywordflow">catch</span>(std::string errorstring){</div>
+<div class="line"><a name="l00757"></a><span class="lineno">  757</span>           std::cerr << errorstring << <span class="stringliteral">"in line "</span> << y << std::endl;</div>
+<div class="line"><a name="l00758"></a><span class="lineno">  758</span>         }</div>
+<div class="line"><a name="l00759"></a><span class="lineno">  759</span>       }</div>
+<div class="line"><a name="l00760"></a><span class="lineno">  760</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00761"></a><span class="lineno">  761</span>         <span class="keywordtype">int</span> over=y+dimY/2-input.nrOfRow();</div>
+<div class="line"><a name="l00762"></a><span class="lineno">  762</span>         <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
+<div class="line"><a name="l00763"></a><span class="lineno">  763</span>         assert(index>=0);</div>
+<div class="line"><a name="l00764"></a><span class="lineno">  764</span>         assert(index<inBuffer.size());</div>
+<div class="line"><a name="l00765"></a><span class="lineno">  765</span>         inBuffer.push_back(inBuffer[index]);</div>
+<div class="line"><a name="l00766"></a><span class="lineno">  766</span>       }</div>
+<div class="line"><a name="l00767"></a><span class="lineno">  767</span>     }</div>
+<div class="line"><a name="l00768"></a><span class="lineno">  768</span>     <span class="keywordflow">if</span>((y+1+down/2)%down)</div>
+<div class="line"><a name="l00769"></a><span class="lineno">  769</span>       <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l00770"></a><span class="lineno">  770</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nrOfCol();++x){</div>
+<div class="line"><a name="l00771"></a><span class="lineno">  771</span>       <span class="keywordflow">if</span>((x+1+down/2)%down)</div>
+<div class="line"><a name="l00772"></a><span class="lineno">  772</span>         <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l00773"></a><span class="lineno">  773</span>       std::vector<short> potential(m_class.size());</div>
+<div class="line"><a name="l00774"></a><span class="lineno">  774</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
+<div class="line"><a name="l00775"></a><span class="lineno">  775</span>         potential[iclass]=0;</div>
+<div class="line"><a name="l00776"></a><span class="lineno">  776</span>         outBuffer[iclass][x/down]=0;</div>
+<div class="line"><a name="l00777"></a><span class="lineno">  777</span>       }</div>
+<div class="line"><a name="l00778"></a><span class="lineno">  778</span>       std::vector<double> windowBuffer;</div>
+<div class="line"><a name="l00779"></a><span class="lineno">  779</span>       <span class="keywordtype">int</span> centre=dimX*(dimY-1)/2+(dimX-1)/2;</div>
+<div class="line"><a name="l00780"></a><span class="lineno">  780</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00781"></a><span class="lineno">  781</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
+<div class="line"><a name="l00782"></a><span class="lineno">  782</span>           <span class="keywordflow">if</span>(i!=0&&j!=0&&!eightConnectivity)</div>
+<div class="line"><a name="l00783"></a><span class="lineno">  783</span>             <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l00784"></a><span class="lineno">  784</span>           <span class="keywordflow">if</span>(i==0&&j==0)</div>
+<div class="line"><a name="l00785"></a><span class="lineno">  785</span>             <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l00786"></a><span class="lineno">  786</span>           indexI=x+i;</div>
+<div class="line"><a name="l00787"></a><span class="lineno">  787</span>           <span class="comment">//check if out of bounds</span></div>
+<div class="line"><a name="l00788"></a><span class="lineno">  788</span>           <span class="keywordflow">if</span>(indexI<0)</div>
+<div class="line"><a name="l00789"></a><span class="lineno">  789</span>             indexI=-indexI;</div>
+<div class="line"><a name="l00790"></a><span class="lineno">  790</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=input.nrOfCol())</div>
+<div class="line"><a name="l00791"></a><span class="lineno">  791</span>             indexI=input.nrOfCol()-i;</div>
+<div class="line"><a name="l00792"></a><span class="lineno">  792</span>           <span class="keywordflow">if</span>(y+j<0)</div>
+<div class="line"><a name="l00793"></a><span class="lineno">  793</span>             indexJ=-j;</div>
+<div class="line"><a name="l00794"></a><span class="lineno">  794</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=input.nrOfRow())</div>
+<div class="line"><a name="l00795"></a><span class="lineno">  795</span>             indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
+<div class="line"><a name="l00796"></a><span class="lineno">  796</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00797"></a><span class="lineno">  797</span>             indexJ=(dimY-1)/2+j;</div>
+<div class="line"><a name="l00798"></a><span class="lineno">  798</span>           <span class="keywordtype">bool</span> masked=<span class="keyword">false</span>;</div>
+<div class="line"><a name="l00799"></a><span class="lineno">  799</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
+<div class="line"><a name="l00800"></a><span class="lineno">  800</span>             <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_noDataValues[imask]){</div>
+<div class="line"><a name="l00801"></a><span class="lineno">  801</span>               masked=<span class="keyword">true</span>;</div>
+<div class="line"><a name="l00802"></a><span class="lineno">  802</span>               <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00803"></a><span class="lineno">  803</span>             }</div>
+<div class="line"><a name="l00804"></a><span class="lineno">  804</span>           }</div>
+<div class="line"><a name="l00805"></a><span class="lineno">  805</span>           <span class="keywordflow">if</span>(!masked){</div>
+<div class="line"><a name="l00806"></a><span class="lineno">  806</span>             <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
+<div class="line"><a name="l00807"></a><span class="lineno">  807</span>               <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_class[iclass])</div>
+<div class="line"><a name="l00808"></a><span class="lineno">  808</span>                 potential[iclass]+=1;</div>
+<div class="line"><a name="l00809"></a><span class="lineno">  809</span>             }</div>
+<div class="line"><a name="l00810"></a><span class="lineno">  810</span>           }</div>
+<div class="line"><a name="l00811"></a><span class="lineno">  811</span>         }</div>
+<div class="line"><a name="l00812"></a><span class="lineno">  812</span>       }</div>
+<div class="line"><a name="l00813"></a><span class="lineno">  813</span>       <span class="keywordtype">double</span> norm=0;</div>
+<div class="line"><a name="l00814"></a><span class="lineno">  814</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass1=0;iclass1<m_class.size();++iclass1){</div>
+<div class="line"><a name="l00815"></a><span class="lineno">  815</span>     assert(beta[iclass1].size()==m_class.size());</div>
+<div class="line"><a name="l00816"></a><span class="lineno">  816</span>         <span class="keywordtype">double</span> pot=0;</div>
+<div class="line"><a name="l00817"></a><span class="lineno">  817</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass2=0;iclass2<m_class.size();++iclass2)</div>
+<div class="line"><a name="l00818"></a><span class="lineno">  818</span>       <span class="keywordflow">if</span>(iclass2!=iclass1)</div>
+<div class="line"><a name="l00819"></a><span class="lineno">  819</span>         pot+=potential[iclass2]*beta[iclass1][iclass2];</div>
+<div class="line"><a name="l00820"></a><span class="lineno">  820</span>         <span class="keywordtype">double</span> prior=exp(-pot);</div>
+<div class="line"><a name="l00821"></a><span class="lineno">  821</span>         outBuffer[iclass1][x/down]=prior;</div>
+<div class="line"><a name="l00822"></a><span class="lineno">  822</span>         norm+=prior;</div>
+<div class="line"><a name="l00823"></a><span class="lineno">  823</span>       }</div>
+<div class="line"><a name="l00824"></a><span class="lineno">  824</span>       <span class="keywordflow">if</span>(norm){</div>
+<div class="line"><a name="l00825"></a><span class="lineno">  825</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass1=0;iclass1<m_class.size();++iclass1)</div>
+<div class="line"><a name="l00826"></a><span class="lineno">  826</span>           outBuffer[iclass1][x/down]/=norm;</div>
+<div class="line"><a name="l00827"></a><span class="lineno">  827</span>       }</div>
+<div class="line"><a name="l00828"></a><span class="lineno">  828</span>     }</div>
+<div class="line"><a name="l00829"></a><span class="lineno">  829</span>     progress=(1.0+y/down)/output.nrOfRow();</div>
+<div class="line"><a name="l00830"></a><span class="lineno">  830</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00831"></a><span class="lineno">  831</span>     <span class="comment">//write outBuffer to file</span></div>
+<div class="line"><a name="l00832"></a><span class="lineno">  832</span>     assert(outBuffer.size()==m_class.size());</div>
+<div class="line"><a name="l00833"></a><span class="lineno">  833</span>     assert(y<output.nrOfRow());</div>
+<div class="line"><a name="l00834"></a><span class="lineno">  834</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
+<div class="line"><a name="l00835"></a><span class="lineno">  835</span>       assert(outBuffer[iclass].size()==output.nrOfCol());</div>
+<div class="line"><a name="l00836"></a><span class="lineno">  836</span>       <span class="keywordflow">try</span>{</div>
+<div class="line"><a name="l00837"></a><span class="lineno">  837</span>         output.writeData(outBuffer[iclass],GDT_Float64,y/down,iclass);</div>
 <div class="line"><a name="l00838"></a><span class="lineno">  838</span>       }</div>
-<div class="line"><a name="l00839"></a><span class="lineno">  839</span>     }</div>
-<div class="line"><a name="l00840"></a><span class="lineno">  840</span>   }</div>
-<div class="line"><a name="l00841"></a><span class="lineno">  841</span> }</div>
-<div class="line"><a name="l00842"></a><span class="lineno">  842</span> </div>
-<div class="line"><a name="l00843"></a><span class="lineno">  843</span> <span class="keywordtype">void</span> filter2d::Filter2d::shift(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keywordtype">double</span> offsetX, <span class="keywordtype">double</span> offsetY, <span class="keywordtype">double</span> randomSigma, RESAMPLE  [...]
-<div class="line"><a name="l00844"></a><span class="lineno">  844</span> {</div>
-<div class="line"><a name="l00845"></a><span class="lineno">  845</span>   assert(input.nrOfCol()==output.nrOfCol());</div>
-<div class="line"><a name="l00846"></a><span class="lineno">  846</span>   assert(input.nrOfRow()==output.nrOfRow());</div>
-<div class="line"><a name="l00847"></a><span class="lineno">  847</span>   assert(input.nrOfBand()==output.nrOfBand());</div>
-<div class="line"><a name="l00848"></a><span class="lineno">  848</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l00849"></a><span class="lineno">  849</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l00850"></a><span class="lineno">  850</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l00851"></a><span class="lineno">  851</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l00852"></a><span class="lineno">  852</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00853"></a><span class="lineno">  853</span>   <span class="comment">//process band per band in memory</span></div>
-<div class="line"><a name="l00854"></a><span class="lineno">  854</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> inBuffer(input.nrOfRow(),output.nrOfCol());</div>
-<div class="line"><a name="l00855"></a><span class="lineno">  855</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> outBuffer(input.nrOfRow(),output.nrOfCol());</div>
-<div class="line"><a name="l00856"></a><span class="lineno">  856</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
-<div class="line"><a name="l00857"></a><span class="lineno">  857</span>     input.readDataBlock(inBuffer,GDT_Float64,0,inBuffer.nCols()-1,0,inBuffer.nRows()-1,iband);</div>
-<div class="line"><a name="l00858"></a><span class="lineno">  858</span>     shift(inBuffer,outBuffer,offsetX,offsetY,randomSigma,resample,verbose);</div>
-<div class="line"><a name="l00859"></a><span class="lineno">  859</span>     output.writeDataBlock(outBuffer,GDT_Float64,0,outBuffer.nCols()-1,0,outBuffer.nRows()-1,iband);</div>
-<div class="line"><a name="l00860"></a><span class="lineno">  860</span>   }</div>
-<div class="line"><a name="l00861"></a><span class="lineno">  861</span> }</div>
-<div class="line"><a name="l00862"></a><span class="lineno">  862</span> </div>
-<div class="line"><a name="l00863"></a><span class="lineno">  863</span> <span class="comment">//todo: re-implement without dependency of CImg and reg libraries</span></div>
-<div class="line"><a name="l00864"></a><span class="lineno">  864</span> <span class="comment">// void filter2d::Filter2d::dwt_texture(const std::string& inputFilename, const std::string& outputFilename,int dim, int scale, int down, int iband, bool verbose)</span></div>
-<div class="line"><a name="l00865"></a><span class="lineno">  865</span> <span class="comment">// {</span></div>
-<div class="line"><a name="l00866"></a><span class="lineno">  866</span> <span class="comment">//   ImgReaderGdal input;</span></div>
-<div class="line"><a name="l00867"></a><span class="lineno">  867</span> <span class="comment">//   ImgWriterGdal output;</span></div>
-<div class="line"><a name="l00868"></a><span class="lineno">  868</span> <span class="comment">//   if(verbose)</span></div>
-<div class="line"><a name="l00869"></a><span class="lineno">  869</span> <span class="comment">//     std::cout << "opening file " << inputFilename << std::endl;</span></div>
-<div class="line"><a name="l00870"></a><span class="lineno">  870</span> <span class="comment">//   input.open(inputFilename);</span></div>
-<div class="line"><a name="l00871"></a><span class="lineno">  871</span> <span class="comment">//   double magicX=1,magicY=1;</span></div>
-<div class="line"><a name="l00872"></a><span class="lineno">  872</span> <span class="comment">//   output.open(outputFilename,(input.nrOfCol()+down-1)/down,(input.nrOfRow()+down-1)/down,scale*3,GDT_Float32,input.getImageType());</span></div>
-<div class="line"><a name="l00873"></a><span class="lineno">  873</span> <span class="comment">//   if(input.isGeoRef()){</span></div>
-<div class="line"><a name="l00874"></a><span class="lineno">  874</span> <span class="comment">//     output.setProjection(input.getProjection());</span></div>
-<div class="line"><a name="l00875"></a><span class="lineno">  875</span> <span class="comment">//     output.copyGeoTransform(input);</span></div>
-<div class="line"><a name="l00876"></a><span class="lineno">  876</span> <span class="comment">//   }</span></div>
-<div class="line"><a name="l00877"></a><span class="lineno">  877</span> <span class="comment">//   if(verbose)</span></div>
-<div class="line"><a name="l00878"></a><span class="lineno">  878</span> <span class="comment">//     std::cout << "Dimension texture (row x col x band) = " << (input.nrOfCol()+down-1)/down << " x " << (input.nrOfRow()+down-1)/down << " x " << scale*3 << std::endl;</span></div>
-<div class="line"><a name="l00879"></a><span class="lineno">  879</span> <span class="comment">//   assert(dim%2);</span></div>
-<div class="line"><a name="l00880"></a><span class="lineno">  880</span> <span class="comment">//   int dimX=dim;</span></div>
-<div class="line"><a name="l00881"></a><span class="lineno">  881</span> <span class="comment">//   int dimY=dim;</span></div>
-<div class="line"><a name="l00882"></a><span class="lineno">  882</span> <span class="comment">//   Vector2d<float> inBuffer(dimY,input.nrOfCol());</span></div>
-<div class="line"><a name="l00883"></a><span class="lineno">  883</span> <span class="comment">//   Vector2d<float> outBuffer(scale*3,(input.nrOfCol()+down-1)/down);</span></div>
-<div class="line"><a name="l00884"></a><span class="lineno">  884</span> <span class="comment">//   //initialize last half of inBuffer</span></div>
-<div class="line"><a name="l00885"></a><span class="lineno">  885</span> <span class="comment">//   int indexI=0;</span></div>
-<div class="line"><a name="l00886"></a><span class="lineno">  886</span> <span class="comment">//   int indexJ=0;</span></div>
-<div class="line"><a name="l00887"></a><span class="lineno">  887</span> <span class="comment">//   for(int j=-dimY/2;j<(dimY+1)/2;++j){</span></div>
-<div class="line"><a name="l00888"></a><span class="lineno">  888</span> <span class="comment">//     try{</span></div>
-<div class="line"><a name="l00889"></a><span class="lineno">  889</span> <span class="comment">//       if(verbose)</span></div>
-<div class="line"><a name="l00890"></a><span class="lineno">  890</span> <span class="comment">//  cout << "reading input line " << abs(j) << std::endl;</span></div>
-<div class="line"><a name="l00891"></a><span class="lineno">  891</span> <span class="comment">//       input.readData(inBuffer[indexJ],GDT_Float32,abs(j),iband);</span></div>
-<div class="line"><a name="l00892"></a><span class="lineno">  892</span> <span class="comment">//       ++indexJ;</span></div>
-<div class="line"><a name="l00893"></a><span class="lineno">  893</span> <span class="comment">//     }</span></div>
-<div class="line"><a name="l00894"></a><span class="lineno">  894</span> <span class="comment">//     catch(std::string errorstring){</span></div>
-<div class="line"><a name="l00895"></a><span class="lineno">  895</span> <span class="comment">//       std::cerr << errorstring << "in band " << iband << ", line " << indexJ << std::endl;</span></div>
+<div class="line"><a name="l00839"></a><span class="lineno">  839</span>       <span class="keywordflow">catch</span>(std::string errorstring){</div>
+<div class="line"><a name="l00840"></a><span class="lineno">  840</span>         std::cerr << errorstring << <span class="stringliteral">"in class "</span> << iclass << <span class="stringliteral">", line "</span> << y << std::endl;</div>
+<div class="line"><a name="l00841"></a><span class="lineno">  841</span>       }</div>
+<div class="line"><a name="l00842"></a><span class="lineno">  842</span>     }</div>
+<div class="line"><a name="l00843"></a><span class="lineno">  843</span>   }</div>
+<div class="line"><a name="l00844"></a><span class="lineno">  844</span> }</div>
+<div class="line"><a name="l00845"></a><span class="lineno">  845</span> </div>
+<div class="line"><a name="l00846"></a><span class="lineno">  846</span> <span class="keywordtype">void</span> filter2d::Filter2d::shift(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keywordtype">double</span> offsetX, <span class="keywordtype">double</span> offsetY, <span class="keywordtype">double</span> randomSigma, RESAMPLE  [...]
+<div class="line"><a name="l00847"></a><span class="lineno">  847</span> {</div>
+<div class="line"><a name="l00848"></a><span class="lineno">  848</span>   assert(input.nrOfCol()==output.nrOfCol());</div>
+<div class="line"><a name="l00849"></a><span class="lineno">  849</span>   assert(input.nrOfRow()==output.nrOfRow());</div>
+<div class="line"><a name="l00850"></a><span class="lineno">  850</span>   assert(input.nrOfBand()==output.nrOfBand());</div>
+<div class="line"><a name="l00851"></a><span class="lineno">  851</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l00852"></a><span class="lineno">  852</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l00853"></a><span class="lineno">  853</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l00854"></a><span class="lineno">  854</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l00855"></a><span class="lineno">  855</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00856"></a><span class="lineno">  856</span>   <span class="comment">//process band per band in memory</span></div>
+<div class="line"><a name="l00857"></a><span class="lineno">  857</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> inBuffer(input.nrOfRow(),output.nrOfCol());</div>
+<div class="line"><a name="l00858"></a><span class="lineno">  858</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> outBuffer(input.nrOfRow(),output.nrOfCol());</div>
+<div class="line"><a name="l00859"></a><span class="lineno">  859</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
+<div class="line"><a name="l00860"></a><span class="lineno">  860</span>     input.readDataBlock(inBuffer,GDT_Float64,0,inBuffer.nCols()-1,0,inBuffer.nRows()-1,iband);</div>
+<div class="line"><a name="l00861"></a><span class="lineno">  861</span>     shift(inBuffer,outBuffer,offsetX,offsetY,randomSigma,resample,verbose);</div>
+<div class="line"><a name="l00862"></a><span class="lineno">  862</span>     output.writeDataBlock(outBuffer,GDT_Float64,0,outBuffer.nCols()-1,0,outBuffer.nRows()-1,iband);</div>
+<div class="line"><a name="l00863"></a><span class="lineno">  863</span>   }</div>
+<div class="line"><a name="l00864"></a><span class="lineno">  864</span> }</div>
+<div class="line"><a name="l00865"></a><span class="lineno">  865</span> </div>
+<div class="line"><a name="l00866"></a><span class="lineno">  866</span> <span class="comment">//todo: re-implement without dependency of CImg and reg libraries</span></div>
+<div class="line"><a name="l00867"></a><span class="lineno">  867</span> <span class="comment">// void filter2d::Filter2d::dwt_texture(const std::string& inputFilename, const std::string& outputFilename,int dim, int scale, int down, int iband, bool verbose)</span></div>
+<div class="line"><a name="l00868"></a><span class="lineno">  868</span> <span class="comment">// {</span></div>
+<div class="line"><a name="l00869"></a><span class="lineno">  869</span> <span class="comment">//   ImgReaderGdal input;</span></div>
+<div class="line"><a name="l00870"></a><span class="lineno">  870</span> <span class="comment">//   ImgWriterGdal output;</span></div>
+<div class="line"><a name="l00871"></a><span class="lineno">  871</span> <span class="comment">//   if(verbose)</span></div>
+<div class="line"><a name="l00872"></a><span class="lineno">  872</span> <span class="comment">//     std::cout << "opening file " << inputFilename << std::endl;</span></div>
+<div class="line"><a name="l00873"></a><span class="lineno">  873</span> <span class="comment">//   input.open(inputFilename);</span></div>
+<div class="line"><a name="l00874"></a><span class="lineno">  874</span> <span class="comment">//   double magicX=1,magicY=1;</span></div>
+<div class="line"><a name="l00875"></a><span class="lineno">  875</span> <span class="comment">//   output.open(outputFilename,(input.nrOfCol()+down-1)/down,(input.nrOfRow()+down-1)/down,scale*3,GDT_Float32,input.getImageType());</span></div>
+<div class="line"><a name="l00876"></a><span class="lineno">  876</span> <span class="comment">//   if(input.isGeoRef()){</span></div>
+<div class="line"><a name="l00877"></a><span class="lineno">  877</span> <span class="comment">//     output.setProjection(input.getProjection());</span></div>
+<div class="line"><a name="l00878"></a><span class="lineno">  878</span> <span class="comment">//     output.copyGeoTransform(input);</span></div>
+<div class="line"><a name="l00879"></a><span class="lineno">  879</span> <span class="comment">//   }</span></div>
+<div class="line"><a name="l00880"></a><span class="lineno">  880</span> <span class="comment">//   if(verbose)</span></div>
+<div class="line"><a name="l00881"></a><span class="lineno">  881</span> <span class="comment">//     std::cout << "Dimension texture (row x col x band) = " << (input.nrOfCol()+down-1)/down << " x " << (input.nrOfRow()+down-1)/down << " x " << scale*3 << std::endl;</span></div>
+<div class="line"><a name="l00882"></a><span class="lineno">  882</span> <span class="comment">//   assert(dim%2);</span></div>
+<div class="line"><a name="l00883"></a><span class="lineno">  883</span> <span class="comment">//   int dimX=dim;</span></div>
+<div class="line"><a name="l00884"></a><span class="lineno">  884</span> <span class="comment">//   int dimY=dim;</span></div>
+<div class="line"><a name="l00885"></a><span class="lineno">  885</span> <span class="comment">//   Vector2d<float> inBuffer(dimY,input.nrOfCol());</span></div>
+<div class="line"><a name="l00886"></a><span class="lineno">  886</span> <span class="comment">//   Vector2d<float> outBuffer(scale*3,(input.nrOfCol()+down-1)/down);</span></div>
+<div class="line"><a name="l00887"></a><span class="lineno">  887</span> <span class="comment">//   //initialize last half of inBuffer</span></div>
+<div class="line"><a name="l00888"></a><span class="lineno">  888</span> <span class="comment">//   int indexI=0;</span></div>
+<div class="line"><a name="l00889"></a><span class="lineno">  889</span> <span class="comment">//   int indexJ=0;</span></div>
+<div class="line"><a name="l00890"></a><span class="lineno">  890</span> <span class="comment">//   for(int j=-dimY/2;j<(dimY+1)/2;++j){</span></div>
+<div class="line"><a name="l00891"></a><span class="lineno">  891</span> <span class="comment">//     try{</span></div>
+<div class="line"><a name="l00892"></a><span class="lineno">  892</span> <span class="comment">//       if(verbose)</span></div>
+<div class="line"><a name="l00893"></a><span class="lineno">  893</span> <span class="comment">//  cout << "reading input line " << abs(j) << std::endl;</span></div>
+<div class="line"><a name="l00894"></a><span class="lineno">  894</span> <span class="comment">//       input.readData(inBuffer[indexJ],GDT_Float32,abs(j),iband);</span></div>
+<div class="line"><a name="l00895"></a><span class="lineno">  895</span> <span class="comment">//       ++indexJ;</span></div>
 <div class="line"><a name="l00896"></a><span class="lineno">  896</span> <span class="comment">//     }</span></div>
-<div class="line"><a name="l00897"></a><span class="lineno">  897</span> <span class="comment">//   }</span></div>
-<div class="line"><a name="l00898"></a><span class="lineno">  898</span> <span class="comment">//   const char* pszMessage;</span></div>
-<div class="line"><a name="l00899"></a><span class="lineno">  899</span> <span class="comment">//   void* pProgressArg=NULL;</span></div>
-<div class="line"><a name="l00900"></a><span class="lineno">  900</span> <span class="comment">//   GDALProgressFunc pfnProgress=GDALTermProgress;</span></div>
-<div class="line"><a name="l00901"></a><span class="lineno">  901</span> <span class="comment">//   double progress=0;</span></div>
-<div class="line"><a name="l00902"></a><span class="lineno">  902</span> <span class="comment">//   pfnProgress(progress,pszMessage,pProgressArg);</span></div>
-<div class="line"><a name="l00903"></a><span class="lineno">  903</span> <span class="comment">//   for(int y=0;y<input.nrOfRow();y+=down){</span></div>
-<div class="line"><a name="l00904"></a><span class="lineno">  904</span> <span class="comment">//     if(verbose)</span></div>
-<div class="line"><a name="l00905"></a><span class="lineno">  905</span> <span class="comment">//       std::cout << "calculating line " << y/down << std::endl;</span></div>
-<div class="line"><a name="l00906"></a><span class="lineno">  906</span> <span class="comment">//     if(y){//inBuffer already initialized for y=0</span></div>
-<div class="line"><a name="l00907"></a><span class="lineno">  907</span> <span class="comment">//       //erase first line from inBuffer</span></div>
-<div class="line"><a name="l00908"></a><span class="lineno">  908</span> <span class="comment">//       inBuffer.erase(inBuffer.begin());</span></div>
-<div class="line"><a name="l00909"></a><span class="lineno">  909</span> <span class="comment">//       //read extra line and push back to inBuffer if not out of bounds</span></div>
-<div class="line"><a name="l00910"></a><span class="lineno">  910</span> <span class="comment">//       if(y+dimY/2<input.nrOfRow()){</span></div>
-<div class="line"><a name="l00911"></a><span class="lineno">  911</span> <span class="comment">//  //allocate buffer</span></div>
-<div class="line"><a name="l00912"></a><span class="lineno">  912</span> <span class="comment">//  inBuffer.push_back(inBuffer.back());</span></div>
-<div class="line"><a name="l00913"></a><span class="lineno">  913</span> <span class="comment">//  try{</span></div>
-<div class="line"><a name="l00914"></a><span class="lineno">  914</span> <span class="comment">//    if(verbose)</span></div>
-<div class="line"><a name="l00915"></a><span class="lineno">  915</span> <span class="comment">//      std::cout << "reading input line " << y+dimY/2 << std::endl;</span></div>
-<div class="line"><a name="l00916"></a><span class="lineno">  916</span> <span class="comment">//           input.readData(inBuffer[inBuffer.size()-1],GDT_Float32,y+dimY/2,iband);</span></div>
-<div class="line"><a name="l00917"></a><span class="lineno">  917</span> <span class="comment">//  }</span></div>
-<div class="line"><a name="l00918"></a><span class="lineno">  918</span> <span class="comment">//  catch(std::string errorstring){</span></div>
-<div class="line"><a name="l00919"></a><span class="lineno">  919</span> <span class="comment">//    std::cerr << errorstring << "in band " << iband << ", line " << y << std::endl;</span></div>
+<div class="line"><a name="l00897"></a><span class="lineno">  897</span> <span class="comment">//     catch(std::string errorstring){</span></div>
+<div class="line"><a name="l00898"></a><span class="lineno">  898</span> <span class="comment">//       std::cerr << errorstring << "in band " << iband << ", line " << indexJ << std::endl;</span></div>
+<div class="line"><a name="l00899"></a><span class="lineno">  899</span> <span class="comment">//     }</span></div>
+<div class="line"><a name="l00900"></a><span class="lineno">  900</span> <span class="comment">//   }</span></div>
+<div class="line"><a name="l00901"></a><span class="lineno">  901</span> <span class="comment">//   const char* pszMessage;</span></div>
+<div class="line"><a name="l00902"></a><span class="lineno">  902</span> <span class="comment">//   void* pProgressArg=NULL;</span></div>
+<div class="line"><a name="l00903"></a><span class="lineno">  903</span> <span class="comment">//   GDALProgressFunc pfnProgress=GDALTermProgress;</span></div>
+<div class="line"><a name="l00904"></a><span class="lineno">  904</span> <span class="comment">//   double progress=0;</span></div>
+<div class="line"><a name="l00905"></a><span class="lineno">  905</span> <span class="comment">//   pfnProgress(progress,pszMessage,pProgressArg);</span></div>
+<div class="line"><a name="l00906"></a><span class="lineno">  906</span> <span class="comment">//   for(int y=0;y<input.nrOfRow();y+=down){</span></div>
+<div class="line"><a name="l00907"></a><span class="lineno">  907</span> <span class="comment">//     if(verbose)</span></div>
+<div class="line"><a name="l00908"></a><span class="lineno">  908</span> <span class="comment">//       std::cout << "calculating line " << y/down << std::endl;</span></div>
+<div class="line"><a name="l00909"></a><span class="lineno">  909</span> <span class="comment">//     if(y){//inBuffer already initialized for y=0</span></div>
+<div class="line"><a name="l00910"></a><span class="lineno">  910</span> <span class="comment">//       //erase first line from inBuffer</span></div>
+<div class="line"><a name="l00911"></a><span class="lineno">  911</span> <span class="comment">//       inBuffer.erase(inBuffer.begin());</span></div>
+<div class="line"><a name="l00912"></a><span class="lineno">  912</span> <span class="comment">//       //read extra line and push back to inBuffer if not out of bounds</span></div>
+<div class="line"><a name="l00913"></a><span class="lineno">  913</span> <span class="comment">//       if(y+dimY/2<input.nrOfRow()){</span></div>
+<div class="line"><a name="l00914"></a><span class="lineno">  914</span> <span class="comment">//  //allocate buffer</span></div>
+<div class="line"><a name="l00915"></a><span class="lineno">  915</span> <span class="comment">//  inBuffer.push_back(inBuffer.back());</span></div>
+<div class="line"><a name="l00916"></a><span class="lineno">  916</span> <span class="comment">//  try{</span></div>
+<div class="line"><a name="l00917"></a><span class="lineno">  917</span> <span class="comment">//    if(verbose)</span></div>
+<div class="line"><a name="l00918"></a><span class="lineno">  918</span> <span class="comment">//      std::cout << "reading input line " << y+dimY/2 << std::endl;</span></div>
+<div class="line"><a name="l00919"></a><span class="lineno">  919</span> <span class="comment">//           input.readData(inBuffer[inBuffer.size()-1],GDT_Float32,y+dimY/2,iband);</span></div>
 <div class="line"><a name="l00920"></a><span class="lineno">  920</span> <span class="comment">//  }</span></div>
-<div class="line"><a name="l00921"></a><span class="lineno">  921</span> <span class="comment">//       }</span></div>
-<div class="line"><a name="l00922"></a><span class="lineno">  922</span> <span class="comment">//     }</span></div>
-<div class="line"><a name="l00923"></a><span class="lineno">  923</span> <span class="comment">//     for(int x=0;x<input.nrOfCol();x+=down){</span></div>
-<div class="line"><a name="l00924"></a><span class="lineno">  924</span> <span class="comment">//       Vector2d<double> texture_feature(scale,3);</span></div>
-<div class="line"><a name="l00925"></a><span class="lineno">  925</span> <span class="comment">//       CImg<> texture_in(dimX,dimY);</span></div>
-<div class="line"><a name="l00926"></a><span class="lineno">  926</span> <span class="comment">//       int r=0;//index for row of texture_in</span></div>
-<div class="line"><a name="l00927"></a><span class="lineno">  927</span> <span class="comment">//       for(int j=-dimY/2;j<(dimY+1)/2;++j){</span></div>
-<div class="line"><a name="l00928"></a><span class="lineno">  928</span> <span class="comment">//  int c=0;</span></div>
-<div class="line"><a name="l00929"></a><span class="lineno">  929</span> <span class="comment">//  for(int i=-dimX/2;i<(dimX+1)/2;++i){</span></div>
-<div class="line"><a name="l00930"></a><span class="lineno">  930</span> <span class="comment">//    indexI=x+i;</span></div>
-<div class="line"><a name="l00931"></a><span class="lineno">  931</span> <span class="comment">//    //check if out of bounds</span></div>
-<div class="line"><a name="l00932"></a><span class="lineno">  932</span> <span class="comment">//    if(indexI<0)</span></div>
-<div class="line"><a name="l00933"></a><span class="lineno">  933</span> <span class="comment">//      indexI=-indexI;</span></div>
-<div class="line"><a name="l00934"></a><span class="lineno">  934</span> <span class="comment">//    else if(indexI>=input.nrOfCol())</span></div>
-<div class="line"><a name="l00935"></a><span class="lineno">  935</span> <span class="comment">//      indexI=input.nrOfCol()-i;</span></div>
-<div class="line"><a name="l00936"></a><span class="lineno">  936</span> <span class="comment">//    if(y+j<0)</span></div>
-<div class="line"><a name="l00937"></a><span class="lineno">  937</span> <span class="comment">//      indexJ=-j;</span></div>
-<div class="line"><a name="l00938"></a><span class="lineno">  938</span> <span class="comment">//    else if(y+j>=input.nrOfRow())</span></div>
-<div class="line"><a name="l00939"></a><span class="lineno">  939</span> <span class="comment">//      indexJ=dimY/2-j;//indexJ=inBuffer.size()-1-j;</span></div>
-<div class="line"><a name="l00940"></a><span class="lineno">  940</span> <span class="comment">//    else</span></div>
-<div class="line"><a name="l00941"></a><span class="lineno">  941</span> <span class="comment">//      indexJ=dimY/2+j;</span></div>
-<div class="line"><a name="l00942"></a><span class="lineno">  942</span> <span class="comment">//    assert(indexJ<inBuffer.size());</span></div>
-<div class="line"><a name="l00943"></a><span class="lineno">  943</span> <span class="comment">//    assert(indexI<inBuffer[indexJ].size());</span></div>
-<div class="line"><a name="l00944"></a><span class="lineno">  944</span> <span class="comment">//    texture_in(r,c)=inBuffer[indexJ][indexI];</span></div>
-<div class="line"><a name="l00945"></a><span class="lineno">  945</span> <span class="comment">//    c++;</span></div>
-<div class="line"><a name="l00946"></a><span class="lineno">  946</span> <span class="comment">//  }</span></div>
-<div class="line"><a name="l00947"></a><span class="lineno">  947</span> <span class="comment">//  ++r;</span></div>
-<div class="line"><a name="l00948"></a><span class="lineno">  948</span> <span class="comment">//       }</span></div>
-<div class="line"><a name="l00949"></a><span class="lineno">  949</span> <span class="comment">//       texture_in.dwt_texture(texture_feature,scale);</span></div>
-<div class="line"><a name="l00950"></a><span class="lineno">  950</span> <span class="comment">//       for(int v=0;v<scale*3;++v)</span></div>
-<div class="line"><a name="l00951"></a><span class="lineno">  951</span> <span class="comment">//  outBuffer[v][x/down]=texture_feature[v/3][v%3];</span></div>
-<div class="line"><a name="l00952"></a><span class="lineno">  952</span> <span class="comment">//     }</span></div>
-<div class="line"><a name="l00953"></a><span class="lineno">  953</span> <span class="comment">//     //write outBuffer to file</span></div>
-<div class="line"><a name="l00954"></a><span class="lineno">  954</span> <span class="comment">//     try{</span></div>
-<div class="line"><a name="l00955"></a><span class="lineno">  955</span> <span class="comment">//       if(verbose)</span></div>
-<div class="line"><a name="l00956"></a><span class="lineno">  956</span> <span class="comment">//         std::cout << "writing line " << y/down << std::endl;</span></div>
-<div class="line"><a name="l00957"></a><span class="lineno">  957</span> <span class="comment">//       for(int v=0;v<scale*3;++v)</span></div>
-<div class="line"><a name="l00958"></a><span class="lineno">  958</span> <span class="comment">//         output.writeData(outBuffer[v],GDT_Float32,y/down,v);</span></div>
-<div class="line"><a name="l00959"></a><span class="lineno">  959</span> <span class="comment">//     }</span></div>
-<div class="line"><a name="l00960"></a><span class="lineno">  960</span> <span class="comment">//     catch(std::string errorstring){</span></div>
-<div class="line"><a name="l00961"></a><span class="lineno">  961</span> <span class="comment">//       std::cerr << errorstring << "in band " << iband << ", line " << y << std::endl;</span></div>
+<div class="line"><a name="l00921"></a><span class="lineno">  921</span> <span class="comment">//  catch(std::string errorstring){</span></div>
+<div class="line"><a name="l00922"></a><span class="lineno">  922</span> <span class="comment">//    std::cerr << errorstring << "in band " << iband << ", line " << y << std::endl;</span></div>
+<div class="line"><a name="l00923"></a><span class="lineno">  923</span> <span class="comment">//  }</span></div>
+<div class="line"><a name="l00924"></a><span class="lineno">  924</span> <span class="comment">//       }</span></div>
+<div class="line"><a name="l00925"></a><span class="lineno">  925</span> <span class="comment">//     }</span></div>
+<div class="line"><a name="l00926"></a><span class="lineno">  926</span> <span class="comment">//     for(int x=0;x<input.nrOfCol();x+=down){</span></div>
+<div class="line"><a name="l00927"></a><span class="lineno">  927</span> <span class="comment">//       Vector2d<double> texture_feature(scale,3);</span></div>
+<div class="line"><a name="l00928"></a><span class="lineno">  928</span> <span class="comment">//       CImg<> texture_in(dimX,dimY);</span></div>
+<div class="line"><a name="l00929"></a><span class="lineno">  929</span> <span class="comment">//       int r=0;//index for row of texture_in</span></div>
+<div class="line"><a name="l00930"></a><span class="lineno">  930</span> <span class="comment">//       for(int j=-dimY/2;j<(dimY+1)/2;++j){</span></div>
+<div class="line"><a name="l00931"></a><span class="lineno">  931</span> <span class="comment">//  int c=0;</span></div>
+<div class="line"><a name="l00932"></a><span class="lineno">  932</span> <span class="comment">//  for(int i=-dimX/2;i<(dimX+1)/2;++i){</span></div>
+<div class="line"><a name="l00933"></a><span class="lineno">  933</span> <span class="comment">//    indexI=x+i;</span></div>
+<div class="line"><a name="l00934"></a><span class="lineno">  934</span> <span class="comment">//    //check if out of bounds</span></div>
+<div class="line"><a name="l00935"></a><span class="lineno">  935</span> <span class="comment">//    if(indexI<0)</span></div>
+<div class="line"><a name="l00936"></a><span class="lineno">  936</span> <span class="comment">//      indexI=-indexI;</span></div>
+<div class="line"><a name="l00937"></a><span class="lineno">  937</span> <span class="comment">//    else if(indexI>=input.nrOfCol())</span></div>
+<div class="line"><a name="l00938"></a><span class="lineno">  938</span> <span class="comment">//      indexI=input.nrOfCol()-i;</span></div>
+<div class="line"><a name="l00939"></a><span class="lineno">  939</span> <span class="comment">//    if(y+j<0)</span></div>
+<div class="line"><a name="l00940"></a><span class="lineno">  940</span> <span class="comment">//      indexJ=-j;</span></div>
+<div class="line"><a name="l00941"></a><span class="lineno">  941</span> <span class="comment">//    else if(y+j>=input.nrOfRow())</span></div>
+<div class="line"><a name="l00942"></a><span class="lineno">  942</span> <span class="comment">//      indexJ=dimY/2-j;//indexJ=inBuffer.size()-1-j;</span></div>
+<div class="line"><a name="l00943"></a><span class="lineno">  943</span> <span class="comment">//    else</span></div>
+<div class="line"><a name="l00944"></a><span class="lineno">  944</span> <span class="comment">//      indexJ=dimY/2+j;</span></div>
+<div class="line"><a name="l00945"></a><span class="lineno">  945</span> <span class="comment">//    assert(indexJ<inBuffer.size());</span></div>
+<div class="line"><a name="l00946"></a><span class="lineno">  946</span> <span class="comment">//    assert(indexI<inBuffer[indexJ].size());</span></div>
+<div class="line"><a name="l00947"></a><span class="lineno">  947</span> <span class="comment">//    texture_in(r,c)=inBuffer[indexJ][indexI];</span></div>
+<div class="line"><a name="l00948"></a><span class="lineno">  948</span> <span class="comment">//    c++;</span></div>
+<div class="line"><a name="l00949"></a><span class="lineno">  949</span> <span class="comment">//  }</span></div>
+<div class="line"><a name="l00950"></a><span class="lineno">  950</span> <span class="comment">//  ++r;</span></div>
+<div class="line"><a name="l00951"></a><span class="lineno">  951</span> <span class="comment">//       }</span></div>
+<div class="line"><a name="l00952"></a><span class="lineno">  952</span> <span class="comment">//       texture_in.dwt_texture(texture_feature,scale);</span></div>
+<div class="line"><a name="l00953"></a><span class="lineno">  953</span> <span class="comment">//       for(int v=0;v<scale*3;++v)</span></div>
+<div class="line"><a name="l00954"></a><span class="lineno">  954</span> <span class="comment">//  outBuffer[v][x/down]=texture_feature[v/3][v%3];</span></div>
+<div class="line"><a name="l00955"></a><span class="lineno">  955</span> <span class="comment">//     }</span></div>
+<div class="line"><a name="l00956"></a><span class="lineno">  956</span> <span class="comment">//     //write outBuffer to file</span></div>
+<div class="line"><a name="l00957"></a><span class="lineno">  957</span> <span class="comment">//     try{</span></div>
+<div class="line"><a name="l00958"></a><span class="lineno">  958</span> <span class="comment">//       if(verbose)</span></div>
+<div class="line"><a name="l00959"></a><span class="lineno">  959</span> <span class="comment">//         std::cout << "writing line " << y/down << std::endl;</span></div>
+<div class="line"><a name="l00960"></a><span class="lineno">  960</span> <span class="comment">//       for(int v=0;v<scale*3;++v)</span></div>
+<div class="line"><a name="l00961"></a><span class="lineno">  961</span> <span class="comment">//         output.writeData(outBuffer[v],GDT_Float32,y/down,v);</span></div>
 <div class="line"><a name="l00962"></a><span class="lineno">  962</span> <span class="comment">//     }</span></div>
-<div class="line"><a name="l00963"></a><span class="lineno">  963</span> <span class="comment">//     progress=(1.0+y)/output.nrOfRow();</span></div>
-<div class="line"><a name="l00964"></a><span class="lineno">  964</span> <span class="comment">//     pfnProgress(progress,pszMessage,pProgressArg);</span></div>
-<div class="line"><a name="l00965"></a><span class="lineno">  965</span> <span class="comment">//   }</span></div>
-<div class="line"><a name="l00966"></a><span class="lineno">  966</span> <span class="comment">//   input.close();</span></div>
-<div class="line"><a name="l00967"></a><span class="lineno">  967</span> <span class="comment">//   output.close();</span></div>
-<div class="line"><a name="l00968"></a><span class="lineno">  968</span> <span class="comment">// }</span></div>
-<div class="line"><a name="l00969"></a><span class="lineno">  969</span> </div>
-<div class="line"><a name="l00970"></a><span class="lineno">  970</span> <span class="keywordtype">void</span> filter2d::Filter2d::morphology(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keyword">const</span> std::string& method, <span class="keywordtype">int</span> dimX, <span class="keywordtype">int</span> dimY, <span cla [...]
-<div class="line"><a name="l00971"></a><span class="lineno">  971</span> {</div>
-<div class="line"><a name="l00972"></a><span class="lineno">  972</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l00973"></a><span class="lineno">  973</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l00974"></a><span class="lineno">  974</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l00975"></a><span class="lineno">  975</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l00976"></a><span class="lineno">  976</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00977"></a><span class="lineno">  977</span> </div>
-<div class="line"><a name="l00978"></a><span class="lineno">  978</span>   assert(dimX);</div>
-<div class="line"><a name="l00979"></a><span class="lineno">  979</span>   assert(dimY);</div>
+<div class="line"><a name="l00963"></a><span class="lineno">  963</span> <span class="comment">//     catch(std::string errorstring){</span></div>
+<div class="line"><a name="l00964"></a><span class="lineno">  964</span> <span class="comment">//       std::cerr << errorstring << "in band " << iband << ", line " << y << std::endl;</span></div>
+<div class="line"><a name="l00965"></a><span class="lineno">  965</span> <span class="comment">//     }</span></div>
+<div class="line"><a name="l00966"></a><span class="lineno">  966</span> <span class="comment">//     progress=(1.0+y)/output.nrOfRow();</span></div>
+<div class="line"><a name="l00967"></a><span class="lineno">  967</span> <span class="comment">//     pfnProgress(progress,pszMessage,pProgressArg);</span></div>
+<div class="line"><a name="l00968"></a><span class="lineno">  968</span> <span class="comment">//   }</span></div>
+<div class="line"><a name="l00969"></a><span class="lineno">  969</span> <span class="comment">//   input.close();</span></div>
+<div class="line"><a name="l00970"></a><span class="lineno">  970</span> <span class="comment">//   output.close();</span></div>
+<div class="line"><a name="l00971"></a><span class="lineno">  971</span> <span class="comment">// }</span></div>
+<div class="line"><a name="l00972"></a><span class="lineno">  972</span> </div>
+<div class="line"><a name="l00973"></a><span class="lineno">  973</span> <span class="keywordtype">void</span> filter2d::Filter2d::morphology(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keyword">const</span> std::string& method, <span class="keywordtype">int</span> dimX, <span class="keywordtype">int</span> dimY, <span cla [...]
+<div class="line"><a name="l00974"></a><span class="lineno">  974</span> {</div>
+<div class="line"><a name="l00975"></a><span class="lineno">  975</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l00976"></a><span class="lineno">  976</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l00977"></a><span class="lineno">  977</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l00978"></a><span class="lineno">  978</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l00979"></a><span class="lineno">  979</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
 <div class="line"><a name="l00980"></a><span class="lineno">  980</span> </div>
-<div class="line"><a name="l00981"></a><span class="lineno">  981</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
-<div class="line"><a name="l00982"></a><span class="lineno">  982</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
-<div class="line"><a name="l00983"></a><span class="lineno">  983</span>     <a class="code" href="classVector2d.html">Vector2d<double></a> inBuffer(dimY,input.nrOfCol());</div>
-<div class="line"><a name="l00984"></a><span class="lineno">  984</span>     std::vector<double> outBuffer(input.nrOfCol());</div>
-<div class="line"><a name="l00985"></a><span class="lineno">  985</span>     <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l00986"></a><span class="lineno">  986</span>     <span class="keywordtype">int</span> indexJ=0;</div>
-<div class="line"><a name="l00987"></a><span class="lineno">  987</span>     <span class="comment">//initialize last half of inBuffer</span></div>
-<div class="line"><a name="l00988"></a><span class="lineno">  988</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00989"></a><span class="lineno">  989</span>       <span class="keywordflow">try</span>{</div>
-<div class="line"><a name="l00990"></a><span class="lineno">  990</span>     input.readData(inBuffer[indexJ],GDT_Float64,abs(j),iband);</div>
-<div class="line"><a name="l00991"></a><span class="lineno">  991</span>     ++indexJ;</div>
-<div class="line"><a name="l00992"></a><span class="lineno">  992</span>       }</div>
-<div class="line"><a name="l00993"></a><span class="lineno">  993</span>       <span class="keywordflow">catch</span>(std::string errorstring){</div>
-<div class="line"><a name="l00994"></a><span class="lineno">  994</span>     std::cerr << errorstring << <span class="stringliteral">"in line "</span> << indexJ << std::endl;</div>
+<div class="line"><a name="l00981"></a><span class="lineno">  981</span>   assert(dimX);</div>
+<div class="line"><a name="l00982"></a><span class="lineno">  982</span>   assert(dimY);</div>
+<div class="line"><a name="l00983"></a><span class="lineno">  983</span> </div>
+<div class="line"><a name="l00984"></a><span class="lineno">  984</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
+<div class="line"><a name="l00985"></a><span class="lineno">  985</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
+<div class="line"><a name="l00986"></a><span class="lineno">  986</span>     <a class="code" href="classVector2d.html">Vector2d<double></a> inBuffer(dimY,input.nrOfCol());</div>
+<div class="line"><a name="l00987"></a><span class="lineno">  987</span>     std::vector<double> outBuffer(input.nrOfCol());</div>
+<div class="line"><a name="l00988"></a><span class="lineno">  988</span>     <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l00989"></a><span class="lineno">  989</span>     <span class="keywordtype">int</span> indexJ=0;</div>
+<div class="line"><a name="l00990"></a><span class="lineno">  990</span>     <span class="comment">//initialize last half of inBuffer</span></div>
+<div class="line"><a name="l00991"></a><span class="lineno">  991</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00992"></a><span class="lineno">  992</span>       <span class="keywordflow">try</span>{</div>
+<div class="line"><a name="l00993"></a><span class="lineno">  993</span>     input.readData(inBuffer[indexJ],GDT_Float64,abs(j),iband);</div>
+<div class="line"><a name="l00994"></a><span class="lineno">  994</span>     ++indexJ;</div>
 <div class="line"><a name="l00995"></a><span class="lineno">  995</span>       }</div>
-<div class="line"><a name="l00996"></a><span class="lineno">  996</span>     }</div>
-<div class="line"><a name="l00997"></a><span class="lineno">  997</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nrOfRow();++y){</div>
-<div class="line"><a name="l00998"></a><span class="lineno">  998</span>       <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
-<div class="line"><a name="l00999"></a><span class="lineno">  999</span>     <span class="comment">//erase first line from inBuffer</span></div>
-<div class="line"><a name="l01000"></a><span class="lineno"> 1000</span>     <span class="keywordflow">if</span>(dimY>1)</div>
-<div class="line"><a name="l01001"></a><span class="lineno"> 1001</span>       inBuffer.erase(inBuffer.begin());</div>
-<div class="line"><a name="l01002"></a><span class="lineno"> 1002</span>     <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
-<div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>     <span class="keywordflow">if</span>(y+dimY/2<input.nrOfRow()){</div>
-<div class="line"><a name="l01004"></a><span class="lineno"> 1004</span>       <span class="comment">//allocate buffer</span></div>
-<div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>       <span class="keywordflow">if</span>(dimY>1)</div>
-<div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>         inBuffer.push_back(inBuffer.back());</div>
-<div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>       <span class="keywordflow">try</span>{</div>
-<div class="line"><a name="l01008"></a><span class="lineno"> 1008</span>             input.readData(inBuffer[inBuffer.size()-1],GDT_Float64,y+dimY/2,iband);</div>
-<div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>       }</div>
-<div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>       <span class="keywordflow">catch</span>(std::string errorstring){</div>
-<div class="line"><a name="l01011"></a><span class="lineno"> 1011</span>         std::cerr << errorstring << <span class="stringliteral">"in band "</span> << iband << <span class="stringliteral">", line "</span> << y << std::endl;</div>
+<div class="line"><a name="l00996"></a><span class="lineno">  996</span>       <span class="keywordflow">catch</span>(std::string errorstring){</div>
+<div class="line"><a name="l00997"></a><span class="lineno">  997</span>     std::cerr << errorstring << <span class="stringliteral">"in line "</span> << indexJ << std::endl;</div>
+<div class="line"><a name="l00998"></a><span class="lineno">  998</span>       }</div>
+<div class="line"><a name="l00999"></a><span class="lineno">  999</span>     }</div>
+<div class="line"><a name="l01000"></a><span class="lineno"> 1000</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nrOfRow();++y){</div>
+<div class="line"><a name="l01001"></a><span class="lineno"> 1001</span>       <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
+<div class="line"><a name="l01002"></a><span class="lineno"> 1002</span>     <span class="comment">//erase first line from inBuffer</span></div>
+<div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>     <span class="keywordflow">if</span>(dimY>1)</div>
+<div class="line"><a name="l01004"></a><span class="lineno"> 1004</span>       inBuffer.erase(inBuffer.begin());</div>
+<div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>     <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
+<div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>     <span class="keywordflow">if</span>(y+dimY/2<input.nrOfRow()){</div>
+<div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>       <span class="comment">//allocate buffer</span></div>
+<div class="line"><a name="l01008"></a><span class="lineno"> 1008</span>       <span class="keywordflow">if</span>(dimY>1)</div>
+<div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>         inBuffer.push_back(inBuffer.back());</div>
+<div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>       <span class="keywordflow">try</span>{</div>
+<div class="line"><a name="l01011"></a><span class="lineno"> 1011</span>             input.readData(inBuffer[inBuffer.size()-1],GDT_Float64,y+dimY/2,iband);</div>
 <div class="line"><a name="l01012"></a><span class="lineno"> 1012</span>       }</div>
-<div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>     }</div>
-<div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>         <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>           <span class="keywordtype">int</span> over=y+dimY/2-input.nrOfRow();</div>
-<div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>           <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
-<div class="line"><a name="l01017"></a><span class="lineno"> 1017</span>           assert(index>=0);</div>
-<div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>           assert(index<inBuffer.size());</div>
-<div class="line"><a name="l01019"></a><span class="lineno"> 1019</span>           inBuffer.push_back(inBuffer[index]);</div>
-<div class="line"><a name="l01020"></a><span class="lineno"> 1020</span>         }</div>
-<div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>       }</div>
-<div class="line"><a name="l01022"></a><span class="lineno"> 1022</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nrOfCol();++x){</div>
-<div class="line"><a name="l01023"></a><span class="lineno"> 1023</span>         <span class="keywordtype">double</span> currentValue=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l01024"></a><span class="lineno"> 1024</span>     outBuffer[x]=currentValue;</div>
-<div class="line"><a name="l01025"></a><span class="lineno"> 1025</span>     std::vector<double> statBuffer;</div>
-<div class="line"><a name="l01026"></a><span class="lineno"> 1026</span>     <span class="keywordtype">bool</span> currentMasked=<span class="keyword">false</span>;</div>
-<div class="line"><a name="l01027"></a><span class="lineno"> 1027</span>         <span class="keywordtype">int</span> centre=dimX*(dimY-1)/2+(dimX-1)/2;</div>
-<div class="line"><a name="l01028"></a><span class="lineno"> 1028</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
-<div class="line"><a name="l01029"></a><span class="lineno"> 1029</span>       <span class="keywordflow">if</span>(currentValue==m_noDataValues[imask]){</div>
-<div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>         currentMasked=<span class="keyword">true</span>;</div>
-<div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l01032"></a><span class="lineno"> 1032</span>       }</div>
-<div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>     }</div>
-<div class="line"><a name="l01034"></a><span class="lineno"> 1034</span>     <span class="keywordflow">if</span>(currentMasked){</div>
-<div class="line"><a name="l01035"></a><span class="lineno"> 1035</span>       outBuffer[x]=currentValue;</div>
+<div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>       <span class="keywordflow">catch</span>(std::string errorstring){</div>
+<div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>         std::cerr << errorstring << <span class="stringliteral">"in band "</span> << iband << <span class="stringliteral">", line "</span> << y << std::endl;</div>
+<div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>       }</div>
+<div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>     }</div>
+<div class="line"><a name="l01017"></a><span class="lineno"> 1017</span>         <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>           <span class="keywordtype">int</span> over=y+dimY/2-input.nrOfRow();</div>
+<div class="line"><a name="l01019"></a><span class="lineno"> 1019</span>           <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
+<div class="line"><a name="l01020"></a><span class="lineno"> 1020</span>           assert(index>=0);</div>
+<div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>           assert(index<inBuffer.size());</div>
+<div class="line"><a name="l01022"></a><span class="lineno"> 1022</span>           inBuffer.push_back(inBuffer[index]);</div>
+<div class="line"><a name="l01023"></a><span class="lineno"> 1023</span>         }</div>
+<div class="line"><a name="l01024"></a><span class="lineno"> 1024</span>       }</div>
+<div class="line"><a name="l01025"></a><span class="lineno"> 1025</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nrOfCol();++x){</div>
+<div class="line"><a name="l01026"></a><span class="lineno"> 1026</span>         <span class="keywordtype">double</span> currentValue=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l01027"></a><span class="lineno"> 1027</span>     outBuffer[x]=currentValue;</div>
+<div class="line"><a name="l01028"></a><span class="lineno"> 1028</span>     std::vector<double> statBuffer;</div>
+<div class="line"><a name="l01029"></a><span class="lineno"> 1029</span>     <span class="keywordtype">bool</span> currentMasked=<span class="keyword">false</span>;</div>
+<div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>         <span class="keywordtype">int</span> centre=dimX*(dimY-1)/2+(dimX-1)/2;</div>
+<div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
+<div class="line"><a name="l01032"></a><span class="lineno"> 1032</span>       <span class="keywordflow">if</span>(currentValue==m_noDataValues[imask]){</div>
+<div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>         currentMasked=<span class="keyword">true</span>;</div>
+<div class="line"><a name="l01034"></a><span class="lineno"> 1034</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l01035"></a><span class="lineno"> 1035</span>       }</div>
 <div class="line"><a name="l01036"></a><span class="lineno"> 1036</span>     }</div>
-<div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>     <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>             <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
-<div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>               <span class="keywordtype">double</span> d2=i*i+j*j;<span class="comment">//square distance</span></div>
-<div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>               <span class="keywordflow">if</span>(disc&&(d2>(dimX/2)*(dimY/2)))</div>
-<div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>                 <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>           <span class="keywordflow">if</span>(angle.size()){</div>
-<div class="line"><a name="l01044"></a><span class="lineno"> 1044</span>             <span class="keywordtype">double</span> theta;</div>
-<div class="line"><a name="l01045"></a><span class="lineno"> 1045</span>         <span class="comment">//use polar coordinates in radians</span></div>
-<div class="line"><a name="l01046"></a><span class="lineno"> 1046</span>             <span class="keywordflow">if</span>(i>0){</div>
-<div class="line"><a name="l01047"></a><span class="lineno"> 1047</span>           <span class="keywordflow">if</span>(j<0)</div>
-<div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>             theta=atan(static_cast<double>(-j)/(static_cast<double>(i)));</div>
-<div class="line"><a name="l01049"></a><span class="lineno"> 1049</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>             theta=-atan(static_cast<double>(j)/(static_cast<double>(i)));</div>
-<div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>         }</div>
-<div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(i<0){</div>
-<div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>           <span class="keywordflow">if</span>(j<0)</div>
-<div class="line"><a name="l01054"></a><span class="lineno"> 1054</span>             theta=PI-atan(static_cast<double>(-j)/(static_cast<double>(-i)));</div>
-<div class="line"><a name="l01055"></a><span class="lineno"> 1055</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>             theta=PI+atan(static_cast<double>(j)/(static_cast<double>(-i)));</div>
-<div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>         }</div>
-<div class="line"><a name="l01058"></a><span class="lineno"> 1058</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(j<0)</div>
-<div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>               theta=PI/2.0;</div>
-<div class="line"><a name="l01060"></a><span class="lineno"> 1060</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(j>0)</div>
-<div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>               theta=3.0*PI/2.0;</div>
-<div class="line"><a name="l01062"></a><span class="lineno"> 1062</span>         <span class="comment">//convert to North (0), East (90), South (180), West (270) in degrees</span></div>
-<div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>         theta=360-(theta/PI*180)+90;</div>
-<div class="line"><a name="l01064"></a><span class="lineno"> 1064</span>         <span class="keywordflow">if</span>(theta<0)</div>
-<div class="line"><a name="l01065"></a><span class="lineno"> 1065</span>           theta+=360;</div>
-<div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>         <span class="keywordflow">while</span>(theta>360)</div>
-<div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>           theta-=360;</div>
-<div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>         <span class="keywordtype">bool</span> alligned=<span class="keyword">false</span>;</div>
-<div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iangle=0;iangle<angle.size();++iangle){</div>
-<div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>           <span class="keywordflow">if</span>(sqrt((theta-angle[iangle])*(theta-angle[iangle]))<10){</div>
-<div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>             alligned=<span class="keyword">true</span>;</div>
-<div class="line"><a name="l01072"></a><span class="lineno"> 1072</span>             <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>           }</div>
-<div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>         }</div>
-<div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>         <span class="keywordflow">if</span>(!alligned)</div>
-<div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>           <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>           }</div>
-<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>           indexI=x+i;</div>
-<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>           <span class="comment">//check if out of bounds</span></div>
-<div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>           <span class="keywordflow">if</span>(indexI<0)</div>
-<div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>         indexI=-indexI;</div>
-<div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=input.nrOfCol())</div>
-<div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>         indexI=input.nrOfCol()-i;</div>
-<div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>           <span class="keywordflow">if</span>(y+j<0)</div>
-<div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>         indexJ=-j;</div>
-<div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>               <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=input.nrOfRow())</div>
-<div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>                 indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
-<div class="line"><a name="l01088"></a><span class="lineno"> 1088</span>               <span class="keywordflow">else</span></div>
-<div class="line"><a name="l01089"></a><span class="lineno"> 1089</span>                 indexJ=(dimY-1)/2+j;</div>
-<div class="line"><a name="l01090"></a><span class="lineno"> 1090</span>               <span class="comment">//todo: introduce novalue as this: ?</span></div>
-<div class="line"><a name="l01091"></a><span class="lineno"> 1091</span>               <span class="comment">// if(inBuffer[indexJ][indexI]==(m_noDataValues.size())? m_noDataValues[0] : 0)</span></div>
-<div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>               <span class="comment">//   continue;</span></div>
-<div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>               <span class="keywordtype">bool</span> masked=<span class="keyword">false</span>;</div>
-<div class="line"><a name="l01094"></a><span class="lineno"> 1094</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
-<div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>         <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_noDataValues[imask]){</div>
-<div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>           masked=<span class="keyword">true</span>;</div>
-<div class="line"><a name="l01097"></a><span class="lineno"> 1097</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l01098"></a><span class="lineno"> 1098</span>         }</div>
-<div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>           }</div>
-<div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>           <span class="keywordflow">if</span>(!masked){</div>
-<div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>         <span class="keywordtype">short</span> binValue=0;</div>
-<div class="line"><a name="l01102"></a><span class="lineno"> 1102</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
-<div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>           <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_class[iclass]){</div>
-<div class="line"><a name="l01104"></a><span class="lineno"> 1104</span>             binValue=1;</div>
-<div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>             <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>           }</div>
-<div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>         }</div>
-<div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>         <span class="keywordflow">if</span>(m_class.size())</div>
-<div class="line"><a name="l01109"></a><span class="lineno"> 1109</span>           statBuffer.push_back(binValue);</div>
-<div class="line"><a name="l01110"></a><span class="lineno"> 1110</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l01111"></a><span class="lineno"> 1111</span>           statBuffer.push_back(inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l01112"></a><span class="lineno"> 1112</span>           }</div>
-<div class="line"><a name="l01113"></a><span class="lineno"> 1113</span>         }</div>
-<div class="line"><a name="l01114"></a><span class="lineno"> 1114</span>           }</div>
-<div class="line"><a name="l01115"></a><span class="lineno"> 1115</span>       <span class="keywordflow">if</span>(statBuffer.size()){</div>
-<div class="line"><a name="l01116"></a><span class="lineno"> 1116</span>             <span class="keywordflow">switch</span>(getFilterType(method)){</div>
-<div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>             <span class="keywordflow">case</span>(filter2d::dilate):</div>
-<div class="line"><a name="l01118"></a><span class="lineno"> 1118</span>               outBuffer[x]=stat.mymax(statBuffer);</div>
-<div class="line"><a name="l01119"></a><span class="lineno"> 1119</span>               <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>             <span class="keywordflow">case</span>(filter2d::erode):</div>
-<div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>               outBuffer[x]=stat.mymin(statBuffer);</div>
+<div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>     <span class="keywordflow">if</span>(currentMasked){</div>
+<div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>       outBuffer[x]=currentValue;</div>
+<div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>     }</div>
+<div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>     <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>             <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
+<div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>               <span class="keywordtype">double</span> d2=i*i+j*j;<span class="comment">//square distance</span></div>
+<div class="line"><a name="l01044"></a><span class="lineno"> 1044</span>               <span class="keywordflow">if</span>(disc&&(d2>(dimX/2)*(dimY/2)))</div>
+<div class="line"><a name="l01045"></a><span class="lineno"> 1045</span>                 <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l01046"></a><span class="lineno"> 1046</span>           <span class="keywordflow">if</span>(angle.size()){</div>
+<div class="line"><a name="l01047"></a><span class="lineno"> 1047</span>             <span class="keywordtype">double</span> theta;</div>
+<div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>         <span class="comment">//use polar coordinates in radians</span></div>
+<div class="line"><a name="l01049"></a><span class="lineno"> 1049</span>             <span class="keywordflow">if</span>(i>0){</div>
+<div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>           <span class="keywordflow">if</span>(j<0)</div>
+<div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>             theta=atan(static_cast<double>(-j)/(static_cast<double>(i)));</div>
+<div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>             theta=-atan(static_cast<double>(j)/(static_cast<double>(i)));</div>
+<div class="line"><a name="l01054"></a><span class="lineno"> 1054</span>         }</div>
+<div class="line"><a name="l01055"></a><span class="lineno"> 1055</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(i<0){</div>
+<div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>           <span class="keywordflow">if</span>(j<0)</div>
+<div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>             theta=PI-atan(static_cast<double>(-j)/(static_cast<double>(-i)));</div>
+<div class="line"><a name="l01058"></a><span class="lineno"> 1058</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>             theta=PI+atan(static_cast<double>(j)/(static_cast<double>(-i)));</div>
+<div class="line"><a name="l01060"></a><span class="lineno"> 1060</span>         }</div>
+<div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(j<0)</div>
+<div class="line"><a name="l01062"></a><span class="lineno"> 1062</span>               theta=PI/2.0;</div>
+<div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(j>0)</div>
+<div class="line"><a name="l01064"></a><span class="lineno"> 1064</span>               theta=3.0*PI/2.0;</div>
+<div class="line"><a name="l01065"></a><span class="lineno"> 1065</span>         <span class="comment">//convert to North (0), East (90), South (180), West (270) in degrees</span></div>
+<div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>         theta=360-(theta/PI*180)+90;</div>
+<div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>         <span class="keywordflow">if</span>(theta<0)</div>
+<div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>           theta+=360;</div>
+<div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>         <span class="keywordflow">while</span>(theta>360)</div>
+<div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>           theta-=360;</div>
+<div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>         <span class="keywordtype">bool</span> alligned=<span class="keyword">false</span>;</div>
+<div class="line"><a name="l01072"></a><span class="lineno"> 1072</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iangle=0;iangle<angle.size();++iangle){</div>
+<div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>           <span class="keywordflow">if</span>(sqrt((theta-angle[iangle])*(theta-angle[iangle]))<10){</div>
+<div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>             alligned=<span class="keyword">true</span>;</div>
+<div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>             <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>           }</div>
+<div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>         }</div>
+<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>         <span class="keywordflow">if</span>(!alligned)</div>
+<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>           <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>           }</div>
+<div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>           indexI=x+i;</div>
+<div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>           <span class="comment">//check if out of bounds</span></div>
+<div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>           <span class="keywordflow">if</span>(indexI<0)</div>
+<div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>         indexI=-indexI;</div>
+<div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=input.nrOfCol())</div>
+<div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>         indexI=input.nrOfCol()-i;</div>
+<div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>           <span class="keywordflow">if</span>(y+j<0)</div>
+<div class="line"><a name="l01088"></a><span class="lineno"> 1088</span>         indexJ=-j;</div>
+<div class="line"><a name="l01089"></a><span class="lineno"> 1089</span>               <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=input.nrOfRow())</div>
+<div class="line"><a name="l01090"></a><span class="lineno"> 1090</span>                 indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
+<div class="line"><a name="l01091"></a><span class="lineno"> 1091</span>               <span class="keywordflow">else</span></div>
+<div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>                 indexJ=(dimY-1)/2+j;</div>
+<div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>               <span class="comment">//todo: introduce novalue as this: ?</span></div>
+<div class="line"><a name="l01094"></a><span class="lineno"> 1094</span>               <span class="comment">// if(inBuffer[indexJ][indexI]==(m_noDataValues.size())? m_noDataValues[0] : 0)</span></div>
+<div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>               <span class="comment">//   continue;</span></div>
+<div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>               <span class="keywordtype">bool</span> masked=<span class="keyword">false</span>;</div>
+<div class="line"><a name="l01097"></a><span class="lineno"> 1097</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
+<div class="line"><a name="l01098"></a><span class="lineno"> 1098</span>         <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_noDataValues[imask]){</div>
+<div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>           masked=<span class="keyword">true</span>;</div>
+<div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>         }</div>
+<div class="line"><a name="l01102"></a><span class="lineno"> 1102</span>           }</div>
+<div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>           <span class="keywordflow">if</span>(!masked){</div>
+<div class="line"><a name="l01104"></a><span class="lineno"> 1104</span>         <span class="keywordtype">short</span> binValue=0;</div>
+<div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
+<div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>           <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_class[iclass]){</div>
+<div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>             binValue=1;</div>
+<div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>             <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l01109"></a><span class="lineno"> 1109</span>           }</div>
+<div class="line"><a name="l01110"></a><span class="lineno"> 1110</span>         }</div>
+<div class="line"><a name="l01111"></a><span class="lineno"> 1111</span>         <span class="keywordflow">if</span>(m_class.size())</div>
+<div class="line"><a name="l01112"></a><span class="lineno"> 1112</span>           statBuffer.push_back(binValue);</div>
+<div class="line"><a name="l01113"></a><span class="lineno"> 1113</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l01114"></a><span class="lineno"> 1114</span>           statBuffer.push_back(inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l01115"></a><span class="lineno"> 1115</span>           }</div>
+<div class="line"><a name="l01116"></a><span class="lineno"> 1116</span>         }</div>
+<div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>           }</div>
+<div class="line"><a name="l01118"></a><span class="lineno"> 1118</span>       <span class="keywordflow">if</span>(statBuffer.size()){</div>
+<div class="line"><a name="l01119"></a><span class="lineno"> 1119</span>             <span class="keywordflow">switch</span>(getFilterType(method)){</div>
+<div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>             <span class="keywordflow">case</span>(filter2d::dilate):</div>
+<div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>               outBuffer[x]=stat.mymax(statBuffer);</div>
 <div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>               <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>             <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l01124"></a><span class="lineno"> 1124</span>               std::ostringstream ess;</div>
-<div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>               ess << <span class="stringliteral">"Error:  morphology method "</span> << method << <span class="stringliteral">" not supported, choose "</span> << filter2d::dilate << <span class="stringliteral">" (dilate) or "</span> << filter2d::erode << <span class="stringliteral">" (erode)"</span> << std::endl;</div>
-<div class="line"><a name="l01126"></a><span class="lineno"> 1126</span>               <span class="keywordflow">throw</span>(ess.str());</div>
-<div class="line"><a name="l01127"></a><span class="lineno"> 1127</span>               <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>             }</div>
-<div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>           }</div>
-<div class="line"><a name="l01130"></a><span class="lineno"> 1130</span>       <span class="keywordflow">if</span>(outBuffer[x]&&m_class.size())</div>
-<div class="line"><a name="l01131"></a><span class="lineno"> 1131</span>         outBuffer[x]=m_class[0];</div>
-<div class="line"><a name="l01132"></a><span class="lineno"> 1132</span>     }</div>
-<div class="line"><a name="l01133"></a><span class="lineno"> 1133</span>       }</div>
-<div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>       <span class="comment">//write outBuffer to file</span></div>
-<div class="line"><a name="l01135"></a><span class="lineno"> 1135</span>       <span class="keywordflow">try</span>{</div>
-<div class="line"><a name="l01136"></a><span class="lineno"> 1136</span>         output.writeData(outBuffer,GDT_Float64,y,iband);</div>
-<div class="line"><a name="l01137"></a><span class="lineno"> 1137</span>       }</div>
-<div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>       <span class="keywordflow">catch</span>(std::string errorstring){</div>
-<div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>     std::cerr << errorstring << <span class="stringliteral">"in band "</span> << iband << <span class="stringliteral">", line "</span> << y << std::endl;</div>
+<div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>             <span class="keywordflow">case</span>(filter2d::erode):</div>
+<div class="line"><a name="l01124"></a><span class="lineno"> 1124</span>               outBuffer[x]=stat.mymin(statBuffer);</div>
+<div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>               <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l01126"></a><span class="lineno"> 1126</span>             <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l01127"></a><span class="lineno"> 1127</span>               std::ostringstream ess;</div>
+<div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>               ess << <span class="stringliteral">"Error:  morphology method "</span> << method << <span class="stringliteral">" not supported, choose "</span> << filter2d::dilate << <span class="stringliteral">" (dilate) or "</span> << filter2d::erode << <span class="stringliteral">" (erode)"</span> << std::endl;</div>
+<div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>               <span class="keywordflow">throw</span>(ess.str());</div>
+<div class="line"><a name="l01130"></a><span class="lineno"> 1130</span>               <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l01131"></a><span class="lineno"> 1131</span>             }</div>
+<div class="line"><a name="l01132"></a><span class="lineno"> 1132</span>           }</div>
+<div class="line"><a name="l01133"></a><span class="lineno"> 1133</span>       <span class="keywordflow">if</span>(outBuffer[x]&&m_class.size())</div>
+<div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>         outBuffer[x]=m_class[0];</div>
+<div class="line"><a name="l01135"></a><span class="lineno"> 1135</span>     }</div>
+<div class="line"><a name="l01136"></a><span class="lineno"> 1136</span>       }</div>
+<div class="line"><a name="l01137"></a><span class="lineno"> 1137</span>       <span class="comment">//write outBuffer to file</span></div>
+<div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>       <span class="keywordflow">try</span>{</div>
+<div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>         output.writeData(outBuffer,GDT_Float64,y,iband);</div>
 <div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>       }</div>
-<div class="line"><a name="l01141"></a><span class="lineno"> 1141</span>       progress=(1.0+y);</div>
-<div class="line"><a name="l01142"></a><span class="lineno"> 1142</span>       progress+=(output.nrOfRow()*iband);</div>
-<div class="line"><a name="l01143"></a><span class="lineno"> 1143</span>       progress/=output.nrOfBand()*output.nrOfRow();</div>
-<div class="line"><a name="l01144"></a><span class="lineno"> 1144</span>       pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>     }</div>
-<div class="line"><a name="l01146"></a><span class="lineno"> 1146</span>   }</div>
-<div class="line"><a name="l01147"></a><span class="lineno"> 1147</span> }</div>
-<div class="line"><a name="l01148"></a><span class="lineno"> 1148</span> </div>
-<div class="line"><a name="l01149"></a><span class="lineno"> 1149</span> <span class="keywordtype">void</span> filter2d::Filter2d::shadowDsm(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keywordtype">double</span> sza, <span class="keywordtype">double</span> saa, <span class="keywordtype">double</span> pixelSize, <span class="ke [...]
-<div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> inputBuffer;</div>
-<div class="line"><a name="l01151"></a><span class="lineno"> 1151</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> outputBuffer;</div>
-<div class="line"><a name="l01152"></a><span class="lineno"> 1152</span>   input.readDataBlock(inputBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, 0);</div>
-<div class="line"><a name="l01153"></a><span class="lineno"> 1153</span>   shadowDsm(inputBuffer, outputBuffer, sza, saa, pixelSize, shadowFlag);</div>
-<div class="line"><a name="l01154"></a><span class="lineno"> 1154</span>   output.writeDataBlock(outputBuffer,GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,0);</div>
-<div class="line"><a name="l01155"></a><span class="lineno"> 1155</span> }</div>
-<div class="line"><a name="l01156"></a><span class="lineno"> 1156</span> </div>
-<div class="line"><a name="l01157"></a><span class="lineno"> 1157</span> <span class="keywordtype">void</span> filter2d::Filter2d::dwtForward(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family){</div>
-<div class="line"><a name="l01158"></a><span class="lineno"> 1158</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> theBuffer;</div>
-<div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
-<div class="line"><a name="l01160"></a><span class="lineno"> 1160</span>     input.readDataBlock(theBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, iband);</div>
-<div class="line"><a name="l01161"></a><span class="lineno"> 1161</span>     std::cout << <span class="stringliteral">"filtering band "</span> << iband << std::endl << std::flush;</div>
-<div class="line"><a name="l01162"></a><span class="lineno"> 1162</span>     dwtForward(theBuffer, wavelet_type, family);</div>
-<div class="line"><a name="l01163"></a><span class="lineno"> 1163</span>     output.writeDataBlock(theBuffer,GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,iband);</div>
-<div class="line"><a name="l01164"></a><span class="lineno"> 1164</span>   }</div>
-<div class="line"><a name="l01165"></a><span class="lineno"> 1165</span> }</div>
-<div class="line"><a name="l01166"></a><span class="lineno"> 1166</span> </div>
-<div class="line"><a name="l01167"></a><span class="lineno"> 1167</span> <span class="keywordtype">void</span> filter2d::Filter2d::dwtInverse(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family){</div>
-<div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> theBuffer;</div>
-<div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
-<div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>     input.readDataBlock(theBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, iband);</div>
-<div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>     std::cout << <span class="stringliteral">"filtering band "</span> << iband << std::endl << std::flush;</div>
-<div class="line"><a name="l01172"></a><span class="lineno"> 1172</span>     dwtInverse(theBuffer, wavelet_type, family);</div>
-<div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>     output.writeDataBlock(theBuffer,GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,iband);</div>
-<div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>   }</div>
-<div class="line"><a name="l01175"></a><span class="lineno"> 1175</span> }</div>
-<div class="line"><a name="l01176"></a><span class="lineno"> 1176</span> </div>
-<div class="line"><a name="l01177"></a><span class="lineno"> 1177</span> <span class="keywordtype">void</span> filter2d::Filter2d::dwtCut(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family, <span class="keywordtype">double</span> cut, <sp [...]
-<div class="line"><a name="l01178"></a><span class="lineno"> 1178</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> theBuffer;</div>
-<div class="line"><a name="l01179"></a><span class="lineno"> 1179</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
-<div class="line"><a name="l01180"></a><span class="lineno"> 1180</span>     input.readDataBlock(theBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, iband);</div>
-<div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>     std::cout << <span class="stringliteral">"filtering band "</span> << iband << std::endl << std::flush;</div>
-<div class="line"><a name="l01182"></a><span class="lineno"> 1182</span>     dwtCut(theBuffer, wavelet_type, family, cut);</div>
-<div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>     output.writeDataBlock(theBuffer,GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,iband);</div>
-<div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>   }</div>
-<div class="line"><a name="l01185"></a><span class="lineno"> 1185</span> }</div>
-<div class="line"><a name="l01186"></a><span class="lineno"> 1186</span> </div>
-<div class="line"><a name="l01187"></a><span class="lineno"> 1187</span> <span class="keywordtype">void</span> filter2d::Filter2d::linearFeature(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keywordtype">float</span> angle, <span class="keywordtype">float</span> angleStep, <span class="keywordtype">float</span> maxDistance, <spa [...]
-<div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> inputBuffer;</div>
-<div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>   std::vector< Vector2d<float> > outputBuffer;</div>
-<div class="line"><a name="l01190"></a><span class="lineno"> 1190</span>   input.readDataBlock(inputBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, band);</div>
-<div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>   <span class="keywordflow">if</span>(maxDistance<=0)</div>
-<div class="line"><a name="l01192"></a><span class="lineno"> 1192</span>     maxDistance=sqrt(static_cast<float>(input.nrOfCol()*input.nrOfRow()));</div>
-<div class="line"><a name="l01193"></a><span class="lineno"> 1193</span>   linearFeature(inputBuffer,outputBuffer,angle,angleStep,maxDistance,eps, l1, a1, l2, a2,verbose);</div>
-<div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<outputBuffer.size();++iband)</div>
-<div class="line"><a name="l01195"></a><span class="lineno"> 1195</span>     output.writeDataBlock(outputBuffer[iband],GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,iband);</div>
-<div class="line"><a name="l01196"></a><span class="lineno"> 1196</span> }</div>
-<div class="line"><a name="l01197"></a><span class="lineno"> 1197</span> </div>
-<div class="line"><a name="l01198"></a><span class="lineno"> 1198</span> <span class="keywordtype">void</span> filter2d::Filter2d::linearFeature(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<float></a>& input, std::vector< <a class="code" href="classVector2d.html">Vector2d<float></a> >& output, <span class="keywordtype">float</span> angle, <span class="keywordtype">float</span> angleStep, <span class="keywordtype">flo [...]
-<div class="line"><a name="l01199"></a><span class="lineno"> 1199</span> {</div>
-<div class="line"><a name="l01200"></a><span class="lineno"> 1200</span>   output.clear();</div>
-<div class="line"><a name="l01201"></a><span class="lineno"> 1201</span>   <span class="keywordtype">int</span> nband=0;<span class="comment">//linear feature</span></div>
-<div class="line"><a name="l01202"></a><span class="lineno"> 1202</span>   <span class="keywordflow">if</span>(l1)</div>
-<div class="line"><a name="l01203"></a><span class="lineno"> 1203</span>     ++nband;</div>
-<div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>   <span class="keywordflow">if</span>(a1)</div>
-<div class="line"><a name="l01205"></a><span class="lineno"> 1205</span>     ++nband;</div>
-<div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>   <span class="keywordflow">if</span>(l2)</div>
-<div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>     ++nband;</div>
-<div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>   <span class="keywordflow">if</span>(a2)</div>
-<div class="line"><a name="l01209"></a><span class="lineno"> 1209</span>     ++nband;</div>
-<div class="line"><a name="l01210"></a><span class="lineno"> 1210</span>   output.resize(nband);</div>
-<div class="line"><a name="l01211"></a><span class="lineno"> 1211</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<output.size();++iband)</div>
-<div class="line"><a name="l01212"></a><span class="lineno"> 1212</span>     output[iband].resize(input.nRows(),input.nCols());</div>
-<div class="line"><a name="l01213"></a><span class="lineno"> 1213</span>   <span class="keywordflow">if</span>(maxDistance<=0)</div>
-<div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>     maxDistance=sqrt(static_cast<float>(input.nRows()*input.nCols()));</div>
-<div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>   <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l01216"></a><span class="lineno"> 1216</span>   <span class="keywordtype">int</span> indexJ=0;</div>
-<div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l01221"></a><span class="lineno"> 1221</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01222"></a><span class="lineno"> 1222</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nRows();++y){</div>
-<div class="line"><a name="l01223"></a><span class="lineno"> 1223</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nCols();++x){</div>
-<div class="line"><a name="l01224"></a><span class="lineno"> 1224</span>       <span class="keywordtype">float</span> currentValue=input[y][x];</div>
-<div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>       <span class="comment">//find values equal to current value with some error margin</span></div>
-<div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>       <span class="comment">//todo: add distance for two opposite directions</span></div>
-<div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>       <span class="keywordtype">float</span> lineDistance1=0;<span class="comment">//longest line of object</span></div>
-<div class="line"><a name="l01228"></a><span class="lineno"> 1228</span>       <span class="keywordtype">float</span> lineDistance2=maxDistance;<span class="comment">//shortest line of object</span></div>
-<div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>       <span class="keywordtype">float</span> lineAngle1=0;<span class="comment">//angle to longest line (North=0)</span></div>
-<div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>       <span class="keywordtype">float</span> lineAngle2=0;<span class="comment">//angle to shortest line (North=0)</span></div>
-<div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>       <span class="keywordtype">float</span> northAngle=0;<span class="comment">//rotating angle</span></div>
-<div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>       <span class="keywordflow">for</span>(northAngle=0;northAngle<180;northAngle+=angleStep){</div>
-<div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>     <span class="keywordflow">if</span>(angle<=360&&angle>=0&&angle!=northAngle)</div>
-<div class="line"><a name="l01234"></a><span class="lineno"> 1234</span>       <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l01235"></a><span class="lineno"> 1235</span>     <span class="comment">//test</span></div>
-<div class="line"><a name="l01236"></a><span class="lineno"> 1236</span>     <span class="keywordflow">if</span>(verbose)</div>
-<div class="line"><a name="l01237"></a><span class="lineno"> 1237</span>       std::cout << <span class="stringliteral">"northAngle: "</span> << northAngle << std::endl;</div>
-<div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>     <span class="keywordtype">float</span> currentDistance=0;</div>
-<div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>     <span class="keywordtype">float</span> theDir=0;</div>
-<div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>     <span class="keywordflow">for</span>(<span class="keywordtype">short</span> side=0;side<=1;side+=1){</div>
-<div class="line"><a name="l01241"></a><span class="lineno"> 1241</span>       theDir=PI/2.0-DEG2RAD(northAngle)+side*PI;<span class="comment">//in radians</span></div>
-<div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>       <span class="comment">//test</span></div>
-<div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>       <span class="keywordflow">if</span>(verbose)</div>
-<div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>         std::cout << <span class="stringliteral">"theDir in deg: "</span> << RAD2DEG(theDir) << std::endl;</div>
-<div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>       <span class="keywordflow">if</span>(theDir<0)</div>
-<div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>         theDir+=2*PI;</div>
-<div class="line"><a name="l01247"></a><span class="lineno"> 1247</span>       <span class="comment">//test</span></div>
-<div class="line"><a name="l01248"></a><span class="lineno"> 1248</span>       <span class="keywordflow">if</span>(verbose)</div>
-<div class="line"><a name="l01249"></a><span class="lineno"> 1249</span>         std::cout << <span class="stringliteral">"theDir in deg: "</span> << RAD2DEG(theDir) << std::endl;</div>
-<div class="line"><a name="l01250"></a><span class="lineno"> 1250</span>       <span class="keywordtype">float</span> nextValue=currentValue;</div>
-<div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>       <span class="keywordflow">for</span>(<span class="keywordtype">float</span> currentRay=1;currentRay<maxDistance;++currentRay){</div>
-<div class="line"><a name="l01252"></a><span class="lineno"> 1252</span>         indexI=x+currentRay*cos(theDir);</div>
-<div class="line"><a name="l01253"></a><span class="lineno"> 1253</span>         indexJ=y-currentRay*sin(theDir);</div>
-<div class="line"><a name="l01254"></a><span class="lineno"> 1254</span>         <span class="keywordflow">if</span>(indexJ<0||indexJ>=input.size())</div>
-<div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>         <span class="keywordflow">if</span>(indexI<0||indexI>=input[indexJ].size())</div>
-<div class="line"><a name="l01257"></a><span class="lineno"> 1257</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l01258"></a><span class="lineno"> 1258</span>         nextValue=input[indexJ][indexI];</div>
-<div class="line"><a name="l01259"></a><span class="lineno"> 1259</span>         <span class="keywordflow">if</span>(verbose){</div>
-<div class="line"><a name="l01260"></a><span class="lineno"> 1260</span>           std::cout << <span class="stringliteral">"x: "</span> << x << std::endl;</div>
-<div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>           std::cout << <span class="stringliteral">"y: "</span> << y << std::endl;</div>
-<div class="line"><a name="l01262"></a><span class="lineno"> 1262</span>           std::cout << <span class="stringliteral">"currentValue: "</span> << currentValue << std::endl;</div>
-<div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>           std::cout << <span class="stringliteral">"theDir in degrees: "</span> << RAD2DEG(theDir) << std::endl;</div>
-<div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>           std::cout << <span class="stringliteral">"cos(theDir): "</span> << cos(theDir) << std::endl;</div>
-<div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>           std::cout << <span class="stringliteral">"sin(theDir): "</span> << sin(theDir) << std::endl;</div>
-<div class="line"><a name="l01266"></a><span class="lineno"> 1266</span>           std::cout << <span class="stringliteral">"currentRay: "</span> << currentRay << std::endl;</div>
-<div class="line"><a name="l01267"></a><span class="lineno"> 1267</span>           std::cout << <span class="stringliteral">"currentDistance: "</span> << currentDistance << std::endl;</div>
-<div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>           std::cout << <span class="stringliteral">"indexI: "</span> << indexI << std::endl;</div>
-<div class="line"><a name="l01269"></a><span class="lineno"> 1269</span>           std::cout << <span class="stringliteral">"indexJ: "</span> << indexJ << std::endl;</div>
-<div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>           std::cout << <span class="stringliteral">"nextValue: "</span> << nextValue << std::endl;</div>
-<div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>         }</div>
-<div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>         <span class="keywordflow">if</span>(fabs(currentValue-nextValue)<=eps){</div>
-<div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>           ++currentDistance;</div>
-<div class="line"><a name="l01274"></a><span class="lineno"> 1274</span>           <span class="comment">//test</span></div>
-<div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>           <span class="keywordflow">if</span>(verbose)</div>
-<div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>         std::cout << <span class="stringliteral">"currentDistance: "</span> << currentDistance << <span class="stringliteral">", continue"</span> << std::endl;</div>
-<div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>         }</div>
-<div class="line"><a name="l01278"></a><span class="lineno"> 1278</span>         <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l01279"></a><span class="lineno"> 1279</span>           <span class="keywordflow">if</span>(verbose)</div>
-<div class="line"><a name="l01280"></a><span class="lineno"> 1280</span>         std::cout << <span class="stringliteral">"currentDistance: "</span> << currentDistance << <span class="stringliteral">", break"</span> << std::endl;</div>
-<div class="line"><a name="l01281"></a><span class="lineno"> 1281</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>         }</div>
-<div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>       }</div>
-<div class="line"><a name="l01284"></a><span class="lineno"> 1284</span>     }</div>
-<div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>     <span class="keywordflow">if</span>(lineDistance1<currentDistance){</div>
-<div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>       lineDistance1=currentDistance;</div>
-<div class="line"><a name="l01287"></a><span class="lineno"> 1287</span>       lineAngle1=northAngle;</div>
-<div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>     }</div>
-<div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>     <span class="keywordflow">if</span>(lineDistance2>currentDistance){</div>
-<div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>       lineDistance2=currentDistance;</div>
-<div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>       lineAngle2=northAngle;</div>
-<div class="line"><a name="l01292"></a><span class="lineno"> 1292</span>     }</div>
-<div class="line"><a name="l01293"></a><span class="lineno"> 1293</span>     <span class="keywordflow">if</span>(verbose){</div>
-<div class="line"><a name="l01294"></a><span class="lineno"> 1294</span>       std::cout << <span class="stringliteral">"lineDistance1: "</span> << lineDistance1 << std::endl;</div>
-<div class="line"><a name="l01295"></a><span class="lineno"> 1295</span>       std::cout << <span class="stringliteral">"lineAngle1: "</span> << lineAngle1 << std::endl;</div>
-<div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>       std::cout << <span class="stringliteral">"lineDistance2: "</span> << lineDistance2 << std::endl;</div>
-<div class="line"><a name="l01297"></a><span class="lineno"> 1297</span>       std::cout << <span class="stringliteral">"lineAngle2: "</span> << lineAngle2 << std::endl;</div>
-<div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>     }</div>
-<div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>       }</div>
-<div class="line"><a name="l01300"></a><span class="lineno"> 1300</span>       <span class="keywordtype">int</span> iband=0;</div>
-<div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>       <span class="keywordflow">if</span>(l1)</div>
-<div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>     output[iband++][y][x]=lineDistance1;</div>
-<div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>       <span class="keywordflow">if</span>(a1)</div>
-<div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>     output[iband++][y][x]=lineAngle1;</div>
-<div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>       <span class="keywordflow">if</span>(l2)</div>
-<div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>     output[iband++][y][x]=lineDistance2;</div>
-<div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>       <span class="keywordflow">if</span>(a2)</div>
-<div class="line"><a name="l01308"></a><span class="lineno"> 1308</span>     output[iband++][y][x]=lineAngle2;</div>
-<div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>       assert(iband==nband);</div>
-<div class="line"><a name="l01310"></a><span class="lineno"> 1310</span>     }</div>
-<div class="line"><a name="l01311"></a><span class="lineno"> 1311</span>     progress=(1.0+y);</div>
-<div class="line"><a name="l01312"></a><span class="lineno"> 1312</span>     progress/=input.nRows();</div>
-<div class="line"><a name="l01313"></a><span class="lineno"> 1313</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>   }</div>
-<div class="line"><a name="l01315"></a><span class="lineno"> 1315</span> }</div>
-<div class="ttc" id="classImgReaderGdal_html"><div class="ttname"><a href="classImgReaderGdal.html">ImgReaderGdal</a></div><div class="ttdef"><b>Definition:</b> <a href="ImgReaderGdal_8h_source.html#l00033">ImgReaderGdal.h:33</a></div></div>
-<div class="ttc" id="classImgWriterGdal_html"><div class="ttname"><a href="classImgWriterGdal.html">ImgWriterGdal</a></div><div class="ttdef"><b>Definition:</b> <a href="ImgWriterGdal_8h_source.html#l00032">ImgWriterGdal.h:32</a></div></div>
+<div class="line"><a name="l01141"></a><span class="lineno"> 1141</span>       <span class="keywordflow">catch</span>(std::string errorstring){</div>
+<div class="line"><a name="l01142"></a><span class="lineno"> 1142</span>     std::cerr << errorstring << <span class="stringliteral">"in band "</span> << iband << <span class="stringliteral">", line "</span> << y << std::endl;</div>
+<div class="line"><a name="l01143"></a><span class="lineno"> 1143</span>       }</div>
+<div class="line"><a name="l01144"></a><span class="lineno"> 1144</span>       progress=(1.0+y);</div>
+<div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>       progress+=(output.nrOfRow()*iband);</div>
+<div class="line"><a name="l01146"></a><span class="lineno"> 1146</span>       progress/=output.nrOfBand()*output.nrOfRow();</div>
+<div class="line"><a name="l01147"></a><span class="lineno"> 1147</span>       pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>     }</div>
+<div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>   }</div>
+<div class="line"><a name="l01150"></a><span class="lineno"> 1150</span> }</div>
+<div class="line"><a name="l01151"></a><span class="lineno"> 1151</span> </div>
+<div class="line"><a name="l01152"></a><span class="lineno"> 1152</span> <span class="keywordtype">void</span> filter2d::Filter2d::shadowDsm(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keywordtype">double</span> sza, <span class="keywordtype">double</span> saa, <span class="keywordtype">double</span> pixelSize, <span class="ke [...]
+<div class="line"><a name="l01153"></a><span class="lineno"> 1153</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> inputBuffer;</div>
+<div class="line"><a name="l01154"></a><span class="lineno"> 1154</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> outputBuffer;</div>
+<div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>   input.readDataBlock(inputBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, 0);</div>
+<div class="line"><a name="l01156"></a><span class="lineno"> 1156</span>   shadowDsm(inputBuffer, outputBuffer, sza, saa, pixelSize, shadowFlag);</div>
+<div class="line"><a name="l01157"></a><span class="lineno"> 1157</span>   output.writeDataBlock(outputBuffer,GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,0);</div>
+<div class="line"><a name="l01158"></a><span class="lineno"> 1158</span> }</div>
+<div class="line"><a name="l01159"></a><span class="lineno"> 1159</span> </div>
+<div class="line"><a name="l01160"></a><span class="lineno"> 1160</span> <span class="keywordtype">void</span> filter2d::Filter2d::dwtForward(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family){</div>
+<div class="line"><a name="l01161"></a><span class="lineno"> 1161</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> theBuffer;</div>
+<div class="line"><a name="l01162"></a><span class="lineno"> 1162</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
+<div class="line"><a name="l01163"></a><span class="lineno"> 1163</span>     input.readDataBlock(theBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, iband);</div>
+<div class="line"><a name="l01164"></a><span class="lineno"> 1164</span>     std::cout << <span class="stringliteral">"filtering band "</span> << iband << std::endl << std::flush;</div>
+<div class="line"><a name="l01165"></a><span class="lineno"> 1165</span>     dwtForward(theBuffer, wavelet_type, family);</div>
+<div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>     output.writeDataBlock(theBuffer,GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,iband);</div>
+<div class="line"><a name="l01167"></a><span class="lineno"> 1167</span>   }</div>
+<div class="line"><a name="l01168"></a><span class="lineno"> 1168</span> }</div>
+<div class="line"><a name="l01169"></a><span class="lineno"> 1169</span> </div>
+<div class="line"><a name="l01170"></a><span class="lineno"> 1170</span> <span class="keywordtype">void</span> filter2d::Filter2d::dwtInverse(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family){</div>
+<div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> theBuffer;</div>
+<div class="line"><a name="l01172"></a><span class="lineno"> 1172</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
+<div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>     input.readDataBlock(theBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, iband);</div>
+<div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>     std::cout << <span class="stringliteral">"filtering band "</span> << iband << std::endl << std::flush;</div>
+<div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>     dwtInverse(theBuffer, wavelet_type, family);</div>
+<div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>     output.writeDataBlock(theBuffer,GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,iband);</div>
+<div class="line"><a name="l01177"></a><span class="lineno"> 1177</span>   }</div>
+<div class="line"><a name="l01178"></a><span class="lineno"> 1178</span> }</div>
+<div class="line"><a name="l01179"></a><span class="lineno"> 1179</span> </div>
+<div class="line"><a name="l01180"></a><span class="lineno"> 1180</span> <span class="keywordtype">void</span> filter2d::Filter2d::dwtCut(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family, <span class="keywordtype">double</span> cut, <sp [...]
+<div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> theBuffer;</div>
+<div class="line"><a name="l01182"></a><span class="lineno"> 1182</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
+<div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>     input.readDataBlock(theBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, iband);</div>
+<div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>     std::cout << <span class="stringliteral">"filtering band "</span> << iband << std::endl << std::flush;</div>
+<div class="line"><a name="l01185"></a><span class="lineno"> 1185</span>     dwtCut(theBuffer, wavelet_type, family, cut);</div>
+<div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>     output.writeDataBlock(theBuffer,GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,iband);</div>
+<div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>   }</div>
+<div class="line"><a name="l01188"></a><span class="lineno"> 1188</span> }</div>
+<div class="line"><a name="l01189"></a><span class="lineno"> 1189</span> </div>
+<div class="line"><a name="l01190"></a><span class="lineno"> 1190</span> <span class="keywordtype">void</span> filter2d::Filter2d::linearFeature(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keywordtype">float</span> angle, <span class="keywordtype">float</span> angleStep, <span class="keywordtype">float</span> maxDistance, <spa [...]
+<div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>   <a class="code" href="classVector2d.html">Vector2d<float></a> inputBuffer;</div>
+<div class="line"><a name="l01192"></a><span class="lineno"> 1192</span>   std::vector< Vector2d<float> > outputBuffer;</div>
+<div class="line"><a name="l01193"></a><span class="lineno"> 1193</span>   input.readDataBlock(inputBuffer, GDT_Float32, 0, input.nrOfCol()-1, 0, input.nrOfRow()-1, band);</div>
+<div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>   <span class="keywordflow">if</span>(maxDistance<=0)</div>
+<div class="line"><a name="l01195"></a><span class="lineno"> 1195</span>     maxDistance=sqrt(static_cast<float>(input.nrOfCol()*input.nrOfRow()));</div>
+<div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>   linearFeature(inputBuffer,outputBuffer,angle,angleStep,maxDistance,eps, l1, a1, l2, a2,verbose);</div>
+<div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<outputBuffer.size();++iband)</div>
+<div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>     output.writeDataBlock(outputBuffer[iband],GDT_Float32,0,output.nrOfCol()-1,0,output.nrOfRow()-1,iband);</div>
+<div class="line"><a name="l01199"></a><span class="lineno"> 1199</span> }</div>
+<div class="line"><a name="l01200"></a><span class="lineno"> 1200</span> </div>
+<div class="line"><a name="l01201"></a><span class="lineno"> 1201</span> <span class="keywordtype">void</span> filter2d::Filter2d::linearFeature(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<float></a>& input, std::vector< <a class="code" href="classVector2d.html">Vector2d<float></a> >& output, <span class="keywordtype">float</span> angle, <span class="keywordtype">float</span> angleStep, <span class="keywordtype">flo [...]
+<div class="line"><a name="l01202"></a><span class="lineno"> 1202</span> {</div>
+<div class="line"><a name="l01203"></a><span class="lineno"> 1203</span>   output.clear();</div>
+<div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>   <span class="keywordtype">int</span> nband=0;<span class="comment">//linear feature</span></div>
+<div class="line"><a name="l01205"></a><span class="lineno"> 1205</span>   <span class="keywordflow">if</span>(l1)</div>
+<div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>     ++nband;</div>
+<div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>   <span class="keywordflow">if</span>(a1)</div>
+<div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>     ++nband;</div>
+<div class="line"><a name="l01209"></a><span class="lineno"> 1209</span>   <span class="keywordflow">if</span>(l2)</div>
+<div class="line"><a name="l01210"></a><span class="lineno"> 1210</span>     ++nband;</div>
+<div class="line"><a name="l01211"></a><span class="lineno"> 1211</span>   <span class="keywordflow">if</span>(a2)</div>
+<div class="line"><a name="l01212"></a><span class="lineno"> 1212</span>     ++nband;</div>
+<div class="line"><a name="l01213"></a><span class="lineno"> 1213</span>   output.resize(nband);</div>
+<div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<output.size();++iband)</div>
+<div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>     output[iband].resize(input.nRows(),input.nCols());</div>
+<div class="line"><a name="l01216"></a><span class="lineno"> 1216</span>   <span class="keywordflow">if</span>(maxDistance<=0)</div>
+<div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>     maxDistance=sqrt(static_cast<float>(input.nRows()*input.nCols()));</div>
+<div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>   <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>   <span class="keywordtype">int</span> indexJ=0;</div>
+<div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l01221"></a><span class="lineno"> 1221</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l01222"></a><span class="lineno"> 1222</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l01223"></a><span class="lineno"> 1223</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l01224"></a><span class="lineno"> 1224</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nRows();++y){</div>
+<div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nCols();++x){</div>
+<div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>       <span class="keywordtype">float</span> currentValue=input[y][x];</div>
+<div class="line"><a name="l01228"></a><span class="lineno"> 1228</span>       <span class="comment">//find values equal to current value with some error margin</span></div>
+<div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>       <span class="comment">//todo: add distance for two opposite directions</span></div>
+<div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>       <span class="keywordtype">float</span> lineDistance1=0;<span class="comment">//longest line of object</span></div>
+<div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>       <span class="keywordtype">float</span> lineDistance2=maxDistance;<span class="comment">//shortest line of object</span></div>
+<div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>       <span class="keywordtype">float</span> lineAngle1=0;<span class="comment">//angle to longest line (North=0)</span></div>
+<div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>       <span class="keywordtype">float</span> lineAngle2=0;<span class="comment">//angle to shortest line (North=0)</span></div>
+<div class="line"><a name="l01234"></a><span class="lineno"> 1234</span>       <span class="keywordtype">float</span> northAngle=0;<span class="comment">//rotating angle</span></div>
+<div class="line"><a name="l01235"></a><span class="lineno"> 1235</span>       <span class="keywordflow">for</span>(northAngle=0;northAngle<180;northAngle+=angleStep){</div>
+<div class="line"><a name="l01236"></a><span class="lineno"> 1236</span>     <span class="keywordflow">if</span>(angle<=360&&angle>=0&&angle!=northAngle)</div>
+<div class="line"><a name="l01237"></a><span class="lineno"> 1237</span>       <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>     <span class="comment">//test</span></div>
+<div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>     <span class="keywordflow">if</span>(verbose)</div>
+<div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>       std::cout << <span class="stringliteral">"northAngle: "</span> << northAngle << std::endl;</div>
+<div class="line"><a name="l01241"></a><span class="lineno"> 1241</span>     <span class="keywordtype">float</span> currentDistance=0;</div>
+<div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>     <span class="keywordtype">float</span> theDir=0;</div>
+<div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>     <span class="keywordflow">for</span>(<span class="keywordtype">short</span> side=0;side<=1;side+=1){</div>
+<div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>       theDir=PI/2.0-DEG2RAD(northAngle)+side*PI;<span class="comment">//in radians</span></div>
+<div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>       <span class="comment">//test</span></div>
+<div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>       <span class="keywordflow">if</span>(verbose)</div>
+<div class="line"><a name="l01247"></a><span class="lineno"> 1247</span>         std::cout << <span class="stringliteral">"theDir in deg: "</span> << RAD2DEG(theDir) << std::endl;</div>
+<div class="line"><a name="l01248"></a><span class="lineno"> 1248</span>       <span class="keywordflow">if</span>(theDir<0)</div>
+<div class="line"><a name="l01249"></a><span class="lineno"> 1249</span>         theDir+=2*PI;</div>
+<div class="line"><a name="l01250"></a><span class="lineno"> 1250</span>       <span class="comment">//test</span></div>
+<div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>       <span class="keywordflow">if</span>(verbose)</div>
+<div class="line"><a name="l01252"></a><span class="lineno"> 1252</span>         std::cout << <span class="stringliteral">"theDir in deg: "</span> << RAD2DEG(theDir) << std::endl;</div>
+<div class="line"><a name="l01253"></a><span class="lineno"> 1253</span>       <span class="keywordtype">float</span> nextValue=currentValue;</div>
+<div class="line"><a name="l01254"></a><span class="lineno"> 1254</span>       <span class="keywordflow">for</span>(<span class="keywordtype">float</span> currentRay=1;currentRay<maxDistance;++currentRay){</div>
+<div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>         indexI=x+currentRay*cos(theDir);</div>
+<div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>         indexJ=y-currentRay*sin(theDir);</div>
+<div class="line"><a name="l01257"></a><span class="lineno"> 1257</span>         <span class="keywordflow">if</span>(indexJ<0||indexJ>=input.size())</div>
+<div class="line"><a name="l01258"></a><span class="lineno"> 1258</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l01259"></a><span class="lineno"> 1259</span>         <span class="keywordflow">if</span>(indexI<0||indexI>=input[indexJ].size())</div>
+<div class="line"><a name="l01260"></a><span class="lineno"> 1260</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>         nextValue=input[indexJ][indexI];</div>
+<div class="line"><a name="l01262"></a><span class="lineno"> 1262</span>         <span class="keywordflow">if</span>(verbose){</div>
+<div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>           std::cout << <span class="stringliteral">"x: "</span> << x << std::endl;</div>
+<div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>           std::cout << <span class="stringliteral">"y: "</span> << y << std::endl;</div>
+<div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>           std::cout << <span class="stringliteral">"currentValue: "</span> << currentValue << std::endl;</div>
+<div class="line"><a name="l01266"></a><span class="lineno"> 1266</span>           std::cout << <span class="stringliteral">"theDir in degrees: "</span> << RAD2DEG(theDir) << std::endl;</div>
+<div class="line"><a name="l01267"></a><span class="lineno"> 1267</span>           std::cout << <span class="stringliteral">"cos(theDir): "</span> << cos(theDir) << std::endl;</div>
+<div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>           std::cout << <span class="stringliteral">"sin(theDir): "</span> << sin(theDir) << std::endl;</div>
+<div class="line"><a name="l01269"></a><span class="lineno"> 1269</span>           std::cout << <span class="stringliteral">"currentRay: "</span> << currentRay << std::endl;</div>
+<div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>           std::cout << <span class="stringliteral">"currentDistance: "</span> << currentDistance << std::endl;</div>
+<div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>           std::cout << <span class="stringliteral">"indexI: "</span> << indexI << std::endl;</div>
+<div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>           std::cout << <span class="stringliteral">"indexJ: "</span> << indexJ << std::endl;</div>
+<div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>           std::cout << <span class="stringliteral">"nextValue: "</span> << nextValue << std::endl;</div>
+<div class="line"><a name="l01274"></a><span class="lineno"> 1274</span>         }</div>
+<div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>         <span class="keywordflow">if</span>(fabs(currentValue-nextValue)<=eps){</div>
+<div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>           ++currentDistance;</div>
+<div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>           <span class="comment">//test</span></div>
+<div class="line"><a name="l01278"></a><span class="lineno"> 1278</span>           <span class="keywordflow">if</span>(verbose)</div>
+<div class="line"><a name="l01279"></a><span class="lineno"> 1279</span>         std::cout << <span class="stringliteral">"currentDistance: "</span> << currentDistance << <span class="stringliteral">", continue"</span> << std::endl;</div>
+<div class="line"><a name="l01280"></a><span class="lineno"> 1280</span>         }</div>
+<div class="line"><a name="l01281"></a><span class="lineno"> 1281</span>         <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>           <span class="keywordflow">if</span>(verbose)</div>
+<div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>         std::cout << <span class="stringliteral">"currentDistance: "</span> << currentDistance << <span class="stringliteral">", break"</span> << std::endl;</div>
+<div class="line"><a name="l01284"></a><span class="lineno"> 1284</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>         }</div>
+<div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>       }</div>
+<div class="line"><a name="l01287"></a><span class="lineno"> 1287</span>     }</div>
+<div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>     <span class="keywordflow">if</span>(lineDistance1<currentDistance){</div>
+<div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>       lineDistance1=currentDistance;</div>
+<div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>       lineAngle1=northAngle;</div>
+<div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>     }</div>
+<div class="line"><a name="l01292"></a><span class="lineno"> 1292</span>     <span class="keywordflow">if</span>(lineDistance2>currentDistance){</div>
+<div class="line"><a name="l01293"></a><span class="lineno"> 1293</span>       lineDistance2=currentDistance;</div>
+<div class="line"><a name="l01294"></a><span class="lineno"> 1294</span>       lineAngle2=northAngle;</div>
+<div class="line"><a name="l01295"></a><span class="lineno"> 1295</span>     }</div>
+<div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>     <span class="keywordflow">if</span>(verbose){</div>
+<div class="line"><a name="l01297"></a><span class="lineno"> 1297</span>       std::cout << <span class="stringliteral">"lineDistance1: "</span> << lineDistance1 << std::endl;</div>
+<div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>       std::cout << <span class="stringliteral">"lineAngle1: "</span> << lineAngle1 << std::endl;</div>
+<div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>       std::cout << <span class="stringliteral">"lineDistance2: "</span> << lineDistance2 << std::endl;</div>
+<div class="line"><a name="l01300"></a><span class="lineno"> 1300</span>       std::cout << <span class="stringliteral">"lineAngle2: "</span> << lineAngle2 << std::endl;</div>
+<div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>     }</div>
+<div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>       }</div>
+<div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>       <span class="keywordtype">int</span> iband=0;</div>
+<div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>       <span class="keywordflow">if</span>(l1)</div>
+<div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>     output[iband++][y][x]=lineDistance1;</div>
+<div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>       <span class="keywordflow">if</span>(a1)</div>
+<div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>     output[iband++][y][x]=lineAngle1;</div>
+<div class="line"><a name="l01308"></a><span class="lineno"> 1308</span>       <span class="keywordflow">if</span>(l2)</div>
+<div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>     output[iband++][y][x]=lineDistance2;</div>
+<div class="line"><a name="l01310"></a><span class="lineno"> 1310</span>       <span class="keywordflow">if</span>(a2)</div>
+<div class="line"><a name="l01311"></a><span class="lineno"> 1311</span>     output[iband++][y][x]=lineAngle2;</div>
+<div class="line"><a name="l01312"></a><span class="lineno"> 1312</span>       assert(iband==nband);</div>
+<div class="line"><a name="l01313"></a><span class="lineno"> 1313</span>     }</div>
+<div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>     progress=(1.0+y);</div>
+<div class="line"><a name="l01315"></a><span class="lineno"> 1315</span>     progress/=input.nRows();</div>
+<div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01317"></a><span class="lineno"> 1317</span>   }</div>
+<div class="line"><a name="l01318"></a><span class="lineno"> 1318</span> }</div>
+<div class="ttc" id="classImgReaderGdal_html"><div class="ttname"><a href="classImgReaderGdal.html">ImgReaderGdal</a></div><div class="ttdef"><b>Definition:</b> <a href="ImgReaderGdal_8h_source.html#l00032">ImgReaderGdal.h:32</a></div></div>
+<div class="ttc" id="classImgWriterGdal_html"><div class="ttname"><a href="classImgWriterGdal.html">ImgWriterGdal</a></div><div class="ttdef"><b>Definition:</b> <a href="ImgWriterGdal_8h_source.html#l00033">ImgWriterGdal.h:33</a></div></div>
 <div class="ttc" id="classVector2d_html"><div class="ttname"><a href="classVector2d.html">Vector2d< double ></a></div></div>
 <div class="ttc" id="classstatfactory_1_1StatFactory_html"><div class="ttname"><a href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a></div><div class="ttdef"><b>Definition:</b> <a href="StatFactory_8h_source.html#l00043">StatFactory.h:43</a></div></div>
 </div><!-- fragment --></div><!-- contents -->
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:26 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:05 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/Filter2d_8h_source.html b/doc/html/Filter2d_8h_source.html
index caf024e..24a7561 100644
--- a/doc/html/Filter2d_8h_source.html
+++ b/doc/html/Filter2d_8h_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -112,7 +112,7 @@
 <div class="line"><a name="l00058"></a><span class="lineno">   58</span> </div>
 <div class="line"><a name="l00059"></a><span class="lineno">   59</span> <span class="keyword">namespace </span>filter2d</div>
 <div class="line"><a name="l00060"></a><span class="lineno">   60</span> {</div>
-<div class="line"><a name="l00061"></a><span class="lineno">   61</span>   <span class="keyword">enum</span> FILTER_TYPE { median=100, var=101 , min=102, max=103, sum=104, mean=105, minmax=106, dilate=107, erode=108, close=109, open=110, homog=111, sobelx=112, sobely=113, sobelxy=114, sobelyx=115, smooth=116, density=117, mode=118, mixed=119, threshold=120, ismin=121, ismax=122, heterog=123, order=124, stdev=125, mrf=126, dwt=127, dwti=128, dwt_cut=129, scramble=130, shift=131, line [...]
+<div class="line"><a name="l00061"></a><span class="lineno">   61</span>   <span class="keyword">enum</span> FILTER_TYPE { median=100, var=101 , min=102, max=103, sum=104, mean=105, minmax=106, dilate=107, erode=108, close=109, open=110, homog=111, sobelx=112, sobely=113, sobelxy=114, sobelyx=115, smooth=116, density=117, mode=118, mixed=119, threshold=120, ismin=121, ismax=122, heterog=123, order=124, stdev=125, mrf=126, dwt=127, dwti=128, dwt_cut=129, scramble=130, shift=131, line [...]
 <div class="line"><a name="l00062"></a><span class="lineno">   62</span> </div>
 <div class="line"><a name="l00063"></a><span class="lineno">   63</span>   <span class="keyword">enum</span> RESAMPLE { NEAR = 0, BILINEAR = 1, BICUBIC = 2 };<span class="comment">//bicubic not supported yet...</span></div>
 <div class="line"><a name="l00064"></a><span class="lineno">   64</span>   </div>
@@ -186,1239 +186,1243 @@
 <div class="line"><a name="l00132"></a><span class="lineno">  132</span>   <span class="keyword">static</span> <span class="keywordtype">void</span> initMap(std::map<std::string, FILTER_TYPE>& m_filterMap){</div>
 <div class="line"><a name="l00133"></a><span class="lineno">  133</span>     <span class="comment">//initialize selMap</span></div>
 <div class="line"><a name="l00134"></a><span class="lineno">  134</span>     m_filterMap[<span class="stringliteral">"median"</span>]=filter2d::median;</div>
-<div class="line"><a name="l00135"></a><span class="lineno">  135</span>     m_filterMap[<span class="stringliteral">"var"</span>]=filter2d::var;</div>
-<div class="line"><a name="l00136"></a><span class="lineno">  136</span>     m_filterMap[<span class="stringliteral">"min"</span>]=filter2d::min;</div>
-<div class="line"><a name="l00137"></a><span class="lineno">  137</span>     m_filterMap[<span class="stringliteral">"max"</span>]=filter2d::max;</div>
-<div class="line"><a name="l00138"></a><span class="lineno">  138</span>     m_filterMap[<span class="stringliteral">"sum"</span>]=filter2d::sum;</div>
-<div class="line"><a name="l00139"></a><span class="lineno">  139</span>     m_filterMap[<span class="stringliteral">"mean"</span>]=filter2d::mean;</div>
-<div class="line"><a name="l00140"></a><span class="lineno">  140</span>     m_filterMap[<span class="stringliteral">"minmax"</span>]=filter2d::minmax;</div>
-<div class="line"><a name="l00141"></a><span class="lineno">  141</span>     m_filterMap[<span class="stringliteral">"dilate"</span>]=filter2d::dilate;</div>
-<div class="line"><a name="l00142"></a><span class="lineno">  142</span>     m_filterMap[<span class="stringliteral">"erode"</span>]=filter2d::erode;</div>
-<div class="line"><a name="l00143"></a><span class="lineno">  143</span>     m_filterMap[<span class="stringliteral">"close"</span>]=filter2d::close;</div>
-<div class="line"><a name="l00144"></a><span class="lineno">  144</span>     m_filterMap[<span class="stringliteral">"open"</span>]=filter2d::open;</div>
-<div class="line"><a name="l00145"></a><span class="lineno">  145</span>     m_filterMap[<span class="stringliteral">"homog"</span>]=filter2d::homog;</div>
-<div class="line"><a name="l00146"></a><span class="lineno">  146</span>     m_filterMap[<span class="stringliteral">"sobelx"</span>]=filter2d::sobelx;</div>
-<div class="line"><a name="l00147"></a><span class="lineno">  147</span>     m_filterMap[<span class="stringliteral">"sobely"</span>]=filter2d::sobely;</div>
-<div class="line"><a name="l00148"></a><span class="lineno">  148</span>     m_filterMap[<span class="stringliteral">"sobelxy"</span>]=filter2d::sobelxy;</div>
-<div class="line"><a name="l00149"></a><span class="lineno">  149</span>     m_filterMap[<span class="stringliteral">"sobelyx"</span>]=filter2d::sobelyx;</div>
-<div class="line"><a name="l00150"></a><span class="lineno">  150</span>     m_filterMap[<span class="stringliteral">"smooth"</span>]=filter2d::smooth;</div>
-<div class="line"><a name="l00151"></a><span class="lineno">  151</span>     m_filterMap[<span class="stringliteral">"density"</span>]=filter2d::density;</div>
-<div class="line"><a name="l00152"></a><span class="lineno">  152</span>     m_filterMap[<span class="stringliteral">"mode"</span>]=filter2d::mode;</div>
-<div class="line"><a name="l00153"></a><span class="lineno">  153</span>     m_filterMap[<span class="stringliteral">"mixed"</span>]=filter2d::mixed;</div>
-<div class="line"><a name="l00154"></a><span class="lineno">  154</span>     m_filterMap[<span class="stringliteral">"smoothnodata"</span>]=filter2d::smoothnodata;</div>
-<div class="line"><a name="l00155"></a><span class="lineno">  155</span>     m_filterMap[<span class="stringliteral">"threshold"</span>]=filter2d::threshold;</div>
-<div class="line"><a name="l00156"></a><span class="lineno">  156</span>     m_filterMap[<span class="stringliteral">"ismin"</span>]=filter2d::ismin;</div>
-<div class="line"><a name="l00157"></a><span class="lineno">  157</span>     m_filterMap[<span class="stringliteral">"ismax"</span>]=filter2d::ismax;</div>
-<div class="line"><a name="l00158"></a><span class="lineno">  158</span>     m_filterMap[<span class="stringliteral">"heterog"</span>]=filter2d::heterog;</div>
-<div class="line"><a name="l00159"></a><span class="lineno">  159</span>     m_filterMap[<span class="stringliteral">"order"</span>]=filter2d::order;</div>
-<div class="line"><a name="l00160"></a><span class="lineno">  160</span>     m_filterMap[<span class="stringliteral">"stdev"</span>]=filter2d::stdev;</div>
-<div class="line"><a name="l00161"></a><span class="lineno">  161</span>     m_filterMap[<span class="stringliteral">"mrf"</span>]=filter2d::mrf;</div>
-<div class="line"><a name="l00162"></a><span class="lineno">  162</span>     m_filterMap[<span class="stringliteral">"dwt"</span>]=filter2d::dwt;</div>
-<div class="line"><a name="l00163"></a><span class="lineno">  163</span>     m_filterMap[<span class="stringliteral">"dwti"</span>]=filter2d::dwti;</div>
-<div class="line"><a name="l00164"></a><span class="lineno">  164</span>     m_filterMap[<span class="stringliteral">"dwt_cut"</span>]=filter2d::dwt_cut;</div>
-<div class="line"><a name="l00165"></a><span class="lineno">  165</span>     m_filterMap[<span class="stringliteral">"dwt_cut_from"</span>]=filter2d::dwt_cut_from;</div>
-<div class="line"><a name="l00166"></a><span class="lineno">  166</span>     m_filterMap[<span class="stringliteral">"scramble"</span>]=filter2d::scramble;</div>
-<div class="line"><a name="l00167"></a><span class="lineno">  167</span>     m_filterMap[<span class="stringliteral">"shift"</span>]=filter2d::shift;</div>
-<div class="line"><a name="l00168"></a><span class="lineno">  168</span>     m_filterMap[<span class="stringliteral">"linearfeature"</span>]=filter2d::linearfeature;</div>
-<div class="line"><a name="l00169"></a><span class="lineno">  169</span>     m_filterMap[<span class="stringliteral">"countid"</span>]=filter2d::countid;</div>
-<div class="line"><a name="l00170"></a><span class="lineno">  170</span>     m_filterMap[<span class="stringliteral">"savgolay"</span>]=filter2d::savgolay;</div>
-<div class="line"><a name="l00171"></a><span class="lineno">  171</span>     m_filterMap[<span class="stringliteral">"percentile"</span>]=filter2d::percentile;</div>
-<div class="line"><a name="l00172"></a><span class="lineno">  172</span>     m_filterMap[<span class="stringliteral">"proportion"</span>]=filter2d::proportion;</div>
-<div class="line"><a name="l00173"></a><span class="lineno">  173</span>   }</div>
-<div class="line"><a name="l00174"></a><span class="lineno">  174</span> </div>
-<div class="line"><a name="l00175"></a><span class="lineno">  175</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> m_taps;</div>
-<div class="line"><a name="l00176"></a><span class="lineno">  176</span>   <span class="comment">/* double m_noValue; */</span></div>
-<div class="line"><a name="l00177"></a><span class="lineno">  177</span>   std::vector<short> m_class;</div>
-<div class="line"><a name="l00178"></a><span class="lineno">  178</span>   <span class="comment">/* std::vector<short> m_mask; */</span></div>
-<div class="line"><a name="l00179"></a><span class="lineno">  179</span>   std::vector<double> m_noDataValues;</div>
-<div class="line"><a name="l00180"></a><span class="lineno">  180</span>   std::vector<double> m_threshold;</div>
-<div class="line"><a name="l00181"></a><span class="lineno">  181</span> };</div>
-<div class="line"><a name="l00182"></a><span class="lineno">  182</span> </div>
+<div class="line"><a name="l00135"></a><span class="lineno">  135</span>     m_filterMap[<span class="stringliteral">"nvalid"</span>]=filter2d::nvalid;</div>
+<div class="line"><a name="l00136"></a><span class="lineno">  136</span>     m_filterMap[<span class="stringliteral">"var"</span>]=filter2d::var;</div>
+<div class="line"><a name="l00137"></a><span class="lineno">  137</span>     m_filterMap[<span class="stringliteral">"min"</span>]=filter2d::min;</div>
+<div class="line"><a name="l00138"></a><span class="lineno">  138</span>     m_filterMap[<span class="stringliteral">"max"</span>]=filter2d::max;</div>
+<div class="line"><a name="l00139"></a><span class="lineno">  139</span>     m_filterMap[<span class="stringliteral">"sum"</span>]=filter2d::sum;</div>
+<div class="line"><a name="l00140"></a><span class="lineno">  140</span>     m_filterMap[<span class="stringliteral">"mean"</span>]=filter2d::mean;</div>
+<div class="line"><a name="l00141"></a><span class="lineno">  141</span>     m_filterMap[<span class="stringliteral">"minmax"</span>]=filter2d::minmax;</div>
+<div class="line"><a name="l00142"></a><span class="lineno">  142</span>     m_filterMap[<span class="stringliteral">"dilate"</span>]=filter2d::dilate;</div>
+<div class="line"><a name="l00143"></a><span class="lineno">  143</span>     m_filterMap[<span class="stringliteral">"erode"</span>]=filter2d::erode;</div>
+<div class="line"><a name="l00144"></a><span class="lineno">  144</span>     m_filterMap[<span class="stringliteral">"close"</span>]=filter2d::close;</div>
+<div class="line"><a name="l00145"></a><span class="lineno">  145</span>     m_filterMap[<span class="stringliteral">"open"</span>]=filter2d::open;</div>
+<div class="line"><a name="l00146"></a><span class="lineno">  146</span>     m_filterMap[<span class="stringliteral">"homog"</span>]=filter2d::homog;</div>
+<div class="line"><a name="l00147"></a><span class="lineno">  147</span>     m_filterMap[<span class="stringliteral">"sobelx"</span>]=filter2d::sobelx;</div>
+<div class="line"><a name="l00148"></a><span class="lineno">  148</span>     m_filterMap[<span class="stringliteral">"sobely"</span>]=filter2d::sobely;</div>
+<div class="line"><a name="l00149"></a><span class="lineno">  149</span>     m_filterMap[<span class="stringliteral">"sobelxy"</span>]=filter2d::sobelxy;</div>
+<div class="line"><a name="l00150"></a><span class="lineno">  150</span>     m_filterMap[<span class="stringliteral">"sobelyx"</span>]=filter2d::sobelyx;</div>
+<div class="line"><a name="l00151"></a><span class="lineno">  151</span>     m_filterMap[<span class="stringliteral">"smooth"</span>]=filter2d::smooth;</div>
+<div class="line"><a name="l00152"></a><span class="lineno">  152</span>     m_filterMap[<span class="stringliteral">"density"</span>]=filter2d::density;</div>
+<div class="line"><a name="l00153"></a><span class="lineno">  153</span>     m_filterMap[<span class="stringliteral">"mode"</span>]=filter2d::mode;</div>
+<div class="line"><a name="l00154"></a><span class="lineno">  154</span>     m_filterMap[<span class="stringliteral">"mixed"</span>]=filter2d::mixed;</div>
+<div class="line"><a name="l00155"></a><span class="lineno">  155</span>     m_filterMap[<span class="stringliteral">"smoothnodata"</span>]=filter2d::smoothnodata;</div>
+<div class="line"><a name="l00156"></a><span class="lineno">  156</span>     m_filterMap[<span class="stringliteral">"threshold"</span>]=filter2d::threshold;</div>
+<div class="line"><a name="l00157"></a><span class="lineno">  157</span>     m_filterMap[<span class="stringliteral">"ismin"</span>]=filter2d::ismin;</div>
+<div class="line"><a name="l00158"></a><span class="lineno">  158</span>     m_filterMap[<span class="stringliteral">"ismax"</span>]=filter2d::ismax;</div>
+<div class="line"><a name="l00159"></a><span class="lineno">  159</span>     m_filterMap[<span class="stringliteral">"heterog"</span>]=filter2d::heterog;</div>
+<div class="line"><a name="l00160"></a><span class="lineno">  160</span>     m_filterMap[<span class="stringliteral">"order"</span>]=filter2d::order;</div>
+<div class="line"><a name="l00161"></a><span class="lineno">  161</span>     m_filterMap[<span class="stringliteral">"stdev"</span>]=filter2d::stdev;</div>
+<div class="line"><a name="l00162"></a><span class="lineno">  162</span>     m_filterMap[<span class="stringliteral">"mrf"</span>]=filter2d::mrf;</div>
+<div class="line"><a name="l00163"></a><span class="lineno">  163</span>     m_filterMap[<span class="stringliteral">"dwt"</span>]=filter2d::dwt;</div>
+<div class="line"><a name="l00164"></a><span class="lineno">  164</span>     m_filterMap[<span class="stringliteral">"dwti"</span>]=filter2d::dwti;</div>
+<div class="line"><a name="l00165"></a><span class="lineno">  165</span>     m_filterMap[<span class="stringliteral">"dwt_cut"</span>]=filter2d::dwt_cut;</div>
+<div class="line"><a name="l00166"></a><span class="lineno">  166</span>     m_filterMap[<span class="stringliteral">"dwt_cut_from"</span>]=filter2d::dwt_cut_from;</div>
+<div class="line"><a name="l00167"></a><span class="lineno">  167</span>     m_filterMap[<span class="stringliteral">"scramble"</span>]=filter2d::scramble;</div>
+<div class="line"><a name="l00168"></a><span class="lineno">  168</span>     m_filterMap[<span class="stringliteral">"shift"</span>]=filter2d::shift;</div>
+<div class="line"><a name="l00169"></a><span class="lineno">  169</span>     m_filterMap[<span class="stringliteral">"linearfeature"</span>]=filter2d::linearfeature;</div>
+<div class="line"><a name="l00170"></a><span class="lineno">  170</span>     m_filterMap[<span class="stringliteral">"countid"</span>]=filter2d::countid;</div>
+<div class="line"><a name="l00171"></a><span class="lineno">  171</span>     m_filterMap[<span class="stringliteral">"savgolay"</span>]=filter2d::savgolay;</div>
+<div class="line"><a name="l00172"></a><span class="lineno">  172</span>     m_filterMap[<span class="stringliteral">"percentile"</span>]=filter2d::percentile;</div>
+<div class="line"><a name="l00173"></a><span class="lineno">  173</span>     m_filterMap[<span class="stringliteral">"proportion"</span>]=filter2d::proportion;</div>
+<div class="line"><a name="l00174"></a><span class="lineno">  174</span>   }</div>
+<div class="line"><a name="l00175"></a><span class="lineno">  175</span> </div>
+<div class="line"><a name="l00176"></a><span class="lineno">  176</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> m_taps;</div>
+<div class="line"><a name="l00177"></a><span class="lineno">  177</span>   <span class="comment">/* double m_noValue; */</span></div>
+<div class="line"><a name="l00178"></a><span class="lineno">  178</span>   std::vector<short> m_class;</div>
+<div class="line"><a name="l00179"></a><span class="lineno">  179</span>   <span class="comment">/* std::vector<short> m_mask; */</span></div>
+<div class="line"><a name="l00180"></a><span class="lineno">  180</span>   std::vector<double> m_noDataValues;</div>
+<div class="line"><a name="l00181"></a><span class="lineno">  181</span>   std::vector<double> m_threshold;</div>
+<div class="line"><a name="l00182"></a><span class="lineno">  182</span> };</div>
 <div class="line"><a name="l00183"></a><span class="lineno">  183</span> </div>
-<div class="line"><a name="l00184"></a><span class="lineno">  184</span>  <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2> <span class="keywordtype">void</span> Filter2d::smooth(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T1></a>& inputVector, <a class="code" href="classVector2d.html">Vector2d<T2></a>& outputVector,<span class="keywordtype">int</span [...]
-<div class="line"><a name="l00185"></a><span class="lineno">  185</span>   {</div>
-<div class="line"><a name="l00186"></a><span class="lineno">  186</span>     smooth(inputVector,outputVector,dim,dim);</div>
-<div class="line"><a name="l00187"></a><span class="lineno">  187</span>   }</div>
-<div class="line"><a name="l00188"></a><span class="lineno">  188</span> </div>
-<div class="line"><a name="l00189"></a><span class="lineno">  189</span>  <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2> <span class="keywordtype">void</span> Filter2d::smooth(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T1></a>& inputVector, <a class="code" href="classVector2d.html">Vector2d<T2></a>& outputVector,<span class="keywordtype">int</span [...]
-<div class="line"><a name="l00190"></a><span class="lineno">  190</span>   {</div>
-<div class="line"><a name="l00191"></a><span class="lineno">  191</span>     m_taps.resize(dimY);</div>
-<div class="line"><a name="l00192"></a><span class="lineno">  192</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j<dimY;++j){</div>
-<div class="line"><a name="l00193"></a><span class="lineno">  193</span>       m_taps[j].resize(dimX);</div>
-<div class="line"><a name="l00194"></a><span class="lineno">  194</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<dimX;++i)</div>
-<div class="line"><a name="l00195"></a><span class="lineno">  195</span>     m_taps[j][i]=1.0/dimX/dimY;</div>
-<div class="line"><a name="l00196"></a><span class="lineno">  196</span>     }</div>
-<div class="line"><a name="l00197"></a><span class="lineno">  197</span>     filter(inputVector,outputVector);</div>
-<div class="line"><a name="l00198"></a><span class="lineno">  198</span>   }</div>
-<div class="line"><a name="l00199"></a><span class="lineno">  199</span>   </div>
-<div class="line"><a name="l00200"></a><span class="lineno">  200</span>   <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2> <span class="keywordtype">void</span> Filter2d::filter(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T1></a>& inputVector, <a class="code" href="classVector2d.html">Vector2d<T2></a>& outputVector)</div>
-<div class="line"><a name="l00201"></a><span class="lineno">  201</span>   {</div>
-<div class="line"><a name="l00202"></a><span class="lineno">  202</span>     outputVector.resize(inputVector.size());</div>
-<div class="line"><a name="l00203"></a><span class="lineno">  203</span>     <span class="keywordtype">int</span> dimX=m_taps[0].size();<span class="comment">//horizontal!!!</span></div>
-<div class="line"><a name="l00204"></a><span class="lineno">  204</span>     <span class="keywordtype">int</span> dimY=m_taps.size();<span class="comment">//vertical!!!</span></div>
-<div class="line"><a name="l00205"></a><span class="lineno">  205</span>     <a class="code" href="classVector2d.html">Vector2d<T1></a> inBuffer(dimY);</div>
-<div class="line"><a name="l00206"></a><span class="lineno">  206</span>     std::vector<T2> outBuffer(inputVector[0].size());</div>
-<div class="line"><a name="l00207"></a><span class="lineno">  207</span>     <span class="comment">//initialize last half of inBuffer</span></div>
-<div class="line"><a name="l00208"></a><span class="lineno">  208</span>     <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l00209"></a><span class="lineno">  209</span>     <span class="keywordtype">int</span> indexJ=0;</div>
-<div class="line"><a name="l00210"></a><span class="lineno">  210</span>     <span class="comment">//initialize last half of inBuffer</span></div>
-<div class="line"><a name="l00211"></a><span class="lineno">  211</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00212"></a><span class="lineno">  212</span>       inBuffer[indexJ]=inputVector[abs(j)];</div>
-<div class="line"><a name="l00213"></a><span class="lineno">  213</span>       ++indexJ;</div>
-<div class="line"><a name="l00214"></a><span class="lineno">  214</span>     }</div>
-<div class="line"><a name="l00215"></a><span class="lineno">  215</span> </div>
-<div class="line"><a name="l00216"></a><span class="lineno">  216</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<inputVector.size();++y){</div>
-<div class="line"><a name="l00217"></a><span class="lineno">  217</span>       <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
-<div class="line"><a name="l00218"></a><span class="lineno">  218</span>         <span class="comment">//erase first line from inBuffer</span></div>
-<div class="line"><a name="l00219"></a><span class="lineno">  219</span>         inBuffer.erase(inBuffer.begin());</div>
-<div class="line"><a name="l00220"></a><span class="lineno">  220</span>         <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
-<div class="line"><a name="l00221"></a><span class="lineno">  221</span>         <span class="keywordflow">if</span>(y+dimY/2<inputVector.size()){</div>
-<div class="line"><a name="l00222"></a><span class="lineno">  222</span>       <span class="comment">//allocate buffer</span></div>
-<div class="line"><a name="l00223"></a><span class="lineno">  223</span>           inBuffer.push_back(inputVector[y+dimY/2]);</div>
-<div class="line"><a name="l00224"></a><span class="lineno">  224</span>         }</div>
-<div class="line"><a name="l00225"></a><span class="lineno">  225</span>         <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00226"></a><span class="lineno">  226</span>           <span class="keywordtype">int</span> over=y+dimY/2-inputVector.nRows();</div>
-<div class="line"><a name="l00227"></a><span class="lineno">  227</span>           <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
-<div class="line"><a name="l00228"></a><span class="lineno">  228</span>           assert(index>=0);</div>
-<div class="line"><a name="l00229"></a><span class="lineno">  229</span>           assert(index<inBuffer.size());</div>
-<div class="line"><a name="l00230"></a><span class="lineno">  230</span>           inBuffer.push_back(inBuffer[index]);</div>
-<div class="line"><a name="l00231"></a><span class="lineno">  231</span>         }</div>
-<div class="line"><a name="l00232"></a><span class="lineno">  232</span>       }</div>
-<div class="line"><a name="l00233"></a><span class="lineno">  233</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<inputVector.nCols();++x){</div>
-<div class="line"><a name="l00234"></a><span class="lineno">  234</span>         outBuffer[x]=0;</div>
-<div class="line"><a name="l00235"></a><span class="lineno">  235</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00236"></a><span class="lineno">  236</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
-<div class="line"><a name="l00237"></a><span class="lineno">  237</span>         indexI=x+i;</div>
-<div class="line"><a name="l00238"></a><span class="lineno">  238</span>         indexJ=(dimY-1)/2+j;</div>
-<div class="line"><a name="l00239"></a><span class="lineno">  239</span>         <span class="comment">//check if out of bounds</span></div>
-<div class="line"><a name="l00240"></a><span class="lineno">  240</span>         <span class="keywordflow">if</span>(x<(dimX-1)/2)</div>
-<div class="line"><a name="l00241"></a><span class="lineno">  241</span>           indexI=x+abs(i);</div>
-<div class="line"><a name="l00242"></a><span class="lineno">  242</span>         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(x>=inputVector.nCols()-(dimX-1)/2)</div>
-<div class="line"><a name="l00243"></a><span class="lineno">  243</span>           indexI=x-abs(i);</div>
-<div class="line"><a name="l00244"></a><span class="lineno">  244</span>         <span class="keywordflow">if</span>(y<(dimY-1)/2)</div>
-<div class="line"><a name="l00245"></a><span class="lineno">  245</span>           indexJ=(dimY-1)/2+abs(j);</div>
-<div class="line"><a name="l00246"></a><span class="lineno">  246</span>         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y>=inputVector.nRows()-(dimY-1)/2)</div>
-<div class="line"><a name="l00247"></a><span class="lineno">  247</span>           indexJ=(dimY-1)/2-abs(j);</div>
-<div class="line"><a name="l00248"></a><span class="lineno">  248</span>             outBuffer[x]+=(m_taps[(dimY-1)/2+j][(dimX-1)/2+i]*inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l00249"></a><span class="lineno">  249</span>           }</div>
-<div class="line"><a name="l00250"></a><span class="lineno">  250</span>         }</div>
-<div class="line"><a name="l00251"></a><span class="lineno">  251</span>       }</div>
-<div class="line"><a name="l00252"></a><span class="lineno">  252</span>       <span class="comment">//copy outBuffer to outputVector</span></div>
-<div class="line"><a name="l00253"></a><span class="lineno">  253</span>       outputVector[y]=outBuffer;</div>
-<div class="line"><a name="l00254"></a><span class="lineno">  254</span>     }</div>
-<div class="line"><a name="l00255"></a><span class="lineno">  255</span>   }</div>
-<div class="line"><a name="l00256"></a><span class="lineno">  256</span> </div>
-<div class="line"><a name="l00257"></a><span class="lineno">  257</span> <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2> <span class="keywordtype">void</span> Filter2d::doit(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T1></a>& inputVector, <a class="code" href="classVector2d.html">Vector2d<T2></a>& outputVector, <span class="keyword">const</span> st [...]
-<div class="line"><a name="l00258"></a><span class="lineno">  258</span> {</div>
-<div class="line"><a name="l00259"></a><span class="lineno">  259</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l00260"></a><span class="lineno">  260</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l00261"></a><span class="lineno">  261</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l00262"></a><span class="lineno">  262</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l00263"></a><span class="lineno">  263</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00264"></a><span class="lineno">  264</span> </div>
-<div class="line"><a name="l00265"></a><span class="lineno">  265</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
-<div class="line"><a name="l00266"></a><span class="lineno">  266</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
-<div class="line"><a name="l00267"></a><span class="lineno">  267</span>     noDataValue=m_noDataValues[0];</div>
-<div class="line"><a name="l00268"></a><span class="lineno">  268</span> </div>
-<div class="line"><a name="l00269"></a><span class="lineno">  269</span>   assert(dimX);</div>
-<div class="line"><a name="l00270"></a><span class="lineno">  270</span>   assert(dimY);</div>
-<div class="line"><a name="l00271"></a><span class="lineno">  271</span> </div>
-<div class="line"><a name="l00272"></a><span class="lineno">  272</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
-<div class="line"><a name="l00273"></a><span class="lineno">  273</span>   outputVector.resize((inputVector.size()+down-1)/down);</div>
-<div class="line"><a name="l00274"></a><span class="lineno">  274</span>   <a class="code" href="classVector2d.html">Vector2d<T1></a> inBuffer(dimY);</div>
-<div class="line"><a name="l00275"></a><span class="lineno">  275</span>   std::vector<T2> outBuffer((inputVector[0].size()+down-1)/down);</div>
-<div class="line"><a name="l00276"></a><span class="lineno">  276</span>   <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l00277"></a><span class="lineno">  277</span>   <span class="keywordtype">int</span> indexJ=0;</div>
-<div class="line"><a name="l00278"></a><span class="lineno">  278</span>   <span class="comment">//initialize last half of inBuffer</span></div>
-<div class="line"><a name="l00279"></a><span class="lineno">  279</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00280"></a><span class="lineno">  280</span>     inBuffer[indexJ]=inputVector[abs(j)];</div>
-<div class="line"><a name="l00281"></a><span class="lineno">  281</span>     ++indexJ;</div>
-<div class="line"><a name="l00282"></a><span class="lineno">  282</span>   }</div>
-<div class="line"><a name="l00283"></a><span class="lineno">  283</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<inputVector.size();++y){</div>
-<div class="line"><a name="l00284"></a><span class="lineno">  284</span>     <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
-<div class="line"><a name="l00285"></a><span class="lineno">  285</span>       <span class="comment">//erase first line from inBuffer</span></div>
-<div class="line"><a name="l00286"></a><span class="lineno">  286</span>       inBuffer.erase(inBuffer.begin());</div>
-<div class="line"><a name="l00287"></a><span class="lineno">  287</span>       <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
-<div class="line"><a name="l00288"></a><span class="lineno">  288</span>       <span class="keywordflow">if</span>(y+dimY/2<inputVector.size())</div>
-<div class="line"><a name="l00289"></a><span class="lineno">  289</span>     inBuffer.push_back(inputVector[y+dimY/2]);</div>
-<div class="line"><a name="l00290"></a><span class="lineno">  290</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00291"></a><span class="lineno">  291</span>         <span class="keywordtype">int</span> over=y+dimY/2-inputVector.size();</div>
-<div class="line"><a name="l00292"></a><span class="lineno">  292</span>         <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
-<div class="line"><a name="l00293"></a><span class="lineno">  293</span>         assert(index>=0);</div>
-<div class="line"><a name="l00294"></a><span class="lineno">  294</span>         assert(index<inBuffer.size());</div>
-<div class="line"><a name="l00295"></a><span class="lineno">  295</span>         inBuffer.push_back(inBuffer[index]);</div>
-<div class="line"><a name="l00296"></a><span class="lineno">  296</span>       }</div>
-<div class="line"><a name="l00297"></a><span class="lineno">  297</span>     }</div>
-<div class="line"><a name="l00298"></a><span class="lineno">  298</span>     <span class="keywordflow">if</span>((y+1+down/2)%down)</div>
-<div class="line"><a name="l00299"></a><span class="lineno">  299</span>       <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l00300"></a><span class="lineno">  300</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<inputVector[0].size();++x){</div>
-<div class="line"><a name="l00301"></a><span class="lineno">  301</span>       <span class="keywordflow">if</span>((x+1+down/2)%down)</div>
-<div class="line"><a name="l00302"></a><span class="lineno">  302</span>         <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l00303"></a><span class="lineno">  303</span>       outBuffer[x/down]=0;</div>
-<div class="line"><a name="l00304"></a><span class="lineno">  304</span>       std::vector<double> windowBuffer;</div>
-<div class="line"><a name="l00305"></a><span class="lineno">  305</span>       std::map<int,int> occurrence;</div>
-<div class="line"><a name="l00306"></a><span class="lineno">  306</span>       <span class="keywordtype">int</span> centre=dimX*(dimY-1)/2+(dimX-1)/2;</div>
-<div class="line"><a name="l00307"></a><span class="lineno">  307</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00308"></a><span class="lineno">  308</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
-<div class="line"><a name="l00309"></a><span class="lineno">  309</span>       indexI=x+i;</div>
-<div class="line"><a name="l00310"></a><span class="lineno">  310</span>       <span class="comment">//check if out of bounds</span></div>
-<div class="line"><a name="l00311"></a><span class="lineno">  311</span>           <span class="keywordflow">if</span>(indexI<0)</div>
-<div class="line"><a name="l00312"></a><span class="lineno">  312</span>             indexI=-indexI;</div>
-<div class="line"><a name="l00313"></a><span class="lineno">  313</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=inputVector[0].size())</div>
-<div class="line"><a name="l00314"></a><span class="lineno">  314</span>             indexI=inputVector[0].size()-i;</div>
-<div class="line"><a name="l00315"></a><span class="lineno">  315</span>           <span class="keywordflow">if</span>(y+j<0)</div>
-<div class="line"><a name="l00316"></a><span class="lineno">  316</span>             indexJ=-j;</div>
-<div class="line"><a name="l00317"></a><span class="lineno">  317</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=inputVector.size())</div>
-<div class="line"><a name="l00318"></a><span class="lineno">  318</span>             indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
-<div class="line"><a name="l00319"></a><span class="lineno">  319</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00320"></a><span class="lineno">  320</span>             indexJ=(dimY-1)/2+j;</div>
-<div class="line"><a name="l00321"></a><span class="lineno">  321</span>           <span class="keywordtype">bool</span> masked=<span class="keyword">false</span>;</div>
-<div class="line"><a name="l00322"></a><span class="lineno">  322</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
-<div class="line"><a name="l00323"></a><span class="lineno">  323</span>             <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_noDataValues[imask]){</div>
-<div class="line"><a name="l00324"></a><span class="lineno">  324</span>               masked=<span class="keyword">true</span>;</div>
-<div class="line"><a name="l00325"></a><span class="lineno">  325</span>               <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00326"></a><span class="lineno">  326</span>             }</div>
-<div class="line"><a name="l00327"></a><span class="lineno">  327</span>           }</div>
-<div class="line"><a name="l00328"></a><span class="lineno">  328</span>           <span class="keywordflow">if</span>(!masked){</div>
-<div class="line"><a name="l00329"></a><span class="lineno">  329</span>             std::vector<short>::const_iterator vit=m_class.begin();</div>
-<div class="line"><a name="l00330"></a><span class="lineno">  330</span>             <span class="comment">//todo: test if this works (only add occurrence if within defined classes)!</span></div>
-<div class="line"><a name="l00331"></a><span class="lineno">  331</span>             <span class="keywordflow">if</span>(!m_class.size())</div>
-<div class="line"><a name="l00332"></a><span class="lineno">  332</span>               ++occurrence[inBuffer[indexJ][indexI]];</div>
-<div class="line"><a name="l00333"></a><span class="lineno">  333</span>             <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00334"></a><span class="lineno">  334</span>               <span class="keywordflow">while</span>(vit!=m_class.end()){</div>
-<div class="line"><a name="l00335"></a><span class="lineno">  335</span>                 <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==*(vit++))</div>
-<div class="line"><a name="l00336"></a><span class="lineno">  336</span>                   ++occurrence[inBuffer[indexJ][indexI]];</div>
-<div class="line"><a name="l00337"></a><span class="lineno">  337</span>               }</div>
-<div class="line"><a name="l00338"></a><span class="lineno">  338</span>             }</div>
-<div class="line"><a name="l00339"></a><span class="lineno">  339</span>             windowBuffer.push_back(inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l00340"></a><span class="lineno">  340</span>           }</div>
-<div class="line"><a name="l00341"></a><span class="lineno">  341</span>         }</div>
-<div class="line"><a name="l00342"></a><span class="lineno">  342</span>       }</div>
-<div class="line"><a name="l00343"></a><span class="lineno">  343</span>       <span class="keywordflow">switch</span>(getFilterType(method)){</div>
-<div class="line"><a name="l00344"></a><span class="lineno">  344</span>       <span class="keywordflow">case</span>(filter2d::median):</div>
-<div class="line"><a name="l00345"></a><span class="lineno">  345</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00346"></a><span class="lineno">  346</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00347"></a><span class="lineno">  347</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00348"></a><span class="lineno">  348</span>           outBuffer[x/down]=stat.median(windowBuffer);</div>
-<div class="line"><a name="l00349"></a><span class="lineno">  349</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00350"></a><span class="lineno">  350</span>       <span class="keywordflow">case</span>(filter2d::var):{</div>
-<div class="line"><a name="l00351"></a><span class="lineno">  351</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00352"></a><span class="lineno">  352</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00353"></a><span class="lineno">  353</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00354"></a><span class="lineno">  354</span>           outBuffer[x/down]=stat.var(windowBuffer);</div>
-<div class="line"><a name="l00355"></a><span class="lineno">  355</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00356"></a><span class="lineno">  356</span>       }</div>
-<div class="line"><a name="l00357"></a><span class="lineno">  357</span>       <span class="keywordflow">case</span>(filter2d::stdev):{</div>
-<div class="line"><a name="l00358"></a><span class="lineno">  358</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00359"></a><span class="lineno">  359</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00360"></a><span class="lineno">  360</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00361"></a><span class="lineno">  361</span>           outBuffer[x/down]=sqrt(stat.var(windowBuffer));</div>
-<div class="line"><a name="l00362"></a><span class="lineno">  362</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00363"></a><span class="lineno">  363</span>       }</div>
-<div class="line"><a name="l00364"></a><span class="lineno">  364</span>       <span class="keywordflow">case</span>(filter2d::mean):{</div>
-<div class="line"><a name="l00365"></a><span class="lineno">  365</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00366"></a><span class="lineno">  366</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00367"></a><span class="lineno">  367</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00368"></a><span class="lineno">  368</span>           outBuffer[x/down]=stat.mean(windowBuffer);</div>
-<div class="line"><a name="l00369"></a><span class="lineno">  369</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00370"></a><span class="lineno">  370</span>       }</div>
-<div class="line"><a name="l00371"></a><span class="lineno">  371</span>       <span class="keywordflow">case</span>(filter2d::min):{</div>
-<div class="line"><a name="l00372"></a><span class="lineno">  372</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00373"></a><span class="lineno">  373</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00374"></a><span class="lineno">  374</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00375"></a><span class="lineno">  375</span>           outBuffer[x/down]=stat.mymin(windowBuffer);</div>
-<div class="line"><a name="l00376"></a><span class="lineno">  376</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00377"></a><span class="lineno">  377</span>       }</div>
-<div class="line"><a name="l00378"></a><span class="lineno">  378</span>       <span class="keywordflow">case</span>(filter2d::ismin):{</div>
-<div class="line"><a name="l00379"></a><span class="lineno">  379</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00380"></a><span class="lineno">  380</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00381"></a><span class="lineno">  381</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00382"></a><span class="lineno">  382</span>           outBuffer[x/down]=(stat.mymin(windowBuffer)==windowBuffer[centre])? 1:0;</div>
-<div class="line"><a name="l00383"></a><span class="lineno">  383</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00384"></a><span class="lineno">  384</span>       }</div>
-<div class="line"><a name="l00385"></a><span class="lineno">  385</span>       <span class="keywordflow">case</span>(filter2d::minmax):{</div>
-<div class="line"><a name="l00386"></a><span class="lineno">  386</span>         <span class="keywordtype">double</span> min=0;</div>
-<div class="line"><a name="l00387"></a><span class="lineno">  387</span>         <span class="keywordtype">double</span> max=0;</div>
-<div class="line"><a name="l00388"></a><span class="lineno">  388</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00389"></a><span class="lineno">  389</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00390"></a><span class="lineno">  390</span>         <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00391"></a><span class="lineno">  391</span>           stat.minmax(windowBuffer,windowBuffer.begin(),windowBuffer.end(),min,max);</div>
-<div class="line"><a name="l00392"></a><span class="lineno">  392</span>           <span class="keywordflow">if</span>(min!=max)</div>
-<div class="line"><a name="l00393"></a><span class="lineno">  393</span>             outBuffer[x/down]=0;</div>
-<div class="line"><a name="l00394"></a><span class="lineno">  394</span>           <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00395"></a><span class="lineno">  395</span>             outBuffer[x/down]=windowBuffer[centre];<span class="comment">//centre pixels</span></div>
-<div class="line"><a name="l00396"></a><span class="lineno">  396</span>         }</div>
-<div class="line"><a name="l00397"></a><span class="lineno">  397</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00398"></a><span class="lineno">  398</span>       }</div>
-<div class="line"><a name="l00399"></a><span class="lineno">  399</span>       <span class="keywordflow">case</span>(filter2d::max):{</div>
-<div class="line"><a name="l00400"></a><span class="lineno">  400</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00401"></a><span class="lineno">  401</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00402"></a><span class="lineno">  402</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00403"></a><span class="lineno">  403</span>           outBuffer[x/down]=stat.mymax(windowBuffer);</div>
-<div class="line"><a name="l00404"></a><span class="lineno">  404</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00405"></a><span class="lineno">  405</span>       }</div>
-<div class="line"><a name="l00406"></a><span class="lineno">  406</span>       <span class="keywordflow">case</span>(filter2d::ismax):{</div>
-<div class="line"><a name="l00407"></a><span class="lineno">  407</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00408"></a><span class="lineno">  408</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00409"></a><span class="lineno">  409</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00410"></a><span class="lineno">  410</span>           outBuffer[x/down]=(stat.mymax(windowBuffer)==windowBuffer[centre])? 1:0;</div>
-<div class="line"><a name="l00411"></a><span class="lineno">  411</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00412"></a><span class="lineno">  412</span>       }</div>
-<div class="line"><a name="l00413"></a><span class="lineno">  413</span>       <span class="keywordflow">case</span>(filter2d::order):{</div>
-<div class="line"><a name="l00414"></a><span class="lineno">  414</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
-<div class="line"><a name="l00415"></a><span class="lineno">  415</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00416"></a><span class="lineno">  416</span>         <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00417"></a><span class="lineno">  417</span>           <span class="keywordtype">double</span> lbound=0;</div>
-<div class="line"><a name="l00418"></a><span class="lineno">  418</span>           <span class="keywordtype">double</span> ubound=dimX*dimY;</div>
-<div class="line"><a name="l00419"></a><span class="lineno">  419</span>           <span class="keywordtype">double</span> theMin=stat.mymin(windowBuffer);</div>
-<div class="line"><a name="l00420"></a><span class="lineno">  420</span>           <span class="keywordtype">double</span> theMax=stat.mymax(windowBuffer);</div>
-<div class="line"><a name="l00421"></a><span class="lineno">  421</span>           <span class="keywordtype">double</span> scale=(ubound-lbound)/(theMax-theMin);</div>
-<div class="line"><a name="l00422"></a><span class="lineno">  422</span>           outBuffer[x/down]=<span class="keyword">static_cast<</span><span class="keywordtype">short</span><span class="keyword">></span>(scale*(windowBuffer[centre]-theMin)+lbound);</div>
-<div class="line"><a name="l00423"></a><span class="lineno">  423</span>         }</div>
-<div class="line"><a name="l00424"></a><span class="lineno">  424</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00425"></a><span class="lineno">  425</span>       }</div>
-<div class="line"><a name="l00426"></a><span class="lineno">  426</span>       <span class="keywordflow">case</span>(filter2d::sum):{</div>
-<div class="line"><a name="l00427"></a><span class="lineno">  427</span>         outBuffer[x/down]=stat.sum(windowBuffer);</div>
+<div class="line"><a name="l00184"></a><span class="lineno">  184</span> </div>
+<div class="line"><a name="l00185"></a><span class="lineno">  185</span>  <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2> <span class="keywordtype">void</span> Filter2d::smooth(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T1></a>& inputVector, <a class="code" href="classVector2d.html">Vector2d<T2></a>& outputVector,<span class="keywordtype">int</span [...]
+<div class="line"><a name="l00186"></a><span class="lineno">  186</span>   {</div>
+<div class="line"><a name="l00187"></a><span class="lineno">  187</span>     smooth(inputVector,outputVector,dim,dim);</div>
+<div class="line"><a name="l00188"></a><span class="lineno">  188</span>   }</div>
+<div class="line"><a name="l00189"></a><span class="lineno">  189</span> </div>
+<div class="line"><a name="l00190"></a><span class="lineno">  190</span>  <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2> <span class="keywordtype">void</span> Filter2d::smooth(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T1></a>& inputVector, <a class="code" href="classVector2d.html">Vector2d<T2></a>& outputVector,<span class="keywordtype">int</span [...]
+<div class="line"><a name="l00191"></a><span class="lineno">  191</span>   {</div>
+<div class="line"><a name="l00192"></a><span class="lineno">  192</span>     m_taps.resize(dimY);</div>
+<div class="line"><a name="l00193"></a><span class="lineno">  193</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j<dimY;++j){</div>
+<div class="line"><a name="l00194"></a><span class="lineno">  194</span>       m_taps[j].resize(dimX);</div>
+<div class="line"><a name="l00195"></a><span class="lineno">  195</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<dimX;++i)</div>
+<div class="line"><a name="l00196"></a><span class="lineno">  196</span>     m_taps[j][i]=1.0/dimX/dimY;</div>
+<div class="line"><a name="l00197"></a><span class="lineno">  197</span>     }</div>
+<div class="line"><a name="l00198"></a><span class="lineno">  198</span>     filter(inputVector,outputVector);</div>
+<div class="line"><a name="l00199"></a><span class="lineno">  199</span>   }</div>
+<div class="line"><a name="l00200"></a><span class="lineno">  200</span>   </div>
+<div class="line"><a name="l00201"></a><span class="lineno">  201</span>   <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2> <span class="keywordtype">void</span> Filter2d::filter(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T1></a>& inputVector, <a class="code" href="classVector2d.html">Vector2d<T2></a>& outputVector)</div>
+<div class="line"><a name="l00202"></a><span class="lineno">  202</span>   {</div>
+<div class="line"><a name="l00203"></a><span class="lineno">  203</span>     outputVector.resize(inputVector.size());</div>
+<div class="line"><a name="l00204"></a><span class="lineno">  204</span>     <span class="keywordtype">int</span> dimX=m_taps[0].size();<span class="comment">//horizontal!!!</span></div>
+<div class="line"><a name="l00205"></a><span class="lineno">  205</span>     <span class="keywordtype">int</span> dimY=m_taps.size();<span class="comment">//vertical!!!</span></div>
+<div class="line"><a name="l00206"></a><span class="lineno">  206</span>     <a class="code" href="classVector2d.html">Vector2d<T1></a> inBuffer(dimY);</div>
+<div class="line"><a name="l00207"></a><span class="lineno">  207</span>     std::vector<T2> outBuffer(inputVector[0].size());</div>
+<div class="line"><a name="l00208"></a><span class="lineno">  208</span>     <span class="comment">//initialize last half of inBuffer</span></div>
+<div class="line"><a name="l00209"></a><span class="lineno">  209</span>     <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l00210"></a><span class="lineno">  210</span>     <span class="keywordtype">int</span> indexJ=0;</div>
+<div class="line"><a name="l00211"></a><span class="lineno">  211</span>     <span class="comment">//initialize last half of inBuffer</span></div>
+<div class="line"><a name="l00212"></a><span class="lineno">  212</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00213"></a><span class="lineno">  213</span>       inBuffer[indexJ]=inputVector[abs(j)];</div>
+<div class="line"><a name="l00214"></a><span class="lineno">  214</span>       ++indexJ;</div>
+<div class="line"><a name="l00215"></a><span class="lineno">  215</span>     }</div>
+<div class="line"><a name="l00216"></a><span class="lineno">  216</span> </div>
+<div class="line"><a name="l00217"></a><span class="lineno">  217</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<inputVector.size();++y){</div>
+<div class="line"><a name="l00218"></a><span class="lineno">  218</span>       <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
+<div class="line"><a name="l00219"></a><span class="lineno">  219</span>         <span class="comment">//erase first line from inBuffer</span></div>
+<div class="line"><a name="l00220"></a><span class="lineno">  220</span>         inBuffer.erase(inBuffer.begin());</div>
+<div class="line"><a name="l00221"></a><span class="lineno">  221</span>         <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
+<div class="line"><a name="l00222"></a><span class="lineno">  222</span>         <span class="keywordflow">if</span>(y+dimY/2<inputVector.size()){</div>
+<div class="line"><a name="l00223"></a><span class="lineno">  223</span>       <span class="comment">//allocate buffer</span></div>
+<div class="line"><a name="l00224"></a><span class="lineno">  224</span>           inBuffer.push_back(inputVector[y+dimY/2]);</div>
+<div class="line"><a name="l00225"></a><span class="lineno">  225</span>         }</div>
+<div class="line"><a name="l00226"></a><span class="lineno">  226</span>         <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00227"></a><span class="lineno">  227</span>           <span class="keywordtype">int</span> over=y+dimY/2-inputVector.nRows();</div>
+<div class="line"><a name="l00228"></a><span class="lineno">  228</span>           <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
+<div class="line"><a name="l00229"></a><span class="lineno">  229</span>           assert(index>=0);</div>
+<div class="line"><a name="l00230"></a><span class="lineno">  230</span>           assert(index<inBuffer.size());</div>
+<div class="line"><a name="l00231"></a><span class="lineno">  231</span>           inBuffer.push_back(inBuffer[index]);</div>
+<div class="line"><a name="l00232"></a><span class="lineno">  232</span>         }</div>
+<div class="line"><a name="l00233"></a><span class="lineno">  233</span>       }</div>
+<div class="line"><a name="l00234"></a><span class="lineno">  234</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<inputVector.nCols();++x){</div>
+<div class="line"><a name="l00235"></a><span class="lineno">  235</span>         outBuffer[x]=0;</div>
+<div class="line"><a name="l00236"></a><span class="lineno">  236</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00237"></a><span class="lineno">  237</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
+<div class="line"><a name="l00238"></a><span class="lineno">  238</span>         indexI=x+i;</div>
+<div class="line"><a name="l00239"></a><span class="lineno">  239</span>         indexJ=(dimY-1)/2+j;</div>
+<div class="line"><a name="l00240"></a><span class="lineno">  240</span>         <span class="comment">//check if out of bounds</span></div>
+<div class="line"><a name="l00241"></a><span class="lineno">  241</span>         <span class="keywordflow">if</span>(x<(dimX-1)/2)</div>
+<div class="line"><a name="l00242"></a><span class="lineno">  242</span>           indexI=x+abs(i);</div>
+<div class="line"><a name="l00243"></a><span class="lineno">  243</span>         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(x>=inputVector.nCols()-(dimX-1)/2)</div>
+<div class="line"><a name="l00244"></a><span class="lineno">  244</span>           indexI=x-abs(i);</div>
+<div class="line"><a name="l00245"></a><span class="lineno">  245</span>         <span class="keywordflow">if</span>(y<(dimY-1)/2)</div>
+<div class="line"><a name="l00246"></a><span class="lineno">  246</span>           indexJ=(dimY-1)/2+abs(j);</div>
+<div class="line"><a name="l00247"></a><span class="lineno">  247</span>         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y>=inputVector.nRows()-(dimY-1)/2)</div>
+<div class="line"><a name="l00248"></a><span class="lineno">  248</span>           indexJ=(dimY-1)/2-abs(j);</div>
+<div class="line"><a name="l00249"></a><span class="lineno">  249</span>             outBuffer[x]+=(m_taps[(dimY-1)/2+j][(dimX-1)/2+i]*inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l00250"></a><span class="lineno">  250</span>           }</div>
+<div class="line"><a name="l00251"></a><span class="lineno">  251</span>         }</div>
+<div class="line"><a name="l00252"></a><span class="lineno">  252</span>       }</div>
+<div class="line"><a name="l00253"></a><span class="lineno">  253</span>       <span class="comment">//copy outBuffer to outputVector</span></div>
+<div class="line"><a name="l00254"></a><span class="lineno">  254</span>       outputVector[y]=outBuffer;</div>
+<div class="line"><a name="l00255"></a><span class="lineno">  255</span>     }</div>
+<div class="line"><a name="l00256"></a><span class="lineno">  256</span>   }</div>
+<div class="line"><a name="l00257"></a><span class="lineno">  257</span> </div>
+<div class="line"><a name="l00258"></a><span class="lineno">  258</span> <span class="keyword">template</span><<span class="keyword">class</span> T1, <span class="keyword">class</span> T2> <span class="keywordtype">void</span> Filter2d::doit(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T1></a>& inputVector, <a class="code" href="classVector2d.html">Vector2d<T2></a>& outputVector, <span class="keyword">const</span> st [...]
+<div class="line"><a name="l00259"></a><span class="lineno">  259</span> {</div>
+<div class="line"><a name="l00260"></a><span class="lineno">  260</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l00261"></a><span class="lineno">  261</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l00262"></a><span class="lineno">  262</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l00263"></a><span class="lineno">  263</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l00264"></a><span class="lineno">  264</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00265"></a><span class="lineno">  265</span> </div>
+<div class="line"><a name="l00266"></a><span class="lineno">  266</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
+<div class="line"><a name="l00267"></a><span class="lineno">  267</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
+<div class="line"><a name="l00268"></a><span class="lineno">  268</span>     noDataValue=m_noDataValues[0];</div>
+<div class="line"><a name="l00269"></a><span class="lineno">  269</span> </div>
+<div class="line"><a name="l00270"></a><span class="lineno">  270</span>   assert(dimX);</div>
+<div class="line"><a name="l00271"></a><span class="lineno">  271</span>   assert(dimY);</div>
+<div class="line"><a name="l00272"></a><span class="lineno">  272</span> </div>
+<div class="line"><a name="l00273"></a><span class="lineno">  273</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
+<div class="line"><a name="l00274"></a><span class="lineno">  274</span>   outputVector.resize((inputVector.size()+down-1)/down);</div>
+<div class="line"><a name="l00275"></a><span class="lineno">  275</span>   <a class="code" href="classVector2d.html">Vector2d<T1></a> inBuffer(dimY);</div>
+<div class="line"><a name="l00276"></a><span class="lineno">  276</span>   std::vector<T2> outBuffer((inputVector[0].size()+down-1)/down);</div>
+<div class="line"><a name="l00277"></a><span class="lineno">  277</span>   <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l00278"></a><span class="lineno">  278</span>   <span class="keywordtype">int</span> indexJ=0;</div>
+<div class="line"><a name="l00279"></a><span class="lineno">  279</span>   <span class="comment">//initialize last half of inBuffer</span></div>
+<div class="line"><a name="l00280"></a><span class="lineno">  280</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00281"></a><span class="lineno">  281</span>     inBuffer[indexJ]=inputVector[abs(j)];</div>
+<div class="line"><a name="l00282"></a><span class="lineno">  282</span>     ++indexJ;</div>
+<div class="line"><a name="l00283"></a><span class="lineno">  283</span>   }</div>
+<div class="line"><a name="l00284"></a><span class="lineno">  284</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<inputVector.size();++y){</div>
+<div class="line"><a name="l00285"></a><span class="lineno">  285</span>     <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
+<div class="line"><a name="l00286"></a><span class="lineno">  286</span>       <span class="comment">//erase first line from inBuffer</span></div>
+<div class="line"><a name="l00287"></a><span class="lineno">  287</span>       inBuffer.erase(inBuffer.begin());</div>
+<div class="line"><a name="l00288"></a><span class="lineno">  288</span>       <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
+<div class="line"><a name="l00289"></a><span class="lineno">  289</span>       <span class="keywordflow">if</span>(y+dimY/2<inputVector.size())</div>
+<div class="line"><a name="l00290"></a><span class="lineno">  290</span>     inBuffer.push_back(inputVector[y+dimY/2]);</div>
+<div class="line"><a name="l00291"></a><span class="lineno">  291</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00292"></a><span class="lineno">  292</span>         <span class="keywordtype">int</span> over=y+dimY/2-inputVector.size();</div>
+<div class="line"><a name="l00293"></a><span class="lineno">  293</span>         <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
+<div class="line"><a name="l00294"></a><span class="lineno">  294</span>         assert(index>=0);</div>
+<div class="line"><a name="l00295"></a><span class="lineno">  295</span>         assert(index<inBuffer.size());</div>
+<div class="line"><a name="l00296"></a><span class="lineno">  296</span>         inBuffer.push_back(inBuffer[index]);</div>
+<div class="line"><a name="l00297"></a><span class="lineno">  297</span>       }</div>
+<div class="line"><a name="l00298"></a><span class="lineno">  298</span>     }</div>
+<div class="line"><a name="l00299"></a><span class="lineno">  299</span>     <span class="keywordflow">if</span>((y+1+down/2)%down)</div>
+<div class="line"><a name="l00300"></a><span class="lineno">  300</span>       <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l00301"></a><span class="lineno">  301</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<inputVector[0].size();++x){</div>
+<div class="line"><a name="l00302"></a><span class="lineno">  302</span>       <span class="keywordflow">if</span>((x+1+down/2)%down)</div>
+<div class="line"><a name="l00303"></a><span class="lineno">  303</span>         <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l00304"></a><span class="lineno">  304</span>       outBuffer[x/down]=0;</div>
+<div class="line"><a name="l00305"></a><span class="lineno">  305</span>       std::vector<double> windowBuffer;</div>
+<div class="line"><a name="l00306"></a><span class="lineno">  306</span>       std::map<int,int> occurrence;</div>
+<div class="line"><a name="l00307"></a><span class="lineno">  307</span>       <span class="keywordtype">int</span> centre=dimX*(dimY-1)/2+(dimX-1)/2;</div>
+<div class="line"><a name="l00308"></a><span class="lineno">  308</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00309"></a><span class="lineno">  309</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
+<div class="line"><a name="l00310"></a><span class="lineno">  310</span>       indexI=x+i;</div>
+<div class="line"><a name="l00311"></a><span class="lineno">  311</span>       <span class="comment">//check if out of bounds</span></div>
+<div class="line"><a name="l00312"></a><span class="lineno">  312</span>           <span class="keywordflow">if</span>(indexI<0)</div>
+<div class="line"><a name="l00313"></a><span class="lineno">  313</span>             indexI=-indexI;</div>
+<div class="line"><a name="l00314"></a><span class="lineno">  314</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=inputVector[0].size())</div>
+<div class="line"><a name="l00315"></a><span class="lineno">  315</span>             indexI=inputVector[0].size()-i;</div>
+<div class="line"><a name="l00316"></a><span class="lineno">  316</span>           <span class="keywordflow">if</span>(y+j<0)</div>
+<div class="line"><a name="l00317"></a><span class="lineno">  317</span>             indexJ=-j;</div>
+<div class="line"><a name="l00318"></a><span class="lineno">  318</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=inputVector.size())</div>
+<div class="line"><a name="l00319"></a><span class="lineno">  319</span>             indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
+<div class="line"><a name="l00320"></a><span class="lineno">  320</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00321"></a><span class="lineno">  321</span>             indexJ=(dimY-1)/2+j;</div>
+<div class="line"><a name="l00322"></a><span class="lineno">  322</span>           <span class="keywordtype">bool</span> masked=<span class="keyword">false</span>;</div>
+<div class="line"><a name="l00323"></a><span class="lineno">  323</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
+<div class="line"><a name="l00324"></a><span class="lineno">  324</span>             <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_noDataValues[imask]){</div>
+<div class="line"><a name="l00325"></a><span class="lineno">  325</span>               masked=<span class="keyword">true</span>;</div>
+<div class="line"><a name="l00326"></a><span class="lineno">  326</span>               <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00327"></a><span class="lineno">  327</span>             }</div>
+<div class="line"><a name="l00328"></a><span class="lineno">  328</span>           }</div>
+<div class="line"><a name="l00329"></a><span class="lineno">  329</span>           <span class="keywordflow">if</span>(!masked){</div>
+<div class="line"><a name="l00330"></a><span class="lineno">  330</span>             std::vector<short>::const_iterator vit=m_class.begin();</div>
+<div class="line"><a name="l00331"></a><span class="lineno">  331</span>             <span class="comment">//todo: test if this works (only add occurrence if within defined classes)!</span></div>
+<div class="line"><a name="l00332"></a><span class="lineno">  332</span>             <span class="keywordflow">if</span>(!m_class.size())</div>
+<div class="line"><a name="l00333"></a><span class="lineno">  333</span>               ++occurrence[inBuffer[indexJ][indexI]];</div>
+<div class="line"><a name="l00334"></a><span class="lineno">  334</span>             <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00335"></a><span class="lineno">  335</span>               <span class="keywordflow">while</span>(vit!=m_class.end()){</div>
+<div class="line"><a name="l00336"></a><span class="lineno">  336</span>                 <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==*(vit++))</div>
+<div class="line"><a name="l00337"></a><span class="lineno">  337</span>                   ++occurrence[inBuffer[indexJ][indexI]];</div>
+<div class="line"><a name="l00338"></a><span class="lineno">  338</span>               }</div>
+<div class="line"><a name="l00339"></a><span class="lineno">  339</span>             }</div>
+<div class="line"><a name="l00340"></a><span class="lineno">  340</span>             windowBuffer.push_back(inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l00341"></a><span class="lineno">  341</span>           }</div>
+<div class="line"><a name="l00342"></a><span class="lineno">  342</span>         }</div>
+<div class="line"><a name="l00343"></a><span class="lineno">  343</span>       }</div>
+<div class="line"><a name="l00344"></a><span class="lineno">  344</span>       <span class="keywordflow">switch</span>(getFilterType(method)){</div>
+<div class="line"><a name="l00345"></a><span class="lineno">  345</span>       <span class="keywordflow">case</span>(filter2d::nvalid):</div>
+<div class="line"><a name="l00346"></a><span class="lineno">  346</span>     outBuffer[x/down]=stat.nvalid(windowBuffer);</div>
+<div class="line"><a name="l00347"></a><span class="lineno">  347</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00348"></a><span class="lineno">  348</span>       <span class="keywordflow">case</span>(filter2d::median):</div>
+<div class="line"><a name="l00349"></a><span class="lineno">  349</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00350"></a><span class="lineno">  350</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00351"></a><span class="lineno">  351</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00352"></a><span class="lineno">  352</span>           outBuffer[x/down]=stat.median(windowBuffer);</div>
+<div class="line"><a name="l00353"></a><span class="lineno">  353</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00354"></a><span class="lineno">  354</span>       <span class="keywordflow">case</span>(filter2d::var):{</div>
+<div class="line"><a name="l00355"></a><span class="lineno">  355</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00356"></a><span class="lineno">  356</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00357"></a><span class="lineno">  357</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00358"></a><span class="lineno">  358</span>           outBuffer[x/down]=stat.var(windowBuffer);</div>
+<div class="line"><a name="l00359"></a><span class="lineno">  359</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00360"></a><span class="lineno">  360</span>       }</div>
+<div class="line"><a name="l00361"></a><span class="lineno">  361</span>       <span class="keywordflow">case</span>(filter2d::stdev):{</div>
+<div class="line"><a name="l00362"></a><span class="lineno">  362</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00363"></a><span class="lineno">  363</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00364"></a><span class="lineno">  364</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00365"></a><span class="lineno">  365</span>           outBuffer[x/down]=sqrt(stat.var(windowBuffer));</div>
+<div class="line"><a name="l00366"></a><span class="lineno">  366</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00367"></a><span class="lineno">  367</span>       }</div>
+<div class="line"><a name="l00368"></a><span class="lineno">  368</span>       <span class="keywordflow">case</span>(filter2d::mean):{</div>
+<div class="line"><a name="l00369"></a><span class="lineno">  369</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00370"></a><span class="lineno">  370</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00371"></a><span class="lineno">  371</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00372"></a><span class="lineno">  372</span>           outBuffer[x/down]=stat.mean(windowBuffer);</div>
+<div class="line"><a name="l00373"></a><span class="lineno">  373</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00374"></a><span class="lineno">  374</span>       }</div>
+<div class="line"><a name="l00375"></a><span class="lineno">  375</span>       <span class="keywordflow">case</span>(filter2d::min):{</div>
+<div class="line"><a name="l00376"></a><span class="lineno">  376</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00377"></a><span class="lineno">  377</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00378"></a><span class="lineno">  378</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00379"></a><span class="lineno">  379</span>           outBuffer[x/down]=stat.mymin(windowBuffer);</div>
+<div class="line"><a name="l00380"></a><span class="lineno">  380</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00381"></a><span class="lineno">  381</span>       }</div>
+<div class="line"><a name="l00382"></a><span class="lineno">  382</span>       <span class="keywordflow">case</span>(filter2d::ismin):{</div>
+<div class="line"><a name="l00383"></a><span class="lineno">  383</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00384"></a><span class="lineno">  384</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00385"></a><span class="lineno">  385</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00386"></a><span class="lineno">  386</span>           outBuffer[x/down]=(stat.mymin(windowBuffer)==windowBuffer[centre])? 1:0;</div>
+<div class="line"><a name="l00387"></a><span class="lineno">  387</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00388"></a><span class="lineno">  388</span>       }</div>
+<div class="line"><a name="l00389"></a><span class="lineno">  389</span>       <span class="keywordflow">case</span>(filter2d::minmax):{</div>
+<div class="line"><a name="l00390"></a><span class="lineno">  390</span>         <span class="keywordtype">double</span> min=0;</div>
+<div class="line"><a name="l00391"></a><span class="lineno">  391</span>         <span class="keywordtype">double</span> max=0;</div>
+<div class="line"><a name="l00392"></a><span class="lineno">  392</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00393"></a><span class="lineno">  393</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00394"></a><span class="lineno">  394</span>         <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00395"></a><span class="lineno">  395</span>           stat.minmax(windowBuffer,windowBuffer.begin(),windowBuffer.end(),min,max);</div>
+<div class="line"><a name="l00396"></a><span class="lineno">  396</span>           <span class="keywordflow">if</span>(min!=max)</div>
+<div class="line"><a name="l00397"></a><span class="lineno">  397</span>             outBuffer[x/down]=0;</div>
+<div class="line"><a name="l00398"></a><span class="lineno">  398</span>           <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00399"></a><span class="lineno">  399</span>             outBuffer[x/down]=windowBuffer[centre];<span class="comment">//centre pixels</span></div>
+<div class="line"><a name="l00400"></a><span class="lineno">  400</span>         }</div>
+<div class="line"><a name="l00401"></a><span class="lineno">  401</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00402"></a><span class="lineno">  402</span>       }</div>
+<div class="line"><a name="l00403"></a><span class="lineno">  403</span>       <span class="keywordflow">case</span>(filter2d::max):{</div>
+<div class="line"><a name="l00404"></a><span class="lineno">  404</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00405"></a><span class="lineno">  405</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00406"></a><span class="lineno">  406</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00407"></a><span class="lineno">  407</span>           outBuffer[x/down]=stat.mymax(windowBuffer);</div>
+<div class="line"><a name="l00408"></a><span class="lineno">  408</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00409"></a><span class="lineno">  409</span>       }</div>
+<div class="line"><a name="l00410"></a><span class="lineno">  410</span>       <span class="keywordflow">case</span>(filter2d::ismax):{</div>
+<div class="line"><a name="l00411"></a><span class="lineno">  411</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00412"></a><span class="lineno">  412</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00413"></a><span class="lineno">  413</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00414"></a><span class="lineno">  414</span>           outBuffer[x/down]=(stat.mymax(windowBuffer)==windowBuffer[centre])? 1:0;</div>
+<div class="line"><a name="l00415"></a><span class="lineno">  415</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00416"></a><span class="lineno">  416</span>       }</div>
+<div class="line"><a name="l00417"></a><span class="lineno">  417</span>       <span class="keywordflow">case</span>(filter2d::order):{</div>
+<div class="line"><a name="l00418"></a><span class="lineno">  418</span>         <span class="keywordflow">if</span>(windowBuffer.empty())</div>
+<div class="line"><a name="l00419"></a><span class="lineno">  419</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00420"></a><span class="lineno">  420</span>         <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00421"></a><span class="lineno">  421</span>           <span class="keywordtype">double</span> lbound=0;</div>
+<div class="line"><a name="l00422"></a><span class="lineno">  422</span>           <span class="keywordtype">double</span> ubound=dimX*dimY;</div>
+<div class="line"><a name="l00423"></a><span class="lineno">  423</span>           <span class="keywordtype">double</span> theMin=stat.mymin(windowBuffer);</div>
+<div class="line"><a name="l00424"></a><span class="lineno">  424</span>           <span class="keywordtype">double</span> theMax=stat.mymax(windowBuffer);</div>
+<div class="line"><a name="l00425"></a><span class="lineno">  425</span>           <span class="keywordtype">double</span> scale=(ubound-lbound)/(theMax-theMin);</div>
+<div class="line"><a name="l00426"></a><span class="lineno">  426</span>           outBuffer[x/down]=<span class="keyword">static_cast<</span><span class="keywordtype">short</span><span class="keyword">></span>(scale*(windowBuffer[centre]-theMin)+lbound);</div>
+<div class="line"><a name="l00427"></a><span class="lineno">  427</span>         }</div>
 <div class="line"><a name="l00428"></a><span class="lineno">  428</span>         <span class="keywordflow">break</span>;</div>
 <div class="line"><a name="l00429"></a><span class="lineno">  429</span>       }</div>
-<div class="line"><a name="l00430"></a><span class="lineno">  430</span>       <span class="keywordflow">case</span>(filter2d::percentile):{</div>
-<div class="line"><a name="l00431"></a><span class="lineno">  431</span>     assert(m_threshold.size());</div>
-<div class="line"><a name="l00432"></a><span class="lineno">  432</span>         outBuffer[x/down]=stat.percentile(windowBuffer,windowBuffer.begin(),windowBuffer.end(),m_threshold[0]);</div>
-<div class="line"><a name="l00433"></a><span class="lineno">  433</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00434"></a><span class="lineno">  434</span>       }</div>
-<div class="line"><a name="l00435"></a><span class="lineno">  435</span>       <span class="keywordflow">case</span>(filter2d::proportion):{</div>
-<div class="line"><a name="l00436"></a><span class="lineno">  436</span>     assert(m_threshold.size());</div>
-<div class="line"><a name="l00437"></a><span class="lineno">  437</span>     <span class="keywordtype">double</span> sum=stat.sum(windowBuffer);</div>
-<div class="line"><a name="l00438"></a><span class="lineno">  438</span>     <span class="keywordflow">if</span>(sum)</div>
-<div class="line"><a name="l00439"></a><span class="lineno">  439</span>       outBuffer[x/down]=windowBuffer[centre]/sum;</div>
-<div class="line"><a name="l00440"></a><span class="lineno">  440</span>     <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00441"></a><span class="lineno">  441</span>       outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00442"></a><span class="lineno">  442</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00443"></a><span class="lineno">  443</span>       }</div>
-<div class="line"><a name="l00444"></a><span class="lineno">  444</span>       <span class="keywordflow">case</span>(filter2d::homog):</div>
-<div class="line"><a name="l00445"></a><span class="lineno">  445</span>         <span class="keywordflow">if</span>(occurrence.size()==1)<span class="comment">//all values in window must be the same</span></div>
-<div class="line"><a name="l00446"></a><span class="lineno">  446</span>           outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l00447"></a><span class="lineno">  447</span>         <span class="keywordflow">else</span><span class="comment">//favorize original value in case of ties</span></div>
-<div class="line"><a name="l00448"></a><span class="lineno">  448</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00449"></a><span class="lineno">  449</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00450"></a><span class="lineno">  450</span>       <span class="keywordflow">case</span>(filter2d::heterog):{</div>
-<div class="line"><a name="l00451"></a><span class="lineno">  451</span>         <span class="keywordflow">for</span>(std::vector<double>::const_iterator wit=windowBuffer.begin();wit!=windowBuffer.end();++wit){</div>
-<div class="line"><a name="l00452"></a><span class="lineno">  452</span>           <span class="keywordflow">if</span>(wit==windowBuffer.begin()+windowBuffer.size()/2)</div>
-<div class="line"><a name="l00453"></a><span class="lineno">  453</span>             <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l00454"></a><span class="lineno">  454</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(*wit!=inBuffer[(dimY-1)/2][x])</div>
-<div class="line"><a name="l00455"></a><span class="lineno">  455</span>             outBuffer[x/down]=1;</div>
-<div class="line"><a name="l00456"></a><span class="lineno">  456</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(*wit==inBuffer[(dimY-1)/2][x]){<span class="comment">//todo:wit mag niet central pixel zijn</span></div>
-<div class="line"><a name="l00457"></a><span class="lineno">  457</span>             outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00458"></a><span class="lineno">  458</span>             <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00459"></a><span class="lineno">  459</span>           }</div>
-<div class="line"><a name="l00460"></a><span class="lineno">  460</span>         }</div>
-<div class="line"><a name="l00461"></a><span class="lineno">  461</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00462"></a><span class="lineno">  462</span>       }</div>
-<div class="line"><a name="l00463"></a><span class="lineno">  463</span>       <span class="keywordflow">case</span>(filter2d::density):{</div>
-<div class="line"><a name="l00464"></a><span class="lineno">  464</span>         <span class="keywordflow">if</span>(windowBuffer.size()){</div>
-<div class="line"><a name="l00465"></a><span class="lineno">  465</span>           std::vector<short>::const_iterator vit=m_class.begin();</div>
-<div class="line"><a name="l00466"></a><span class="lineno">  466</span>           <span class="keywordflow">while</span>(vit!=m_class.end())</div>
-<div class="line"><a name="l00467"></a><span class="lineno">  467</span>             outBuffer[x/down]+=100.0*occurrence[*(vit++)]/windowBuffer.size();</div>
-<div class="line"><a name="l00468"></a><span class="lineno">  468</span>         }</div>
-<div class="line"><a name="l00469"></a><span class="lineno">  469</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00470"></a><span class="lineno">  470</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00471"></a><span class="lineno">  471</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00472"></a><span class="lineno">  472</span>       }</div>
-<div class="line"><a name="l00473"></a><span class="lineno">  473</span>       <span class="keywordflow">case</span>(filter2d::countid):{</div>
-<div class="line"><a name="l00474"></a><span class="lineno">  474</span>     <span class="keywordflow">if</span>(windowBuffer.size())</div>
-<div class="line"><a name="l00475"></a><span class="lineno">  475</span>       outBuffer[x/down]=occurrence.size();</div>
-<div class="line"><a name="l00476"></a><span class="lineno">  476</span>     <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00477"></a><span class="lineno">  477</span>       outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00478"></a><span class="lineno">  478</span>     <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00479"></a><span class="lineno">  479</span>       }</div>
-<div class="line"><a name="l00480"></a><span class="lineno">  480</span>       <span class="keywordflow">case</span>(filter2d::mode):{</div>
-<div class="line"><a name="l00481"></a><span class="lineno">  481</span>         <span class="keywordflow">if</span>(occurrence.size()){</div>
-<div class="line"><a name="l00482"></a><span class="lineno">  482</span>           std::map<int,int>::const_iterator maxit=occurrence.begin();</div>
-<div class="line"><a name="l00483"></a><span class="lineno">  483</span>           <span class="keywordflow">for</span>(std::map<int,int>::const_iterator mit=occurrence.begin();mit!=occurrence.end();++mit){</div>
-<div class="line"><a name="l00484"></a><span class="lineno">  484</span>             <span class="keywordflow">if</span>(mit->second>maxit->second)</div>
-<div class="line"><a name="l00485"></a><span class="lineno">  485</span>               maxit=mit;</div>
-<div class="line"><a name="l00486"></a><span class="lineno">  486</span>           }</div>
-<div class="line"><a name="l00487"></a><span class="lineno">  487</span>           <span class="keywordflow">if</span>(occurrence[inBuffer[(dimY-1)/2][x]]<maxit->second)<span class="comment">//</span></div>
-<div class="line"><a name="l00488"></a><span class="lineno">  488</span>             outBuffer[x/down]=maxit->first;</div>
-<div class="line"><a name="l00489"></a><span class="lineno">  489</span>           <span class="keywordflow">else</span><span class="comment">//favorize original value in case of ties</span></div>
-<div class="line"><a name="l00490"></a><span class="lineno">  490</span>             outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l00491"></a><span class="lineno">  491</span>         }</div>
-<div class="line"><a name="l00492"></a><span class="lineno">  492</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00493"></a><span class="lineno">  493</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00494"></a><span class="lineno">  494</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00495"></a><span class="lineno">  495</span>       }</div>
-<div class="line"><a name="l00496"></a><span class="lineno">  496</span>       <span class="keywordflow">case</span>(filter2d::threshold):{</div>
-<div class="line"><a name="l00497"></a><span class="lineno">  497</span>         assert(m_class.size()==m_threshold.size());</div>
-<div class="line"><a name="l00498"></a><span class="lineno">  498</span>         <span class="keywordflow">if</span>(windowBuffer.size()){</div>
-<div class="line"><a name="l00499"></a><span class="lineno">  499</span>           outBuffer[x/down]=inBuffer[(dimY-1)/2][x];<span class="comment">//initialize with original value (in case thresholds not met)</span></div>
-<div class="line"><a name="l00500"></a><span class="lineno">  500</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
-<div class="line"><a name="l00501"></a><span class="lineno">  501</span>             <span class="keywordflow">if</span>(100.0*(occurrence[m_class[iclass]])/windowBuffer.size()>m_threshold[iclass])</div>
-<div class="line"><a name="l00502"></a><span class="lineno">  502</span>               outBuffer[x/down]=m_class[iclass];</div>
-<div class="line"><a name="l00503"></a><span class="lineno">  503</span>           }</div>
-<div class="line"><a name="l00504"></a><span class="lineno">  504</span>         }</div>
-<div class="line"><a name="l00505"></a><span class="lineno">  505</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00506"></a><span class="lineno">  506</span>           outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00507"></a><span class="lineno">  507</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00508"></a><span class="lineno">  508</span>       }</div>
-<div class="line"><a name="l00509"></a><span class="lineno">  509</span>       <span class="keywordflow">case</span>(filter2d::scramble):{<span class="comment">//could be done more efficiently window by window with random shuffling entire buffer and assigning entire buffer at once to output image...</span></div>
-<div class="line"><a name="l00510"></a><span class="lineno">  510</span>     <span class="keywordflow">if</span>(windowBuffer.size()){</div>
-<div class="line"><a name="l00511"></a><span class="lineno">  511</span>       <span class="keywordtype">int</span> randomIndex=std::rand()%windowBuffer.size();</div>
-<div class="line"><a name="l00512"></a><span class="lineno">  512</span>       <span class="keywordflow">if</span>(randomIndex>=windowBuffer.size())</div>
-<div class="line"><a name="l00513"></a><span class="lineno">  513</span>         outBuffer[x/down]=windowBuffer.back();</div>
-<div class="line"><a name="l00514"></a><span class="lineno">  514</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(randomIndex<0)</div>
-<div class="line"><a name="l00515"></a><span class="lineno">  515</span>         outBuffer[x/down]=windowBuffer[0];</div>
-<div class="line"><a name="l00516"></a><span class="lineno">  516</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00517"></a><span class="lineno">  517</span>         outBuffer[x/down]=windowBuffer[randomIndex];</div>
-<div class="line"><a name="l00518"></a><span class="lineno">  518</span>     }</div>
-<div class="line"><a name="l00519"></a><span class="lineno">  519</span>     <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00520"></a><span class="lineno">  520</span>       outBuffer[x/down]=noDataValue;</div>
-<div class="line"><a name="l00521"></a><span class="lineno">  521</span>     <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00522"></a><span class="lineno">  522</span>       }</div>
-<div class="line"><a name="l00523"></a><span class="lineno">  523</span>       <span class="keywordflow">case</span>(filter2d::mixed):{</div>
-<div class="line"><a name="l00524"></a><span class="lineno">  524</span>         <span class="keyword">enum</span> MixType { BF=11, CF=12, MF=13, NF=20, W=30 };</div>
-<div class="line"><a name="l00525"></a><span class="lineno">  525</span>         <span class="keywordtype">double</span> nBF=occurrence[BF];</div>
-<div class="line"><a name="l00526"></a><span class="lineno">  526</span>         <span class="keywordtype">double</span> nCF=occurrence[CF];</div>
-<div class="line"><a name="l00527"></a><span class="lineno">  527</span>         <span class="keywordtype">double</span> nMF=occurrence[MF];</div>
-<div class="line"><a name="l00528"></a><span class="lineno">  528</span>         <span class="keywordtype">double</span> nNF=occurrence[NF];</div>
-<div class="line"><a name="l00529"></a><span class="lineno">  529</span>         <span class="keywordtype">double</span> nW=occurrence[W];</div>
-<div class="line"><a name="l00530"></a><span class="lineno">  530</span>         <span class="keywordflow">if</span>(windowBuffer.size()){</div>
-<div class="line"><a name="l00531"></a><span class="lineno">  531</span>           <span class="keywordflow">if</span>((nBF+nCF+nMF)&&(nBF+nCF+nMF>=nNF+nW)){<span class="comment">//forest</span></div>
-<div class="line"><a name="l00532"></a><span class="lineno">  532</span>             <span class="keywordflow">if</span>(nBF/(nBF+nCF)>=0.75)</div>
-<div class="line"><a name="l00533"></a><span class="lineno">  533</span>               outBuffer[x/down]=BF;</div>
-<div class="line"><a name="l00534"></a><span class="lineno">  534</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(nCF/(nBF+nCF)>=0.75)</div>
-<div class="line"><a name="l00535"></a><span class="lineno">  535</span>               outBuffer[x/down]=CF;</div>
-<div class="line"><a name="l00536"></a><span class="lineno">  536</span>             <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00537"></a><span class="lineno">  537</span>               outBuffer[x/down]=MF;</div>
-<div class="line"><a name="l00538"></a><span class="lineno">  538</span>           }</div>
-<div class="line"><a name="l00539"></a><span class="lineno">  539</span>           <span class="keywordflow">else</span>{<span class="comment">//non-forest</span></div>
-<div class="line"><a name="l00540"></a><span class="lineno">  540</span>             <span class="keywordflow">if</span>(nW&&(nW>=nNF))</div>
-<div class="line"><a name="l00541"></a><span class="lineno">  541</span>               outBuffer[x/down]=W;</div>
-<div class="line"><a name="l00542"></a><span class="lineno">  542</span>             <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00543"></a><span class="lineno">  543</span>               outBuffer[x/down]=NF;</div>
-<div class="line"><a name="l00544"></a><span class="lineno">  544</span>           }</div>
-<div class="line"><a name="l00545"></a><span class="lineno">  545</span>         }</div>
-<div class="line"><a name="l00546"></a><span class="lineno">  546</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00547"></a><span class="lineno">  547</span>           outBuffer[x/down]=inBuffer[indexJ][indexI];</div>
-<div class="line"><a name="l00548"></a><span class="lineno">  548</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00549"></a><span class="lineno">  549</span>       }</div>
-<div class="line"><a name="l00550"></a><span class="lineno">  550</span>       <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l00551"></a><span class="lineno">  551</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00552"></a><span class="lineno">  552</span>       }</div>
-<div class="line"><a name="l00553"></a><span class="lineno">  553</span>     }</div>
-<div class="line"><a name="l00554"></a><span class="lineno">  554</span>     progress=(1.0+y/down);</div>
-<div class="line"><a name="l00555"></a><span class="lineno">  555</span>     progress+=(outputVector.size());</div>
-<div class="line"><a name="l00556"></a><span class="lineno">  556</span>     progress/=outputVector.size();</div>
-<div class="line"><a name="l00557"></a><span class="lineno">  557</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00558"></a><span class="lineno">  558</span>     <span class="comment">//copy outBuffer to outputVector</span></div>
-<div class="line"><a name="l00559"></a><span class="lineno">  559</span>     outputVector[y/down]=outBuffer;</div>
-<div class="line"><a name="l00560"></a><span class="lineno">  560</span>   }</div>
-<div class="line"><a name="l00561"></a><span class="lineno">  561</span> }</div>
-<div class="line"><a name="l00562"></a><span class="lineno">  562</span> </div>
-<div class="line"><a name="l00563"></a><span class="lineno">  563</span> <span class="comment">// class Compare_mapValue{</span></div>
-<div class="line"><a name="l00564"></a><span class="lineno">  564</span> <span class="comment">// public:</span></div>
-<div class="line"><a name="l00565"></a><span class="lineno">  565</span> <span class="comment">//   int operator() (const map<int,int>::value_type& v1, const map<int, int>::value_type& v2) const{</span></div>
-<div class="line"><a name="l00566"></a><span class="lineno">  566</span> <span class="comment">//     return (v1.second)>(v2.second);</span></div>
-<div class="line"><a name="l00567"></a><span class="lineno">  567</span> <span class="comment">//   }</span></div>
-<div class="line"><a name="l00568"></a><span class="lineno">  568</span> <span class="comment">// };</span></div>
-<div class="line"><a name="l00569"></a><span class="lineno">  569</span> </div>
-<div class="line"><a name="l00570"></a><span class="lineno">  570</span> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> Filter2d::shift(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& input, <a class="code" href="classVector2d.html">Vector2d<T></a>& output, <span class="keywordtype">double</span> offsetX, <span class="keywordtype">double</span> o [...]
-<div class="line"><a name="l00571"></a><span class="lineno">  571</span>   output.resize(input.nRows(),input.nCols());</div>
-<div class="line"><a name="l00572"></a><span class="lineno">  572</span>   <span class="keyword">const</span> gsl_rng_type *rangenType;</div>
-<div class="line"><a name="l00573"></a><span class="lineno">  573</span>   gsl_rng *rangen;</div>
-<div class="line"><a name="l00574"></a><span class="lineno">  574</span>   gsl_rng_env_setup();</div>
-<div class="line"><a name="l00575"></a><span class="lineno">  575</span>   rangenType=gsl_rng_default;</div>
-<div class="line"><a name="l00576"></a><span class="lineno">  576</span>   rangen=gsl_rng_alloc(rangenType);</div>
-<div class="line"><a name="l00577"></a><span class="lineno">  577</span>   <span class="keywordtype">long</span> seed=time(NULL)*getpid();</div>
-<div class="line"><a name="l00578"></a><span class="lineno">  578</span>   gsl_rng_set(rangen,seed);</div>
-<div class="line"><a name="l00579"></a><span class="lineno">  579</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l00580"></a><span class="lineno">  580</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l00581"></a><span class="lineno">  581</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l00582"></a><span class="lineno">  582</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l00583"></a><span class="lineno">  583</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00584"></a><span class="lineno">  584</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j<input.nRows();++j){</div>
-<div class="line"><a name="l00585"></a><span class="lineno">  585</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<input.nCols();++i){</div>
-<div class="line"><a name="l00586"></a><span class="lineno">  586</span>       T theValue=0;</div>
-<div class="line"><a name="l00587"></a><span class="lineno">  587</span>       <span class="keywordtype">double</span> randomX=0;</div>
-<div class="line"><a name="l00588"></a><span class="lineno">  588</span>       <span class="keywordtype">double</span> randomY=0;</div>
-<div class="line"><a name="l00589"></a><span class="lineno">  589</span>       <span class="keywordflow">if</span>(randomSigma>0){</div>
-<div class="line"><a name="l00590"></a><span class="lineno">  590</span>         randomX=gsl_ran_gaussian(rangen,randomSigma);</div>
-<div class="line"><a name="l00591"></a><span class="lineno">  591</span>         randomY=gsl_ran_gaussian(rangen,randomSigma);</div>
-<div class="line"><a name="l00592"></a><span class="lineno">  592</span>       }</div>
-<div class="line"><a name="l00593"></a><span class="lineno">  593</span>       <span class="keywordtype">double</span> readCol=i+offsetX+randomX;</div>
-<div class="line"><a name="l00594"></a><span class="lineno">  594</span>       <span class="keywordtype">double</span> readRow=j+offsetY+randomY;</div>
-<div class="line"><a name="l00595"></a><span class="lineno">  595</span>       <span class="keywordflow">if</span>(readRow<0)</div>
-<div class="line"><a name="l00596"></a><span class="lineno">  596</span>         readRow=0;</div>
-<div class="line"><a name="l00597"></a><span class="lineno">  597</span>       <span class="keywordflow">if</span>(readRow>input.nRows()-1)</div>
-<div class="line"><a name="l00598"></a><span class="lineno">  598</span>         readRow=input.nRows()-1;</div>
-<div class="line"><a name="l00599"></a><span class="lineno">  599</span>       <span class="keywordflow">if</span>(readCol<0)</div>
-<div class="line"><a name="l00600"></a><span class="lineno">  600</span>         readCol=0;</div>
-<div class="line"><a name="l00601"></a><span class="lineno">  601</span>       <span class="keywordflow">if</span>(readCol>input.nCols()-1)</div>
-<div class="line"><a name="l00602"></a><span class="lineno">  602</span>         readCol=input.nCols()-1;</div>
-<div class="line"><a name="l00603"></a><span class="lineno">  603</span>       <span class="keywordflow">switch</span>(resample){</div>
-<div class="line"><a name="l00604"></a><span class="lineno">  604</span>       <span class="keywordflow">case</span>(BILINEAR):{</div>
-<div class="line"><a name="l00605"></a><span class="lineno">  605</span>         <span class="keywordtype">double</span> lowerRow=readRow-0.5;</div>
-<div class="line"><a name="l00606"></a><span class="lineno">  606</span>         <span class="keywordtype">double</span> upperRow=readRow+0.5;</div>
-<div class="line"><a name="l00607"></a><span class="lineno">  607</span>         lowerRow=<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(lowerRow);</div>
-<div class="line"><a name="l00608"></a><span class="lineno">  608</span>         upperRow=<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(upperRow);</div>
-<div class="line"><a name="l00609"></a><span class="lineno">  609</span>         <span class="keywordtype">double</span> lowerCol=readCol-0.5;</div>
-<div class="line"><a name="l00610"></a><span class="lineno">  610</span>         <span class="keywordtype">double</span> upperCol=readCol+0.5;</div>
-<div class="line"><a name="l00611"></a><span class="lineno">  611</span>         lowerCol=<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(lowerCol);</div>
-<div class="line"><a name="l00612"></a><span class="lineno">  612</span>         upperCol=<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(upperCol);</div>
-<div class="line"><a name="l00613"></a><span class="lineno">  613</span>         assert(lowerRow>=0);</div>
-<div class="line"><a name="l00614"></a><span class="lineno">  614</span>         assert(lowerRow<input.nRows());</div>
-<div class="line"><a name="l00615"></a><span class="lineno">  615</span>         assert(lowerCol>=0);</div>
-<div class="line"><a name="l00616"></a><span class="lineno">  616</span>         assert(lowerCol<input.nCols());</div>
-<div class="line"><a name="l00617"></a><span class="lineno">  617</span>         assert(upperRow>=0);</div>
-<div class="line"><a name="l00618"></a><span class="lineno">  618</span>         assert(upperRow<input.nRows());</div>
-<div class="line"><a name="l00619"></a><span class="lineno">  619</span>         assert(upperCol>=0);</div>
-<div class="line"><a name="l00620"></a><span class="lineno">  620</span>         <span class="keywordflow">if</span>(upperCol>=input.nCols()){</div>
-<div class="line"><a name="l00621"></a><span class="lineno">  621</span>           std::cout << <span class="stringliteral">"upperCol: "</span> << upperCol << std::endl;</div>
-<div class="line"><a name="l00622"></a><span class="lineno">  622</span>           std::cout << <span class="stringliteral">"readCol: "</span> << readCol << std::endl;</div>
-<div class="line"><a name="l00623"></a><span class="lineno">  623</span>           std::cout << <span class="stringliteral">"readCol+0.5: "</span> << readCol+0.5 << std::endl;</div>
-<div class="line"><a name="l00624"></a><span class="lineno">  624</span>           std::cout << <span class="stringliteral">"static_cast<int>(readCol+0.5): "</span> << <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(readCol+0.5) << std::endl;</div>
-<div class="line"><a name="l00625"></a><span class="lineno">  625</span>         }</div>
-<div class="line"><a name="l00626"></a><span class="lineno">  626</span>         assert(upperCol<input.nCols());</div>
-<div class="line"><a name="l00627"></a><span class="lineno">  627</span>         <span class="keywordtype">double</span> c00=input[lowerRow][lowerCol];</div>
-<div class="line"><a name="l00628"></a><span class="lineno">  628</span>         <span class="keywordtype">double</span> c11=input[upperRow][upperCol];</div>
-<div class="line"><a name="l00629"></a><span class="lineno">  629</span>         <span class="keywordtype">double</span> c01=input[lowerRow][upperCol];</div>
-<div class="line"><a name="l00630"></a><span class="lineno">  630</span>         <span class="keywordtype">double</span> c10=input[upperRow][lowerCol];</div>
-<div class="line"><a name="l00631"></a><span class="lineno">  631</span>         <span class="keywordtype">double</span> a=(upperCol-readCol)*c00+(readCol-lowerCol)*c01;</div>
-<div class="line"><a name="l00632"></a><span class="lineno">  632</span>         <span class="keywordtype">double</span> b=(upperCol-readCol)*c10+(readCol-lowerCol)*c11;</div>
-<div class="line"><a name="l00633"></a><span class="lineno">  633</span>         theValue=(upperRow-readRow)*a+(readRow-lowerRow)*b;</div>
-<div class="line"><a name="l00634"></a><span class="lineno">  634</span>         <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00635"></a><span class="lineno">  635</span>       }</div>
-<div class="line"><a name="l00636"></a><span class="lineno">  636</span>       <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l00637"></a><span class="lineno">  637</span>         theValue=input[<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(readRow)][static_cast<int>(readCol)];</div>
+<div class="line"><a name="l00430"></a><span class="lineno">  430</span>       <span class="keywordflow">case</span>(filter2d::sum):{</div>
+<div class="line"><a name="l00431"></a><span class="lineno">  431</span>         outBuffer[x/down]=stat.sum(windowBuffer);</div>
+<div class="line"><a name="l00432"></a><span class="lineno">  432</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00433"></a><span class="lineno">  433</span>       }</div>
+<div class="line"><a name="l00434"></a><span class="lineno">  434</span>       <span class="keywordflow">case</span>(filter2d::percentile):{</div>
+<div class="line"><a name="l00435"></a><span class="lineno">  435</span>     assert(m_threshold.size());</div>
+<div class="line"><a name="l00436"></a><span class="lineno">  436</span>         outBuffer[x/down]=stat.percentile(windowBuffer,windowBuffer.begin(),windowBuffer.end(),m_threshold[0]);</div>
+<div class="line"><a name="l00437"></a><span class="lineno">  437</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00438"></a><span class="lineno">  438</span>       }</div>
+<div class="line"><a name="l00439"></a><span class="lineno">  439</span>       <span class="keywordflow">case</span>(filter2d::proportion):{</div>
+<div class="line"><a name="l00440"></a><span class="lineno">  440</span>     assert(m_threshold.size());</div>
+<div class="line"><a name="l00441"></a><span class="lineno">  441</span>     <span class="keywordtype">double</span> sum=stat.sum(windowBuffer);</div>
+<div class="line"><a name="l00442"></a><span class="lineno">  442</span>     <span class="keywordflow">if</span>(sum)</div>
+<div class="line"><a name="l00443"></a><span class="lineno">  443</span>       outBuffer[x/down]=windowBuffer[centre]/sum;</div>
+<div class="line"><a name="l00444"></a><span class="lineno">  444</span>     <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00445"></a><span class="lineno">  445</span>       outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00446"></a><span class="lineno">  446</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00447"></a><span class="lineno">  447</span>       }</div>
+<div class="line"><a name="l00448"></a><span class="lineno">  448</span>       <span class="keywordflow">case</span>(filter2d::homog):</div>
+<div class="line"><a name="l00449"></a><span class="lineno">  449</span>         <span class="keywordflow">if</span>(occurrence.size()==1)<span class="comment">//all values in window must be the same</span></div>
+<div class="line"><a name="l00450"></a><span class="lineno">  450</span>           outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l00451"></a><span class="lineno">  451</span>         <span class="keywordflow">else</span><span class="comment">//favorize original value in case of ties</span></div>
+<div class="line"><a name="l00452"></a><span class="lineno">  452</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00453"></a><span class="lineno">  453</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00454"></a><span class="lineno">  454</span>       <span class="keywordflow">case</span>(filter2d::heterog):{</div>
+<div class="line"><a name="l00455"></a><span class="lineno">  455</span>         <span class="keywordflow">for</span>(std::vector<double>::const_iterator wit=windowBuffer.begin();wit!=windowBuffer.end();++wit){</div>
+<div class="line"><a name="l00456"></a><span class="lineno">  456</span>           <span class="keywordflow">if</span>(wit==windowBuffer.begin()+windowBuffer.size()/2)</div>
+<div class="line"><a name="l00457"></a><span class="lineno">  457</span>             <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l00458"></a><span class="lineno">  458</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(*wit!=inBuffer[(dimY-1)/2][x])</div>
+<div class="line"><a name="l00459"></a><span class="lineno">  459</span>             outBuffer[x/down]=1;</div>
+<div class="line"><a name="l00460"></a><span class="lineno">  460</span>           <span class="keywordflow">else</span> <span class="keywordflow">if</span>(*wit==inBuffer[(dimY-1)/2][x]){<span class="comment">//todo:wit mag niet central pixel zijn</span></div>
+<div class="line"><a name="l00461"></a><span class="lineno">  461</span>             outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00462"></a><span class="lineno">  462</span>             <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00463"></a><span class="lineno">  463</span>           }</div>
+<div class="line"><a name="l00464"></a><span class="lineno">  464</span>         }</div>
+<div class="line"><a name="l00465"></a><span class="lineno">  465</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00466"></a><span class="lineno">  466</span>       }</div>
+<div class="line"><a name="l00467"></a><span class="lineno">  467</span>       <span class="keywordflow">case</span>(filter2d::density):{</div>
+<div class="line"><a name="l00468"></a><span class="lineno">  468</span>         <span class="keywordflow">if</span>(windowBuffer.size()){</div>
+<div class="line"><a name="l00469"></a><span class="lineno">  469</span>           std::vector<short>::const_iterator vit=m_class.begin();</div>
+<div class="line"><a name="l00470"></a><span class="lineno">  470</span>           <span class="keywordflow">while</span>(vit!=m_class.end())</div>
+<div class="line"><a name="l00471"></a><span class="lineno">  471</span>             outBuffer[x/down]+=100.0*occurrence[*(vit++)]/windowBuffer.size();</div>
+<div class="line"><a name="l00472"></a><span class="lineno">  472</span>         }</div>
+<div class="line"><a name="l00473"></a><span class="lineno">  473</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00474"></a><span class="lineno">  474</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00475"></a><span class="lineno">  475</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00476"></a><span class="lineno">  476</span>       }</div>
+<div class="line"><a name="l00477"></a><span class="lineno">  477</span>       <span class="keywordflow">case</span>(filter2d::countid):{</div>
+<div class="line"><a name="l00478"></a><span class="lineno">  478</span>     <span class="keywordflow">if</span>(windowBuffer.size())</div>
+<div class="line"><a name="l00479"></a><span class="lineno">  479</span>       outBuffer[x/down]=occurrence.size();</div>
+<div class="line"><a name="l00480"></a><span class="lineno">  480</span>     <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00481"></a><span class="lineno">  481</span>       outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00482"></a><span class="lineno">  482</span>     <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00483"></a><span class="lineno">  483</span>       }</div>
+<div class="line"><a name="l00484"></a><span class="lineno">  484</span>       <span class="keywordflow">case</span>(filter2d::mode):{</div>
+<div class="line"><a name="l00485"></a><span class="lineno">  485</span>         <span class="keywordflow">if</span>(occurrence.size()){</div>
+<div class="line"><a name="l00486"></a><span class="lineno">  486</span>           std::map<int,int>::const_iterator maxit=occurrence.begin();</div>
+<div class="line"><a name="l00487"></a><span class="lineno">  487</span>           <span class="keywordflow">for</span>(std::map<int,int>::const_iterator mit=occurrence.begin();mit!=occurrence.end();++mit){</div>
+<div class="line"><a name="l00488"></a><span class="lineno">  488</span>             <span class="keywordflow">if</span>(mit->second>maxit->second)</div>
+<div class="line"><a name="l00489"></a><span class="lineno">  489</span>               maxit=mit;</div>
+<div class="line"><a name="l00490"></a><span class="lineno">  490</span>           }</div>
+<div class="line"><a name="l00491"></a><span class="lineno">  491</span>           <span class="keywordflow">if</span>(occurrence[inBuffer[(dimY-1)/2][x]]<maxit->second)<span class="comment">//</span></div>
+<div class="line"><a name="l00492"></a><span class="lineno">  492</span>             outBuffer[x/down]=maxit->first;</div>
+<div class="line"><a name="l00493"></a><span class="lineno">  493</span>           <span class="keywordflow">else</span><span class="comment">//favorize original value in case of ties</span></div>
+<div class="line"><a name="l00494"></a><span class="lineno">  494</span>             outBuffer[x/down]=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l00495"></a><span class="lineno">  495</span>         }</div>
+<div class="line"><a name="l00496"></a><span class="lineno">  496</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00497"></a><span class="lineno">  497</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00498"></a><span class="lineno">  498</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00499"></a><span class="lineno">  499</span>       }</div>
+<div class="line"><a name="l00500"></a><span class="lineno">  500</span>       <span class="keywordflow">case</span>(filter2d::threshold):{</div>
+<div class="line"><a name="l00501"></a><span class="lineno">  501</span>         assert(m_class.size()==m_threshold.size());</div>
+<div class="line"><a name="l00502"></a><span class="lineno">  502</span>         <span class="keywordflow">if</span>(windowBuffer.size()){</div>
+<div class="line"><a name="l00503"></a><span class="lineno">  503</span>           outBuffer[x/down]=inBuffer[(dimY-1)/2][x];<span class="comment">//initialize with original value (in case thresholds not met)</span></div>
+<div class="line"><a name="l00504"></a><span class="lineno">  504</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
+<div class="line"><a name="l00505"></a><span class="lineno">  505</span>             <span class="keywordflow">if</span>(100.0*(occurrence[m_class[iclass]])/windowBuffer.size()>m_threshold[iclass])</div>
+<div class="line"><a name="l00506"></a><span class="lineno">  506</span>               outBuffer[x/down]=m_class[iclass];</div>
+<div class="line"><a name="l00507"></a><span class="lineno">  507</span>           }</div>
+<div class="line"><a name="l00508"></a><span class="lineno">  508</span>         }</div>
+<div class="line"><a name="l00509"></a><span class="lineno">  509</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00510"></a><span class="lineno">  510</span>           outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00511"></a><span class="lineno">  511</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00512"></a><span class="lineno">  512</span>       }</div>
+<div class="line"><a name="l00513"></a><span class="lineno">  513</span>       <span class="keywordflow">case</span>(filter2d::scramble):{<span class="comment">//could be done more efficiently window by window with random shuffling entire buffer and assigning entire buffer at once to output image...</span></div>
+<div class="line"><a name="l00514"></a><span class="lineno">  514</span>     <span class="keywordflow">if</span>(windowBuffer.size()){</div>
+<div class="line"><a name="l00515"></a><span class="lineno">  515</span>       <span class="keywordtype">int</span> randomIndex=std::rand()%windowBuffer.size();</div>
+<div class="line"><a name="l00516"></a><span class="lineno">  516</span>       <span class="keywordflow">if</span>(randomIndex>=windowBuffer.size())</div>
+<div class="line"><a name="l00517"></a><span class="lineno">  517</span>         outBuffer[x/down]=windowBuffer.back();</div>
+<div class="line"><a name="l00518"></a><span class="lineno">  518</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(randomIndex<0)</div>
+<div class="line"><a name="l00519"></a><span class="lineno">  519</span>         outBuffer[x/down]=windowBuffer[0];</div>
+<div class="line"><a name="l00520"></a><span class="lineno">  520</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00521"></a><span class="lineno">  521</span>         outBuffer[x/down]=windowBuffer[randomIndex];</div>
+<div class="line"><a name="l00522"></a><span class="lineno">  522</span>     }</div>
+<div class="line"><a name="l00523"></a><span class="lineno">  523</span>     <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00524"></a><span class="lineno">  524</span>       outBuffer[x/down]=noDataValue;</div>
+<div class="line"><a name="l00525"></a><span class="lineno">  525</span>     <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00526"></a><span class="lineno">  526</span>       }</div>
+<div class="line"><a name="l00527"></a><span class="lineno">  527</span>       <span class="keywordflow">case</span>(filter2d::mixed):{</div>
+<div class="line"><a name="l00528"></a><span class="lineno">  528</span>         <span class="keyword">enum</span> MixType { BF=11, CF=12, MF=13, NF=20, W=30 };</div>
+<div class="line"><a name="l00529"></a><span class="lineno">  529</span>         <span class="keywordtype">double</span> nBF=occurrence[BF];</div>
+<div class="line"><a name="l00530"></a><span class="lineno">  530</span>         <span class="keywordtype">double</span> nCF=occurrence[CF];</div>
+<div class="line"><a name="l00531"></a><span class="lineno">  531</span>         <span class="keywordtype">double</span> nMF=occurrence[MF];</div>
+<div class="line"><a name="l00532"></a><span class="lineno">  532</span>         <span class="keywordtype">double</span> nNF=occurrence[NF];</div>
+<div class="line"><a name="l00533"></a><span class="lineno">  533</span>         <span class="keywordtype">double</span> nW=occurrence[W];</div>
+<div class="line"><a name="l00534"></a><span class="lineno">  534</span>         <span class="keywordflow">if</span>(windowBuffer.size()){</div>
+<div class="line"><a name="l00535"></a><span class="lineno">  535</span>           <span class="keywordflow">if</span>((nBF+nCF+nMF)&&(nBF+nCF+nMF>=nNF+nW)){<span class="comment">//forest</span></div>
+<div class="line"><a name="l00536"></a><span class="lineno">  536</span>             <span class="keywordflow">if</span>(nBF/(nBF+nCF)>=0.75)</div>
+<div class="line"><a name="l00537"></a><span class="lineno">  537</span>               outBuffer[x/down]=BF;</div>
+<div class="line"><a name="l00538"></a><span class="lineno">  538</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(nCF/(nBF+nCF)>=0.75)</div>
+<div class="line"><a name="l00539"></a><span class="lineno">  539</span>               outBuffer[x/down]=CF;</div>
+<div class="line"><a name="l00540"></a><span class="lineno">  540</span>             <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00541"></a><span class="lineno">  541</span>               outBuffer[x/down]=MF;</div>
+<div class="line"><a name="l00542"></a><span class="lineno">  542</span>           }</div>
+<div class="line"><a name="l00543"></a><span class="lineno">  543</span>           <span class="keywordflow">else</span>{<span class="comment">//non-forest</span></div>
+<div class="line"><a name="l00544"></a><span class="lineno">  544</span>             <span class="keywordflow">if</span>(nW&&(nW>=nNF))</div>
+<div class="line"><a name="l00545"></a><span class="lineno">  545</span>               outBuffer[x/down]=W;</div>
+<div class="line"><a name="l00546"></a><span class="lineno">  546</span>             <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00547"></a><span class="lineno">  547</span>               outBuffer[x/down]=NF;</div>
+<div class="line"><a name="l00548"></a><span class="lineno">  548</span>           }</div>
+<div class="line"><a name="l00549"></a><span class="lineno">  549</span>         }</div>
+<div class="line"><a name="l00550"></a><span class="lineno">  550</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00551"></a><span class="lineno">  551</span>           outBuffer[x/down]=inBuffer[indexJ][indexI];</div>
+<div class="line"><a name="l00552"></a><span class="lineno">  552</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00553"></a><span class="lineno">  553</span>       }</div>
+<div class="line"><a name="l00554"></a><span class="lineno">  554</span>       <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l00555"></a><span class="lineno">  555</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00556"></a><span class="lineno">  556</span>       }</div>
+<div class="line"><a name="l00557"></a><span class="lineno">  557</span>     }</div>
+<div class="line"><a name="l00558"></a><span class="lineno">  558</span>     progress=(1.0+y/down);</div>
+<div class="line"><a name="l00559"></a><span class="lineno">  559</span>     progress+=(outputVector.size());</div>
+<div class="line"><a name="l00560"></a><span class="lineno">  560</span>     progress/=outputVector.size();</div>
+<div class="line"><a name="l00561"></a><span class="lineno">  561</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00562"></a><span class="lineno">  562</span>     <span class="comment">//copy outBuffer to outputVector</span></div>
+<div class="line"><a name="l00563"></a><span class="lineno">  563</span>     outputVector[y/down]=outBuffer;</div>
+<div class="line"><a name="l00564"></a><span class="lineno">  564</span>   }</div>
+<div class="line"><a name="l00565"></a><span class="lineno">  565</span> }</div>
+<div class="line"><a name="l00566"></a><span class="lineno">  566</span> </div>
+<div class="line"><a name="l00567"></a><span class="lineno">  567</span> <span class="comment">// class Compare_mapValue{</span></div>
+<div class="line"><a name="l00568"></a><span class="lineno">  568</span> <span class="comment">// public:</span></div>
+<div class="line"><a name="l00569"></a><span class="lineno">  569</span> <span class="comment">//   int operator() (const map<int,int>::value_type& v1, const map<int, int>::value_type& v2) const{</span></div>
+<div class="line"><a name="l00570"></a><span class="lineno">  570</span> <span class="comment">//     return (v1.second)>(v2.second);</span></div>
+<div class="line"><a name="l00571"></a><span class="lineno">  571</span> <span class="comment">//   }</span></div>
+<div class="line"><a name="l00572"></a><span class="lineno">  572</span> <span class="comment">// };</span></div>
+<div class="line"><a name="l00573"></a><span class="lineno">  573</span> </div>
+<div class="line"><a name="l00574"></a><span class="lineno">  574</span> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> Filter2d::shift(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& input, <a class="code" href="classVector2d.html">Vector2d<T></a>& output, <span class="keywordtype">double</span> offsetX, <span class="keywordtype">double</span> o [...]
+<div class="line"><a name="l00575"></a><span class="lineno">  575</span>   output.resize(input.nRows(),input.nCols());</div>
+<div class="line"><a name="l00576"></a><span class="lineno">  576</span>   <span class="keyword">const</span> gsl_rng_type *rangenType;</div>
+<div class="line"><a name="l00577"></a><span class="lineno">  577</span>   gsl_rng *rangen;</div>
+<div class="line"><a name="l00578"></a><span class="lineno">  578</span>   gsl_rng_env_setup();</div>
+<div class="line"><a name="l00579"></a><span class="lineno">  579</span>   rangenType=gsl_rng_default;</div>
+<div class="line"><a name="l00580"></a><span class="lineno">  580</span>   rangen=gsl_rng_alloc(rangenType);</div>
+<div class="line"><a name="l00581"></a><span class="lineno">  581</span>   <span class="keywordtype">long</span> seed=time(NULL)*getpid();</div>
+<div class="line"><a name="l00582"></a><span class="lineno">  582</span>   gsl_rng_set(rangen,seed);</div>
+<div class="line"><a name="l00583"></a><span class="lineno">  583</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l00584"></a><span class="lineno">  584</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l00585"></a><span class="lineno">  585</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l00586"></a><span class="lineno">  586</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l00587"></a><span class="lineno">  587</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00588"></a><span class="lineno">  588</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0;j<input.nRows();++j){</div>
+<div class="line"><a name="l00589"></a><span class="lineno">  589</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<input.nCols();++i){</div>
+<div class="line"><a name="l00590"></a><span class="lineno">  590</span>       T theValue=0;</div>
+<div class="line"><a name="l00591"></a><span class="lineno">  591</span>       <span class="keywordtype">double</span> randomX=0;</div>
+<div class="line"><a name="l00592"></a><span class="lineno">  592</span>       <span class="keywordtype">double</span> randomY=0;</div>
+<div class="line"><a name="l00593"></a><span class="lineno">  593</span>       <span class="keywordflow">if</span>(randomSigma>0){</div>
+<div class="line"><a name="l00594"></a><span class="lineno">  594</span>         randomX=gsl_ran_gaussian(rangen,randomSigma);</div>
+<div class="line"><a name="l00595"></a><span class="lineno">  595</span>         randomY=gsl_ran_gaussian(rangen,randomSigma);</div>
+<div class="line"><a name="l00596"></a><span class="lineno">  596</span>       }</div>
+<div class="line"><a name="l00597"></a><span class="lineno">  597</span>       <span class="keywordtype">double</span> readCol=i+offsetX+randomX;</div>
+<div class="line"><a name="l00598"></a><span class="lineno">  598</span>       <span class="keywordtype">double</span> readRow=j+offsetY+randomY;</div>
+<div class="line"><a name="l00599"></a><span class="lineno">  599</span>       <span class="keywordflow">if</span>(readRow<0)</div>
+<div class="line"><a name="l00600"></a><span class="lineno">  600</span>         readRow=0;</div>
+<div class="line"><a name="l00601"></a><span class="lineno">  601</span>       <span class="keywordflow">if</span>(readRow>input.nRows()-1)</div>
+<div class="line"><a name="l00602"></a><span class="lineno">  602</span>         readRow=input.nRows()-1;</div>
+<div class="line"><a name="l00603"></a><span class="lineno">  603</span>       <span class="keywordflow">if</span>(readCol<0)</div>
+<div class="line"><a name="l00604"></a><span class="lineno">  604</span>         readCol=0;</div>
+<div class="line"><a name="l00605"></a><span class="lineno">  605</span>       <span class="keywordflow">if</span>(readCol>input.nCols()-1)</div>
+<div class="line"><a name="l00606"></a><span class="lineno">  606</span>         readCol=input.nCols()-1;</div>
+<div class="line"><a name="l00607"></a><span class="lineno">  607</span>       <span class="keywordflow">switch</span>(resample){</div>
+<div class="line"><a name="l00608"></a><span class="lineno">  608</span>       <span class="keywordflow">case</span>(BILINEAR):{</div>
+<div class="line"><a name="l00609"></a><span class="lineno">  609</span>         <span class="keywordtype">double</span> lowerRow=readRow-0.5;</div>
+<div class="line"><a name="l00610"></a><span class="lineno">  610</span>         <span class="keywordtype">double</span> upperRow=readRow+0.5;</div>
+<div class="line"><a name="l00611"></a><span class="lineno">  611</span>         lowerRow=<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(lowerRow);</div>
+<div class="line"><a name="l00612"></a><span class="lineno">  612</span>         upperRow=<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(upperRow);</div>
+<div class="line"><a name="l00613"></a><span class="lineno">  613</span>         <span class="keywordtype">double</span> lowerCol=readCol-0.5;</div>
+<div class="line"><a name="l00614"></a><span class="lineno">  614</span>         <span class="keywordtype">double</span> upperCol=readCol+0.5;</div>
+<div class="line"><a name="l00615"></a><span class="lineno">  615</span>         lowerCol=<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(lowerCol);</div>
+<div class="line"><a name="l00616"></a><span class="lineno">  616</span>         upperCol=<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(upperCol);</div>
+<div class="line"><a name="l00617"></a><span class="lineno">  617</span>         assert(lowerRow>=0);</div>
+<div class="line"><a name="l00618"></a><span class="lineno">  618</span>         assert(lowerRow<input.nRows());</div>
+<div class="line"><a name="l00619"></a><span class="lineno">  619</span>         assert(lowerCol>=0);</div>
+<div class="line"><a name="l00620"></a><span class="lineno">  620</span>         assert(lowerCol<input.nCols());</div>
+<div class="line"><a name="l00621"></a><span class="lineno">  621</span>         assert(upperRow>=0);</div>
+<div class="line"><a name="l00622"></a><span class="lineno">  622</span>         assert(upperRow<input.nRows());</div>
+<div class="line"><a name="l00623"></a><span class="lineno">  623</span>         assert(upperCol>=0);</div>
+<div class="line"><a name="l00624"></a><span class="lineno">  624</span>         <span class="keywordflow">if</span>(upperCol>=input.nCols()){</div>
+<div class="line"><a name="l00625"></a><span class="lineno">  625</span>           std::cout << <span class="stringliteral">"upperCol: "</span> << upperCol << std::endl;</div>
+<div class="line"><a name="l00626"></a><span class="lineno">  626</span>           std::cout << <span class="stringliteral">"readCol: "</span> << readCol << std::endl;</div>
+<div class="line"><a name="l00627"></a><span class="lineno">  627</span>           std::cout << <span class="stringliteral">"readCol+0.5: "</span> << readCol+0.5 << std::endl;</div>
+<div class="line"><a name="l00628"></a><span class="lineno">  628</span>           std::cout << <span class="stringliteral">"static_cast<int>(readCol+0.5): "</span> << <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(readCol+0.5) << std::endl;</div>
+<div class="line"><a name="l00629"></a><span class="lineno">  629</span>         }</div>
+<div class="line"><a name="l00630"></a><span class="lineno">  630</span>         assert(upperCol<input.nCols());</div>
+<div class="line"><a name="l00631"></a><span class="lineno">  631</span>         <span class="keywordtype">double</span> c00=input[lowerRow][lowerCol];</div>
+<div class="line"><a name="l00632"></a><span class="lineno">  632</span>         <span class="keywordtype">double</span> c11=input[upperRow][upperCol];</div>
+<div class="line"><a name="l00633"></a><span class="lineno">  633</span>         <span class="keywordtype">double</span> c01=input[lowerRow][upperCol];</div>
+<div class="line"><a name="l00634"></a><span class="lineno">  634</span>         <span class="keywordtype">double</span> c10=input[upperRow][lowerCol];</div>
+<div class="line"><a name="l00635"></a><span class="lineno">  635</span>         <span class="keywordtype">double</span> a=(upperCol-readCol)*c00+(readCol-lowerCol)*c01;</div>
+<div class="line"><a name="l00636"></a><span class="lineno">  636</span>         <span class="keywordtype">double</span> b=(upperCol-readCol)*c10+(readCol-lowerCol)*c11;</div>
+<div class="line"><a name="l00637"></a><span class="lineno">  637</span>         theValue=(upperRow-readRow)*a+(readRow-lowerRow)*b;</div>
 <div class="line"><a name="l00638"></a><span class="lineno">  638</span>         <span class="keywordflow">break</span>;</div>
 <div class="line"><a name="l00639"></a><span class="lineno">  639</span>       }</div>
-<div class="line"><a name="l00640"></a><span class="lineno">  640</span>       assert(j>=0);</div>
-<div class="line"><a name="l00641"></a><span class="lineno">  641</span>       assert(j<output.nRows());</div>
-<div class="line"><a name="l00642"></a><span class="lineno">  642</span>       assert(i>=0);</div>
-<div class="line"><a name="l00643"></a><span class="lineno">  643</span>       assert(i<output.nCols());</div>
-<div class="line"><a name="l00644"></a><span class="lineno">  644</span>       output[j][i]=theValue;</div>
-<div class="line"><a name="l00645"></a><span class="lineno">  645</span>     }</div>
-<div class="line"><a name="l00646"></a><span class="lineno">  646</span>     progress=(1.0+j);</div>
-<div class="line"><a name="l00647"></a><span class="lineno">  647</span>     progress/=output.nRows();</div>
-<div class="line"><a name="l00648"></a><span class="lineno">  648</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00649"></a><span class="lineno">  649</span>   }</div>
-<div class="line"><a name="l00650"></a><span class="lineno">  650</span>   gsl_rng_free(rangen);</div>
-<div class="line"><a name="l00651"></a><span class="lineno">  651</span> }</div>
-<div class="line"><a name="l00652"></a><span class="lineno">  652</span> </div>
-<div class="line"><a name="l00653"></a><span class="lineno">  653</span> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> Filter2d::morphology(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& input, <a class="code" href="classVector2d.html">Vector2d<T></a>& output, <span  [...]
-<div class="line"><a name="l00654"></a><span class="lineno">  654</span> {</div>
-<div class="line"><a name="l00655"></a><span class="lineno">  655</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l00656"></a><span class="lineno">  656</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l00657"></a><span class="lineno">  657</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l00658"></a><span class="lineno">  658</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l00659"></a><span class="lineno">  659</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00660"></a><span class="lineno">  660</span> </div>
-<div class="line"><a name="l00661"></a><span class="lineno">  661</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
-<div class="line"><a name="l00662"></a><span class="lineno">  662</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
-<div class="line"><a name="l00663"></a><span class="lineno">  663</span>     noDataValue=m_noDataValues[0];</div>
+<div class="line"><a name="l00640"></a><span class="lineno">  640</span>       <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l00641"></a><span class="lineno">  641</span>         theValue=input[<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(readRow)][static_cast<int>(readCol)];</div>
+<div class="line"><a name="l00642"></a><span class="lineno">  642</span>         <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00643"></a><span class="lineno">  643</span>       }</div>
+<div class="line"><a name="l00644"></a><span class="lineno">  644</span>       assert(j>=0);</div>
+<div class="line"><a name="l00645"></a><span class="lineno">  645</span>       assert(j<output.nRows());</div>
+<div class="line"><a name="l00646"></a><span class="lineno">  646</span>       assert(i>=0);</div>
+<div class="line"><a name="l00647"></a><span class="lineno">  647</span>       assert(i<output.nCols());</div>
+<div class="line"><a name="l00648"></a><span class="lineno">  648</span>       output[j][i]=theValue;</div>
+<div class="line"><a name="l00649"></a><span class="lineno">  649</span>     }</div>
+<div class="line"><a name="l00650"></a><span class="lineno">  650</span>     progress=(1.0+j);</div>
+<div class="line"><a name="l00651"></a><span class="lineno">  651</span>     progress/=output.nRows();</div>
+<div class="line"><a name="l00652"></a><span class="lineno">  652</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00653"></a><span class="lineno">  653</span>   }</div>
+<div class="line"><a name="l00654"></a><span class="lineno">  654</span>   gsl_rng_free(rangen);</div>
+<div class="line"><a name="l00655"></a><span class="lineno">  655</span> }</div>
+<div class="line"><a name="l00656"></a><span class="lineno">  656</span> </div>
+<div class="line"><a name="l00657"></a><span class="lineno">  657</span> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> Filter2d::morphology(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& input, <a class="code" href="classVector2d.html">Vector2d<T></a>& output, <span  [...]
+<div class="line"><a name="l00658"></a><span class="lineno">  658</span> {</div>
+<div class="line"><a name="l00659"></a><span class="lineno">  659</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l00660"></a><span class="lineno">  660</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l00661"></a><span class="lineno">  661</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l00662"></a><span class="lineno">  662</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l00663"></a><span class="lineno">  663</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
 <div class="line"><a name="l00664"></a><span class="lineno">  664</span> </div>
-<div class="line"><a name="l00665"></a><span class="lineno">  665</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nchange=0;</div>
-<div class="line"><a name="l00666"></a><span class="lineno">  666</span>   assert(dimX);</div>
-<div class="line"><a name="l00667"></a><span class="lineno">  667</span>   assert(dimY);</div>
-<div class="line"><a name="l00668"></a><span class="lineno">  668</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
-<div class="line"><a name="l00669"></a><span class="lineno">  669</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> inBuffer(dimY,input.nCols());</div>
-<div class="line"><a name="l00670"></a><span class="lineno">  670</span>   output.clear();</div>
-<div class="line"><a name="l00671"></a><span class="lineno">  671</span>   output.resize(input.nRows(),input.nCols());</div>
-<div class="line"><a name="l00672"></a><span class="lineno">  672</span>   <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l00673"></a><span class="lineno">  673</span>   <span class="keywordtype">int</span> indexJ=0;</div>
-<div class="line"><a name="l00674"></a><span class="lineno">  674</span>   <span class="comment">//initialize last half of inBuffer</span></div>
-<div class="line"><a name="l00675"></a><span class="lineno">  675</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00676"></a><span class="lineno">  676</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<input.nCols();++i)</div>
-<div class="line"><a name="l00677"></a><span class="lineno">  677</span>       inBuffer[indexJ][i]=input[abs(j)][i];</div>
-<div class="line"><a name="l00678"></a><span class="lineno">  678</span>     ++indexJ;</div>
-<div class="line"><a name="l00679"></a><span class="lineno">  679</span>   }</div>
-<div class="line"><a name="l00680"></a><span class="lineno">  680</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nRows();++y){</div>
-<div class="line"><a name="l00681"></a><span class="lineno">  681</span>     <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
-<div class="line"><a name="l00682"></a><span class="lineno">  682</span>       <span class="comment">//erase first line from inBuffer</span></div>
-<div class="line"><a name="l00683"></a><span class="lineno">  683</span>       inBuffer.erase(inBuffer.begin());</div>
-<div class="line"><a name="l00684"></a><span class="lineno">  684</span>       <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
-<div class="line"><a name="l00685"></a><span class="lineno">  685</span>       <span class="keywordflow">if</span>(y+dimY/2<input.nRows()){</div>
-<div class="line"><a name="l00686"></a><span class="lineno">  686</span>         <span class="comment">//allocate buffer</span></div>
-<div class="line"><a name="l00687"></a><span class="lineno">  687</span>         inBuffer.push_back(inBuffer.back());</div>
-<div class="line"><a name="l00688"></a><span class="lineno">  688</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<input.nCols();++i)</div>
-<div class="line"><a name="l00689"></a><span class="lineno">  689</span>           inBuffer[inBuffer.size()-1][i]=input[y+dimY/2][i];</div>
-<div class="line"><a name="l00690"></a><span class="lineno">  690</span>       }</div>
-<div class="line"><a name="l00691"></a><span class="lineno">  691</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00692"></a><span class="lineno">  692</span>         <span class="keywordtype">int</span> over=y+dimY/2-input.nRows();</div>
-<div class="line"><a name="l00693"></a><span class="lineno">  693</span>         <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
-<div class="line"><a name="l00694"></a><span class="lineno">  694</span>         assert(index>=0);</div>
-<div class="line"><a name="l00695"></a><span class="lineno">  695</span>         assert(index<inBuffer.size());</div>
-<div class="line"><a name="l00696"></a><span class="lineno">  696</span>         inBuffer.push_back(inBuffer[index]);</div>
-<div class="line"><a name="l00697"></a><span class="lineno">  697</span>       }</div>
-<div class="line"><a name="l00698"></a><span class="lineno">  698</span>     }</div>
-<div class="line"><a name="l00699"></a><span class="lineno">  699</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nCols();++x){</div>
-<div class="line"><a name="l00700"></a><span class="lineno">  700</span>       output[y][x]=0;</div>
-<div class="line"><a name="l00701"></a><span class="lineno">  701</span>       <span class="keywordtype">double</span> currentValue=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l00702"></a><span class="lineno">  702</span>       std::vector<double> statBuffer;</div>
-<div class="line"><a name="l00703"></a><span class="lineno">  703</span>       <span class="keywordtype">bool</span> currentMasked=<span class="keyword">false</span>;</div>
-<div class="line"><a name="l00704"></a><span class="lineno">  704</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
-<div class="line"><a name="l00705"></a><span class="lineno">  705</span>         <span class="keywordflow">if</span>(currentValue==m_noDataValues[imask]){</div>
-<div class="line"><a name="l00706"></a><span class="lineno">  706</span>           currentMasked=<span class="keyword">true</span>;</div>
-<div class="line"><a name="l00707"></a><span class="lineno">  707</span>           <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00708"></a><span class="lineno">  708</span>         }</div>
-<div class="line"><a name="l00709"></a><span class="lineno">  709</span>       }</div>
-<div class="line"><a name="l00710"></a><span class="lineno">  710</span>       output[y][x]=currentValue;<span class="comment">//introduced due to hThreshold</span></div>
-<div class="line"><a name="l00711"></a><span class="lineno">  711</span>       <span class="keywordflow">if</span>(currentMasked){</div>
-<div class="line"><a name="l00712"></a><span class="lineno">  712</span>         output[y][x]=currentValue;</div>
+<div class="line"><a name="l00665"></a><span class="lineno">  665</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
+<div class="line"><a name="l00666"></a><span class="lineno">  666</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
+<div class="line"><a name="l00667"></a><span class="lineno">  667</span>     noDataValue=m_noDataValues[0];</div>
+<div class="line"><a name="l00668"></a><span class="lineno">  668</span> </div>
+<div class="line"><a name="l00669"></a><span class="lineno">  669</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nchange=0;</div>
+<div class="line"><a name="l00670"></a><span class="lineno">  670</span>   assert(dimX);</div>
+<div class="line"><a name="l00671"></a><span class="lineno">  671</span>   assert(dimY);</div>
+<div class="line"><a name="l00672"></a><span class="lineno">  672</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
+<div class="line"><a name="l00673"></a><span class="lineno">  673</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> inBuffer(dimY,input.nCols());</div>
+<div class="line"><a name="l00674"></a><span class="lineno">  674</span>   output.clear();</div>
+<div class="line"><a name="l00675"></a><span class="lineno">  675</span>   output.resize(input.nRows(),input.nCols());</div>
+<div class="line"><a name="l00676"></a><span class="lineno">  676</span>   <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l00677"></a><span class="lineno">  677</span>   <span class="keywordtype">int</span> indexJ=0;</div>
+<div class="line"><a name="l00678"></a><span class="lineno">  678</span>   <span class="comment">//initialize last half of inBuffer</span></div>
+<div class="line"><a name="l00679"></a><span class="lineno">  679</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00680"></a><span class="lineno">  680</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<input.nCols();++i)</div>
+<div class="line"><a name="l00681"></a><span class="lineno">  681</span>       inBuffer[indexJ][i]=input[abs(j)][i];</div>
+<div class="line"><a name="l00682"></a><span class="lineno">  682</span>     ++indexJ;</div>
+<div class="line"><a name="l00683"></a><span class="lineno">  683</span>   }</div>
+<div class="line"><a name="l00684"></a><span class="lineno">  684</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nRows();++y){</div>
+<div class="line"><a name="l00685"></a><span class="lineno">  685</span>     <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
+<div class="line"><a name="l00686"></a><span class="lineno">  686</span>       <span class="comment">//erase first line from inBuffer</span></div>
+<div class="line"><a name="l00687"></a><span class="lineno">  687</span>       inBuffer.erase(inBuffer.begin());</div>
+<div class="line"><a name="l00688"></a><span class="lineno">  688</span>       <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
+<div class="line"><a name="l00689"></a><span class="lineno">  689</span>       <span class="keywordflow">if</span>(y+dimY/2<input.nRows()){</div>
+<div class="line"><a name="l00690"></a><span class="lineno">  690</span>         <span class="comment">//allocate buffer</span></div>
+<div class="line"><a name="l00691"></a><span class="lineno">  691</span>         inBuffer.push_back(inBuffer.back());</div>
+<div class="line"><a name="l00692"></a><span class="lineno">  692</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<input.nCols();++i)</div>
+<div class="line"><a name="l00693"></a><span class="lineno">  693</span>           inBuffer[inBuffer.size()-1][i]=input[y+dimY/2][i];</div>
+<div class="line"><a name="l00694"></a><span class="lineno">  694</span>       }</div>
+<div class="line"><a name="l00695"></a><span class="lineno">  695</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00696"></a><span class="lineno">  696</span>         <span class="keywordtype">int</span> over=y+dimY/2-input.nRows();</div>
+<div class="line"><a name="l00697"></a><span class="lineno">  697</span>         <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
+<div class="line"><a name="l00698"></a><span class="lineno">  698</span>         assert(index>=0);</div>
+<div class="line"><a name="l00699"></a><span class="lineno">  699</span>         assert(index<inBuffer.size());</div>
+<div class="line"><a name="l00700"></a><span class="lineno">  700</span>         inBuffer.push_back(inBuffer[index]);</div>
+<div class="line"><a name="l00701"></a><span class="lineno">  701</span>       }</div>
+<div class="line"><a name="l00702"></a><span class="lineno">  702</span>     }</div>
+<div class="line"><a name="l00703"></a><span class="lineno">  703</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nCols();++x){</div>
+<div class="line"><a name="l00704"></a><span class="lineno">  704</span>       output[y][x]=0;</div>
+<div class="line"><a name="l00705"></a><span class="lineno">  705</span>       <span class="keywordtype">double</span> currentValue=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l00706"></a><span class="lineno">  706</span>       std::vector<double> statBuffer;</div>
+<div class="line"><a name="l00707"></a><span class="lineno">  707</span>       <span class="keywordtype">bool</span> currentMasked=<span class="keyword">false</span>;</div>
+<div class="line"><a name="l00708"></a><span class="lineno">  708</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
+<div class="line"><a name="l00709"></a><span class="lineno">  709</span>         <span class="keywordflow">if</span>(currentValue==m_noDataValues[imask]){</div>
+<div class="line"><a name="l00710"></a><span class="lineno">  710</span>           currentMasked=<span class="keyword">true</span>;</div>
+<div class="line"><a name="l00711"></a><span class="lineno">  711</span>           <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00712"></a><span class="lineno">  712</span>         }</div>
 <div class="line"><a name="l00713"></a><span class="lineno">  713</span>       }</div>
-<div class="line"><a name="l00714"></a><span class="lineno">  714</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00715"></a><span class="lineno">  715</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00716"></a><span class="lineno">  716</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
-<div class="line"><a name="l00717"></a><span class="lineno">  717</span>             <span class="keywordtype">double</span> d2=i*i+j*j;<span class="comment">//square distance</span></div>
-<div class="line"><a name="l00718"></a><span class="lineno">  718</span>             <span class="keywordflow">if</span>(disc&&(d2>(dimX/2)*(dimY/2)))</div>
-<div class="line"><a name="l00719"></a><span class="lineno">  719</span>               <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l00720"></a><span class="lineno">  720</span>             indexI=x+i;</div>
-<div class="line"><a name="l00721"></a><span class="lineno">  721</span>             <span class="comment">//check if out of bounds</span></div>
-<div class="line"><a name="l00722"></a><span class="lineno">  722</span>             <span class="keywordflow">if</span>(indexI<0)</div>
-<div class="line"><a name="l00723"></a><span class="lineno">  723</span>               indexI=-indexI;</div>
-<div class="line"><a name="l00724"></a><span class="lineno">  724</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=input.nCols())</div>
-<div class="line"><a name="l00725"></a><span class="lineno">  725</span>               indexI=input.nCols()-i;</div>
-<div class="line"><a name="l00726"></a><span class="lineno">  726</span>             <span class="keywordflow">if</span>(y+j<0)</div>
-<div class="line"><a name="l00727"></a><span class="lineno">  727</span>               indexJ=-j;</div>
-<div class="line"><a name="l00728"></a><span class="lineno">  728</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=input.nRows())</div>
-<div class="line"><a name="l00729"></a><span class="lineno">  729</span>                 indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
-<div class="line"><a name="l00730"></a><span class="lineno">  730</span>               <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00731"></a><span class="lineno">  731</span>                 indexJ=(dimY-1)/2+j;</div>
-<div class="line"><a name="l00732"></a><span class="lineno">  732</span>             <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==noDataValue)</div>
-<div class="line"><a name="l00733"></a><span class="lineno">  733</span>               <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l00734"></a><span class="lineno">  734</span>             <span class="keywordtype">bool</span> masked=<span class="keyword">false</span>;</div>
-<div class="line"><a name="l00735"></a><span class="lineno">  735</span>             <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
-<div class="line"><a name="l00736"></a><span class="lineno">  736</span>               <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_noDataValues[imask]){</div>
-<div class="line"><a name="l00737"></a><span class="lineno">  737</span>                 masked=<span class="keyword">true</span>;</div>
-<div class="line"><a name="l00738"></a><span class="lineno">  738</span>                 <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00739"></a><span class="lineno">  739</span>               }</div>
-<div class="line"><a name="l00740"></a><span class="lineno">  740</span>             }</div>
-<div class="line"><a name="l00741"></a><span class="lineno">  741</span>             <span class="keywordflow">if</span>(!masked){</div>
-<div class="line"><a name="l00742"></a><span class="lineno">  742</span>               <span class="keywordtype">short</span> binValue=0;</div>
-<div class="line"><a name="l00743"></a><span class="lineno">  743</span>               <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
-<div class="line"><a name="l00744"></a><span class="lineno">  744</span>                 <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_class[iclass]){</div>
-<div class="line"><a name="l00745"></a><span class="lineno">  745</span>                   binValue=1;</div>
-<div class="line"><a name="l00746"></a><span class="lineno">  746</span>                   <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00747"></a><span class="lineno">  747</span>                 }</div>
-<div class="line"><a name="l00748"></a><span class="lineno">  748</span>               }</div>
-<div class="line"><a name="l00749"></a><span class="lineno">  749</span>               <span class="keywordflow">if</span>(m_class.size())</div>
-<div class="line"><a name="l00750"></a><span class="lineno">  750</span>                 statBuffer.push_back(binValue);</div>
-<div class="line"><a name="l00751"></a><span class="lineno">  751</span>               <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00752"></a><span class="lineno">  752</span>                 statBuffer.push_back(inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l00753"></a><span class="lineno">  753</span>             }</div>
-<div class="line"><a name="l00754"></a><span class="lineno">  754</span>           }</div>
-<div class="line"><a name="l00755"></a><span class="lineno">  755</span>         }</div>
-<div class="line"><a name="l00756"></a><span class="lineno">  756</span>         <span class="keywordflow">if</span>(statBuffer.size()){</div>
-<div class="line"><a name="l00757"></a><span class="lineno">  757</span>           <span class="keywordflow">switch</span>(getFilterType(method)){</div>
-<div class="line"><a name="l00758"></a><span class="lineno">  758</span>           <span class="keywordflow">case</span>(filter2d::dilate):</div>
-<div class="line"><a name="l00759"></a><span class="lineno">  759</span>             <span class="keywordflow">if</span>(output[y][x]<stat.mymax(statBuffer)-hThreshold){</div>
-<div class="line"><a name="l00760"></a><span class="lineno">  760</span>               output[y][x]=stat.mymax(statBuffer);</div>
-<div class="line"><a name="l00761"></a><span class="lineno">  761</span>               ++nchange;</div>
-<div class="line"><a name="l00762"></a><span class="lineno">  762</span>             }</div>
-<div class="line"><a name="l00763"></a><span class="lineno">  763</span>             <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00764"></a><span class="lineno">  764</span>           <span class="keywordflow">case</span>(filter2d::erode):</div>
-<div class="line"><a name="l00765"></a><span class="lineno">  765</span>             <span class="keywordflow">if</span>(output[y][x]>stat.mymin(statBuffer)+hThreshold){</div>
-<div class="line"><a name="l00766"></a><span class="lineno">  766</span>               output[y][x]=stat.mymin(statBuffer);</div>
-<div class="line"><a name="l00767"></a><span class="lineno">  767</span>               ++nchange;</div>
-<div class="line"><a name="l00768"></a><span class="lineno">  768</span>             }</div>
-<div class="line"><a name="l00769"></a><span class="lineno">  769</span>             <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00770"></a><span class="lineno">  770</span>           <span class="keywordflow">default</span>:</div>
-<div class="line"><a name="l00771"></a><span class="lineno">  771</span>             std::ostringstream ess;</div>
-<div class="line"><a name="l00772"></a><span class="lineno">  772</span>             ess << <span class="stringliteral">"Error:  morphology method "</span> << method << <span class="stringliteral">" not supported, choose "</span> << filter2d::dilate << <span class="stringliteral">" (dilate) or "</span> << filter2d::erode << <span class="stringliteral">" (erode)"</span> << std::endl;</div>
-<div class="line"><a name="l00773"></a><span class="lineno">  773</span>             <span class="keywordflow">throw</span>(ess.str());</div>
-<div class="line"><a name="l00774"></a><span class="lineno">  774</span>             <span class="keywordflow">break</span>;</div>
-<div class="line"><a name="l00775"></a><span class="lineno">  775</span>           }</div>
-<div class="line"><a name="l00776"></a><span class="lineno">  776</span>           <span class="keywordflow">if</span>(output[y][x]&&m_class.size())</div>
-<div class="line"><a name="l00777"></a><span class="lineno">  777</span>             output[y][x]=m_class[0];</div>
-<div class="line"><a name="l00778"></a><span class="lineno">  778</span>           <span class="comment">// else{</span></div>
-<div class="line"><a name="l00779"></a><span class="lineno">  779</span>           <span class="comment">//   assert(m_noDataValues.size());</span></div>
-<div class="line"><a name="l00780"></a><span class="lineno">  780</span>           <span class="comment">//   output[x]=m_noDataValues[0];</span></div>
-<div class="line"><a name="l00781"></a><span class="lineno">  781</span>           <span class="comment">// }</span></div>
-<div class="line"><a name="l00782"></a><span class="lineno">  782</span>         }</div>
-<div class="line"><a name="l00783"></a><span class="lineno">  783</span>         <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00784"></a><span class="lineno">  784</span>           output[y][x]=noDataValue;</div>
-<div class="line"><a name="l00785"></a><span class="lineno">  785</span>       }</div>
-<div class="line"><a name="l00786"></a><span class="lineno">  786</span>     }</div>
-<div class="line"><a name="l00787"></a><span class="lineno">  787</span>     progress=(1.0+y);</div>
-<div class="line"><a name="l00788"></a><span class="lineno">  788</span>     progress/=output.nRows();</div>
-<div class="line"><a name="l00789"></a><span class="lineno">  789</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00790"></a><span class="lineno">  790</span>   }</div>
-<div class="line"><a name="l00791"></a><span class="lineno">  791</span>   <span class="keywordflow">return</span> nchange;</div>
-<div class="line"><a name="l00792"></a><span class="lineno">  792</span> }</div>
-<div class="line"><a name="l00793"></a><span class="lineno">  793</span> </div>
-<div class="line"><a name="l00794"></a><span class="lineno">  794</span>  <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> Filter2d::dsm2dtm_nwse(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& inputDSM, <a class="code" href="classVector2d.html">Vector2d<T></a>& outputMa [...]
-<div class="line"><a name="l00795"></a><span class="lineno">  795</span> {</div>
-<div class="line"><a name="l00796"></a><span class="lineno">  796</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l00797"></a><span class="lineno">  797</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l00798"></a><span class="lineno">  798</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l00799"></a><span class="lineno">  799</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l00800"></a><span class="lineno">  800</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00801"></a><span class="lineno">  801</span> </div>
-<div class="line"><a name="l00802"></a><span class="lineno">  802</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> tmpDSM(inputDSM);</div>
-<div class="line"><a name="l00803"></a><span class="lineno">  803</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
-<div class="line"><a name="l00804"></a><span class="lineno">  804</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
-<div class="line"><a name="l00805"></a><span class="lineno">  805</span>     noDataValue=m_noDataValues[0];</div>
-<div class="line"><a name="l00806"></a><span class="lineno">  806</span> </div>
-<div class="line"><a name="l00807"></a><span class="lineno">  807</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nchange=0;</div>
-<div class="line"><a name="l00808"></a><span class="lineno">  808</span>   <span class="keywordtype">int</span> dimX=dim;</div>
-<div class="line"><a name="l00809"></a><span class="lineno">  809</span>   <span class="keywordtype">int</span> dimY=dim;</div>
-<div class="line"><a name="l00810"></a><span class="lineno">  810</span>   assert(dimX);</div>
-<div class="line"><a name="l00811"></a><span class="lineno">  811</span>   assert(dimY);</div>
-<div class="line"><a name="l00812"></a><span class="lineno">  812</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
-<div class="line"><a name="l00813"></a><span class="lineno">  813</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> inBuffer(dimY,inputDSM.nCols());</div>
-<div class="line"><a name="l00814"></a><span class="lineno">  814</span>   <span class="keywordflow">if</span>(outputMask.size()!=inputDSM.nRows())</div>
-<div class="line"><a name="l00815"></a><span class="lineno">  815</span>     outputMask.resize(inputDSM.nRows());</div>
-<div class="line"><a name="l00816"></a><span class="lineno">  816</span>   <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l00817"></a><span class="lineno">  817</span>   <span class="keywordtype">int</span> indexJ=0;</div>
-<div class="line"><a name="l00818"></a><span class="lineno">  818</span>   <span class="comment">//initialize last half of inBuffer</span></div>
-<div class="line"><a name="l00819"></a><span class="lineno">  819</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00820"></a><span class="lineno">  820</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<inputDSM.nCols();++i)</div>
-<div class="line"><a name="l00821"></a><span class="lineno">  821</span>       inBuffer[indexJ][i]=tmpDSM[abs(j)][i];</div>
-<div class="line"><a name="l00822"></a><span class="lineno">  822</span>     ++indexJ;</div>
-<div class="line"><a name="l00823"></a><span class="lineno">  823</span>   }</div>
-<div class="line"><a name="l00824"></a><span class="lineno">  824</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<tmpDSM.nRows();++y){</div>
-<div class="line"><a name="l00825"></a><span class="lineno">  825</span>     <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
-<div class="line"><a name="l00826"></a><span class="lineno">  826</span>       <span class="comment">//erase first line from inBuffer</span></div>
-<div class="line"><a name="l00827"></a><span class="lineno">  827</span>       inBuffer.erase(inBuffer.begin());</div>
-<div class="line"><a name="l00828"></a><span class="lineno">  828</span>       <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
-<div class="line"><a name="l00829"></a><span class="lineno">  829</span>       <span class="keywordflow">if</span>(y+dimY/2<tmpDSM.nRows()){</div>
-<div class="line"><a name="l00830"></a><span class="lineno">  830</span>         <span class="comment">//allocate buffer</span></div>
-<div class="line"><a name="l00831"></a><span class="lineno">  831</span>         inBuffer.push_back(inBuffer.back());</div>
-<div class="line"><a name="l00832"></a><span class="lineno">  832</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<tmpDSM.nCols();++i)</div>
-<div class="line"><a name="l00833"></a><span class="lineno">  833</span>           inBuffer[inBuffer.size()-1][i]=tmpDSM[y+dimY/2][i];</div>
-<div class="line"><a name="l00834"></a><span class="lineno">  834</span>       }</div>
-<div class="line"><a name="l00835"></a><span class="lineno">  835</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00836"></a><span class="lineno">  836</span>         <span class="keywordtype">int</span> over=y+dimY/2-tmpDSM.nRows();</div>
-<div class="line"><a name="l00837"></a><span class="lineno">  837</span>         <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
-<div class="line"><a name="l00838"></a><span class="lineno">  838</span>         assert(index>=0);</div>
-<div class="line"><a name="l00839"></a><span class="lineno">  839</span>         assert(index<inBuffer.size());</div>
-<div class="line"><a name="l00840"></a><span class="lineno">  840</span>         inBuffer.push_back(inBuffer[index]);</div>
-<div class="line"><a name="l00841"></a><span class="lineno">  841</span>       }</div>
-<div class="line"><a name="l00842"></a><span class="lineno">  842</span>     }</div>
-<div class="line"><a name="l00843"></a><span class="lineno">  843</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<tmpDSM.nCols();++x){</div>
-<div class="line"><a name="l00844"></a><span class="lineno">  844</span>       <span class="keywordtype">double</span> centerValue=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l00845"></a><span class="lineno">  845</span>       <span class="keywordtype">short</span> nmasked=0;</div>
-<div class="line"><a name="l00846"></a><span class="lineno">  846</span>       std::vector<T> neighbors;</div>
-<div class="line"><a name="l00847"></a><span class="lineno">  847</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00848"></a><span class="lineno">  848</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
-<div class="line"><a name="l00849"></a><span class="lineno">  849</span>       indexI=x+i;</div>
-<div class="line"><a name="l00850"></a><span class="lineno">  850</span>       <span class="comment">//check if out of bounds</span></div>
-<div class="line"><a name="l00851"></a><span class="lineno">  851</span>       <span class="keywordflow">if</span>(indexI<0)</div>
-<div class="line"><a name="l00852"></a><span class="lineno">  852</span>         indexI=-indexI;</div>
-<div class="line"><a name="l00853"></a><span class="lineno">  853</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=tmpDSM.nCols())</div>
-<div class="line"><a name="l00854"></a><span class="lineno">  854</span>         indexI=tmpDSM.nCols()-i;</div>
-<div class="line"><a name="l00855"></a><span class="lineno">  855</span>       <span class="keywordflow">if</span>(y+j<0)</div>
-<div class="line"><a name="l00856"></a><span class="lineno">  856</span>         indexJ=-j;</div>
-<div class="line"><a name="l00857"></a><span class="lineno">  857</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=tmpDSM.nRows())</div>
-<div class="line"><a name="l00858"></a><span class="lineno">  858</span>         indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
-<div class="line"><a name="l00859"></a><span class="lineno">  859</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00860"></a><span class="lineno">  860</span>         indexJ=(dimY-1)/2+j;</div>
-<div class="line"><a name="l00861"></a><span class="lineno">  861</span>       <span class="keywordtype">double</span> difference=(centerValue-inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l00862"></a><span class="lineno">  862</span>       <span class="keywordflow">if</span>(i||j)<span class="comment">//skip centerValue</span></div>
-<div class="line"><a name="l00863"></a><span class="lineno">  863</span>         neighbors.push_back(inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l00864"></a><span class="lineno">  864</span>       <span class="keywordflow">if</span>(difference>hThreshold)</div>
-<div class="line"><a name="l00865"></a><span class="lineno">  865</span>         ++nmasked;</div>
-<div class="line"><a name="l00866"></a><span class="lineno">  866</span>     }</div>
-<div class="line"><a name="l00867"></a><span class="lineno">  867</span>       }</div>
-<div class="line"><a name="l00868"></a><span class="lineno">  868</span>       <span class="keywordflow">if</span>(nmasked<=nlimit){</div>
-<div class="line"><a name="l00869"></a><span class="lineno">  869</span>     ++nchange;</div>
-<div class="line"><a name="l00870"></a><span class="lineno">  870</span>     <span class="comment">//reset pixel in outputMask</span></div>
-<div class="line"><a name="l00871"></a><span class="lineno">  871</span>     outputMask[y][x]=0;</div>
-<div class="line"><a name="l00872"></a><span class="lineno">  872</span>       }</div>
-<div class="line"><a name="l00873"></a><span class="lineno">  873</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00874"></a><span class="lineno">  874</span>     <span class="comment">//reset pixel height in tmpDSM</span></div>
-<div class="line"><a name="l00875"></a><span class="lineno">  875</span>     sort(neighbors.begin(),neighbors.end());</div>
-<div class="line"><a name="l00876"></a><span class="lineno">  876</span>     assert(neighbors.size()>1);</div>
-<div class="line"><a name="l00877"></a><span class="lineno">  877</span>     inBuffer[(dimY-1)/2][x]=neighbors[1];</div>
-<div class="line"><a name="l00878"></a><span class="lineno">  878</span>     <span class="comment">/* inBuffer[(dimY-1)/2][x]=stat.mymin(neighbors); */</span></div>
-<div class="line"><a name="l00879"></a><span class="lineno">  879</span>       }</div>
-<div class="line"><a name="l00880"></a><span class="lineno">  880</span>     }</div>
-<div class="line"><a name="l00881"></a><span class="lineno">  881</span>     progress=(1.0+y);</div>
-<div class="line"><a name="l00882"></a><span class="lineno">  882</span>     progress/=outputMask.nRows();</div>
-<div class="line"><a name="l00883"></a><span class="lineno">  883</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00884"></a><span class="lineno">  884</span>   }</div>
-<div class="line"><a name="l00885"></a><span class="lineno">  885</span>   <span class="keywordflow">return</span> nchange;</div>
-<div class="line"><a name="l00886"></a><span class="lineno">  886</span> }</div>
-<div class="line"><a name="l00887"></a><span class="lineno">  887</span> </div>
-<div class="line"><a name="l00888"></a><span class="lineno">  888</span>  <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> Filter2d::dsm2dtm_nesw(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& inputDSM, <a class="code" href="classVector2d.html">Vector2d<T></a>& outputMa [...]
-<div class="line"><a name="l00889"></a><span class="lineno">  889</span> {</div>
-<div class="line"><a name="l00890"></a><span class="lineno">  890</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l00891"></a><span class="lineno">  891</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l00892"></a><span class="lineno">  892</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l00893"></a><span class="lineno">  893</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l00894"></a><span class="lineno">  894</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00895"></a><span class="lineno">  895</span> </div>
-<div class="line"><a name="l00896"></a><span class="lineno">  896</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> tmpDSM(inputDSM);</div>
-<div class="line"><a name="l00897"></a><span class="lineno">  897</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
-<div class="line"><a name="l00898"></a><span class="lineno">  898</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
-<div class="line"><a name="l00899"></a><span class="lineno">  899</span>     noDataValue=m_noDataValues[0];</div>
-<div class="line"><a name="l00900"></a><span class="lineno">  900</span> </div>
-<div class="line"><a name="l00901"></a><span class="lineno">  901</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nchange=0;</div>
-<div class="line"><a name="l00902"></a><span class="lineno">  902</span>   <span class="keywordtype">int</span> dimX=dim;</div>
-<div class="line"><a name="l00903"></a><span class="lineno">  903</span>   <span class="keywordtype">int</span> dimY=dim;</div>
-<div class="line"><a name="l00904"></a><span class="lineno">  904</span>   assert(dimX);</div>
-<div class="line"><a name="l00905"></a><span class="lineno">  905</span>   assert(dimY);</div>
-<div class="line"><a name="l00906"></a><span class="lineno">  906</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
-<div class="line"><a name="l00907"></a><span class="lineno">  907</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> inBuffer(dimY,inputDSM.nCols());</div>
-<div class="line"><a name="l00908"></a><span class="lineno">  908</span>   <span class="keywordflow">if</span>(outputMask.size()!=inputDSM.nRows())</div>
-<div class="line"><a name="l00909"></a><span class="lineno">  909</span>     outputMask.resize(inputDSM.nRows());</div>
-<div class="line"><a name="l00910"></a><span class="lineno">  910</span>   <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l00911"></a><span class="lineno">  911</span>   <span class="keywordtype">int</span> indexJ=0;</div>
-<div class="line"><a name="l00912"></a><span class="lineno">  912</span>   <span class="comment">//initialize last half of inBuffer</span></div>
-<div class="line"><a name="l00913"></a><span class="lineno">  913</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00914"></a><span class="lineno">  914</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<inputDSM.nCols();++i)</div>
-<div class="line"><a name="l00915"></a><span class="lineno">  915</span>       inBuffer[indexJ][i]=tmpDSM[abs(j)][i];</div>
-<div class="line"><a name="l00916"></a><span class="lineno">  916</span>     ++indexJ;</div>
-<div class="line"><a name="l00917"></a><span class="lineno">  917</span>   }</div>
-<div class="line"><a name="l00918"></a><span class="lineno">  918</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<tmpDSM.nRows();++y){</div>
-<div class="line"><a name="l00919"></a><span class="lineno">  919</span>     <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
-<div class="line"><a name="l00920"></a><span class="lineno">  920</span>       <span class="comment">//erase first line from inBuffer</span></div>
-<div class="line"><a name="l00921"></a><span class="lineno">  921</span>       inBuffer.erase(inBuffer.begin());</div>
-<div class="line"><a name="l00922"></a><span class="lineno">  922</span>       <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
-<div class="line"><a name="l00923"></a><span class="lineno">  923</span>       <span class="keywordflow">if</span>(y+dimY/2<tmpDSM.nRows()){</div>
-<div class="line"><a name="l00924"></a><span class="lineno">  924</span>         <span class="comment">//allocate buffer</span></div>
-<div class="line"><a name="l00925"></a><span class="lineno">  925</span>         inBuffer.push_back(inBuffer.back());</div>
-<div class="line"><a name="l00926"></a><span class="lineno">  926</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<tmpDSM.nCols();++i)</div>
-<div class="line"><a name="l00927"></a><span class="lineno">  927</span>           inBuffer[inBuffer.size()-1][i]=tmpDSM[y+dimY/2][i];</div>
-<div class="line"><a name="l00928"></a><span class="lineno">  928</span>       }</div>
-<div class="line"><a name="l00929"></a><span class="lineno">  929</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00930"></a><span class="lineno">  930</span>         <span class="keywordtype">int</span> over=y+dimY/2-tmpDSM.nRows();</div>
-<div class="line"><a name="l00931"></a><span class="lineno">  931</span>         <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
-<div class="line"><a name="l00932"></a><span class="lineno">  932</span>         assert(index>=0);</div>
-<div class="line"><a name="l00933"></a><span class="lineno">  933</span>         assert(index<inBuffer.size());</div>
-<div class="line"><a name="l00934"></a><span class="lineno">  934</span>         inBuffer.push_back(inBuffer[index]);</div>
-<div class="line"><a name="l00935"></a><span class="lineno">  935</span>       }</div>
-<div class="line"><a name="l00936"></a><span class="lineno">  936</span>     }</div>
-<div class="line"><a name="l00937"></a><span class="lineno">  937</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=tmpDSM.nCols()-1;x>=0;--x){</div>
-<div class="line"><a name="l00938"></a><span class="lineno">  938</span>       <span class="keywordtype">double</span> centerValue=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l00939"></a><span class="lineno">  939</span>       <span class="keywordtype">short</span> nmasked=0;</div>
-<div class="line"><a name="l00940"></a><span class="lineno">  940</span>       std::vector<T> neighbors;</div>
-<div class="line"><a name="l00941"></a><span class="lineno">  941</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l00942"></a><span class="lineno">  942</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
-<div class="line"><a name="l00943"></a><span class="lineno">  943</span>       indexI=x+i;</div>
-<div class="line"><a name="l00944"></a><span class="lineno">  944</span>       <span class="comment">//check if out of bounds</span></div>
-<div class="line"><a name="l00945"></a><span class="lineno">  945</span>       <span class="keywordflow">if</span>(indexI<0)</div>
-<div class="line"><a name="l00946"></a><span class="lineno">  946</span>         indexI=-indexI;</div>
-<div class="line"><a name="l00947"></a><span class="lineno">  947</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=tmpDSM.nCols())</div>
-<div class="line"><a name="l00948"></a><span class="lineno">  948</span>         indexI=tmpDSM.nCols()-i;</div>
-<div class="line"><a name="l00949"></a><span class="lineno">  949</span>       <span class="keywordflow">if</span>(y+j<0)</div>
-<div class="line"><a name="l00950"></a><span class="lineno">  950</span>         indexJ=-j;</div>
-<div class="line"><a name="l00951"></a><span class="lineno">  951</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=tmpDSM.nRows())</div>
-<div class="line"><a name="l00952"></a><span class="lineno">  952</span>         indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
-<div class="line"><a name="l00953"></a><span class="lineno">  953</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l00954"></a><span class="lineno">  954</span>         indexJ=(dimY-1)/2+j;</div>
-<div class="line"><a name="l00955"></a><span class="lineno">  955</span>       <span class="keywordtype">double</span> difference=(centerValue-inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l00956"></a><span class="lineno">  956</span>       <span class="keywordflow">if</span>(i||j)<span class="comment">//skip centerValue</span></div>
-<div class="line"><a name="l00957"></a><span class="lineno">  957</span>         neighbors.push_back(inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l00958"></a><span class="lineno">  958</span>       <span class="keywordflow">if</span>(difference>hThreshold)</div>
-<div class="line"><a name="l00959"></a><span class="lineno">  959</span>         ++nmasked;</div>
-<div class="line"><a name="l00960"></a><span class="lineno">  960</span>     }</div>
-<div class="line"><a name="l00961"></a><span class="lineno">  961</span>       }</div>
-<div class="line"><a name="l00962"></a><span class="lineno">  962</span>       <span class="keywordflow">if</span>(nmasked<=nlimit){</div>
-<div class="line"><a name="l00963"></a><span class="lineno">  963</span>     ++nchange;</div>
-<div class="line"><a name="l00964"></a><span class="lineno">  964</span>     <span class="comment">//reset pixel in outputMask</span></div>
-<div class="line"><a name="l00965"></a><span class="lineno">  965</span>     outputMask[y][x]=0;</div>
-<div class="line"><a name="l00966"></a><span class="lineno">  966</span>       }</div>
-<div class="line"><a name="l00967"></a><span class="lineno">  967</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l00968"></a><span class="lineno">  968</span>     <span class="comment">//reset pixel height in tmpDSM</span></div>
-<div class="line"><a name="l00969"></a><span class="lineno">  969</span>     sort(neighbors.begin(),neighbors.end());</div>
-<div class="line"><a name="l00970"></a><span class="lineno">  970</span>     assert(neighbors.size()>1);</div>
-<div class="line"><a name="l00971"></a><span class="lineno">  971</span>     inBuffer[(dimY-1)/2][x]=neighbors[1];</div>
-<div class="line"><a name="l00972"></a><span class="lineno">  972</span>     <span class="comment">/* inBuffer[(dimY-1)/2][x]=stat.mymin(neighbors); */</span></div>
-<div class="line"><a name="l00973"></a><span class="lineno">  973</span>       }</div>
-<div class="line"><a name="l00974"></a><span class="lineno">  974</span>     }</div>
-<div class="line"><a name="l00975"></a><span class="lineno">  975</span>     progress=(1.0+y);</div>
-<div class="line"><a name="l00976"></a><span class="lineno">  976</span>     progress/=outputMask.nRows();</div>
-<div class="line"><a name="l00977"></a><span class="lineno">  977</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00978"></a><span class="lineno">  978</span>   }</div>
-<div class="line"><a name="l00979"></a><span class="lineno">  979</span>   <span class="keywordflow">return</span> nchange;</div>
-<div class="line"><a name="l00980"></a><span class="lineno">  980</span> }</div>
-<div class="line"><a name="l00981"></a><span class="lineno">  981</span> </div>
-<div class="line"><a name="l00982"></a><span class="lineno">  982</span>  <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> Filter2d::dsm2dtm_senw(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& inputDSM, <a class="code" href="classVector2d.html">Vector2d<T></a>& outputMa [...]
-<div class="line"><a name="l00983"></a><span class="lineno">  983</span> {</div>
-<div class="line"><a name="l00984"></a><span class="lineno">  984</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l00985"></a><span class="lineno">  985</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l00986"></a><span class="lineno">  986</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l00987"></a><span class="lineno">  987</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l00988"></a><span class="lineno">  988</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00989"></a><span class="lineno">  989</span> </div>
-<div class="line"><a name="l00990"></a><span class="lineno">  990</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> tmpDSM(inputDSM);</div>
-<div class="line"><a name="l00991"></a><span class="lineno">  991</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
-<div class="line"><a name="l00992"></a><span class="lineno">  992</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
-<div class="line"><a name="l00993"></a><span class="lineno">  993</span>     noDataValue=m_noDataValues[0];</div>
-<div class="line"><a name="l00994"></a><span class="lineno">  994</span> </div>
-<div class="line"><a name="l00995"></a><span class="lineno">  995</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nchange=0;</div>
-<div class="line"><a name="l00996"></a><span class="lineno">  996</span>   <span class="keywordtype">int</span> dimX=dim;</div>
-<div class="line"><a name="l00997"></a><span class="lineno">  997</span>   <span class="keywordtype">int</span> dimY=dim;</div>
-<div class="line"><a name="l00998"></a><span class="lineno">  998</span>   assert(dimX);</div>
-<div class="line"><a name="l00999"></a><span class="lineno">  999</span>   assert(dimY);</div>
-<div class="line"><a name="l01000"></a><span class="lineno"> 1000</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
-<div class="line"><a name="l01001"></a><span class="lineno"> 1001</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> inBuffer(dimY,inputDSM.nCols());</div>
-<div class="line"><a name="l01002"></a><span class="lineno"> 1002</span>   <span class="keywordflow">if</span>(outputMask.size()!=inputDSM.nRows())</div>
-<div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>     outputMask.resize(inputDSM.nRows());</div>
-<div class="line"><a name="l01004"></a><span class="lineno"> 1004</span>   <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>   <span class="keywordtype">int</span> indexJ=inputDSM.nRows()-1;</div>
-<div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>   <span class="comment">//initialize first half of inBuffer</span></div>
-<div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=inputDSM.nRows()-dimY/2;j<inputDSM.nRows();--j){</div>
-<div class="line"><a name="l01008"></a><span class="lineno"> 1008</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<inputDSM.nCols();++i)</div>
-<div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>       inBuffer[indexJ][i]=tmpDSM[abs(j)][i];</div>
-<div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>     ++indexJ;</div>
-<div class="line"><a name="l01011"></a><span class="lineno"> 1011</span>   }</div>
-<div class="line"><a name="l01012"></a><span class="lineno"> 1012</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=tmpDSM.nRows()-1;y>=0;--y){</div>
-<div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>     <span class="keywordflow">if</span>(y<tmpDSM.nRows()-1){<span class="comment">//inBuffer already initialized for y=tmpDSM.nRows()-1</span></div>
-<div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>       <span class="comment">//erase last line from inBuffer</span></div>
-<div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>       inBuffer.erase(inBuffer.end()-1);</div>
-<div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>       <span class="comment">//read extra line and insert to inBuffer if not out of bounds</span></div>
-<div class="line"><a name="l01017"></a><span class="lineno"> 1017</span>       <span class="keywordflow">if</span>(y-dimY/2>0){</div>
-<div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>         <span class="comment">//allocate buffer</span></div>
-<div class="line"><a name="l01019"></a><span class="lineno"> 1019</span>         inBuffer.insert(inBuffer.begin(),inBuffer.back());</div>
-<div class="line"><a name="l01020"></a><span class="lineno"> 1020</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<tmpDSM.nCols();++i)</div>
-<div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>           inBuffer[0][i]=tmpDSM[y-dimY/2][i];</div>
-<div class="line"><a name="l01022"></a><span class="lineno"> 1022</span>       }</div>
-<div class="line"><a name="l01023"></a><span class="lineno"> 1023</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l01024"></a><span class="lineno"> 1024</span>         inBuffer.insert(inBuffer.begin(),inBuffer[abs(y-dimY/2)]);</div>
-<div class="line"><a name="l01025"></a><span class="lineno"> 1025</span>       }</div>
-<div class="line"><a name="l01026"></a><span class="lineno"> 1026</span>     }</div>
-<div class="line"><a name="l01027"></a><span class="lineno"> 1027</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=tmpDSM.nCols()-1;x>=0;--x){</div>
-<div class="line"><a name="l01028"></a><span class="lineno"> 1028</span>       <span class="keywordtype">double</span> centerValue=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l01029"></a><span class="lineno"> 1029</span>       <span class="keywordtype">short</span> nmasked=0;</div>
-<div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>       std::vector<T> neighbors;</div>
-<div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l01032"></a><span class="lineno"> 1032</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
-<div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>       indexI=x+i;</div>
-<div class="line"><a name="l01034"></a><span class="lineno"> 1034</span>       <span class="comment">//check if out of bounds</span></div>
-<div class="line"><a name="l01035"></a><span class="lineno"> 1035</span>       <span class="keywordflow">if</span>(indexI<0)</div>
-<div class="line"><a name="l01036"></a><span class="lineno"> 1036</span>         indexI=-indexI;</div>
-<div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=tmpDSM.nCols())</div>
-<div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>         indexI=tmpDSM.nCols()-i;</div>
-<div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>       <span class="keywordflow">if</span>(y+j<0)</div>
-<div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>         indexJ=-j;</div>
-<div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=tmpDSM.nRows())</div>
-<div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>         indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
-<div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l01044"></a><span class="lineno"> 1044</span>         indexJ=(dimY-1)/2+j;</div>
-<div class="line"><a name="l01045"></a><span class="lineno"> 1045</span>       <span class="keywordtype">double</span> difference=(centerValue-inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l01046"></a><span class="lineno"> 1046</span>       <span class="keywordflow">if</span>(i||j)<span class="comment">//skip centerValue</span></div>
-<div class="line"><a name="l01047"></a><span class="lineno"> 1047</span>         neighbors.push_back(inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>       <span class="keywordflow">if</span>(difference>hThreshold)</div>
-<div class="line"><a name="l01049"></a><span class="lineno"> 1049</span>         ++nmasked;</div>
-<div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>     }</div>
-<div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>       }</div>
-<div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>       <span class="keywordflow">if</span>(nmasked<=nlimit){</div>
-<div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>     ++nchange;</div>
-<div class="line"><a name="l01054"></a><span class="lineno"> 1054</span>     <span class="comment">//reset pixel in outputMask</span></div>
-<div class="line"><a name="l01055"></a><span class="lineno"> 1055</span>     outputMask[y][x]=0;</div>
-<div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>       }</div>
-<div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l01058"></a><span class="lineno"> 1058</span>     <span class="comment">//reset pixel height in tmpDSM</span></div>
-<div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>     sort(neighbors.begin(),neighbors.end());</div>
-<div class="line"><a name="l01060"></a><span class="lineno"> 1060</span>     assert(neighbors.size()>1);</div>
-<div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>     inBuffer[(dimY-1)/2][x]=neighbors[1];</div>
-<div class="line"><a name="l01062"></a><span class="lineno"> 1062</span>     <span class="comment">/* inBuffer[(dimY-1)/2][x]=stat.mymin(neighbors); */</span></div>
-<div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>       }</div>
-<div class="line"><a name="l01064"></a><span class="lineno"> 1064</span>     }</div>
-<div class="line"><a name="l01065"></a><span class="lineno"> 1065</span>     progress=(1.0+y);</div>
-<div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>     progress/=outputMask.nRows();</div>
-<div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>   }</div>
-<div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>   <span class="keywordflow">return</span> nchange;</div>
-<div class="line"><a name="l01070"></a><span class="lineno"> 1070</span> }</div>
-<div class="line"><a name="l01071"></a><span class="lineno"> 1071</span> </div>
-<div class="line"><a name="l01072"></a><span class="lineno"> 1072</span>  <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> Filter2d::dsm2dtm_swne(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& inputDSM, <a class="code" href="classVector2d.html">Vector2d<T></a>& outputMa [...]
-<div class="line"><a name="l01073"></a><span class="lineno"> 1073</span> {</div>
-<div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span> </div>
-<div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> tmpDSM(inputDSM);</div>
-<div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
-<div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
-<div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>     noDataValue=m_noDataValues[0];</div>
-<div class="line"><a name="l01084"></a><span class="lineno"> 1084</span> </div>
-<div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nchange=0;</div>
-<div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>   <span class="keywordtype">int</span> dimX=dim;</div>
-<div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>   <span class="keywordtype">int</span> dimY=dim;</div>
-<div class="line"><a name="l01088"></a><span class="lineno"> 1088</span>   assert(dimX);</div>
-<div class="line"><a name="l01089"></a><span class="lineno"> 1089</span>   assert(dimY);</div>
-<div class="line"><a name="l01090"></a><span class="lineno"> 1090</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
-<div class="line"><a name="l01091"></a><span class="lineno"> 1091</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> inBuffer(dimY,inputDSM.nCols());</div>
-<div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>   <span class="keywordflow">if</span>(outputMask.size()!=inputDSM.nRows())</div>
-<div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>     outputMask.resize(inputDSM.nRows());</div>
-<div class="line"><a name="l01094"></a><span class="lineno"> 1094</span>   <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>   <span class="keywordtype">int</span> indexJ=0;</div>
-<div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>   <span class="comment">//initialize first half of inBuffer</span></div>
-<div class="line"><a name="l01097"></a><span class="lineno"> 1097</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=inputDSM.nRows()-dimY/2;j<inputDSM.nRows();--j){</div>
-<div class="line"><a name="l01098"></a><span class="lineno"> 1098</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<inputDSM.nCols();++i)</div>
-<div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>       inBuffer[indexJ][i]=tmpDSM[abs(j)][i];</div>
-<div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>     ++indexJ;</div>
-<div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>   }</div>
-<div class="line"><a name="l01102"></a><span class="lineno"> 1102</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=tmpDSM.nRows()-1;y>=0;--y){</div>
-<div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>     <span class="keywordflow">if</span>(y<tmpDSM.nRows()-1){<span class="comment">//inBuffer already initialized for y=0</span></div>
-<div class="line"><a name="l01104"></a><span class="lineno"> 1104</span>       <span class="comment">//erase last line from inBuffer</span></div>
-<div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>       inBuffer.erase(inBuffer.end()-1);</div>
-<div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>       <span class="comment">//read extra line and insert to inBuffer if not out of bounds</span></div>
-<div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>       <span class="keywordflow">if</span>(y-dimY/2>0){</div>
-<div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>         <span class="comment">//allocate buffer</span></div>
-<div class="line"><a name="l01109"></a><span class="lineno"> 1109</span>         inBuffer.insert(inBuffer.begin(),inBuffer.back());</div>
-<div class="line"><a name="l01110"></a><span class="lineno"> 1110</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<tmpDSM.nCols();++i)</div>
-<div class="line"><a name="l01111"></a><span class="lineno"> 1111</span>           inBuffer[0][i]=tmpDSM[y-dimY/2][i];</div>
-<div class="line"><a name="l01112"></a><span class="lineno"> 1112</span>       }</div>
-<div class="line"><a name="l01113"></a><span class="lineno"> 1113</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l01114"></a><span class="lineno"> 1114</span>         inBuffer.insert(inBuffer.begin(),inBuffer[abs(y-dimY/2)]);</div>
-<div class="line"><a name="l01115"></a><span class="lineno"> 1115</span>       }</div>
-<div class="line"><a name="l01116"></a><span class="lineno"> 1116</span>     }</div>
-<div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<tmpDSM.nCols();++x){</div>
-<div class="line"><a name="l01118"></a><span class="lineno"> 1118</span>       <span class="keywordtype">double</span> centerValue=inBuffer[(dimY-1)/2][x];</div>
-<div class="line"><a name="l01119"></a><span class="lineno"> 1119</span>       <span class="keywordtype">short</span> nmasked=0;</div>
-<div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>       std::vector<T> neighbors;</div>
-<div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
-<div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
-<div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>       indexI=x+i;</div>
-<div class="line"><a name="l01124"></a><span class="lineno"> 1124</span>       <span class="comment">//check if out of bounds</span></div>
-<div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>       <span class="keywordflow">if</span>(indexI<0)</div>
-<div class="line"><a name="l01126"></a><span class="lineno"> 1126</span>         indexI=-indexI;</div>
-<div class="line"><a name="l01127"></a><span class="lineno"> 1127</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=tmpDSM.nCols())</div>
-<div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>         indexI=tmpDSM.nCols()-i;</div>
-<div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>       <span class="keywordflow">if</span>(y+j<0)</div>
-<div class="line"><a name="l01130"></a><span class="lineno"> 1130</span>         indexJ=-j;</div>
-<div class="line"><a name="l01131"></a><span class="lineno"> 1131</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=tmpDSM.nRows())</div>
-<div class="line"><a name="l01132"></a><span class="lineno"> 1132</span>         indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
-<div class="line"><a name="l01133"></a><span class="lineno"> 1133</span>       <span class="keywordflow">else</span></div>
-<div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>         indexJ=(dimY-1)/2+j;</div>
-<div class="line"><a name="l01135"></a><span class="lineno"> 1135</span>       <span class="keywordtype">double</span> difference=(centerValue-inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l01136"></a><span class="lineno"> 1136</span>       <span class="keywordflow">if</span>(i||j)<span class="comment">//skip centerValue</span></div>
-<div class="line"><a name="l01137"></a><span class="lineno"> 1137</span>         neighbors.push_back(inBuffer[indexJ][indexI]);</div>
-<div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>       <span class="keywordflow">if</span>(difference>hThreshold)</div>
-<div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>         ++nmasked;</div>
-<div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>     }</div>
-<div class="line"><a name="l01141"></a><span class="lineno"> 1141</span>       }</div>
-<div class="line"><a name="l01142"></a><span class="lineno"> 1142</span>       <span class="keywordflow">if</span>(nmasked<=nlimit){</div>
-<div class="line"><a name="l01143"></a><span class="lineno"> 1143</span>     ++nchange;</div>
-<div class="line"><a name="l01144"></a><span class="lineno"> 1144</span>     <span class="comment">//reset pixel in outputMask</span></div>
-<div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>     outputMask[y][x]=0;</div>
-<div class="line"><a name="l01146"></a><span class="lineno"> 1146</span>       }</div>
-<div class="line"><a name="l01147"></a><span class="lineno"> 1147</span>       <span class="keywordflow">else</span>{</div>
-<div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>     <span class="comment">//reset pixel height in tmpDSM</span></div>
-<div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>     sort(neighbors.begin(),neighbors.end());</div>
-<div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>     assert(neighbors.size()>1);</div>
-<div class="line"><a name="l01151"></a><span class="lineno"> 1151</span>     inBuffer[(dimY-1)/2][x]=neighbors[1];</div>
-<div class="line"><a name="l01152"></a><span class="lineno"> 1152</span>     <span class="comment">/* inBuffer[(dimY-1)/2][x]=stat.mymin(neighbors); */</span></div>
-<div class="line"><a name="l01153"></a><span class="lineno"> 1153</span>       }</div>
-<div class="line"><a name="l01154"></a><span class="lineno"> 1154</span>     }</div>
-<div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>     progress=(1.0+y);</div>
-<div class="line"><a name="l01156"></a><span class="lineno"> 1156</span>     progress/=outputMask.nRows();</div>
-<div class="line"><a name="l01157"></a><span class="lineno"> 1157</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01158"></a><span class="lineno"> 1158</span>   }</div>
-<div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>   <span class="keywordflow">return</span> nchange;</div>
-<div class="line"><a name="l01160"></a><span class="lineno"> 1160</span> }</div>
-<div class="line"><a name="l01161"></a><span class="lineno"> 1161</span> </div>
-<div class="line"><a name="l01162"></a><span class="lineno"> 1162</span>   <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> Filter2d::shadowDsm(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& input, <a class="code" href="classVector2d.html">Vector2d<T></a>& output, <span class="keywordtype">double</span> sza, <span class="keywordtype">double</span> [...]
-<div class="line"><a name="l01163"></a><span class="lineno"> 1163</span> {</div>
-<div class="line"><a name="l01164"></a><span class="lineno"> 1164</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ncols=input.nCols();</div>
-<div class="line"><a name="l01165"></a><span class="lineno"> 1165</span>   output.clear();</div>
-<div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>   output.resize(input.nRows(),ncols);</div>
-<div class="line"><a name="l01167"></a><span class="lineno"> 1167</span>   <span class="comment">//do we need to initialize output?</span></div>
-<div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>   <span class="comment">// for(int y=0;y<output.nRows();++y)</span></div>
-<div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>   <span class="comment">//   for(int x=0;x<output.nCols();++x)</span></div>
-<div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>   <span class="comment">//     output[y][x]=0;</span></div>
-<div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>   <span class="keywordtype">int</span> indexI=0;</div>
-<div class="line"><a name="l01172"></a><span class="lineno"> 1172</span>   <span class="keywordtype">int</span> indexJ=0;</div>
-<div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l01177"></a><span class="lineno"> 1177</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01178"></a><span class="lineno"> 1178</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nRows();++y){</div>
-<div class="line"><a name="l01179"></a><span class="lineno"> 1179</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nCols();++x){</div>
-<div class="line"><a name="l01180"></a><span class="lineno"> 1180</span>       <span class="keywordtype">double</span> currentValue=input[y][x];</div>
-<div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>       <span class="keywordtype">int</span> theDist=<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(sqrt((currentValue*tan(DEG2RAD(sza))/pixelSize)*(currentValue*tan(DEG2RAD(sza))/pixelSize)));<span class="comment">//in pixels</span></div>
-<div class="line"><a name="l01182"></a><span class="lineno"> 1182</span>       <span class="keywordtype">double</span> theDir=DEG2RAD(saa)+PI/2.0;</div>
-<div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>       <span class="keywordflow">if</span>(theDir<0)</div>
-<div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>         theDir+=2*PI;</div>
-<div class="line"><a name="l01185"></a><span class="lineno"> 1185</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> d=0;d<theDist;++d){<span class="comment">//d in pixels</span></div>
-<div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>         indexI=x+d*cos(theDir);<span class="comment">//in pixels</span></div>
-<div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>         indexJ=y+d*sin(theDir);<span class="comment">//in pixels</span></div>
-<div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>         <span class="keywordflow">if</span>(indexJ<0||indexJ>=input.size())</div>
-<div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>           <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l01190"></a><span class="lineno"> 1190</span>         <span class="keywordflow">if</span>(indexI<0||indexI>=input[indexJ].size())</div>
-<div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>           <span class="keywordflow">continue</span>;</div>
-<div class="line"><a name="l01192"></a><span class="lineno"> 1192</span>         <span class="keywordflow">if</span>(input[indexJ][indexI]<currentValue-d*pixelSize/tan(DEG2RAD(sza))){<span class="comment">//in m</span></div>
-<div class="line"><a name="l01193"></a><span class="lineno"> 1193</span>           output[indexJ][indexI]=shadowFlag;</div>
-<div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>         }</div>
-<div class="line"><a name="l01195"></a><span class="lineno"> 1195</span>       }</div>
-<div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>     }</div>
-<div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>     progress=(1.0+y);</div>
-<div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>     progress/=output.nRows();</div>
-<div class="line"><a name="l01199"></a><span class="lineno"> 1199</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01200"></a><span class="lineno"> 1200</span>   }</div>
-<div class="line"><a name="l01201"></a><span class="lineno"> 1201</span> }</div>
-<div class="line"><a name="l01202"></a><span class="lineno"> 1202</span> </div>
-<div class="line"><a name="l01203"></a><span class="lineno"> 1203</span> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> Filter2d::dwtForward(<a class="code" href="classVector2d.html">Vector2d<T></a>& theBuffer, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family){</div>
-<div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l01205"></a><span class="lineno"> 1205</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01209"></a><span class="lineno"> 1209</span> </div>
-<div class="line"><a name="l01210"></a><span class="lineno"> 1210</span>   <span class="keywordtype">int</span> nRow=theBuffer.size();</div>
-<div class="line"><a name="l01211"></a><span class="lineno"> 1211</span>   assert(nRow);</div>
-<div class="line"><a name="l01212"></a><span class="lineno"> 1212</span>   <span class="keywordtype">int</span> nCol=theBuffer[0].size();</div>
-<div class="line"><a name="l01213"></a><span class="lineno"> 1213</span>   assert(nCol);</div>
-<div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>   <span class="comment">//make sure data size if power of 2</span></div>
-<div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>   <span class="keywordflow">while</span>(theBuffer.size()&(theBuffer.size()-1))</div>
-<div class="line"><a name="l01216"></a><span class="lineno"> 1216</span>     theBuffer.push_back(theBuffer.back());</div>
-<div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow)</div>
-<div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>     <span class="keywordflow">while</span>(theBuffer[irow].size()&(theBuffer[irow].size()-1))</div>
-<div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>       theBuffer[irow].push_back(theBuffer[irow].back());</div>
-<div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>   std::vector<double> vdata(theBuffer.size()*theBuffer[0].size());</div>
-<div class="line"><a name="l01221"></a><span class="lineno"> 1221</span>   <span class="keywordtype">double</span>* data=&(vdata[0]);</div>
-<div class="line"><a name="l01222"></a><span class="lineno"> 1222</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
-<div class="line"><a name="l01223"></a><span class="lineno"> 1223</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[0].size();++icol){</div>
-<div class="line"><a name="l01224"></a><span class="lineno"> 1224</span>       <span class="keywordtype">int</span> index=irow*theBuffer[0].size()+icol;</div>
-<div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>       data[index]=theBuffer[irow][icol];</div>
-<div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>     }</div>
-<div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>   }</div>
-<div class="line"><a name="l01228"></a><span class="lineno"> 1228</span>   <span class="keywordtype">int</span> nsize=theBuffer.size()*theBuffer[0].size();</div>
-<div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>   gsl_wavelet *w;</div>
-<div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>   gsl_wavelet_workspace *work;</div>
-<div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>   assert(nsize);</div>
-<div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>   w=gsl_wavelet_alloc(filter::Filter::getWaveletType(wavelet_type),family);</div>
-<div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>   work=gsl_wavelet_workspace_alloc(nsize);</div>
-<div class="line"><a name="l01234"></a><span class="lineno"> 1234</span>   gsl_wavelet2d_nstransform_forward (w, data, theBuffer.size(), theBuffer.size(),theBuffer[0].size(), work);</div>
-<div class="line"><a name="l01235"></a><span class="lineno"> 1235</span>   theBuffer.erase(theBuffer.begin()+nRow,theBuffer.end());</div>
-<div class="line"><a name="l01236"></a><span class="lineno"> 1236</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
-<div class="line"><a name="l01237"></a><span class="lineno"> 1237</span>     theBuffer[irow].erase(theBuffer[irow].begin()+nCol,theBuffer[irow].end());</div>
-<div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[irow].size();++icol){</div>
-<div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>       <span class="keywordtype">int</span> index=irow*theBuffer[irow].size()+icol;</div>
-<div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>       theBuffer[irow][icol]=data[index];</div>
-<div class="line"><a name="l01241"></a><span class="lineno"> 1241</span>     }</div>
-<div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>     progress=(1.0+irow);</div>
-<div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>     progress/=theBuffer.nRows();</div>
-<div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>   }</div>
-<div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>   gsl_wavelet_free (w);</div>
-<div class="line"><a name="l01247"></a><span class="lineno"> 1247</span>   gsl_wavelet_workspace_free (work);</div>
-<div class="line"><a name="l01248"></a><span class="lineno"> 1248</span> }</div>
-<div class="line"><a name="l01249"></a><span class="lineno"> 1249</span> </div>
-<div class="line"><a name="l01250"></a><span class="lineno"> 1250</span> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> Filter2d::dwtInverse(<a class="code" href="classVector2d.html">Vector2d<T></a>& theBuffer, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family){</div>
-<div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l01252"></a><span class="lineno"> 1252</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l01253"></a><span class="lineno"> 1253</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l01254"></a><span class="lineno"> 1254</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01256"></a><span class="lineno"> 1256</span> </div>
-<div class="line"><a name="l01257"></a><span class="lineno"> 1257</span>   <span class="keywordtype">int</span> nRow=theBuffer.size();</div>
-<div class="line"><a name="l01258"></a><span class="lineno"> 1258</span>   assert(nRow);</div>
-<div class="line"><a name="l01259"></a><span class="lineno"> 1259</span>   <span class="keywordtype">int</span> nCol=theBuffer[0].size();</div>
-<div class="line"><a name="l01260"></a><span class="lineno"> 1260</span>   assert(nCol);</div>
-<div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>   <span class="comment">//make sure data size if power of 2</span></div>
-<div class="line"><a name="l01262"></a><span class="lineno"> 1262</span>   <span class="keywordflow">while</span>(theBuffer.size()&(theBuffer.size()-1))</div>
-<div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>     theBuffer.push_back(theBuffer.back());</div>
-<div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow)</div>
-<div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>     <span class="keywordflow">while</span>(theBuffer[irow].size()&(theBuffer[irow].size()-1))</div>
-<div class="line"><a name="l01266"></a><span class="lineno"> 1266</span>       theBuffer[irow].push_back(theBuffer[irow].back());</div>
-<div class="line"><a name="l01267"></a><span class="lineno"> 1267</span>   std::vector<double> vdata(theBuffer.size()*theBuffer[0].size());</div>
-<div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>   <span class="keywordtype">double</span>* data=&(vdata[0]);</div>
-<div class="line"><a name="l01269"></a><span class="lineno"> 1269</span>   <span class="comment">//double data[theBuffer.size()*theBuffer[0].size()];</span></div>
-<div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
-<div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[0].size();++icol){</div>
-<div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>       <span class="keywordtype">int</span> index=irow*theBuffer[0].size()+icol;</div>
-<div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>       data[index]=theBuffer[irow][icol];</div>
-<div class="line"><a name="l01274"></a><span class="lineno"> 1274</span>     }</div>
-<div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>   }</div>
-<div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>   <span class="keywordtype">int</span> nsize=theBuffer.size()*theBuffer[0].size();</div>
-<div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>   gsl_wavelet *w;</div>
-<div class="line"><a name="l01278"></a><span class="lineno"> 1278</span>   gsl_wavelet_workspace *work;</div>
-<div class="line"><a name="l01279"></a><span class="lineno"> 1279</span>   assert(nsize);</div>
-<div class="line"><a name="l01280"></a><span class="lineno"> 1280</span>   w=gsl_wavelet_alloc(filter::Filter::getWaveletType(wavelet_type),family);</div>
-<div class="line"><a name="l01281"></a><span class="lineno"> 1281</span>   work=gsl_wavelet_workspace_alloc(nsize);</div>
-<div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>   gsl_wavelet2d_nstransform_inverse (w, data, theBuffer.size(), theBuffer.size(),theBuffer[0].size(), work);</div>
-<div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>   theBuffer.erase(theBuffer.begin()+nRow,theBuffer.end());</div>
-<div class="line"><a name="l01284"></a><span class="lineno"> 1284</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
-<div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>     theBuffer[irow].erase(theBuffer[irow].begin()+nCol,theBuffer[irow].end());</div>
-<div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[irow].size();++icol){</div>
-<div class="line"><a name="l01287"></a><span class="lineno"> 1287</span>       <span class="keywordtype">int</span> index=irow*theBuffer[irow].size()+icol;</div>
-<div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>       theBuffer[irow][icol]=data[index];</div>
-<div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>     }</div>
-<div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>     progress=(1.0+irow);</div>
-<div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>     progress/=theBuffer.nRows();</div>
-<div class="line"><a name="l01292"></a><span class="lineno"> 1292</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01293"></a><span class="lineno"> 1293</span>   }</div>
-<div class="line"><a name="l01294"></a><span class="lineno"> 1294</span>   gsl_wavelet_free (w);</div>
-<div class="line"><a name="l01295"></a><span class="lineno"> 1295</span>   gsl_wavelet_workspace_free (work);</div>
-<div class="line"><a name="l01296"></a><span class="lineno"> 1296</span> }</div>
-<div class="line"><a name="l01297"></a><span class="lineno"> 1297</span> </div>
-<div class="line"><a name="l01298"></a><span class="lineno"> 1298</span> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> Filter2d::dwtCut(<a class="code" href="classVector2d.html">Vector2d<T></a>& theBuffer, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family, <span class="keywordtype">double</span> cut){</div>
-<div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l01300"></a><span class="lineno"> 1300</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01304"></a><span class="lineno"> 1304</span> </div>
-<div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>   <span class="keywordtype">int</span> nRow=theBuffer.size();</div>
-<div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>   assert(nRow);</div>
-<div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>   <span class="keywordtype">int</span> nCol=theBuffer[0].size();</div>
-<div class="line"><a name="l01308"></a><span class="lineno"> 1308</span>   assert(nCol);</div>
-<div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>   <span class="comment">//make sure data size if power of 2</span></div>
-<div class="line"><a name="l01310"></a><span class="lineno"> 1310</span>   <span class="keywordflow">while</span>(theBuffer.size()&(theBuffer.size()-1))</div>
-<div class="line"><a name="l01311"></a><span class="lineno"> 1311</span>     theBuffer.push_back(theBuffer.back());</div>
-<div class="line"><a name="l01312"></a><span class="lineno"> 1312</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow)</div>
-<div class="line"><a name="l01313"></a><span class="lineno"> 1313</span>     <span class="keywordflow">while</span>(theBuffer[irow].size()&(theBuffer[irow].size()-1))</div>
-<div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>       theBuffer[irow].push_back(theBuffer[irow].back());</div>
-<div class="line"><a name="l01315"></a><span class="lineno"> 1315</span>   <span class="keywordtype">double</span>* data=<span class="keyword">new</span> <span class="keywordtype">double</span>[theBuffer.size()*theBuffer[0].size()];</div>
-<div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>   <span class="keywordtype">double</span>* abscoeff=<span class="keyword">new</span> <span class="keywordtype">double</span>[theBuffer.size()*theBuffer[0].size()];</div>
-<div class="line"><a name="l01317"></a><span class="lineno"> 1317</span>   <span class="keywordtype">size_t</span>* p=<span class="keyword">new</span> <span class="keywordtype">size_t</span>[theBuffer.size()*theBuffer[0].size()];</div>
-<div class="line"><a name="l01318"></a><span class="lineno"> 1318</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
-<div class="line"><a name="l01319"></a><span class="lineno"> 1319</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[0].size();++icol){</div>
-<div class="line"><a name="l01320"></a><span class="lineno"> 1320</span>       <span class="keywordtype">int</span> index=irow*theBuffer[0].size()+icol;</div>
-<div class="line"><a name="l01321"></a><span class="lineno"> 1321</span>       assert(index<theBuffer.size()*theBuffer[0].size());</div>
-<div class="line"><a name="l01322"></a><span class="lineno"> 1322</span>       data[index]=theBuffer[irow][icol];</div>
-<div class="line"><a name="l01323"></a><span class="lineno"> 1323</span>     }</div>
-<div class="line"><a name="l01324"></a><span class="lineno"> 1324</span>   }</div>
-<div class="line"><a name="l01325"></a><span class="lineno"> 1325</span>   <span class="keywordtype">int</span> nsize=theBuffer.size()*theBuffer[0].size();</div>
-<div class="line"><a name="l01326"></a><span class="lineno"> 1326</span>   gsl_wavelet *w;</div>
-<div class="line"><a name="l01327"></a><span class="lineno"> 1327</span>   gsl_wavelet_workspace *work;</div>
-<div class="line"><a name="l01328"></a><span class="lineno"> 1328</span>   assert(nsize);</div>
-<div class="line"><a name="l01329"></a><span class="lineno"> 1329</span>   w=gsl_wavelet_alloc(filter::Filter::getWaveletType(wavelet_type),family);</div>
-<div class="line"><a name="l01330"></a><span class="lineno"> 1330</span>   work=gsl_wavelet_workspace_alloc(nsize);</div>
-<div class="line"><a name="l01331"></a><span class="lineno"> 1331</span>   gsl_wavelet2d_nstransform_forward (w, data, theBuffer.size(), theBuffer[0].size(),theBuffer[0].size(), work);</div>
-<div class="line"><a name="l01332"></a><span class="lineno"> 1332</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
-<div class="line"><a name="l01333"></a><span class="lineno"> 1333</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[0].size();++icol){</div>
-<div class="line"><a name="l01334"></a><span class="lineno"> 1334</span>       <span class="keywordtype">int</span> index=irow*theBuffer[0].size()+icol;</div>
-<div class="line"><a name="l01335"></a><span class="lineno"> 1335</span>       abscoeff[index]=fabs(data[index]);</div>
-<div class="line"><a name="l01336"></a><span class="lineno"> 1336</span>     }</div>
-<div class="line"><a name="l01337"></a><span class="lineno"> 1337</span>   }</div>
-<div class="line"><a name="l01338"></a><span class="lineno"> 1338</span>   <span class="keywordtype">int</span> nc=(100-cut)/100.0*nsize;</div>
-<div class="line"><a name="l01339"></a><span class="lineno"> 1339</span>   gsl_sort_index(p,abscoeff,1,nsize);</div>
-<div class="line"><a name="l01340"></a><span class="lineno"> 1340</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;(i+nc)<nsize;i++)</div>
-<div class="line"><a name="l01341"></a><span class="lineno"> 1341</span>    data[p[i]]=0;</div>
-<div class="line"><a name="l01342"></a><span class="lineno"> 1342</span>   gsl_wavelet2d_nstransform_inverse (w, data, theBuffer.size(), theBuffer[0].size(),theBuffer[0].size(), work);</div>
-<div class="line"><a name="l01343"></a><span class="lineno"> 1343</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
-<div class="line"><a name="l01344"></a><span class="lineno"> 1344</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[irow].size();++icol){</div>
-<div class="line"><a name="l01345"></a><span class="lineno"> 1345</span>       <span class="keywordtype">int</span> index=irow*theBuffer[irow].size()+icol;</div>
-<div class="line"><a name="l01346"></a><span class="lineno"> 1346</span>       theBuffer[irow][icol]=data[index];</div>
-<div class="line"><a name="l01347"></a><span class="lineno"> 1347</span>     }</div>
-<div class="line"><a name="l01348"></a><span class="lineno"> 1348</span>     progress=(1.0+irow);</div>
-<div class="line"><a name="l01349"></a><span class="lineno"> 1349</span>     progress/=theBuffer.nRows();</div>
-<div class="line"><a name="l01350"></a><span class="lineno"> 1350</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l01351"></a><span class="lineno"> 1351</span>   }</div>
-<div class="line"><a name="l01352"></a><span class="lineno"> 1352</span>   theBuffer.erase(theBuffer.begin()+nRow,theBuffer.end());</div>
-<div class="line"><a name="l01353"></a><span class="lineno"> 1353</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow)</div>
-<div class="line"><a name="l01354"></a><span class="lineno"> 1354</span>     theBuffer[irow].erase(theBuffer[irow].begin()+nCol,theBuffer[irow].end());</div>
-<div class="line"><a name="l01355"></a><span class="lineno"> 1355</span>   <span class="keyword">delete</span>[] data;</div>
-<div class="line"><a name="l01356"></a><span class="lineno"> 1356</span>   <span class="keyword">delete</span>[] abscoeff;</div>
-<div class="line"><a name="l01357"></a><span class="lineno"> 1357</span>   <span class="keyword">delete</span>[] p;</div>
-<div class="line"><a name="l01358"></a><span class="lineno"> 1358</span>   gsl_wavelet_free (w);</div>
-<div class="line"><a name="l01359"></a><span class="lineno"> 1359</span>   gsl_wavelet_workspace_free (work);</div>
-<div class="line"><a name="l01360"></a><span class="lineno"> 1360</span> </div>
-<div class="line"><a name="l01361"></a><span class="lineno"> 1361</span> }</div>
-<div class="line"><a name="l01362"></a><span class="lineno"> 1362</span> </div>
-<div class="line"><a name="l01363"></a><span class="lineno"> 1363</span> }</div>
+<div class="line"><a name="l00714"></a><span class="lineno">  714</span>       output[y][x]=currentValue;<span class="comment">//introduced due to hThreshold</span></div>
+<div class="line"><a name="l00715"></a><span class="lineno">  715</span>       <span class="keywordflow">if</span>(currentMasked){</div>
+<div class="line"><a name="l00716"></a><span class="lineno">  716</span>         output[y][x]=currentValue;</div>
+<div class="line"><a name="l00717"></a><span class="lineno">  717</span>       }</div>
+<div class="line"><a name="l00718"></a><span class="lineno">  718</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00719"></a><span class="lineno">  719</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00720"></a><span class="lineno">  720</span>           <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
+<div class="line"><a name="l00721"></a><span class="lineno">  721</span>             <span class="keywordtype">double</span> d2=i*i+j*j;<span class="comment">//square distance</span></div>
+<div class="line"><a name="l00722"></a><span class="lineno">  722</span>             <span class="keywordflow">if</span>(disc&&(d2>(dimX/2)*(dimY/2)))</div>
+<div class="line"><a name="l00723"></a><span class="lineno">  723</span>               <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l00724"></a><span class="lineno">  724</span>             indexI=x+i;</div>
+<div class="line"><a name="l00725"></a><span class="lineno">  725</span>             <span class="comment">//check if out of bounds</span></div>
+<div class="line"><a name="l00726"></a><span class="lineno">  726</span>             <span class="keywordflow">if</span>(indexI<0)</div>
+<div class="line"><a name="l00727"></a><span class="lineno">  727</span>               indexI=-indexI;</div>
+<div class="line"><a name="l00728"></a><span class="lineno">  728</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=input.nCols())</div>
+<div class="line"><a name="l00729"></a><span class="lineno">  729</span>               indexI=input.nCols()-i;</div>
+<div class="line"><a name="l00730"></a><span class="lineno">  730</span>             <span class="keywordflow">if</span>(y+j<0)</div>
+<div class="line"><a name="l00731"></a><span class="lineno">  731</span>               indexJ=-j;</div>
+<div class="line"><a name="l00732"></a><span class="lineno">  732</span>             <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=input.nRows())</div>
+<div class="line"><a name="l00733"></a><span class="lineno">  733</span>                 indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
+<div class="line"><a name="l00734"></a><span class="lineno">  734</span>               <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00735"></a><span class="lineno">  735</span>                 indexJ=(dimY-1)/2+j;</div>
+<div class="line"><a name="l00736"></a><span class="lineno">  736</span>             <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==noDataValue)</div>
+<div class="line"><a name="l00737"></a><span class="lineno">  737</span>               <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l00738"></a><span class="lineno">  738</span>             <span class="keywordtype">bool</span> masked=<span class="keyword">false</span>;</div>
+<div class="line"><a name="l00739"></a><span class="lineno">  739</span>             <span class="keywordflow">for</span>(<span class="keywordtype">int</span> imask=0;imask<m_noDataValues.size();++imask){</div>
+<div class="line"><a name="l00740"></a><span class="lineno">  740</span>               <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_noDataValues[imask]){</div>
+<div class="line"><a name="l00741"></a><span class="lineno">  741</span>                 masked=<span class="keyword">true</span>;</div>
+<div class="line"><a name="l00742"></a><span class="lineno">  742</span>                 <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00743"></a><span class="lineno">  743</span>               }</div>
+<div class="line"><a name="l00744"></a><span class="lineno">  744</span>             }</div>
+<div class="line"><a name="l00745"></a><span class="lineno">  745</span>             <span class="keywordflow">if</span>(!masked){</div>
+<div class="line"><a name="l00746"></a><span class="lineno">  746</span>               <span class="keywordtype">short</span> binValue=0;</div>
+<div class="line"><a name="l00747"></a><span class="lineno">  747</span>               <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iclass=0;iclass<m_class.size();++iclass){</div>
+<div class="line"><a name="l00748"></a><span class="lineno">  748</span>                 <span class="keywordflow">if</span>(inBuffer[indexJ][indexI]==m_class[iclass]){</div>
+<div class="line"><a name="l00749"></a><span class="lineno">  749</span>                   binValue=1;</div>
+<div class="line"><a name="l00750"></a><span class="lineno">  750</span>                   <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00751"></a><span class="lineno">  751</span>                 }</div>
+<div class="line"><a name="l00752"></a><span class="lineno">  752</span>               }</div>
+<div class="line"><a name="l00753"></a><span class="lineno">  753</span>               <span class="keywordflow">if</span>(m_class.size())</div>
+<div class="line"><a name="l00754"></a><span class="lineno">  754</span>                 statBuffer.push_back(binValue);</div>
+<div class="line"><a name="l00755"></a><span class="lineno">  755</span>               <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00756"></a><span class="lineno">  756</span>                 statBuffer.push_back(inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l00757"></a><span class="lineno">  757</span>             }</div>
+<div class="line"><a name="l00758"></a><span class="lineno">  758</span>           }</div>
+<div class="line"><a name="l00759"></a><span class="lineno">  759</span>         }</div>
+<div class="line"><a name="l00760"></a><span class="lineno">  760</span>         <span class="keywordflow">if</span>(statBuffer.size()){</div>
+<div class="line"><a name="l00761"></a><span class="lineno">  761</span>           <span class="keywordflow">switch</span>(getFilterType(method)){</div>
+<div class="line"><a name="l00762"></a><span class="lineno">  762</span>           <span class="keywordflow">case</span>(filter2d::dilate):</div>
+<div class="line"><a name="l00763"></a><span class="lineno">  763</span>             <span class="keywordflow">if</span>(output[y][x]<stat.mymax(statBuffer)-hThreshold){</div>
+<div class="line"><a name="l00764"></a><span class="lineno">  764</span>               output[y][x]=stat.mymax(statBuffer);</div>
+<div class="line"><a name="l00765"></a><span class="lineno">  765</span>               ++nchange;</div>
+<div class="line"><a name="l00766"></a><span class="lineno">  766</span>             }</div>
+<div class="line"><a name="l00767"></a><span class="lineno">  767</span>             <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00768"></a><span class="lineno">  768</span>           <span class="keywordflow">case</span>(filter2d::erode):</div>
+<div class="line"><a name="l00769"></a><span class="lineno">  769</span>             <span class="keywordflow">if</span>(output[y][x]>stat.mymin(statBuffer)+hThreshold){</div>
+<div class="line"><a name="l00770"></a><span class="lineno">  770</span>               output[y][x]=stat.mymin(statBuffer);</div>
+<div class="line"><a name="l00771"></a><span class="lineno">  771</span>               ++nchange;</div>
+<div class="line"><a name="l00772"></a><span class="lineno">  772</span>             }</div>
+<div class="line"><a name="l00773"></a><span class="lineno">  773</span>             <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00774"></a><span class="lineno">  774</span>           <span class="keywordflow">default</span>:</div>
+<div class="line"><a name="l00775"></a><span class="lineno">  775</span>             std::ostringstream ess;</div>
+<div class="line"><a name="l00776"></a><span class="lineno">  776</span>             ess << <span class="stringliteral">"Error:  morphology method "</span> << method << <span class="stringliteral">" not supported, choose "</span> << filter2d::dilate << <span class="stringliteral">" (dilate) or "</span> << filter2d::erode << <span class="stringliteral">" (erode)"</span> << std::endl;</div>
+<div class="line"><a name="l00777"></a><span class="lineno">  777</span>             <span class="keywordflow">throw</span>(ess.str());</div>
+<div class="line"><a name="l00778"></a><span class="lineno">  778</span>             <span class="keywordflow">break</span>;</div>
+<div class="line"><a name="l00779"></a><span class="lineno">  779</span>           }</div>
+<div class="line"><a name="l00780"></a><span class="lineno">  780</span>           <span class="keywordflow">if</span>(output[y][x]&&m_class.size())</div>
+<div class="line"><a name="l00781"></a><span class="lineno">  781</span>             output[y][x]=m_class[0];</div>
+<div class="line"><a name="l00782"></a><span class="lineno">  782</span>           <span class="comment">// else{</span></div>
+<div class="line"><a name="l00783"></a><span class="lineno">  783</span>           <span class="comment">//   assert(m_noDataValues.size());</span></div>
+<div class="line"><a name="l00784"></a><span class="lineno">  784</span>           <span class="comment">//   output[x]=m_noDataValues[0];</span></div>
+<div class="line"><a name="l00785"></a><span class="lineno">  785</span>           <span class="comment">// }</span></div>
+<div class="line"><a name="l00786"></a><span class="lineno">  786</span>         }</div>
+<div class="line"><a name="l00787"></a><span class="lineno">  787</span>         <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00788"></a><span class="lineno">  788</span>           output[y][x]=noDataValue;</div>
+<div class="line"><a name="l00789"></a><span class="lineno">  789</span>       }</div>
+<div class="line"><a name="l00790"></a><span class="lineno">  790</span>     }</div>
+<div class="line"><a name="l00791"></a><span class="lineno">  791</span>     progress=(1.0+y);</div>
+<div class="line"><a name="l00792"></a><span class="lineno">  792</span>     progress/=output.nRows();</div>
+<div class="line"><a name="l00793"></a><span class="lineno">  793</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00794"></a><span class="lineno">  794</span>   }</div>
+<div class="line"><a name="l00795"></a><span class="lineno">  795</span>   <span class="keywordflow">return</span> nchange;</div>
+<div class="line"><a name="l00796"></a><span class="lineno">  796</span> }</div>
+<div class="line"><a name="l00797"></a><span class="lineno">  797</span> </div>
+<div class="line"><a name="l00798"></a><span class="lineno">  798</span>  <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> Filter2d::dsm2dtm_nwse(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& inputDSM, <a class="code" href="classVector2d.html">Vector2d<T></a>& outputMa [...]
+<div class="line"><a name="l00799"></a><span class="lineno">  799</span> {</div>
+<div class="line"><a name="l00800"></a><span class="lineno">  800</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l00801"></a><span class="lineno">  801</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l00802"></a><span class="lineno">  802</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l00803"></a><span class="lineno">  803</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l00804"></a><span class="lineno">  804</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00805"></a><span class="lineno">  805</span> </div>
+<div class="line"><a name="l00806"></a><span class="lineno">  806</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> tmpDSM(inputDSM);</div>
+<div class="line"><a name="l00807"></a><span class="lineno">  807</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
+<div class="line"><a name="l00808"></a><span class="lineno">  808</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
+<div class="line"><a name="l00809"></a><span class="lineno">  809</span>     noDataValue=m_noDataValues[0];</div>
+<div class="line"><a name="l00810"></a><span class="lineno">  810</span> </div>
+<div class="line"><a name="l00811"></a><span class="lineno">  811</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nchange=0;</div>
+<div class="line"><a name="l00812"></a><span class="lineno">  812</span>   <span class="keywordtype">int</span> dimX=dim;</div>
+<div class="line"><a name="l00813"></a><span class="lineno">  813</span>   <span class="keywordtype">int</span> dimY=dim;</div>
+<div class="line"><a name="l00814"></a><span class="lineno">  814</span>   assert(dimX);</div>
+<div class="line"><a name="l00815"></a><span class="lineno">  815</span>   assert(dimY);</div>
+<div class="line"><a name="l00816"></a><span class="lineno">  816</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
+<div class="line"><a name="l00817"></a><span class="lineno">  817</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> inBuffer(dimY,inputDSM.nCols());</div>
+<div class="line"><a name="l00818"></a><span class="lineno">  818</span>   <span class="keywordflow">if</span>(outputMask.size()!=inputDSM.nRows())</div>
+<div class="line"><a name="l00819"></a><span class="lineno">  819</span>     outputMask.resize(inputDSM.nRows());</div>
+<div class="line"><a name="l00820"></a><span class="lineno">  820</span>   <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l00821"></a><span class="lineno">  821</span>   <span class="keywordtype">int</span> indexJ=0;</div>
+<div class="line"><a name="l00822"></a><span class="lineno">  822</span>   <span class="comment">//initialize last half of inBuffer</span></div>
+<div class="line"><a name="l00823"></a><span class="lineno">  823</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00824"></a><span class="lineno">  824</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<inputDSM.nCols();++i)</div>
+<div class="line"><a name="l00825"></a><span class="lineno">  825</span>       inBuffer[indexJ][i]=tmpDSM[abs(j)][i];</div>
+<div class="line"><a name="l00826"></a><span class="lineno">  826</span>     ++indexJ;</div>
+<div class="line"><a name="l00827"></a><span class="lineno">  827</span>   }</div>
+<div class="line"><a name="l00828"></a><span class="lineno">  828</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<tmpDSM.nRows();++y){</div>
+<div class="line"><a name="l00829"></a><span class="lineno">  829</span>     <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
+<div class="line"><a name="l00830"></a><span class="lineno">  830</span>       <span class="comment">//erase first line from inBuffer</span></div>
+<div class="line"><a name="l00831"></a><span class="lineno">  831</span>       inBuffer.erase(inBuffer.begin());</div>
+<div class="line"><a name="l00832"></a><span class="lineno">  832</span>       <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
+<div class="line"><a name="l00833"></a><span class="lineno">  833</span>       <span class="keywordflow">if</span>(y+dimY/2<tmpDSM.nRows()){</div>
+<div class="line"><a name="l00834"></a><span class="lineno">  834</span>         <span class="comment">//allocate buffer</span></div>
+<div class="line"><a name="l00835"></a><span class="lineno">  835</span>         inBuffer.push_back(inBuffer.back());</div>
+<div class="line"><a name="l00836"></a><span class="lineno">  836</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<tmpDSM.nCols();++i)</div>
+<div class="line"><a name="l00837"></a><span class="lineno">  837</span>           inBuffer[inBuffer.size()-1][i]=tmpDSM[y+dimY/2][i];</div>
+<div class="line"><a name="l00838"></a><span class="lineno">  838</span>       }</div>
+<div class="line"><a name="l00839"></a><span class="lineno">  839</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00840"></a><span class="lineno">  840</span>         <span class="keywordtype">int</span> over=y+dimY/2-tmpDSM.nRows();</div>
+<div class="line"><a name="l00841"></a><span class="lineno">  841</span>         <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
+<div class="line"><a name="l00842"></a><span class="lineno">  842</span>         assert(index>=0);</div>
+<div class="line"><a name="l00843"></a><span class="lineno">  843</span>         assert(index<inBuffer.size());</div>
+<div class="line"><a name="l00844"></a><span class="lineno">  844</span>         inBuffer.push_back(inBuffer[index]);</div>
+<div class="line"><a name="l00845"></a><span class="lineno">  845</span>       }</div>
+<div class="line"><a name="l00846"></a><span class="lineno">  846</span>     }</div>
+<div class="line"><a name="l00847"></a><span class="lineno">  847</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<tmpDSM.nCols();++x){</div>
+<div class="line"><a name="l00848"></a><span class="lineno">  848</span>       <span class="keywordtype">double</span> centerValue=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l00849"></a><span class="lineno">  849</span>       <span class="keywordtype">short</span> nmasked=0;</div>
+<div class="line"><a name="l00850"></a><span class="lineno">  850</span>       std::vector<T> neighbors;</div>
+<div class="line"><a name="l00851"></a><span class="lineno">  851</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00852"></a><span class="lineno">  852</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
+<div class="line"><a name="l00853"></a><span class="lineno">  853</span>       indexI=x+i;</div>
+<div class="line"><a name="l00854"></a><span class="lineno">  854</span>       <span class="comment">//check if out of bounds</span></div>
+<div class="line"><a name="l00855"></a><span class="lineno">  855</span>       <span class="keywordflow">if</span>(indexI<0)</div>
+<div class="line"><a name="l00856"></a><span class="lineno">  856</span>         indexI=-indexI;</div>
+<div class="line"><a name="l00857"></a><span class="lineno">  857</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=tmpDSM.nCols())</div>
+<div class="line"><a name="l00858"></a><span class="lineno">  858</span>         indexI=tmpDSM.nCols()-i;</div>
+<div class="line"><a name="l00859"></a><span class="lineno">  859</span>       <span class="keywordflow">if</span>(y+j<0)</div>
+<div class="line"><a name="l00860"></a><span class="lineno">  860</span>         indexJ=-j;</div>
+<div class="line"><a name="l00861"></a><span class="lineno">  861</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=tmpDSM.nRows())</div>
+<div class="line"><a name="l00862"></a><span class="lineno">  862</span>         indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
+<div class="line"><a name="l00863"></a><span class="lineno">  863</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00864"></a><span class="lineno">  864</span>         indexJ=(dimY-1)/2+j;</div>
+<div class="line"><a name="l00865"></a><span class="lineno">  865</span>       <span class="keywordtype">double</span> difference=(centerValue-inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l00866"></a><span class="lineno">  866</span>       <span class="keywordflow">if</span>(i||j)<span class="comment">//skip centerValue</span></div>
+<div class="line"><a name="l00867"></a><span class="lineno">  867</span>         neighbors.push_back(inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l00868"></a><span class="lineno">  868</span>       <span class="keywordflow">if</span>(difference>hThreshold)</div>
+<div class="line"><a name="l00869"></a><span class="lineno">  869</span>         ++nmasked;</div>
+<div class="line"><a name="l00870"></a><span class="lineno">  870</span>     }</div>
+<div class="line"><a name="l00871"></a><span class="lineno">  871</span>       }</div>
+<div class="line"><a name="l00872"></a><span class="lineno">  872</span>       <span class="keywordflow">if</span>(nmasked<=nlimit){</div>
+<div class="line"><a name="l00873"></a><span class="lineno">  873</span>     ++nchange;</div>
+<div class="line"><a name="l00874"></a><span class="lineno">  874</span>     <span class="comment">//reset pixel in outputMask</span></div>
+<div class="line"><a name="l00875"></a><span class="lineno">  875</span>     outputMask[y][x]=0;</div>
+<div class="line"><a name="l00876"></a><span class="lineno">  876</span>       }</div>
+<div class="line"><a name="l00877"></a><span class="lineno">  877</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00878"></a><span class="lineno">  878</span>     <span class="comment">//reset pixel height in tmpDSM</span></div>
+<div class="line"><a name="l00879"></a><span class="lineno">  879</span>     sort(neighbors.begin(),neighbors.end());</div>
+<div class="line"><a name="l00880"></a><span class="lineno">  880</span>     assert(neighbors.size()>1);</div>
+<div class="line"><a name="l00881"></a><span class="lineno">  881</span>     inBuffer[(dimY-1)/2][x]=neighbors[1];</div>
+<div class="line"><a name="l00882"></a><span class="lineno">  882</span>     <span class="comment">/* inBuffer[(dimY-1)/2][x]=stat.mymin(neighbors); */</span></div>
+<div class="line"><a name="l00883"></a><span class="lineno">  883</span>       }</div>
+<div class="line"><a name="l00884"></a><span class="lineno">  884</span>     }</div>
+<div class="line"><a name="l00885"></a><span class="lineno">  885</span>     progress=(1.0+y);</div>
+<div class="line"><a name="l00886"></a><span class="lineno">  886</span>     progress/=outputMask.nRows();</div>
+<div class="line"><a name="l00887"></a><span class="lineno">  887</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00888"></a><span class="lineno">  888</span>   }</div>
+<div class="line"><a name="l00889"></a><span class="lineno">  889</span>   <span class="keywordflow">return</span> nchange;</div>
+<div class="line"><a name="l00890"></a><span class="lineno">  890</span> }</div>
+<div class="line"><a name="l00891"></a><span class="lineno">  891</span> </div>
+<div class="line"><a name="l00892"></a><span class="lineno">  892</span>  <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> Filter2d::dsm2dtm_nesw(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& inputDSM, <a class="code" href="classVector2d.html">Vector2d<T></a>& outputMa [...]
+<div class="line"><a name="l00893"></a><span class="lineno">  893</span> {</div>
+<div class="line"><a name="l00894"></a><span class="lineno">  894</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l00895"></a><span class="lineno">  895</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l00896"></a><span class="lineno">  896</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l00897"></a><span class="lineno">  897</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l00898"></a><span class="lineno">  898</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00899"></a><span class="lineno">  899</span> </div>
+<div class="line"><a name="l00900"></a><span class="lineno">  900</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> tmpDSM(inputDSM);</div>
+<div class="line"><a name="l00901"></a><span class="lineno">  901</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
+<div class="line"><a name="l00902"></a><span class="lineno">  902</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
+<div class="line"><a name="l00903"></a><span class="lineno">  903</span>     noDataValue=m_noDataValues[0];</div>
+<div class="line"><a name="l00904"></a><span class="lineno">  904</span> </div>
+<div class="line"><a name="l00905"></a><span class="lineno">  905</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nchange=0;</div>
+<div class="line"><a name="l00906"></a><span class="lineno">  906</span>   <span class="keywordtype">int</span> dimX=dim;</div>
+<div class="line"><a name="l00907"></a><span class="lineno">  907</span>   <span class="keywordtype">int</span> dimY=dim;</div>
+<div class="line"><a name="l00908"></a><span class="lineno">  908</span>   assert(dimX);</div>
+<div class="line"><a name="l00909"></a><span class="lineno">  909</span>   assert(dimY);</div>
+<div class="line"><a name="l00910"></a><span class="lineno">  910</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
+<div class="line"><a name="l00911"></a><span class="lineno">  911</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> inBuffer(dimY,inputDSM.nCols());</div>
+<div class="line"><a name="l00912"></a><span class="lineno">  912</span>   <span class="keywordflow">if</span>(outputMask.size()!=inputDSM.nRows())</div>
+<div class="line"><a name="l00913"></a><span class="lineno">  913</span>     outputMask.resize(inputDSM.nRows());</div>
+<div class="line"><a name="l00914"></a><span class="lineno">  914</span>   <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l00915"></a><span class="lineno">  915</span>   <span class="keywordtype">int</span> indexJ=0;</div>
+<div class="line"><a name="l00916"></a><span class="lineno">  916</span>   <span class="comment">//initialize last half of inBuffer</span></div>
+<div class="line"><a name="l00917"></a><span class="lineno">  917</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00918"></a><span class="lineno">  918</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<inputDSM.nCols();++i)</div>
+<div class="line"><a name="l00919"></a><span class="lineno">  919</span>       inBuffer[indexJ][i]=tmpDSM[abs(j)][i];</div>
+<div class="line"><a name="l00920"></a><span class="lineno">  920</span>     ++indexJ;</div>
+<div class="line"><a name="l00921"></a><span class="lineno">  921</span>   }</div>
+<div class="line"><a name="l00922"></a><span class="lineno">  922</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<tmpDSM.nRows();++y){</div>
+<div class="line"><a name="l00923"></a><span class="lineno">  923</span>     <span class="keywordflow">if</span>(y){<span class="comment">//inBuffer already initialized for y=0</span></div>
+<div class="line"><a name="l00924"></a><span class="lineno">  924</span>       <span class="comment">//erase first line from inBuffer</span></div>
+<div class="line"><a name="l00925"></a><span class="lineno">  925</span>       inBuffer.erase(inBuffer.begin());</div>
+<div class="line"><a name="l00926"></a><span class="lineno">  926</span>       <span class="comment">//read extra line and push back to inBuffer if not out of bounds</span></div>
+<div class="line"><a name="l00927"></a><span class="lineno">  927</span>       <span class="keywordflow">if</span>(y+dimY/2<tmpDSM.nRows()){</div>
+<div class="line"><a name="l00928"></a><span class="lineno">  928</span>         <span class="comment">//allocate buffer</span></div>
+<div class="line"><a name="l00929"></a><span class="lineno">  929</span>         inBuffer.push_back(inBuffer.back());</div>
+<div class="line"><a name="l00930"></a><span class="lineno">  930</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<tmpDSM.nCols();++i)</div>
+<div class="line"><a name="l00931"></a><span class="lineno">  931</span>           inBuffer[inBuffer.size()-1][i]=tmpDSM[y+dimY/2][i];</div>
+<div class="line"><a name="l00932"></a><span class="lineno">  932</span>       }</div>
+<div class="line"><a name="l00933"></a><span class="lineno">  933</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00934"></a><span class="lineno">  934</span>         <span class="keywordtype">int</span> over=y+dimY/2-tmpDSM.nRows();</div>
+<div class="line"><a name="l00935"></a><span class="lineno">  935</span>         <span class="keywordtype">int</span> index=(inBuffer.size()-1)-over;</div>
+<div class="line"><a name="l00936"></a><span class="lineno">  936</span>         assert(index>=0);</div>
+<div class="line"><a name="l00937"></a><span class="lineno">  937</span>         assert(index<inBuffer.size());</div>
+<div class="line"><a name="l00938"></a><span class="lineno">  938</span>         inBuffer.push_back(inBuffer[index]);</div>
+<div class="line"><a name="l00939"></a><span class="lineno">  939</span>       }</div>
+<div class="line"><a name="l00940"></a><span class="lineno">  940</span>     }</div>
+<div class="line"><a name="l00941"></a><span class="lineno">  941</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=tmpDSM.nCols()-1;x>=0;--x){</div>
+<div class="line"><a name="l00942"></a><span class="lineno">  942</span>       <span class="keywordtype">double</span> centerValue=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l00943"></a><span class="lineno">  943</span>       <span class="keywordtype">short</span> nmasked=0;</div>
+<div class="line"><a name="l00944"></a><span class="lineno">  944</span>       std::vector<T> neighbors;</div>
+<div class="line"><a name="l00945"></a><span class="lineno">  945</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l00946"></a><span class="lineno">  946</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
+<div class="line"><a name="l00947"></a><span class="lineno">  947</span>       indexI=x+i;</div>
+<div class="line"><a name="l00948"></a><span class="lineno">  948</span>       <span class="comment">//check if out of bounds</span></div>
+<div class="line"><a name="l00949"></a><span class="lineno">  949</span>       <span class="keywordflow">if</span>(indexI<0)</div>
+<div class="line"><a name="l00950"></a><span class="lineno">  950</span>         indexI=-indexI;</div>
+<div class="line"><a name="l00951"></a><span class="lineno">  951</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=tmpDSM.nCols())</div>
+<div class="line"><a name="l00952"></a><span class="lineno">  952</span>         indexI=tmpDSM.nCols()-i;</div>
+<div class="line"><a name="l00953"></a><span class="lineno">  953</span>       <span class="keywordflow">if</span>(y+j<0)</div>
+<div class="line"><a name="l00954"></a><span class="lineno">  954</span>         indexJ=-j;</div>
+<div class="line"><a name="l00955"></a><span class="lineno">  955</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=tmpDSM.nRows())</div>
+<div class="line"><a name="l00956"></a><span class="lineno">  956</span>         indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
+<div class="line"><a name="l00957"></a><span class="lineno">  957</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l00958"></a><span class="lineno">  958</span>         indexJ=(dimY-1)/2+j;</div>
+<div class="line"><a name="l00959"></a><span class="lineno">  959</span>       <span class="keywordtype">double</span> difference=(centerValue-inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l00960"></a><span class="lineno">  960</span>       <span class="keywordflow">if</span>(i||j)<span class="comment">//skip centerValue</span></div>
+<div class="line"><a name="l00961"></a><span class="lineno">  961</span>         neighbors.push_back(inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l00962"></a><span class="lineno">  962</span>       <span class="keywordflow">if</span>(difference>hThreshold)</div>
+<div class="line"><a name="l00963"></a><span class="lineno">  963</span>         ++nmasked;</div>
+<div class="line"><a name="l00964"></a><span class="lineno">  964</span>     }</div>
+<div class="line"><a name="l00965"></a><span class="lineno">  965</span>       }</div>
+<div class="line"><a name="l00966"></a><span class="lineno">  966</span>       <span class="keywordflow">if</span>(nmasked<=nlimit){</div>
+<div class="line"><a name="l00967"></a><span class="lineno">  967</span>     ++nchange;</div>
+<div class="line"><a name="l00968"></a><span class="lineno">  968</span>     <span class="comment">//reset pixel in outputMask</span></div>
+<div class="line"><a name="l00969"></a><span class="lineno">  969</span>     outputMask[y][x]=0;</div>
+<div class="line"><a name="l00970"></a><span class="lineno">  970</span>       }</div>
+<div class="line"><a name="l00971"></a><span class="lineno">  971</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l00972"></a><span class="lineno">  972</span>     <span class="comment">//reset pixel height in tmpDSM</span></div>
+<div class="line"><a name="l00973"></a><span class="lineno">  973</span>     sort(neighbors.begin(),neighbors.end());</div>
+<div class="line"><a name="l00974"></a><span class="lineno">  974</span>     assert(neighbors.size()>1);</div>
+<div class="line"><a name="l00975"></a><span class="lineno">  975</span>     inBuffer[(dimY-1)/2][x]=neighbors[1];</div>
+<div class="line"><a name="l00976"></a><span class="lineno">  976</span>     <span class="comment">/* inBuffer[(dimY-1)/2][x]=stat.mymin(neighbors); */</span></div>
+<div class="line"><a name="l00977"></a><span class="lineno">  977</span>       }</div>
+<div class="line"><a name="l00978"></a><span class="lineno">  978</span>     }</div>
+<div class="line"><a name="l00979"></a><span class="lineno">  979</span>     progress=(1.0+y);</div>
+<div class="line"><a name="l00980"></a><span class="lineno">  980</span>     progress/=outputMask.nRows();</div>
+<div class="line"><a name="l00981"></a><span class="lineno">  981</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00982"></a><span class="lineno">  982</span>   }</div>
+<div class="line"><a name="l00983"></a><span class="lineno">  983</span>   <span class="keywordflow">return</span> nchange;</div>
+<div class="line"><a name="l00984"></a><span class="lineno">  984</span> }</div>
+<div class="line"><a name="l00985"></a><span class="lineno">  985</span> </div>
+<div class="line"><a name="l00986"></a><span class="lineno">  986</span>  <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> Filter2d::dsm2dtm_senw(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& inputDSM, <a class="code" href="classVector2d.html">Vector2d<T></a>& outputMa [...]
+<div class="line"><a name="l00987"></a><span class="lineno">  987</span> {</div>
+<div class="line"><a name="l00988"></a><span class="lineno">  988</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l00989"></a><span class="lineno">  989</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l00990"></a><span class="lineno">  990</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l00991"></a><span class="lineno">  991</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l00992"></a><span class="lineno">  992</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l00993"></a><span class="lineno">  993</span> </div>
+<div class="line"><a name="l00994"></a><span class="lineno">  994</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> tmpDSM(inputDSM);</div>
+<div class="line"><a name="l00995"></a><span class="lineno">  995</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
+<div class="line"><a name="l00996"></a><span class="lineno">  996</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
+<div class="line"><a name="l00997"></a><span class="lineno">  997</span>     noDataValue=m_noDataValues[0];</div>
+<div class="line"><a name="l00998"></a><span class="lineno">  998</span> </div>
+<div class="line"><a name="l00999"></a><span class="lineno">  999</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nchange=0;</div>
+<div class="line"><a name="l01000"></a><span class="lineno"> 1000</span>   <span class="keywordtype">int</span> dimX=dim;</div>
+<div class="line"><a name="l01001"></a><span class="lineno"> 1001</span>   <span class="keywordtype">int</span> dimY=dim;</div>
+<div class="line"><a name="l01002"></a><span class="lineno"> 1002</span>   assert(dimX);</div>
+<div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>   assert(dimY);</div>
+<div class="line"><a name="l01004"></a><span class="lineno"> 1004</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
+<div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> inBuffer(dimY,inputDSM.nCols());</div>
+<div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>   <span class="keywordflow">if</span>(outputMask.size()!=inputDSM.nRows())</div>
+<div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>     outputMask.resize(inputDSM.nRows());</div>
+<div class="line"><a name="l01008"></a><span class="lineno"> 1008</span>   <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>   <span class="keywordtype">int</span> indexJ=inputDSM.nRows()-1;</div>
+<div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>   <span class="comment">//initialize first half of inBuffer</span></div>
+<div class="line"><a name="l01011"></a><span class="lineno"> 1011</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=inputDSM.nRows()-dimY/2;j<inputDSM.nRows();--j){</div>
+<div class="line"><a name="l01012"></a><span class="lineno"> 1012</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<inputDSM.nCols();++i)</div>
+<div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>       inBuffer[indexJ][i]=tmpDSM[abs(j)][i];</div>
+<div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>     ++indexJ;</div>
+<div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>   }</div>
+<div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=tmpDSM.nRows()-1;y>=0;--y){</div>
+<div class="line"><a name="l01017"></a><span class="lineno"> 1017</span>     <span class="keywordflow">if</span>(y<tmpDSM.nRows()-1){<span class="comment">//inBuffer already initialized for y=tmpDSM.nRows()-1</span></div>
+<div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>       <span class="comment">//erase last line from inBuffer</span></div>
+<div class="line"><a name="l01019"></a><span class="lineno"> 1019</span>       inBuffer.erase(inBuffer.end()-1);</div>
+<div class="line"><a name="l01020"></a><span class="lineno"> 1020</span>       <span class="comment">//read extra line and insert to inBuffer if not out of bounds</span></div>
+<div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>       <span class="keywordflow">if</span>(y-dimY/2>0){</div>
+<div class="line"><a name="l01022"></a><span class="lineno"> 1022</span>         <span class="comment">//allocate buffer</span></div>
+<div class="line"><a name="l01023"></a><span class="lineno"> 1023</span>         inBuffer.insert(inBuffer.begin(),inBuffer.back());</div>
+<div class="line"><a name="l01024"></a><span class="lineno"> 1024</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<tmpDSM.nCols();++i)</div>
+<div class="line"><a name="l01025"></a><span class="lineno"> 1025</span>           inBuffer[0][i]=tmpDSM[y-dimY/2][i];</div>
+<div class="line"><a name="l01026"></a><span class="lineno"> 1026</span>       }</div>
+<div class="line"><a name="l01027"></a><span class="lineno"> 1027</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l01028"></a><span class="lineno"> 1028</span>         inBuffer.insert(inBuffer.begin(),inBuffer[abs(y-dimY/2)]);</div>
+<div class="line"><a name="l01029"></a><span class="lineno"> 1029</span>       }</div>
+<div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>     }</div>
+<div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=tmpDSM.nCols()-1;x>=0;--x){</div>
+<div class="line"><a name="l01032"></a><span class="lineno"> 1032</span>       <span class="keywordtype">double</span> centerValue=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>       <span class="keywordtype">short</span> nmasked=0;</div>
+<div class="line"><a name="l01034"></a><span class="lineno"> 1034</span>       std::vector<T> neighbors;</div>
+<div class="line"><a name="l01035"></a><span class="lineno"> 1035</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l01036"></a><span class="lineno"> 1036</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
+<div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>       indexI=x+i;</div>
+<div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>       <span class="comment">//check if out of bounds</span></div>
+<div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>       <span class="keywordflow">if</span>(indexI<0)</div>
+<div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>         indexI=-indexI;</div>
+<div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=tmpDSM.nCols())</div>
+<div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>         indexI=tmpDSM.nCols()-i;</div>
+<div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>       <span class="keywordflow">if</span>(y+j<0)</div>
+<div class="line"><a name="l01044"></a><span class="lineno"> 1044</span>         indexJ=-j;</div>
+<div class="line"><a name="l01045"></a><span class="lineno"> 1045</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=tmpDSM.nRows())</div>
+<div class="line"><a name="l01046"></a><span class="lineno"> 1046</span>         indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
+<div class="line"><a name="l01047"></a><span class="lineno"> 1047</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>         indexJ=(dimY-1)/2+j;</div>
+<div class="line"><a name="l01049"></a><span class="lineno"> 1049</span>       <span class="keywordtype">double</span> difference=(centerValue-inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>       <span class="keywordflow">if</span>(i||j)<span class="comment">//skip centerValue</span></div>
+<div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>         neighbors.push_back(inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>       <span class="keywordflow">if</span>(difference>hThreshold)</div>
+<div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>         ++nmasked;</div>
+<div class="line"><a name="l01054"></a><span class="lineno"> 1054</span>     }</div>
+<div class="line"><a name="l01055"></a><span class="lineno"> 1055</span>       }</div>
+<div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>       <span class="keywordflow">if</span>(nmasked<=nlimit){</div>
+<div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>     ++nchange;</div>
+<div class="line"><a name="l01058"></a><span class="lineno"> 1058</span>     <span class="comment">//reset pixel in outputMask</span></div>
+<div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>     outputMask[y][x]=0;</div>
+<div class="line"><a name="l01060"></a><span class="lineno"> 1060</span>       }</div>
+<div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l01062"></a><span class="lineno"> 1062</span>     <span class="comment">//reset pixel height in tmpDSM</span></div>
+<div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>     sort(neighbors.begin(),neighbors.end());</div>
+<div class="line"><a name="l01064"></a><span class="lineno"> 1064</span>     assert(neighbors.size()>1);</div>
+<div class="line"><a name="l01065"></a><span class="lineno"> 1065</span>     inBuffer[(dimY-1)/2][x]=neighbors[1];</div>
+<div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>     <span class="comment">/* inBuffer[(dimY-1)/2][x]=stat.mymin(neighbors); */</span></div>
+<div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>       }</div>
+<div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>     }</div>
+<div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>     progress=(1.0+y);</div>
+<div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>     progress/=outputMask.nRows();</div>
+<div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01072"></a><span class="lineno"> 1072</span>   }</div>
+<div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>   <span class="keywordflow">return</span> nchange;</div>
+<div class="line"><a name="l01074"></a><span class="lineno"> 1074</span> }</div>
+<div class="line"><a name="l01075"></a><span class="lineno"> 1075</span> </div>
+<div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>  <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> Filter2d::dsm2dtm_swne(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& inputDSM, <a class="code" href="classVector2d.html">Vector2d<T></a>& outputMa [...]
+<div class="line"><a name="l01077"></a><span class="lineno"> 1077</span> {</div>
+<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01083"></a><span class="lineno"> 1083</span> </div>
+<div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> tmpDSM(inputDSM);</div>
+<div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>   <span class="keywordtype">double</span> noDataValue=0;</div>
+<div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>   <span class="keywordflow">if</span>(m_noDataValues.size())</div>
+<div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>     noDataValue=m_noDataValues[0];</div>
+<div class="line"><a name="l01088"></a><span class="lineno"> 1088</span> </div>
+<div class="line"><a name="l01089"></a><span class="lineno"> 1089</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> nchange=0;</div>
+<div class="line"><a name="l01090"></a><span class="lineno"> 1090</span>   <span class="keywordtype">int</span> dimX=dim;</div>
+<div class="line"><a name="l01091"></a><span class="lineno"> 1091</span>   <span class="keywordtype">int</span> dimY=dim;</div>
+<div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>   assert(dimX);</div>
+<div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>   assert(dimY);</div>
+<div class="line"><a name="l01094"></a><span class="lineno"> 1094</span>   <a class="code" href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a> stat;</div>
+<div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>   <a class="code" href="classVector2d.html">Vector2d<T></a> inBuffer(dimY,inputDSM.nCols());</div>
+<div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>   <span class="keywordflow">if</span>(outputMask.size()!=inputDSM.nRows())</div>
+<div class="line"><a name="l01097"></a><span class="lineno"> 1097</span>     outputMask.resize(inputDSM.nRows());</div>
+<div class="line"><a name="l01098"></a><span class="lineno"> 1098</span>   <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>   <span class="keywordtype">int</span> indexJ=0;</div>
+<div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>   <span class="comment">//initialize first half of inBuffer</span></div>
+<div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=inputDSM.nRows()-dimY/2;j<inputDSM.nRows();--j){</div>
+<div class="line"><a name="l01102"></a><span class="lineno"> 1102</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<inputDSM.nCols();++i)</div>
+<div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>       inBuffer[indexJ][i]=tmpDSM[abs(j)][i];</div>
+<div class="line"><a name="l01104"></a><span class="lineno"> 1104</span>     ++indexJ;</div>
+<div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>   }</div>
+<div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=tmpDSM.nRows()-1;y>=0;--y){</div>
+<div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>     <span class="keywordflow">if</span>(y<tmpDSM.nRows()-1){<span class="comment">//inBuffer already initialized for y=0</span></div>
+<div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>       <span class="comment">//erase last line from inBuffer</span></div>
+<div class="line"><a name="l01109"></a><span class="lineno"> 1109</span>       inBuffer.erase(inBuffer.end()-1);</div>
+<div class="line"><a name="l01110"></a><span class="lineno"> 1110</span>       <span class="comment">//read extra line and insert to inBuffer if not out of bounds</span></div>
+<div class="line"><a name="l01111"></a><span class="lineno"> 1111</span>       <span class="keywordflow">if</span>(y-dimY/2>0){</div>
+<div class="line"><a name="l01112"></a><span class="lineno"> 1112</span>         <span class="comment">//allocate buffer</span></div>
+<div class="line"><a name="l01113"></a><span class="lineno"> 1113</span>         inBuffer.insert(inBuffer.begin(),inBuffer.back());</div>
+<div class="line"><a name="l01114"></a><span class="lineno"> 1114</span>         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<tmpDSM.nCols();++i)</div>
+<div class="line"><a name="l01115"></a><span class="lineno"> 1115</span>           inBuffer[0][i]=tmpDSM[y-dimY/2][i];</div>
+<div class="line"><a name="l01116"></a><span class="lineno"> 1116</span>       }</div>
+<div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l01118"></a><span class="lineno"> 1118</span>         inBuffer.insert(inBuffer.begin(),inBuffer[abs(y-dimY/2)]);</div>
+<div class="line"><a name="l01119"></a><span class="lineno"> 1119</span>       }</div>
+<div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>     }</div>
+<div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<tmpDSM.nCols();++x){</div>
+<div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>       <span class="keywordtype">double</span> centerValue=inBuffer[(dimY-1)/2][x];</div>
+<div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>       <span class="keywordtype">short</span> nmasked=0;</div>
+<div class="line"><a name="l01124"></a><span class="lineno"> 1124</span>       std::vector<T> neighbors;</div>
+<div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=-(dimY-1)/2;j<=dimY/2;++j){</div>
+<div class="line"><a name="l01126"></a><span class="lineno"> 1126</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=-(dimX-1)/2;i<=dimX/2;++i){</div>
+<div class="line"><a name="l01127"></a><span class="lineno"> 1127</span>       indexI=x+i;</div>
+<div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>       <span class="comment">//check if out of bounds</span></div>
+<div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>       <span class="keywordflow">if</span>(indexI<0)</div>
+<div class="line"><a name="l01130"></a><span class="lineno"> 1130</span>         indexI=-indexI;</div>
+<div class="line"><a name="l01131"></a><span class="lineno"> 1131</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(indexI>=tmpDSM.nCols())</div>
+<div class="line"><a name="l01132"></a><span class="lineno"> 1132</span>         indexI=tmpDSM.nCols()-i;</div>
+<div class="line"><a name="l01133"></a><span class="lineno"> 1133</span>       <span class="keywordflow">if</span>(y+j<0)</div>
+<div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>         indexJ=-j;</div>
+<div class="line"><a name="l01135"></a><span class="lineno"> 1135</span>       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(y+j>=tmpDSM.nRows())</div>
+<div class="line"><a name="l01136"></a><span class="lineno"> 1136</span>         indexJ=(dimY>2) ? (dimY-1)/2-j : 0;</div>
+<div class="line"><a name="l01137"></a><span class="lineno"> 1137</span>       <span class="keywordflow">else</span></div>
+<div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>         indexJ=(dimY-1)/2+j;</div>
+<div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>       <span class="keywordtype">double</span> difference=(centerValue-inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>       <span class="keywordflow">if</span>(i||j)<span class="comment">//skip centerValue</span></div>
+<div class="line"><a name="l01141"></a><span class="lineno"> 1141</span>         neighbors.push_back(inBuffer[indexJ][indexI]);</div>
+<div class="line"><a name="l01142"></a><span class="lineno"> 1142</span>       <span class="keywordflow">if</span>(difference>hThreshold)</div>
+<div class="line"><a name="l01143"></a><span class="lineno"> 1143</span>         ++nmasked;</div>
+<div class="line"><a name="l01144"></a><span class="lineno"> 1144</span>     }</div>
+<div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>       }</div>
+<div class="line"><a name="l01146"></a><span class="lineno"> 1146</span>       <span class="keywordflow">if</span>(nmasked<=nlimit){</div>
+<div class="line"><a name="l01147"></a><span class="lineno"> 1147</span>     ++nchange;</div>
+<div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>     <span class="comment">//reset pixel in outputMask</span></div>
+<div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>     outputMask[y][x]=0;</div>
+<div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>       }</div>
+<div class="line"><a name="l01151"></a><span class="lineno"> 1151</span>       <span class="keywordflow">else</span>{</div>
+<div class="line"><a name="l01152"></a><span class="lineno"> 1152</span>     <span class="comment">//reset pixel height in tmpDSM</span></div>
+<div class="line"><a name="l01153"></a><span class="lineno"> 1153</span>     sort(neighbors.begin(),neighbors.end());</div>
+<div class="line"><a name="l01154"></a><span class="lineno"> 1154</span>     assert(neighbors.size()>1);</div>
+<div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>     inBuffer[(dimY-1)/2][x]=neighbors[1];</div>
+<div class="line"><a name="l01156"></a><span class="lineno"> 1156</span>     <span class="comment">/* inBuffer[(dimY-1)/2][x]=stat.mymin(neighbors); */</span></div>
+<div class="line"><a name="l01157"></a><span class="lineno"> 1157</span>       }</div>
+<div class="line"><a name="l01158"></a><span class="lineno"> 1158</span>     }</div>
+<div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>     progress=(1.0+y);</div>
+<div class="line"><a name="l01160"></a><span class="lineno"> 1160</span>     progress/=outputMask.nRows();</div>
+<div class="line"><a name="l01161"></a><span class="lineno"> 1161</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01162"></a><span class="lineno"> 1162</span>   }</div>
+<div class="line"><a name="l01163"></a><span class="lineno"> 1163</span>   <span class="keywordflow">return</span> nchange;</div>
+<div class="line"><a name="l01164"></a><span class="lineno"> 1164</span> }</div>
+<div class="line"><a name="l01165"></a><span class="lineno"> 1165</span> </div>
+<div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>   <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> Filter2d::shadowDsm(<span class="keyword">const</span> <a class="code" href="classVector2d.html">Vector2d<T></a>& input, <a class="code" href="classVector2d.html">Vector2d<T></a>& output, <span class="keywordtype">double</span> sza, <span class="keywordtype">double</span> [...]
+<div class="line"><a name="l01167"></a><span class="lineno"> 1167</span> {</div>
+<div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ncols=input.nCols();</div>
+<div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>   output.clear();</div>
+<div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>   output.resize(input.nRows(),ncols);</div>
+<div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>   <span class="comment">//do we need to initialize output?</span></div>
+<div class="line"><a name="l01172"></a><span class="lineno"> 1172</span>   <span class="comment">// for(int y=0;y<output.nRows();++y)</span></div>
+<div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>   <span class="comment">//   for(int x=0;x<output.nCols();++x)</span></div>
+<div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>   <span class="comment">//     output[y][x]=0;</span></div>
+<div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>   <span class="keywordtype">int</span> indexI=0;</div>
+<div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>   <span class="keywordtype">int</span> indexJ=0;</div>
+<div class="line"><a name="l01177"></a><span class="lineno"> 1177</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l01178"></a><span class="lineno"> 1178</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l01179"></a><span class="lineno"> 1179</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l01180"></a><span class="lineno"> 1180</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01182"></a><span class="lineno"> 1182</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nRows();++y){</div>
+<div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nCols();++x){</div>
+<div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>       <span class="keywordtype">double</span> currentValue=input[y][x];</div>
+<div class="line"><a name="l01185"></a><span class="lineno"> 1185</span>       <span class="keywordtype">int</span> theDist=<span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(sqrt((currentValue*tan(DEG2RAD(sza))/pixelSize)*(currentValue*tan(DEG2RAD(sza))/pixelSize)));<span class="comment">//in pixels</span></div>
+<div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>       <span class="keywordtype">double</span> theDir=DEG2RAD(saa)+PI/2.0;</div>
+<div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>       <span class="keywordflow">if</span>(theDir<0)</div>
+<div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>         theDir+=2*PI;</div>
+<div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> d=0;d<theDist;++d){<span class="comment">//d in pixels</span></div>
+<div class="line"><a name="l01190"></a><span class="lineno"> 1190</span>         indexI=x+d*cos(theDir);<span class="comment">//in pixels</span></div>
+<div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>         indexJ=y+d*sin(theDir);<span class="comment">//in pixels</span></div>
+<div class="line"><a name="l01192"></a><span class="lineno"> 1192</span>         <span class="keywordflow">if</span>(indexJ<0||indexJ>=input.size())</div>
+<div class="line"><a name="l01193"></a><span class="lineno"> 1193</span>           <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>         <span class="keywordflow">if</span>(indexI<0||indexI>=input[indexJ].size())</div>
+<div class="line"><a name="l01195"></a><span class="lineno"> 1195</span>           <span class="keywordflow">continue</span>;</div>
+<div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>         <span class="keywordflow">if</span>(input[indexJ][indexI]<currentValue-d*pixelSize/tan(DEG2RAD(sza))){<span class="comment">//in m</span></div>
+<div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>           output[indexJ][indexI]=shadowFlag;</div>
+<div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>         }</div>
+<div class="line"><a name="l01199"></a><span class="lineno"> 1199</span>       }</div>
+<div class="line"><a name="l01200"></a><span class="lineno"> 1200</span>     }</div>
+<div class="line"><a name="l01201"></a><span class="lineno"> 1201</span>     progress=(1.0+y);</div>
+<div class="line"><a name="l01202"></a><span class="lineno"> 1202</span>     progress/=output.nRows();</div>
+<div class="line"><a name="l01203"></a><span class="lineno"> 1203</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>   }</div>
+<div class="line"><a name="l01205"></a><span class="lineno"> 1205</span> }</div>
+<div class="line"><a name="l01206"></a><span class="lineno"> 1206</span> </div>
+<div class="line"><a name="l01207"></a><span class="lineno"> 1207</span> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> Filter2d::dwtForward(<a class="code" href="classVector2d.html">Vector2d<T></a>& theBuffer, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family){</div>
+<div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l01209"></a><span class="lineno"> 1209</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l01210"></a><span class="lineno"> 1210</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l01211"></a><span class="lineno"> 1211</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l01212"></a><span class="lineno"> 1212</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01213"></a><span class="lineno"> 1213</span> </div>
+<div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>   <span class="keywordtype">int</span> nRow=theBuffer.size();</div>
+<div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>   assert(nRow);</div>
+<div class="line"><a name="l01216"></a><span class="lineno"> 1216</span>   <span class="keywordtype">int</span> nCol=theBuffer[0].size();</div>
+<div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>   assert(nCol);</div>
+<div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>   <span class="comment">//make sure data size if power of 2</span></div>
+<div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>   <span class="keywordflow">while</span>(theBuffer.size()&(theBuffer.size()-1))</div>
+<div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>     theBuffer.push_back(theBuffer.back());</div>
+<div class="line"><a name="l01221"></a><span class="lineno"> 1221</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow)</div>
+<div class="line"><a name="l01222"></a><span class="lineno"> 1222</span>     <span class="keywordflow">while</span>(theBuffer[irow].size()&(theBuffer[irow].size()-1))</div>
+<div class="line"><a name="l01223"></a><span class="lineno"> 1223</span>       theBuffer[irow].push_back(theBuffer[irow].back());</div>
+<div class="line"><a name="l01224"></a><span class="lineno"> 1224</span>   std::vector<double> vdata(theBuffer.size()*theBuffer[0].size());</div>
+<div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>   <span class="keywordtype">double</span>* data=&(vdata[0]);</div>
+<div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
+<div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[0].size();++icol){</div>
+<div class="line"><a name="l01228"></a><span class="lineno"> 1228</span>       <span class="keywordtype">int</span> index=irow*theBuffer[0].size()+icol;</div>
+<div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>       data[index]=theBuffer[irow][icol];</div>
+<div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>     }</div>
+<div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>   }</div>
+<div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>   <span class="keywordtype">int</span> nsize=theBuffer.size()*theBuffer[0].size();</div>
+<div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>   gsl_wavelet *w;</div>
+<div class="line"><a name="l01234"></a><span class="lineno"> 1234</span>   gsl_wavelet_workspace *work;</div>
+<div class="line"><a name="l01235"></a><span class="lineno"> 1235</span>   assert(nsize);</div>
+<div class="line"><a name="l01236"></a><span class="lineno"> 1236</span>   w=gsl_wavelet_alloc(filter::Filter::getWaveletType(wavelet_type),family);</div>
+<div class="line"><a name="l01237"></a><span class="lineno"> 1237</span>   work=gsl_wavelet_workspace_alloc(nsize);</div>
+<div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>   gsl_wavelet2d_nstransform_forward (w, data, theBuffer.size(), theBuffer.size(),theBuffer[0].size(), work);</div>
+<div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>   theBuffer.erase(theBuffer.begin()+nRow,theBuffer.end());</div>
+<div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
+<div class="line"><a name="l01241"></a><span class="lineno"> 1241</span>     theBuffer[irow].erase(theBuffer[irow].begin()+nCol,theBuffer[irow].end());</div>
+<div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[irow].size();++icol){</div>
+<div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>       <span class="keywordtype">int</span> index=irow*theBuffer[irow].size()+icol;</div>
+<div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>       theBuffer[irow][icol]=data[index];</div>
+<div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>     }</div>
+<div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>     progress=(1.0+irow);</div>
+<div class="line"><a name="l01247"></a><span class="lineno"> 1247</span>     progress/=theBuffer.nRows();</div>
+<div class="line"><a name="l01248"></a><span class="lineno"> 1248</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01249"></a><span class="lineno"> 1249</span>   }</div>
+<div class="line"><a name="l01250"></a><span class="lineno"> 1250</span>   gsl_wavelet_free (w);</div>
+<div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>   gsl_wavelet_workspace_free (work);</div>
+<div class="line"><a name="l01252"></a><span class="lineno"> 1252</span> }</div>
+<div class="line"><a name="l01253"></a><span class="lineno"> 1253</span> </div>
+<div class="line"><a name="l01254"></a><span class="lineno"> 1254</span> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> Filter2d::dwtInverse(<a class="code" href="classVector2d.html">Vector2d<T></a>& theBuffer, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family){</div>
+<div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l01257"></a><span class="lineno"> 1257</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l01258"></a><span class="lineno"> 1258</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l01259"></a><span class="lineno"> 1259</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01260"></a><span class="lineno"> 1260</span> </div>
+<div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>   <span class="keywordtype">int</span> nRow=theBuffer.size();</div>
+<div class="line"><a name="l01262"></a><span class="lineno"> 1262</span>   assert(nRow);</div>
+<div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>   <span class="keywordtype">int</span> nCol=theBuffer[0].size();</div>
+<div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>   assert(nCol);</div>
+<div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>   <span class="comment">//make sure data size if power of 2</span></div>
+<div class="line"><a name="l01266"></a><span class="lineno"> 1266</span>   <span class="keywordflow">while</span>(theBuffer.size()&(theBuffer.size()-1))</div>
+<div class="line"><a name="l01267"></a><span class="lineno"> 1267</span>     theBuffer.push_back(theBuffer.back());</div>
+<div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow)</div>
+<div class="line"><a name="l01269"></a><span class="lineno"> 1269</span>     <span class="keywordflow">while</span>(theBuffer[irow].size()&(theBuffer[irow].size()-1))</div>
+<div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>       theBuffer[irow].push_back(theBuffer[irow].back());</div>
+<div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>   std::vector<double> vdata(theBuffer.size()*theBuffer[0].size());</div>
+<div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>   <span class="keywordtype">double</span>* data=&(vdata[0]);</div>
+<div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>   <span class="comment">//double data[theBuffer.size()*theBuffer[0].size()];</span></div>
+<div class="line"><a name="l01274"></a><span class="lineno"> 1274</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
+<div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[0].size();++icol){</div>
+<div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>       <span class="keywordtype">int</span> index=irow*theBuffer[0].size()+icol;</div>
+<div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>       data[index]=theBuffer[irow][icol];</div>
+<div class="line"><a name="l01278"></a><span class="lineno"> 1278</span>     }</div>
+<div class="line"><a name="l01279"></a><span class="lineno"> 1279</span>   }</div>
+<div class="line"><a name="l01280"></a><span class="lineno"> 1280</span>   <span class="keywordtype">int</span> nsize=theBuffer.size()*theBuffer[0].size();</div>
+<div class="line"><a name="l01281"></a><span class="lineno"> 1281</span>   gsl_wavelet *w;</div>
+<div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>   gsl_wavelet_workspace *work;</div>
+<div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>   assert(nsize);</div>
+<div class="line"><a name="l01284"></a><span class="lineno"> 1284</span>   w=gsl_wavelet_alloc(filter::Filter::getWaveletType(wavelet_type),family);</div>
+<div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>   work=gsl_wavelet_workspace_alloc(nsize);</div>
+<div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>   gsl_wavelet2d_nstransform_inverse (w, data, theBuffer.size(), theBuffer.size(),theBuffer[0].size(), work);</div>
+<div class="line"><a name="l01287"></a><span class="lineno"> 1287</span>   theBuffer.erase(theBuffer.begin()+nRow,theBuffer.end());</div>
+<div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
+<div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>     theBuffer[irow].erase(theBuffer[irow].begin()+nCol,theBuffer[irow].end());</div>
+<div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[irow].size();++icol){</div>
+<div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>       <span class="keywordtype">int</span> index=irow*theBuffer[irow].size()+icol;</div>
+<div class="line"><a name="l01292"></a><span class="lineno"> 1292</span>       theBuffer[irow][icol]=data[index];</div>
+<div class="line"><a name="l01293"></a><span class="lineno"> 1293</span>     }</div>
+<div class="line"><a name="l01294"></a><span class="lineno"> 1294</span>     progress=(1.0+irow);</div>
+<div class="line"><a name="l01295"></a><span class="lineno"> 1295</span>     progress/=theBuffer.nRows();</div>
+<div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01297"></a><span class="lineno"> 1297</span>   }</div>
+<div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>   gsl_wavelet_free (w);</div>
+<div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>   gsl_wavelet_workspace_free (work);</div>
+<div class="line"><a name="l01300"></a><span class="lineno"> 1300</span> }</div>
+<div class="line"><a name="l01301"></a><span class="lineno"> 1301</span> </div>
+<div class="line"><a name="l01302"></a><span class="lineno"> 1302</span> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> Filter2d::dwtCut(<a class="code" href="classVector2d.html">Vector2d<T></a>& theBuffer, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family, <span class="keywordtype">double</span> cut){</div>
+<div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
+<div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
+<div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
+<div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>   <span class="keywordtype">double</span> progress=0;</div>
+<div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01308"></a><span class="lineno"> 1308</span> </div>
+<div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>   <span class="keywordtype">int</span> nRow=theBuffer.size();</div>
+<div class="line"><a name="l01310"></a><span class="lineno"> 1310</span>   assert(nRow);</div>
+<div class="line"><a name="l01311"></a><span class="lineno"> 1311</span>   <span class="keywordtype">int</span> nCol=theBuffer[0].size();</div>
+<div class="line"><a name="l01312"></a><span class="lineno"> 1312</span>   assert(nCol);</div>
+<div class="line"><a name="l01313"></a><span class="lineno"> 1313</span>   <span class="comment">//make sure data size if power of 2</span></div>
+<div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>   <span class="keywordflow">while</span>(theBuffer.size()&(theBuffer.size()-1))</div>
+<div class="line"><a name="l01315"></a><span class="lineno"> 1315</span>     theBuffer.push_back(theBuffer.back());</div>
+<div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow)</div>
+<div class="line"><a name="l01317"></a><span class="lineno"> 1317</span>     <span class="keywordflow">while</span>(theBuffer[irow].size()&(theBuffer[irow].size()-1))</div>
+<div class="line"><a name="l01318"></a><span class="lineno"> 1318</span>       theBuffer[irow].push_back(theBuffer[irow].back());</div>
+<div class="line"><a name="l01319"></a><span class="lineno"> 1319</span>   <span class="keywordtype">double</span>* data=<span class="keyword">new</span> <span class="keywordtype">double</span>[theBuffer.size()*theBuffer[0].size()];</div>
+<div class="line"><a name="l01320"></a><span class="lineno"> 1320</span>   <span class="keywordtype">double</span>* abscoeff=<span class="keyword">new</span> <span class="keywordtype">double</span>[theBuffer.size()*theBuffer[0].size()];</div>
+<div class="line"><a name="l01321"></a><span class="lineno"> 1321</span>   <span class="keywordtype">size_t</span>* p=<span class="keyword">new</span> <span class="keywordtype">size_t</span>[theBuffer.size()*theBuffer[0].size()];</div>
+<div class="line"><a name="l01322"></a><span class="lineno"> 1322</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
+<div class="line"><a name="l01323"></a><span class="lineno"> 1323</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[0].size();++icol){</div>
+<div class="line"><a name="l01324"></a><span class="lineno"> 1324</span>       <span class="keywordtype">int</span> index=irow*theBuffer[0].size()+icol;</div>
+<div class="line"><a name="l01325"></a><span class="lineno"> 1325</span>       assert(index<theBuffer.size()*theBuffer[0].size());</div>
+<div class="line"><a name="l01326"></a><span class="lineno"> 1326</span>       data[index]=theBuffer[irow][icol];</div>
+<div class="line"><a name="l01327"></a><span class="lineno"> 1327</span>     }</div>
+<div class="line"><a name="l01328"></a><span class="lineno"> 1328</span>   }</div>
+<div class="line"><a name="l01329"></a><span class="lineno"> 1329</span>   <span class="keywordtype">int</span> nsize=theBuffer.size()*theBuffer[0].size();</div>
+<div class="line"><a name="l01330"></a><span class="lineno"> 1330</span>   gsl_wavelet *w;</div>
+<div class="line"><a name="l01331"></a><span class="lineno"> 1331</span>   gsl_wavelet_workspace *work;</div>
+<div class="line"><a name="l01332"></a><span class="lineno"> 1332</span>   assert(nsize);</div>
+<div class="line"><a name="l01333"></a><span class="lineno"> 1333</span>   w=gsl_wavelet_alloc(filter::Filter::getWaveletType(wavelet_type),family);</div>
+<div class="line"><a name="l01334"></a><span class="lineno"> 1334</span>   work=gsl_wavelet_workspace_alloc(nsize);</div>
+<div class="line"><a name="l01335"></a><span class="lineno"> 1335</span>   gsl_wavelet2d_nstransform_forward (w, data, theBuffer.size(), theBuffer[0].size(),theBuffer[0].size(), work);</div>
+<div class="line"><a name="l01336"></a><span class="lineno"> 1336</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
+<div class="line"><a name="l01337"></a><span class="lineno"> 1337</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[0].size();++icol){</div>
+<div class="line"><a name="l01338"></a><span class="lineno"> 1338</span>       <span class="keywordtype">int</span> index=irow*theBuffer[0].size()+icol;</div>
+<div class="line"><a name="l01339"></a><span class="lineno"> 1339</span>       abscoeff[index]=fabs(data[index]);</div>
+<div class="line"><a name="l01340"></a><span class="lineno"> 1340</span>     }</div>
+<div class="line"><a name="l01341"></a><span class="lineno"> 1341</span>   }</div>
+<div class="line"><a name="l01342"></a><span class="lineno"> 1342</span>   <span class="keywordtype">int</span> nc=(100-cut)/100.0*nsize;</div>
+<div class="line"><a name="l01343"></a><span class="lineno"> 1343</span>   gsl_sort_index(p,abscoeff,1,nsize);</div>
+<div class="line"><a name="l01344"></a><span class="lineno"> 1344</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;(i+nc)<nsize;i++)</div>
+<div class="line"><a name="l01345"></a><span class="lineno"> 1345</span>    data[p[i]]=0;</div>
+<div class="line"><a name="l01346"></a><span class="lineno"> 1346</span>   gsl_wavelet2d_nstransform_inverse (w, data, theBuffer.size(), theBuffer[0].size(),theBuffer[0].size(), work);</div>
+<div class="line"><a name="l01347"></a><span class="lineno"> 1347</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow){</div>
+<div class="line"><a name="l01348"></a><span class="lineno"> 1348</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> icol=0;icol<theBuffer[irow].size();++icol){</div>
+<div class="line"><a name="l01349"></a><span class="lineno"> 1349</span>       <span class="keywordtype">int</span> index=irow*theBuffer[irow].size()+icol;</div>
+<div class="line"><a name="l01350"></a><span class="lineno"> 1350</span>       theBuffer[irow][icol]=data[index];</div>
+<div class="line"><a name="l01351"></a><span class="lineno"> 1351</span>     }</div>
+<div class="line"><a name="l01352"></a><span class="lineno"> 1352</span>     progress=(1.0+irow);</div>
+<div class="line"><a name="l01353"></a><span class="lineno"> 1353</span>     progress/=theBuffer.nRows();</div>
+<div class="line"><a name="l01354"></a><span class="lineno"> 1354</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
+<div class="line"><a name="l01355"></a><span class="lineno"> 1355</span>   }</div>
+<div class="line"><a name="l01356"></a><span class="lineno"> 1356</span>   theBuffer.erase(theBuffer.begin()+nRow,theBuffer.end());</div>
+<div class="line"><a name="l01357"></a><span class="lineno"> 1357</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> irow=0;irow<theBuffer.size();++irow)</div>
+<div class="line"><a name="l01358"></a><span class="lineno"> 1358</span>     theBuffer[irow].erase(theBuffer[irow].begin()+nCol,theBuffer[irow].end());</div>
+<div class="line"><a name="l01359"></a><span class="lineno"> 1359</span>   <span class="keyword">delete</span>[] data;</div>
+<div class="line"><a name="l01360"></a><span class="lineno"> 1360</span>   <span class="keyword">delete</span>[] abscoeff;</div>
+<div class="line"><a name="l01361"></a><span class="lineno"> 1361</span>   <span class="keyword">delete</span>[] p;</div>
+<div class="line"><a name="l01362"></a><span class="lineno"> 1362</span>   gsl_wavelet_free (w);</div>
+<div class="line"><a name="l01363"></a><span class="lineno"> 1363</span>   gsl_wavelet_workspace_free (work);</div>
 <div class="line"><a name="l01364"></a><span class="lineno"> 1364</span> </div>
-<div class="line"><a name="l01365"></a><span class="lineno"> 1365</span> <span class="preprocessor">#endif </span><span class="comment">/* _MYFILTER_H_ */</span><span class="preprocessor"></span></div>
-<div class="ttc" id="classImgReaderGdal_html"><div class="ttname"><a href="classImgReaderGdal.html">ImgReaderGdal</a></div><div class="ttdef"><b>Definition:</b> <a href="ImgReaderGdal_8h_source.html#l00033">ImgReaderGdal.h:33</a></div></div>
-<div class="ttc" id="classImgWriterGdal_html"><div class="ttname"><a href="classImgWriterGdal.html">ImgWriterGdal</a></div><div class="ttdef"><b>Definition:</b> <a href="ImgWriterGdal_8h_source.html#l00032">ImgWriterGdal.h:32</a></div></div>
+<div class="line"><a name="l01365"></a><span class="lineno"> 1365</span> }</div>
+<div class="line"><a name="l01366"></a><span class="lineno"> 1366</span> </div>
+<div class="line"><a name="l01367"></a><span class="lineno"> 1367</span> }</div>
+<div class="line"><a name="l01368"></a><span class="lineno"> 1368</span> </div>
+<div class="line"><a name="l01369"></a><span class="lineno"> 1369</span> <span class="preprocessor">#endif </span><span class="comment">/* _MYFILTER_H_ */</span><span class="preprocessor"></span></div>
+<div class="ttc" id="classImgReaderGdal_html"><div class="ttname"><a href="classImgReaderGdal.html">ImgReaderGdal</a></div><div class="ttdef"><b>Definition:</b> <a href="ImgReaderGdal_8h_source.html#l00032">ImgReaderGdal.h:32</a></div></div>
+<div class="ttc" id="classImgWriterGdal_html"><div class="ttname"><a href="classImgWriterGdal.html">ImgWriterGdal</a></div><div class="ttdef"><b>Definition:</b> <a href="ImgWriterGdal_8h_source.html#l00033">ImgWriterGdal.h:33</a></div></div>
 <div class="ttc" id="classfilter2d_1_1Filter2d_html"><div class="ttname"><a href="classfilter2d_1_1Filter2d.html">filter2d::Filter2d</a></div><div class="ttdef"><b>Definition:</b> <a href="Filter2d_8h_source.html#l00065">Filter2d.h:65</a></div></div>
 <div class="ttc" id="classVector2d_html"><div class="ttname"><a href="classVector2d.html">Vector2d< double ></a></div></div>
 <div class="ttc" id="classstatfactory_1_1StatFactory_html"><div class="ttname"><a href="classstatfactory_1_1StatFactory.html">statfactory::StatFactory</a></div><div class="ttdef"><b>Definition:</b> <a href="StatFactory_8h_source.html#l00043">StatFactory.h:43</a></div></div>
@@ -1426,7 +1430,7 @@
 <!-- HTML footer for doxygen 1.8.4-->
 <!-- start footer part -->
 <hr class="footer"/><address class="footer"><small>
-Generated on Tue Nov 3 2015 15:58:26 for pktools by  <a href="http://www.doxygen.org/index.html">
+Generated on Wed Jan 20 2016 09:05:05 for pktools by  <a href="http://www.doxygen.org/index.html">
 <img class="footer" src="doxygen.png" alt="doxygen"/>
 </a> 1.8.6
 </small></address>
diff --git a/doc/html/Filter_8cc_source.html b/doc/html/Filter_8cc_source.html
index 574b21e..9c53e6a 100644
--- a/doc/html/Filter_8cc_source.html
+++ b/doc/html/Filter_8cc_source.html
@@ -19,7 +19,7 @@
   <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
   <td style="padding-left: 0.5em;">
    <div id="projectname">pktools
-    <span id="projectnumber">2.6.4</span>
+    <span id="projectnumber">2.6.6</span>
    </div>
    <div id="projectbrief">Processing Kernel for geospatial data</div>
   </td>
@@ -105,671 +105,748 @@
 <div class="line"><a name="l00051"></a><span class="lineno">   51</span>   assert(m_taps.size()%2);</div>
 <div class="line"><a name="l00052"></a><span class="lineno">   52</span> }</div>
 <div class="line"><a name="l00053"></a><span class="lineno">   53</span> </div>
-<div class="line"><a name="l00054"></a><span class="lineno">   54</span> <span class="keywordtype">int</span> filter::Filter::pushNoDataValue(<span class="keywordtype">double</span> noDataValue)</div>
-<div class="line"><a name="l00055"></a><span class="lineno">   55</span> {</div>
-<div class="line"><a name="l00056"></a><span class="lineno">   56</span>   <span class="keywordflow">if</span>(find(m_noDataValues.begin(),m_noDataValues.end(),noDataValue)==m_noDataValues.end())</div>
-<div class="line"><a name="l00057"></a><span class="lineno">   57</span>     m_noDataValues.push_back(noDataValue);</div>
-<div class="line"><a name="l00058"></a><span class="lineno">   58</span>   <span class="keywordflow">return</span>(m_noDataValues.size());</div>
-<div class="line"><a name="l00059"></a><span class="lineno">   59</span> }</div>
-<div class="line"><a name="l00060"></a><span class="lineno">   60</span> </div>
-<div class="line"><a name="l00061"></a><span class="lineno">   61</span> <span class="keywordtype">void</span> filter::Filter::dwtForward(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span class="keyword">const</span> std::string& wavelet_type, <span class="keywordtype">int</span> family){</div>
-<div class="line"><a name="l00062"></a><span class="lineno">   62</span>   <span class="keyword">const</span> <span class="keywordtype">char</span>* pszMessage;</div>
-<div class="line"><a name="l00063"></a><span class="lineno">   63</span>   <span class="keywordtype">void</span>* pProgressArg=NULL;</div>
-<div class="line"><a name="l00064"></a><span class="lineno">   64</span>   GDALProgressFunc pfnProgress=GDALTermProgress;</div>
-<div class="line"><a name="l00065"></a><span class="lineno">   65</span>   <span class="keywordtype">double</span> progress=0;</div>
-<div class="line"><a name="l00066"></a><span class="lineno">   66</span>   pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00067"></a><span class="lineno">   67</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> lineInput(input.nrOfBand(),input.nrOfCol());</div>
-<div class="line"><a name="l00068"></a><span class="lineno">   68</span>   <a class="code" href="classVector2d.html">Vector2d<double></a> lineOutput(input.nrOfBand(),input.nrOfCol());</div>
-<div class="line"><a name="l00069"></a><span class="lineno">   69</span>   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> y=0;y<input.nrOfRow();++y){</div>
-<div class="line"><a name="l00070"></a><span class="lineno">   70</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband)</div>
-<div class="line"><a name="l00071"></a><span class="lineno">   71</span>       input.readData(lineInput[iband],GDT_Float64,y,iband);</div>
-<div class="line"><a name="l00072"></a><span class="lineno">   72</span>     vector<double> pixelInput(input.nrOfBand());</div>
-<div class="line"><a name="l00073"></a><span class="lineno">   73</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> x=0;x<input.nrOfCol();++x){</div>
-<div class="line"><a name="l00074"></a><span class="lineno">   74</span>       pixelInput=lineInput.selectCol(x);</div>
-<div class="line"><a name="l00075"></a><span class="lineno">   75</span>       dwtForward(pixelInput,wavelet_type,family);</div>
-<div class="line"><a name="l00076"></a><span class="lineno">   76</span>       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband)</div>
-<div class="line"><a name="l00077"></a><span class="lineno">   77</span>         lineOutput[iband][x]=pixelInput[iband];</div>
-<div class="line"><a name="l00078"></a><span class="lineno">   78</span>     }</div>
-<div class="line"><a name="l00079"></a><span class="lineno">   79</span>     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> iband=0;iband<input.nrOfBand();++iband){</div>
-<div class="line"><a name="l00080"></a><span class="lineno">   80</span>       <span class="keywordflow">try</span>{</div>
-<div class="line"><a name="l00081"></a><span class="lineno">   81</span>         output.writeData(lineOutput[iband],GDT_Float64,y,iband);</div>
-<div class="line"><a name="l00082"></a><span class="lineno">   82</span>       }</div>
-<div class="line"><a name="l00083"></a><span class="lineno">   83</span>       <span class="keywordflow">catch</span>(<span class="keywordtype">string</span> errorstring){</div>
-<div class="line"><a name="l00084"></a><span class="lineno">   84</span>         cerr << errorstring << <span class="stringliteral">"in band "</span> << iband << <span class="stringliteral">", line "</span> << y << endl;</div>
-<div class="line"><a name="l00085"></a><span class="lineno">   85</span>       }</div>
-<div class="line"><a name="l00086"></a><span class="lineno">   86</span>     }</div>
-<div class="line"><a name="l00087"></a><span class="lineno">   87</span>     progress=(1.0+y)/output.nrOfRow();</div>
-<div class="line"><a name="l00088"></a><span class="lineno">   88</span>     pfnProgress(progress,pszMessage,pProgressArg);</div>
-<div class="line"><a name="l00089"></a><span class="lineno">   89</span>   }</div>
-<div class="line"><a name="l00090"></a><span class="lineno">   90</span> }</div>
-<div class="line"><a name="l00091"></a><span class="lineno">   91</span> </div>
-<div class="line"><a name="l00092"></a><span class="lineno">   92</span> <span class="keywordtype">void</span> filter::Filter::dwtInverse(<span class="keyword">const</span> <a class="code" href="classImgReaderGdal.html">ImgReaderGdal</a>& input, <a class="code" href="classImgWriterGdal.html">ImgWriterGdal</a>& output, <span cla