From 63f3f77687012f2a62df0690c17dc418632ab0cc Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@orfeo-toolbox.org> Date: Thu, 18 Apr 2019 09:16:59 +0000 Subject: [PATCH] REFAC: Remove RoadExtraction module --- .../ExtractRoadByStepsExampleOutput.1.png | 3 - .../ExtractRoadByStepsExampleOutput.png | 3 - ...xtractRoadByStepsExampleOutput.png.aux.xml | 27 - .../ExtractRoadExampleOutput.1.png | 3 - .../ExtractRoadExampleOutput.png | 3 - .../ExtractRoadExampleOutput.png.aux.xml | 24 - .../qb_ExtractRoad_pretty.png | 3 - .../qb_ExtractRoad_pretty.png.aux.xml | 27 - Data/Baseline/OTB/Files/feAlign.txt | 759 ------------------ .../Files/feBreakAngularPathListOutput.txt | 171 ---- .../OTB/Files/feTvLikelihoodPathOutput.txt | 8 - .../Baseline/OTB/Files/feTvLinkPathOutput.txt | 23 - .../Files/feTvRemoveTortuousPathOutput.txt | 8 - .../OTB/Files/feTvSimplifyPathOutput.txt | 11 - ...ectorDataToRoadDescriptionFilterOutput.dbf | 3 - ...ectorDataToRoadDescriptionFilterOutput.shp | 3 - ...ectorDataToRoadDescriptionFilterOutput.shx | 3 - .../OTB/Images/feDrawPathAlignDeuxTraits.png | 3 - ...ighborhoodScalarProductDirectionOutput.tif | 3 - ...NeighborhoodScalarProductModulusOutput.tif | 3 - .../feTvNonMaxRemovalByDirectionOutput.tif | 3 - .../OTB/Images/feTvOutputRoadDetection.tif | 3 - .../feTvRemoveIsolatedByDirectionOutput.tif | 3 - .../Images/feTvRemoveWrongDirectionOutput.tif | 3 - .../InputForRoadDetectionScalarProductDir.raw | 3 - ...utForRoadDetectionScalarProductDir.raw.hdr | 14 - .../InputForRoadDetectionScalarProductMod.raw | 3 - ...utForRoadDetectionScalarProductMod.raw.hdr | 14 - .../InputForRoadDetection_IsolatedRem.raw | 3 - .../InputForRoadDetection_IsolatedRem.raw.hdr | 14 - .../Input/InputForRoadDetection_NonMaxRem.raw | 3 - .../InputForRoadDetection_NonMaxRem.raw.hdr | 14 - .../InputForRoadDetection_SpectralAngle.raw | 3 - ...nputForRoadDetection_SpectralAngle.raw.hdr | 14 - Data/Input/InputForRoadDetection_WrongRem.raw | 3 - .../InputForRoadDetection_WrongRem.raw.hdr | 14 - Examples/FeatureExtraction/CMakeLists.txt | 12 - .../ExtractRoadByStepsExample.cxx | 414 ---------- .../FeatureExtraction/ExtractRoadExample.cxx | 246 ------ .../ParallelLineDetectionExample.cxx | 238 ------ .../FeatureExtraction/test/CMakeLists.txt | 27 - .../Detection/RoadExtraction/CMakeLists.txt | 22 - .../include/otbBreakAngularPathListFilter.h | 94 --- .../include/otbBreakAngularPathListFilter.hxx | 127 --- .../include/otbGenericRoadExtractionFilter.h | 255 ------ .../otbGenericRoadExtractionFilter.hxx | 192 ----- .../include/otbImageToPathListAlignFilter.h | 158 ---- .../include/otbImageToPathListAlignFilter.hxx | 585 -------------- .../include/otbLikelihoodPathListFilter.h | 106 --- .../include/otbLikelihoodPathListFilter.hxx | 100 --- .../include/otbLinkPathListFilter.h | 129 --- .../include/otbLinkPathListFilter.hxx | 317 -------- ...otbModulusAndDirectionImageToImageFilter.h | 94 --- ...bModulusAndDirectionImageToImageFilter.hxx | 111 --- .../otbNeighborhoodScalarProductFilter.h | 111 --- .../otbNeighborhoodScalarProductFilter.hxx | 181 ----- .../otbNonMaxRemovalByDirectionFilter.h | 161 ---- .../include/otbParallelLinePathListFilter.h | 161 ---- .../include/otbParallelLinePathListFilter.hxx | 536 ------------- .../otbRemoveIsolatedByDirectionFilter.h | 134 ---- .../include/otbRemoveTortuousPathListFilter.h | 67 -- .../include/otbRemoveWrongDirectionFilter.h | 129 --- .../include/otbRoadExtractionFilter.h | 171 ---- .../include/otbRoadExtractionFilter.hxx | 82 -- .../include/otbSimplifyPathListFilter.h | 77 -- .../otbVectorDataToRoadDescriptionFilter.h | 142 ---- .../otbVectorDataToRoadDescriptionFilter.hxx | 145 ---- .../Detection/RoadExtraction/otb-module.cmake | 43 - .../RoadExtraction/test/AlignementsQB.cxx | 142 ---- .../RoadExtraction/test/CMakeLists.txt | 218 ----- .../test/otbAlignImageToPath.cxx | 146 ---- .../test/otbBreakAngularPathListFilter.cxx | 163 ---- .../RoadExtraction/test/otbDrawPathAlign.cxx | 84 -- .../test/otbLikelihoodPathListFilter.cxx | 157 ---- .../test/otbLinkPathListFilter.cxx | 154 ---- .../otbNeighborhoodScalarProductFilter.cxx | 67 -- .../otbNonMaxRemovalByDirectionFilter.cxx | 50 -- .../test/otbParallelLinePathListFilter.cxx | 125 --- .../otbRemoveIsolatedByDirectionFilter.cxx | 50 -- .../test/otbRemoveTortuousPathListFilter.cxx | 144 ---- .../test/otbRemoveWrongDirectionFilter.cxx | 50 -- .../test/otbRoadExtractionFilter.cxx | 99 --- .../test/otbRoadExtractionTestDriver.cxx | 40 - .../test/otbSimplifyManyPathListFilter.cxx | 114 --- .../test/otbSimplifyPathListFilter.cxx | 144 ---- .../otbVectorDataToRoadDescriptionFilter.cxx | 100 --- 86 files changed, 8619 deletions(-) delete mode 100644 Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.1.png delete mode 100644 Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.png delete mode 100644 Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.png.aux.xml delete mode 100644 Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.1.png delete mode 100644 Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.png delete mode 100644 Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.png.aux.xml delete mode 100644 Data/Baseline/Examples/FeatureExtraction/qb_ExtractRoad_pretty.png delete mode 100644 Data/Baseline/Examples/FeatureExtraction/qb_ExtractRoad_pretty.png.aux.xml delete mode 100644 Data/Baseline/OTB/Files/feAlign.txt delete mode 100644 Data/Baseline/OTB/Files/feBreakAngularPathListOutput.txt delete mode 100644 Data/Baseline/OTB/Files/feTvLikelihoodPathOutput.txt delete mode 100644 Data/Baseline/OTB/Files/feTvLinkPathOutput.txt delete mode 100644 Data/Baseline/OTB/Files/feTvRemoveTortuousPathOutput.txt delete mode 100644 Data/Baseline/OTB/Files/feTvSimplifyPathOutput.txt delete mode 100644 Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.dbf delete mode 100644 Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.shp delete mode 100644 Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.shx delete mode 100644 Data/Baseline/OTB/Images/feDrawPathAlignDeuxTraits.png delete mode 100644 Data/Baseline/OTB/Images/feTvNeighborhoodScalarProductDirectionOutput.tif delete mode 100644 Data/Baseline/OTB/Images/feTvNeighborhoodScalarProductModulusOutput.tif delete mode 100644 Data/Baseline/OTB/Images/feTvNonMaxRemovalByDirectionOutput.tif delete mode 100644 Data/Baseline/OTB/Images/feTvOutputRoadDetection.tif delete mode 100644 Data/Baseline/OTB/Images/feTvRemoveIsolatedByDirectionOutput.tif delete mode 100644 Data/Baseline/OTB/Images/feTvRemoveWrongDirectionOutput.tif delete mode 100644 Data/Input/InputForRoadDetectionScalarProductDir.raw delete mode 100644 Data/Input/InputForRoadDetectionScalarProductDir.raw.hdr delete mode 100644 Data/Input/InputForRoadDetectionScalarProductMod.raw delete mode 100644 Data/Input/InputForRoadDetectionScalarProductMod.raw.hdr delete mode 100644 Data/Input/InputForRoadDetection_IsolatedRem.raw delete mode 100644 Data/Input/InputForRoadDetection_IsolatedRem.raw.hdr delete mode 100644 Data/Input/InputForRoadDetection_NonMaxRem.raw delete mode 100644 Data/Input/InputForRoadDetection_NonMaxRem.raw.hdr delete mode 100644 Data/Input/InputForRoadDetection_SpectralAngle.raw delete mode 100644 Data/Input/InputForRoadDetection_SpectralAngle.raw.hdr delete mode 100644 Data/Input/InputForRoadDetection_WrongRem.raw delete mode 100644 Data/Input/InputForRoadDetection_WrongRem.raw.hdr delete mode 100644 Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx delete mode 100644 Examples/FeatureExtraction/ExtractRoadExample.cxx delete mode 100644 Examples/FeatureExtraction/ParallelLineDetectionExample.cxx delete mode 100644 Modules/Detection/RoadExtraction/CMakeLists.txt delete mode 100644 Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.hxx delete mode 100644 Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.hxx delete mode 100644 Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.hxx delete mode 100644 Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.hxx delete mode 100644 Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.hxx delete mode 100644 Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.hxx delete mode 100644 Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.hxx delete mode 100644 Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.hxx delete mode 100644 Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbRemoveTortuousPathListFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.hxx delete mode 100644 Modules/Detection/RoadExtraction/include/otbSimplifyPathListFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h delete mode 100644 Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.hxx delete mode 100644 Modules/Detection/RoadExtraction/otb-module.cmake delete mode 100644 Modules/Detection/RoadExtraction/test/AlignementsQB.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/CMakeLists.txt delete mode 100644 Modules/Detection/RoadExtraction/test/otbAlignImageToPath.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbBreakAngularPathListFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbDrawPathAlign.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbLikelihoodPathListFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbLinkPathListFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbNeighborhoodScalarProductFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbNonMaxRemovalByDirectionFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbParallelLinePathListFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbRemoveIsolatedByDirectionFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbRemoveTortuousPathListFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbRemoveWrongDirectionFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbRoadExtractionFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbRoadExtractionTestDriver.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbSimplifyManyPathListFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbSimplifyPathListFilter.cxx delete mode 100644 Modules/Detection/RoadExtraction/test/otbVectorDataToRoadDescriptionFilter.cxx diff --git a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.1.png b/Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.1.png deleted file mode 100644 index 21b0d0b017..0000000000 --- a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:34a5f9e6daad51f0e614fe07e4755422c8420fda029e7ad7302de31a92535982 -size 1340160 diff --git a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.png b/Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.png deleted file mode 100644 index c2d86e289f..0000000000 --- a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:870c0d619c315c9843cd9a5aedc44a34471d5fecbc9306a492efbb47c19530b9 -size 1340628 diff --git a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.png.aux.xml b/Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.png.aux.xml deleted file mode 100644 index 761fbb2f64..0000000000 --- a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadByStepsExampleOutput.png.aux.xml +++ /dev/null @@ -1,27 +0,0 @@ -<PAMDataset> - <SRS>PROJCS["WGS 84 / UTM zone 32N", - GEOGCS["WGS 84", - DATUM["WGS_1984", - SPHEROID["WGS 84",6378137,298.257223563, - AUTHORITY["EPSG","7030"]], - AUTHORITY["EPSG","6326"]], - PRIMEM["Greenwich",0], - UNIT["degree",0.0174532925199433], - AUTHORITY["EPSG","4326"]], - PROJECTION["Transverse_Mercator"], - PARAMETER["latitude_of_origin",0], - PARAMETER["central_meridian",9], - PARAMETER["scale_factor",0.9996], - PARAMETER["false_easting",500000], - PARAMETER["false_northing",0], - UNIT["metre",1, - AUTHORITY["EPSG","9001"]], - AUTHORITY["EPSG","32632"]]</SRS> - <GeoTransform> 4.3913640000000002e+05, 5.9999999999999998e-01, 0.0000000000000000e+00, 5.2737065999999996e+06, 0.0000000000000000e+00, -5.9999999999999998e-01</GeoTransform> - <Metadata domain="IMAGE_STRUCTURE"> - <MDI key="INTERLEAVE">PIXEL</MDI> - </Metadata> - <Metadata> - <MDI key="AREA_OR_POINT">Area</MDI> - </Metadata> -</PAMDataset> diff --git a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.1.png b/Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.1.png deleted file mode 100644 index 3bb75ceacc..0000000000 --- a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b68d89bfa22c07d91a304ff20c04aa4c242197a66cf24b4f7957cc863c1fd2f7 -size 15199 diff --git a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.png b/Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.png deleted file mode 100644 index bb6e778dc5..0000000000 --- a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:079e3734a9c954f76d4b58596b0ffe9b0bbecb92958774bb7b6c433cb9b7a36d -size 15220 diff --git a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.png.aux.xml b/Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.png.aux.xml deleted file mode 100644 index 21ce935f9d..0000000000 --- a/Data/Baseline/Examples/FeatureExtraction/ExtractRoadExampleOutput.png.aux.xml +++ /dev/null @@ -1,24 +0,0 @@ -<PAMDataset> - <SRS>PROJCS["WGS 84 / UTM zone 32N", - GEOGCS["WGS 84", - DATUM["WGS_1984", - SPHEROID["WGS 84",6378137,298.257223563, - AUTHORITY["EPSG","7030"]], - AUTHORITY["EPSG","6326"]], - PRIMEM["Greenwich",0], - UNIT["degree",0.0174532925199433], - AUTHORITY["EPSG","4326"]], - PROJECTION["Transverse_Mercator"], - PARAMETER["latitude_of_origin",0], - PARAMETER["central_meridian",9], - PARAMETER["scale_factor",0.9996], - PARAMETER["false_easting",500000], - PARAMETER["false_northing",0], - UNIT["metre",1, - AUTHORITY["EPSG","9001"]], - AUTHORITY["EPSG","32632"]]</SRS> - <GeoTransform> 4.3913640000000002e+05, 5.9999999999999998e-01, 0.0000000000000000e+00, 5.2737065999999996e+06, 0.0000000000000000e+00, -5.9999999999999998e-01</GeoTransform> - <Metadata> - <MDI key="AREA_OR_POINT">Area</MDI> - </Metadata> -</PAMDataset> diff --git a/Data/Baseline/Examples/FeatureExtraction/qb_ExtractRoad_pretty.png b/Data/Baseline/Examples/FeatureExtraction/qb_ExtractRoad_pretty.png deleted file mode 100644 index d4307ec6f7..0000000000 --- a/Data/Baseline/Examples/FeatureExtraction/qb_ExtractRoad_pretty.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7a01fe4d41a060407d2613ba9595fde7321aa77c6e44f6552bb83d77d0dcef34 -size 1334929 diff --git a/Data/Baseline/Examples/FeatureExtraction/qb_ExtractRoad_pretty.png.aux.xml b/Data/Baseline/Examples/FeatureExtraction/qb_ExtractRoad_pretty.png.aux.xml deleted file mode 100644 index 761fbb2f64..0000000000 --- a/Data/Baseline/Examples/FeatureExtraction/qb_ExtractRoad_pretty.png.aux.xml +++ /dev/null @@ -1,27 +0,0 @@ -<PAMDataset> - <SRS>PROJCS["WGS 84 / UTM zone 32N", - GEOGCS["WGS 84", - DATUM["WGS_1984", - SPHEROID["WGS 84",6378137,298.257223563, - AUTHORITY["EPSG","7030"]], - AUTHORITY["EPSG","6326"]], - PRIMEM["Greenwich",0], - UNIT["degree",0.0174532925199433], - AUTHORITY["EPSG","4326"]], - PROJECTION["Transverse_Mercator"], - PARAMETER["latitude_of_origin",0], - PARAMETER["central_meridian",9], - PARAMETER["scale_factor",0.9996], - PARAMETER["false_easting",500000], - PARAMETER["false_northing",0], - UNIT["metre",1, - AUTHORITY["EPSG","9001"]], - AUTHORITY["EPSG","32632"]]</SRS> - <GeoTransform> 4.3913640000000002e+05, 5.9999999999999998e-01, 0.0000000000000000e+00, 5.2737065999999996e+06, 0.0000000000000000e+00, -5.9999999999999998e-01</GeoTransform> - <Metadata domain="IMAGE_STRUCTURE"> - <MDI key="INTERLEAVE">PIXEL</MDI> - </Metadata> - <Metadata> - <MDI key="AREA_OR_POINT">Area</MDI> - </Metadata> -</PAMDataset> diff --git a/Data/Baseline/OTB/Files/feAlign.txt b/Data/Baseline/OTB/Files/feAlign.txt deleted file mode 100644 index 9803d3b158..0000000000 --- a/Data/Baseline/OTB/Files/feAlign.txt +++ /dev/null @@ -1,759 +0,0 @@ -Nb Segment: 758 - 260.335 4.536 - 262.335 4.536 - 270.335 4.536 - 281.331 4.667 - 281.333 4.601 - 282.331 4.667 - 281.335 4.536 - 283.333 4.601 - 282.335 4.536 - 283.335 4.536 - 285.333 4.601 - 285.335 4.536 - 287.333 4.601 - 286.335 4.536 - 287.335 4.536 - 288.335 4.536 - 290.333 4.601 - 289.335 4.536 - 290.335 4.536 - 294.329 4.732 - 291.335 4.536 - 294.331 4.667 - 294.333 4.601 - 294.335 4.536 - 304.344 4.274 - 304.348 4.144 - 350.389 51.394 - 350.408 51.199 - 346.504 50.223 - 346.523 50.028 - 344.581 49.443 - 339.677 48.468 - 340.677 48.468 - 339.716 48.077 - 336.792 47.297 - 328.119 43.981 - 341.888 46.322 - 337.985 45.346 - 338.004 45.151 - 338.023 44.956 - 338.042 44.761 - 337.081 44.371 - 338.061 44.566 - 343.965 45.541 - 337.100 44.176 - 343.985 45.346 - 316.542 39.689 - 324.673 43.758 - 326.639 44.017 - 334.401 45.829 - 332.503 45.052 - 370.378 53.593 - 324.048 40.911 - 328.878 42.205 - 324.082 40.652 - 327.980 41.429 - 328.946 41.688 - 328.014 41.170 - 335.776 42.982 - 337.776 42.982 - 333.495 41.930 - 351.805 46.109 - 390.104 20.072 - 367.315 131.143 - 368.315 131.143 - 367.391 130.760 - 347.105 168.454 - 347.209 168.012 - 366.974 130.417 - 371.562 132.187 - 365.284 129.091 - 365.387 128.648 - 296.949 169.500 - 297.949 169.500 - 297.083 169.000 - 323.805 177.500 - 323.939 177.000 - 294.772 166.727 - 54.788 141.714 - 51.789 101.502 - 49.692 80.905 - 48.742 71.097 - 43.817 16.173 - 43.841 11.269 - 42.500 -0.500 - 72.923 344.523 - 55.601 152.183 - 56.515 159.123 - 56.687 145.242 - 51.683 99.636 - 48.506 67.910 - 46.504 45.106 - 44.372 21.312 - 42.500 -0.500 - 43.500 -0.500 - 43.631 0.491 - 294.713 418.881 - 329.666 388.146 - 333.713 418.881 - 339.277 407.975 - 499.546 30.235 - 43.500 -0.500 - 44.565 0.498 - 46.416 13.470 - 47.135 24.446 - 52.190 86.314 - 55.218 117.247 - 57.918 143.192 - 60.095 161.153 - 143.670 444.545 - 159.787 141.196 - 159.853 142.194 - 255.904 417.603 - 275.969 418.601 - 252.639 47.397 - 261.574 46.399 - 268.546 15.466 - 293.923 402.635 - 295.446 410.618 - 271.855 35.423 - 333.969 418.601 - 333.904 417.603 - 444.808 19.457 - 449.209 71.346 - 469.023 7.483 - 498.500 -0.500 - 21.500 320.500 - 22.500 419.500 - 44.500 -0.500 - 45.500 13.500 - 46.500 20.500 - 47.500 27.500 - 48.500 15.500 - 56.500 133.500 - 57.500 142.500 - 58.500 153.500 - 59.500 161.500 - 143.500 444.500 - 144.500 461.500 - 160.500 143.500 - 160.500 142.500 - 196.500 417.500 - 216.500 421.500 - 236.500 421.500 - 236.500 418.500 - 253.500 9.500 - 253.500 22.500 - 255.500 412.500 - 256.500 419.500 - 265.500 12.500 - 269.500 72.500 - 273.500 11.500 - 295.500 412.500 - 296.500 20.500 - 441.500 4.500 - 442.500 48.500 - 445.500 15.500 - 445.500 2.500 - 453.500 8.500 - 468.500 72.500 - 472.500 44.500 - 499.500 9.500 - 499.500 10.500 - 22.442 427.581 - 22.330 444.545 - 60.185 172.130 - 143.976 480.468 - 144.303 475.479 - 197.161 416.605 - 197.227 415.607 - 216.704 423.590 - 254.603 28.438 - 268.584 13.470 - 268.519 14.468 - 273.323 17.461 - 274.781 10.476 - 262.309 322.806 - 287.584 13.470 - 291.072 82.322 - 296.781 10.476 - 297.715 11.474 - 283.069 448.537 - 418.352 93.299 - 145.847 475.394 - 197.418 417.890 - 197.287 418.881 - 295.365 46.098 - 296.887 42.132 - 301.058 78.816 - 304.407 60.970 - 313.064 10.406 - 297.696 38.731 - 397.832 465.373 - 404.100 438.892 - 412.513 401.622 - 417.610 381.025 - 423.682 355.525 - 419.513 401.622 - 428.512 361.410 - 344.607 234.220 - 346.901 229.390 - 352.642 230.356 - 357.007 217.799 - 232.533 240.967 - 252.926 192.674 - 231.747 258.012 - 347.712 228.657 - 348.033 227.710 - 355.033 227.710 - 201.301 309.000 - 211.485 286.827 - 213.634 284.055 - 240.656 221.231 - 239.508 224.003 - 253.519 192.591 - 254.136 193.515 - 182.809 368.128 - 192.994 345.955 - 209.684 308.076 - 217.955 290.522 - 234.645 252.643 - 232.731 257.262 - 347.064 232.318 - 255.293 190.534 - 255.850 191.431 - 250.985 201.296 - 248.004 209.368 - 244.139 219.234 - 233.197 243.449 - 232.755 244.346 - 224.025 264.077 - 213.968 286.499 - 206.122 304.437 - 188.988 341.209 - 196.103 343.002 - 181.181 375.290 - 85.500 292.217 - 229.000 253.245 - 308.500 117.279 - 214.000 286.154 - 165.337 394.590 - 229.122 359.682 - 314.598 112.276 - 444.645 1.719 - 446.637 1.588 - 482.500 -0.500 - 482.502 -0.435 - 482.504 -0.369 - 484.502 -0.435 - 484.504 -0.369 - 486.502 -0.435 - 488.500 -0.500 - 488.502 -0.435 - 488.504 -0.369 - 425.866 350.358 - 425.349 353.290 - 423.278 362.017 - 423.019 363.983 - 421.466 370.778 - 423.278 364.017 - 421.466 371.778 - 418.102 384.336 - 419.396 380.506 - 417.066 390.199 - 416.031 395.063 - 414.478 401.858 - 414.478 402.858 - 411.113 416.416 - 407.490 430.938 - 425.349 364.290 - 403.867 445.461 - 419.396 388.506 - 401.020 458.087 - 399.984 462.950 - 399.467 465.882 - 399.984 464.950 - 408.266 435.041 - 403.461 455.828 - 470.252 292.115 - 470.499 294.366 - 230.937 358.280 - 234.021 356.979 - 224.122 367.878 - 213.786 256.177 - 216.160 256.172 - 212.002 259.950 - 210.855 260.500 - 206.460 264.436 - 122.154 335.011 - 202.848 266.934 - 196.119 270.218 - 115.630 338.540 - 188.802 273.490 - 184.879 288.270 - 118.186 419.536 - 392.518 211.033 - 181.340 275.835 - 176.383 290.487 - 108.965 341.363 - 117.888 420.188 - 116.896 420.319 - 305.271 458.519 - 102.376 227.250 - 171.228 277.737 - 167.237 292.999 - 170.230 292.802 - 127.322 419.615 - 143.288 419.568 - 189.189 442.560 - 193.181 443.298 - 194.179 443.233 - 279.995 443.608 - 293.965 443.692 - 306.937 443.842 - 305.939 443.908 - 325.896 443.600 - 331.883 444.207 - 311.926 460.515 - 326.894 460.534 - 491.500 -0.500 - 327.500 3.500 - 376.500 189.500 - 377.500 189.500 - 437.500 213.500 - 163.500 266.500 - 164.500 278.500 - 165.500 278.500 - 161.500 293.500 - 158.500 295.500 - 72.500 326.500 - 73.500 326.500 - 253.500 417.500 - 138.500 419.500 - 137.500 419.500 - 139.500 420.500 - 137.500 421.500 - 193.500 442.500 - 332.500 443.500 - 333.500 443.500 - 334.500 444.500 - 333.500 444.500 - 344.500 460.500 - 343.500 460.500 - 340.500 461.500 - 340.500 462.500 - 346.500 471.500 - 165.500 476.500 - 288.500 499.500 - 378.783 185.867 - 406.723 192.698 - 165.241 266.871 - 159.254 278.478 - 100.380 328.619 - 233.095 417.318 - 332.881 443.858 - 333.879 443.924 - 326.894 444.466 - 325.896 444.400 - 310.928 444.419 - 309.930 444.354 - 294.962 444.373 - 295.960 444.438 - 273.010 443.934 - 205.155 443.487 - 204.157 443.421 - 189.189 443.440 - 340.864 461.381 - 340.864 462.381 - 320.907 462.073 - 275.005 462.065 - 228.106 471.991 - 166.239 476.936 - 387.561 129.315 - 375.663 186.748 - 361.783 189.921 - 360.792 189.791 - 166.469 262.207 - 150.606 279.119 - 333.031 462.136 - 369.267 186.407 - 358.478 190.261 - 420.268 222.552 - 372.209 212.992 - 390.844 217.699 - 335.920 254.774 - 147.609 279.317 - 136.821 278.171 - 490.884 356.598 - 505.596 359.525 - 367.543 179.195 - 378.168 216.042 - 297.996 198.560 - 363.679 263.160 - 136.687 278.337 - 126.062 276.490 - 101.913 383.020 - 364.673 178.998 - 365.620 179.320 - 121.312 275.388 - 379.557 137.926 - 337.554 186.941 - 335.169 198.964 - 462.382 215.302 - 432.309 266.928 - 453.360 287.390 - 465.245 220.245 - 454.639 209.639 - 210.687 195.687 - 211.394 196.394 - 351.051 144.868 - 351.500 147.104 - 351.000 147.238 - 349.507 148.038 - 509.214 489.712 - 508.893 489.765 - 509.465 491.636 - 509.206 491.670 - 508.688 490.739 - 423.490 41.070 - 420.173 26.396 - 420.173 30.396 - 384.885 492.383 - 368.078 499.443 - 367.284 498.558 - 448.100 482.194 - 449.203 481.751 - 150.096 311.096 - 159.323 323.292 - 158.345 321.036 - 158.441 324.062 - 158.832 323.269 - 158.006 320.889 - 157.386 321.756 - 51.673 496.620 - 84.498 487.697 - 315.363 441.099 - 80.688 467.592 - 166.559 358.825 - 166.886 363.815 - 269.650 497.528 - 253.478 159.254 - 253.432 143.288 - 252.470 113.352 - 252.404 112.354 - 274.922 440.650 - 251.377 81.421 - 251.442 82.419 - 251.461 67.451 - 250.480 52.483 - 250.434 36.517 - 260.451 128.320 - 332.922 440.650 - 441.254 125.326 - 449.862 119.339 - 464.704 86.410 - 473.872 58.470 - 79.500 454.500 - 80.500 478.500 - 141.500 491.500 - 142.500 485.500 - 215.500 454.500 - 215.500 453.500 - 228.500 498.500 - 235.500 441.500 - 248.500 498.500 - 249.500 28.500 - 250.500 83.500 - 251.500 112.500 - 252.500 145.500 - 253.500 162.500 - 253.500 161.500 - 254.500 436.500 - 254.500 437.500 - 257.500 145.500 - 260.500 132.500 - 266.500 125.500 - 268.500 106.500 - 269.500 498.500 - 274.500 436.500 - 290.500 138.500 - 433.500 102.500 - 438.500 79.500 - 452.500 47.500 - 464.500 115.500 - 471.500 87.500 - 474.500 92.500 - 156.078 440.650 - 250.558 82.419 - 228.612 493.536 - 257.558 82.419 - 253.522 159.254 - 255.830 139.296 - 266.511 98.384 - 268.689 80.423 - 271.372 146.281 - 294.923 107.365 - 297.054 105.369 - 491.128 58.470 - 155.506 442.090 - 252.578 137.717 - 274.273 147.631 - 289.927 119.871 - 292.494 107.973 - 412.205 406.398 - 405.504 464.894 - 393.377 485.980 - 398.474 465.384 - 399.059 462.442 - 407.083 427.133 - 410.424 415.364 - 417.472 384.959 - 405.279 466.365 - 437.665 343.767 - 437.470 344.747 - 344.793 259.359 - 412.523 398.453 - 406.017 426.464 - 395.888 467.999 - 392.523 480.556 - 390.935 490.216 - 396.123 496.977 - 390.572 489.668 - 180.137 373.766 - 186.495 360.832 - 165.902 400.185 - 153.000 376.266 - 151.391 377.465 - 252.205 501.474 - 256.205 501.474 - 260.198 501.278 - 260.200 501.344 - 260.202 501.409 - 260.205 501.474 - 264.198 501.278 - 391.162 500.166 - 391.164 500.232 - 391.166 500.297 - 391.168 500.363 - 391.170 500.428 - 391.172 500.493 - 393.170 500.428 - 393.172 500.493 - 395.170 500.428 - 395.172 500.493 - 397.170 500.428 - 397.172 500.493 - 399.170 500.428 - 422.170 500.428 - 422.172 500.493 - 424.170 500.428 - 424.172 500.493 - 170.864 228.008 - 110.917 338.054 - 168.375 219.000 - 106.887 339.500 - 369.256 123.951 - 352.454 112.033 - 148.217 281.921 - 106.576 385.403 - 111.533 384.751 - 167.054 446.441 - 251.958 4.953 - 304.845 5.487 - 305.843 5.421 - 321.808 113.375 - 353.740 188.282 - 363.719 201.628 - 129.222 262.998 - 103.277 384.698 - 176.121 415.924 - 243.975 416.476 - 258.943 416.495 - 117.247 448.782 - 117.247 449.782 - 184.104 446.400 - 214.040 445.438 - 299.856 445.814 - 310.832 446.094 - 307.838 446.290 - 197.076 477.550 - 217.033 477.242 - 269.920 476.776 - 274.909 477.449 - 275.907 477.383 - 289.877 477.468 - 251.500 4.500 - 255.500 5.500 - 347.500 187.500 - 352.500 188.500 - 353.500 201.500 - 137.500 262.500 - 140.500 281.500 - 141.500 294.500 - 140.500 294.500 - 136.500 296.500 - 96.500 384.500 - 99.500 397.500 - 154.500 415.500 - 174.500 416.500 - 197.500 442.500 - 198.500 442.500 - 157.500 445.500 - 286.500 446.500 - 130.500 459.500 - 171.500 464.500 - 155.500 469.500 - 147.500 470.500 - 199.500 476.500 - 170.500 476.500 - 169.500 477.500 - 420.500 498.500 - 25.500 500.500 - 359.727 184.111 - 342.763 186.999 - 132.215 262.199 - 99.286 398.040 - 257.945 415.439 - 243.975 415.524 - 239.984 416.262 - 218.031 415.823 - 170.134 415.684 - 113.256 412.956 - 304.845 445.513 - 289.877 445.532 - 219.029 442.889 - 199.072 442.581 - 200.070 442.646 - 312.828 470.037 - 241.980 469.393 - 156.164 464.768 - 305.843 476.579 - 184.104 469.600 - 274.909 476.551 - 270.918 477.290 - 229.008 476.543 - 214.040 476.562 - 418.601 497.969 - 325.685 45.443 - 352.454 181.967 - 355.429 183.359 - 345.514 185.054 - 339.566 185.270 - 343.531 186.793 - 323.702 222.182 - 126.405 234.207 - 118.473 278.163 - 181.926 415.517 - 238.438 467.957 - 432.761 498.540 - 434.969 132.120 - 333.948 169.026 - 353.563 173.928 - 346.698 179.562 - 348.660 180.952 - 351.602 181.537 - 345.717 185.367 - 335.909 184.416 - 324.140 221.075 - 120.137 231.496 - 122.098 232.886 - 86.790 337.863 - 349.640 482.147 - 359.448 485.098 - 436.098 129.486 - 340.472 168.863 - 334.676 168.310 - 339.506 175.604 - 347.233 179.675 - 262.232 374.899 - 84.501 381.276 - 351.097 481.710 - 353.029 483.228 - 351.097 485.710 - 352.705 171.397 - 342.289 168.861 - 340.395 169.218 - 301.571 172.039 - 114.079 228.394 - 365.015 484.576 - 353.652 481.718 - 356.493 482.683 - 346.879 168.389 - 345.955 170.006 - 341.335 169.093 - 71.006 253.279 - 21.018 395.796 - 21.999 411.763 - 21.933 411.766 - 21.868 411.768 - 21.802 411.770 - 21.737 411.772 - 21.672 411.774 - 21.606 411.776 - 21.541 411.778 - 21.606 413.776 - 21.541 413.778 - 21.606 415.776 - 21.541 415.778 - 21.606 417.776 - 21.606 418.776 - 21.541 417.778 - 21.541 418.778 - 21.606 420.776 - 21.541 419.778 - 21.541 420.778 - 21.737 424.772 - 21.672 423.774 - 21.606 423.776 - 21.672 424.774 - 21.606 424.776 - 21.541 423.778 - 21.541 424.778 - 21.606 426.776 - 21.541 425.778 - 21.541 426.778 - 21.606 428.776 - 21.541 427.778 - 21.541 428.778 - 21.606 430.776 - 21.541 430.778 - 21.606 432.776 - 21.541 432.778 - 21.606 434.776 - 21.541 434.778 - 21.606 436.776 - 21.541 441.778 - 21.606 443.776 - 21.541 443.778 - 22.129 454.759 - 22.129 455.759 - 22.064 454.761 - 21.999 454.763 - 21.868 454.768 - 21.868 455.768 - 21.802 454.770 - 21.737 454.772 - 21.737 455.772 - 21.672 454.774 - 21.606 454.776 - 21.606 455.776 - 21.541 454.778 - 21.737 458.772 - 21.541 455.778 - 21.672 458.774 - 21.606 458.776 - 21.541 457.778 - 21.541 458.778 - 21.606 460.776 - 21.541 459.778 - 21.541 460.778 - 21.737 464.772 - 21.672 464.774 - 21.606 464.776 - 21.541 463.778 - 21.541 464.778 - 21.606 466.776 - 21.541 466.778 - 21.606 468.776 diff --git a/Data/Baseline/OTB/Files/feBreakAngularPathListOutput.txt b/Data/Baseline/OTB/Files/feBreakAngularPathListOutput.txt deleted file mode 100644 index 0f5ea99352..0000000000 --- a/Data/Baseline/OTB/Files/feBreakAngularPathListOutput.txt +++ /dev/null @@ -1,171 +0,0 @@ --------------------------------------------------------------------------- -MAX ANGULAR :0.174533(10 deg.) -INPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1], [5, 11], [5, 21] -Path 8: [1, 1], [31, 1], [41, 1] -OUTPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1] -Path 3: [11, 1], [21, 11] -Path 4: [21, 11], [31, 11] -Path 5: [1, 1], [5, 1], [7, 1], [11, 1] -Path 6: [11, 1], [21, 11] -Path 7: [21, 11], [31, 11], [41, 11] -Path 8: [1, 1], [5, 1], [7, 1], [11, 1] -Path 9: [11, 1], [21, 11] -Path 10: [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 11: [1, 11], [5, 11], [7, 11], [11, 11] -Path 12: [11, 11], [21, 1] -Path 13: [21, 1], [31, 1], [41, 1] -Path 14: [1, 1], [5, 1], [7, 1], [11, 1] -Path 15: [11, 1], [21, 11], [31, 21], [41, 31] -Path 16: [1, 1], [5, 1] -Path 17: [5, 1], [5, 11], [5, 21] -Path 18: [1, 1], [31, 1], [41, 1] --------------------------------------------------------------------------- -MAX ANGULAR :0.349066(20 deg.) -INPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1], [5, 11], [5, 21] -Path 8: [1, 1], [31, 1], [41, 1] -OUTPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1] -Path 3: [11, 1], [21, 11] -Path 4: [21, 11], [31, 11] -Path 5: [1, 1], [5, 1], [7, 1], [11, 1] -Path 6: [11, 1], [21, 11] -Path 7: [21, 11], [31, 11], [41, 11] -Path 8: [1, 1], [5, 1], [7, 1], [11, 1] -Path 9: [11, 1], [21, 11] -Path 10: [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 11: [1, 11], [5, 11], [7, 11], [11, 11] -Path 12: [11, 11], [21, 1] -Path 13: [21, 1], [31, 1], [41, 1] -Path 14: [1, 1], [5, 1], [7, 1], [11, 1] -Path 15: [11, 1], [21, 11], [31, 21], [41, 31] -Path 16: [1, 1], [5, 1] -Path 17: [5, 1], [5, 11], [5, 21] -Path 18: [1, 1], [31, 1], [41, 1] --------------------------------------------------------------------------- -MAX ANGULAR :0.523599(30 deg.) -INPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1], [5, 11], [5, 21] -Path 8: [1, 1], [31, 1], [41, 1] -OUTPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1] -Path 3: [11, 1], [21, 11] -Path 4: [21, 11], [31, 11] -Path 5: [1, 1], [5, 1], [7, 1], [11, 1] -Path 6: [11, 1], [21, 11] -Path 7: [21, 11], [31, 11], [41, 11] -Path 8: [1, 1], [5, 1], [7, 1], [11, 1] -Path 9: [11, 1], [21, 11] -Path 10: [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 11: [1, 11], [5, 11], [7, 11], [11, 11] -Path 12: [11, 11], [21, 1] -Path 13: [21, 1], [31, 1], [41, 1] -Path 14: [1, 1], [5, 1], [7, 1], [11, 1] -Path 15: [11, 1], [21, 11], [31, 21], [41, 31] -Path 16: [1, 1], [5, 1] -Path 17: [5, 1], [5, 11], [5, 21] -Path 18: [1, 1], [31, 1], [41, 1] --------------------------------------------------------------------------- -MAX ANGULAR :0.872665(50 deg.) -INPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1], [5, 11], [5, 21] -Path 8: [1, 1], [31, 1], [41, 1] -OUTPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1] -Path 8: [5, 1], [5, 11], [5, 21] -Path 9: [1, 1], [31, 1], [41, 1] --------------------------------------------------------------------------- -MAX ANGULAR :1.5708(90 deg.) -INPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1], [5, 11], [5, 21] -Path 8: [1, 1], [31, 1], [41, 1] -OUTPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1], [5, 11], [5, 21] -Path 8: [1, 1], [31, 1], [41, 1] --------------------------------------------------------------------------- -MAX ANGULAR :2.44346(140 deg.) -INPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1], [5, 11], [5, 21] -Path 8: [1, 1], [31, 1], [41, 1] -OUTPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1], [5, 11], [5, 21] -Path 8: [1, 1], [31, 1], [41, 1] --------------------------------------------------------------------------- -MAX ANGULAR :3.14159(180 deg.) -INPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1], [5, 11], [5, 21] -Path 8: [1, 1], [31, 1], [41, 1] -OUTPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -Path 5: [1, 11], [5, 11], [7, 11], [11, 11], [21, 1], [31, 1], [41, 1] -Path 6: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 21], [41, 31] -Path 7: [1, 1], [5, 1], [5, 11], [5, 21] -Path 8: [1, 1], [31, 1], [41, 1] diff --git a/Data/Baseline/OTB/Files/feTvLikelihoodPathOutput.txt b/Data/Baseline/OTB/Files/feTvLikelihoodPathOutput.txt deleted file mode 100644 index 7e18b94533..0000000000 --- a/Data/Baseline/OTB/Files/feTvLikelihoodPathOutput.txt +++ /dev/null @@ -1,8 +0,0 @@ -INPUT list of Path : -Path 1: [157, 335], [204, 376] -Path 2: [21, 305], [35, 308], [77, 354], [85, 358] -Path 3: [73, 160], [126, 173] -OUTPUT list of Path : -Path 1: [157, 335], [204, 376] Value: 4.68584e-07 -Path 2: [21, 305], [35, 308], [77, 354], [85, 358] Value: 1.87363e-07 -Path 3: [73, 160], [126, 173] Value: 9.76259e-08 diff --git a/Data/Baseline/OTB/Files/feTvLinkPathOutput.txt b/Data/Baseline/OTB/Files/feTvLinkPathOutput.txt deleted file mode 100644 index 708fabe135..0000000000 --- a/Data/Baseline/OTB/Files/feTvLinkPathOutput.txt +++ /dev/null @@ -1,23 +0,0 @@ -Maximum distance threshold: 30 (30) -Maximum angle threshold: 0.698132 (40) -INPUT list of Path : -Path 1: [1, 1], [51, 1] -Path 2: [61, 1], [91, 1] -Path 3: [111, 11], [211, 11] -Path 4: [1, 51], [51, 51] -Path 5: [71, 71], [71, 91] -Path 6: [71, 131], [71, 201] -Path 7: [141, 111], [101, 111] -Path 8: [151, 111], [191, 111] -Path 9: [111, 71], [141, 71] -Path 10: [181, 71], [151, 71] -Path 11: [11, 131], [11, 101] -Path 12: [11, 171], [11, 141] -OUTPUT list of Path : -Path 1: [1, 51], [51, 51] -Path 2: [71, 71], [71, 91] -Path 3: [71, 131], [71, 201] -Path 4: [211, 11], [111, 11], [91, 1], [61, 1], [51, 1], [1, 1] -Path 5: [101, 111], [141, 111], [151, 111], [191, 111] -Path 6: [111, 71], [141, 71], [151, 71], [181, 71] -Path 7: [11, 101], [11, 131], [11, 141], [11, 171] diff --git a/Data/Baseline/OTB/Files/feTvRemoveTortuousPathOutput.txt b/Data/Baseline/OTB/Files/feTvRemoveTortuousPathOutput.txt deleted file mode 100644 index fffefd4d76..0000000000 --- a/Data/Baseline/OTB/Files/feTvRemoveTortuousPathOutput.txt +++ /dev/null @@ -1,8 +0,0 @@ -Minimum Mean Distance: 10 (10) -INPUT list of Path : -Path 1: [1, 1], [1, 11] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1] -Path 3: [1, 1], [7, 7], [21, 21], [31, 31], [41, 41] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -OUTPUT list of Path : -Path 1: [1, 1], [7, 7], [21, 21], [31, 31], [41, 41] diff --git a/Data/Baseline/OTB/Files/feTvSimplifyPathOutput.txt b/Data/Baseline/OTB/Files/feTvSimplifyPathOutput.txt deleted file mode 100644 index 1da7ddfb7e..0000000000 --- a/Data/Baseline/OTB/Files/feTvSimplifyPathOutput.txt +++ /dev/null @@ -1,11 +0,0 @@ -TOLERANCE: 1(1) -INPUT list of Path : -Path 1: [1, 1], [5, 1], [7, 1], [11, 1], [21, 1], [31, 1] -Path 2: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [5, 5], [7, 7], [11, 11], [21, 21], [31, 31], [41, 41] -Path 4: [1, 1], [5, 1], [7, 1], [11, 1], [21, 11], [31, 11], [41, 11], [58, 11], [70, 11] -OUTPUT list of Path : -Path 1: [1, 1], [31, 1] -Path 2: [1, 1], [11, 1], [21, 11], [31, 11] -Path 3: [1, 1], [41, 41] -Path 4: [1, 1], [11, 1], [21, 11], [70, 11] diff --git a/Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.dbf b/Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.dbf deleted file mode 100644 index fdefcdf342..0000000000 --- a/Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.dbf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1acfd03f31de99605e10020ae2646b81143bd7f816559bc7d962ef2b49216af7 -size 10055 diff --git a/Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.shp b/Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.shp deleted file mode 100644 index b3adb3d3bb..0000000000 --- a/Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.shp +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ff01566163097422211e31b35823cc6ede15efa3965bcc72f2e89f8b95fc2b30 -size 12860 diff --git a/Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.shx b/Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.shx deleted file mode 100644 index 8eb95e8e60..0000000000 --- a/Data/Baseline/OTB/Files/fzTvVectorDataToRoadDescriptionFilterOutput.shx +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b033aa81a9212511ecb13bf36bb9b92d26a2272e8fd2e7106fd938f623084664 -size 668 diff --git a/Data/Baseline/OTB/Images/feDrawPathAlignDeuxTraits.png b/Data/Baseline/OTB/Images/feDrawPathAlignDeuxTraits.png deleted file mode 100644 index fa2ce49bc9..0000000000 --- a/Data/Baseline/OTB/Images/feDrawPathAlignDeuxTraits.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2c57a5038aa07298c3b42be3d1d47dd84136a4d7f210a08dbe5b223b266814f0 -size 568 diff --git a/Data/Baseline/OTB/Images/feTvNeighborhoodScalarProductDirectionOutput.tif b/Data/Baseline/OTB/Images/feTvNeighborhoodScalarProductDirectionOutput.tif deleted file mode 100644 index a5401aba3a..0000000000 --- a/Data/Baseline/OTB/Images/feTvNeighborhoodScalarProductDirectionOutput.tif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4b67d658cebed1a8dcfb9fa45be201a00cdfe874321dc4c63cbcca540ec6c6f3 -size 741552 diff --git a/Data/Baseline/OTB/Images/feTvNeighborhoodScalarProductModulusOutput.tif b/Data/Baseline/OTB/Images/feTvNeighborhoodScalarProductModulusOutput.tif deleted file mode 100644 index f3d6fec2de..0000000000 --- a/Data/Baseline/OTB/Images/feTvNeighborhoodScalarProductModulusOutput.tif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ca321fd53b489787e40bc9bf9dd49140d95d43fff73ae3501b25ceb75e529a23 -size 3023067 diff --git a/Data/Baseline/OTB/Images/feTvNonMaxRemovalByDirectionOutput.tif b/Data/Baseline/OTB/Images/feTvNonMaxRemovalByDirectionOutput.tif deleted file mode 100644 index a0a6e6047b..0000000000 --- a/Data/Baseline/OTB/Images/feTvNonMaxRemovalByDirectionOutput.tif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:57aae675e46c74467b7d34cc2fe660e4944e096db81115663960627e7e775ed4 -size 1018004 diff --git a/Data/Baseline/OTB/Images/feTvOutputRoadDetection.tif b/Data/Baseline/OTB/Images/feTvOutputRoadDetection.tif deleted file mode 100644 index 7fe52fc0ae..0000000000 --- a/Data/Baseline/OTB/Images/feTvOutputRoadDetection.tif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d0495a68b9e656915b10d5ff2c41c9f15fc46f1069a1e9dc429a153139b2607d -size 196662 diff --git a/Data/Baseline/OTB/Images/feTvRemoveIsolatedByDirectionOutput.tif b/Data/Baseline/OTB/Images/feTvRemoveIsolatedByDirectionOutput.tif deleted file mode 100644 index a7d309ac66..0000000000 --- a/Data/Baseline/OTB/Images/feTvRemoveIsolatedByDirectionOutput.tif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e56e9cadb996fea0621e258155d2414f12899652c33dbc04a69c884923981f72 -size 2166447 diff --git a/Data/Baseline/OTB/Images/feTvRemoveWrongDirectionOutput.tif b/Data/Baseline/OTB/Images/feTvRemoveWrongDirectionOutput.tif deleted file mode 100644 index 15afc03958..0000000000 --- a/Data/Baseline/OTB/Images/feTvRemoveWrongDirectionOutput.tif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6cda584546d11c80f5c32dbe32f843d178a182c47062de7d7e3dcb6931bf5304 -size 1360300 diff --git a/Data/Input/InputForRoadDetectionScalarProductDir.raw b/Data/Input/InputForRoadDetectionScalarProductDir.raw deleted file mode 100644 index 95baee1dbe..0000000000 --- a/Data/Input/InputForRoadDetectionScalarProductDir.raw +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:983ff7d0fd3f483320cd5739d48a65d89b39085be7689c9ccf2c1909646abe37 -size 8000000 diff --git a/Data/Input/InputForRoadDetectionScalarProductDir.raw.hdr b/Data/Input/InputForRoadDetectionScalarProductDir.raw.hdr deleted file mode 100644 index 542943fbb7..0000000000 --- a/Data/Input/InputForRoadDetectionScalarProductDir.raw.hdr +++ /dev/null @@ -1,14 +0,0 @@ -ENVI -description = { -/home2/julien/ORFEO-TOOLBOX/otb-build/debug/OTB/Testing/Temporary/feTvNeigborhoodScalarProductDirectionOutput} -samples = 1000 -lines = 1000 -bands = 1 -header offset = 0 -file type = ENVI Standard -data type = 5 -interleave = bsq -byte order = 0 -map info = {UTM, 1, 1, 439136.400000, 5273706.600000, 0.600000, 0.600000, 32, North} -band names = { -Band 1} diff --git a/Data/Input/InputForRoadDetectionScalarProductMod.raw b/Data/Input/InputForRoadDetectionScalarProductMod.raw deleted file mode 100644 index 1965bed302..0000000000 --- a/Data/Input/InputForRoadDetectionScalarProductMod.raw +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4381a7c3cb500cf48069d96e6cfd22d93c314d9b72ed13db4b63d71595cf4d0d -size 8000000 diff --git a/Data/Input/InputForRoadDetectionScalarProductMod.raw.hdr b/Data/Input/InputForRoadDetectionScalarProductMod.raw.hdr deleted file mode 100644 index 4718fbd683..0000000000 --- a/Data/Input/InputForRoadDetectionScalarProductMod.raw.hdr +++ /dev/null @@ -1,14 +0,0 @@ -ENVI -description = { -/home2/julien/ORFEO-TOOLBOX/otb-build/debug/OTB/Testing/Temporary/feTvNeigborhoodScalarProductModulusOutput} -samples = 1000 -lines = 1000 -bands = 1 -header offset = 0 -file type = ENVI Standard -data type = 5 -interleave = bsq -byte order = 0 -map info = {UTM, 1, 1, 439136.400000, 5273706.600000, 0.600000, 0.600000, 32, North} -band names = { -Band 1} diff --git a/Data/Input/InputForRoadDetection_IsolatedRem.raw b/Data/Input/InputForRoadDetection_IsolatedRem.raw deleted file mode 100644 index 47f0f275c5..0000000000 --- a/Data/Input/InputForRoadDetection_IsolatedRem.raw +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:708c193109abedbfbf512198f0ddfb3d395877892535ac24ebd69debed6d252a -size 8000000 diff --git a/Data/Input/InputForRoadDetection_IsolatedRem.raw.hdr b/Data/Input/InputForRoadDetection_IsolatedRem.raw.hdr deleted file mode 100644 index c3059e85c1..0000000000 --- a/Data/Input/InputForRoadDetection_IsolatedRem.raw.hdr +++ /dev/null @@ -1,14 +0,0 @@ -ENVI -description = { -/home2/julien/ORFEO-TOOLBOX/otb-build/debug/OTB/Testing/Temporary/feTvRemoveIsolatedByDirectionOutput} -samples = 1000 -lines = 1000 -bands = 1 -header offset = 0 -file type = ENVI Standard -data type = 5 -interleave = bsq -byte order = 0 -map info = {UTM, 1, 1, 439136.400000, 5273706.600000, 0.600000, 0.600000, 32, North} -band names = { -Band 1} diff --git a/Data/Input/InputForRoadDetection_NonMaxRem.raw b/Data/Input/InputForRoadDetection_NonMaxRem.raw deleted file mode 100644 index 5798a2e6cf..0000000000 --- a/Data/Input/InputForRoadDetection_NonMaxRem.raw +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:38e0a731bd1b6032cfa78f0bf04953af80d47503d7a309c0a151c24d8a7d4c92 -size 8000000 diff --git a/Data/Input/InputForRoadDetection_NonMaxRem.raw.hdr b/Data/Input/InputForRoadDetection_NonMaxRem.raw.hdr deleted file mode 100644 index f127f633be..0000000000 --- a/Data/Input/InputForRoadDetection_NonMaxRem.raw.hdr +++ /dev/null @@ -1,14 +0,0 @@ -ENVI -description = { -/home2/julien/ORFEO-TOOLBOX/otb-build/debug/OTB/Testing/Temporary/feTvNonMaxRemovalByDirectionOutput} -samples = 1000 -lines = 1000 -bands = 1 -header offset = 0 -file type = ENVI Standard -data type = 5 -interleave = bsq -byte order = 0 -map info = {UTM, 1, 1, 439136.400000, 5273706.600000, 0.600000, 0.600000, 32, North} -band names = { -Band 1} diff --git a/Data/Input/InputForRoadDetection_SpectralAngle.raw b/Data/Input/InputForRoadDetection_SpectralAngle.raw deleted file mode 100644 index fcfe442dca..0000000000 --- a/Data/Input/InputForRoadDetection_SpectralAngle.raw +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:650d138fc001f6e44fe4c937736c0fee5a0421f8924116c104e52c5ac60e6845 -size 8000000 diff --git a/Data/Input/InputForRoadDetection_SpectralAngle.raw.hdr b/Data/Input/InputForRoadDetection_SpectralAngle.raw.hdr deleted file mode 100644 index e8d1181b91..0000000000 --- a/Data/Input/InputForRoadDetection_SpectralAngle.raw.hdr +++ /dev/null @@ -1,14 +0,0 @@ -ENVI -description = { -/home2/julien/ORFEO-TOOLBOX/otb-build/debug/OTB/Testing/Temporary/bfTvSpectralAngleDistanceOutput} -samples = 1000 -lines = 1000 -bands = 1 -header offset = 0 -file type = ENVI Standard -data type = 5 -interleave = bsq -byte order = 0 -map info = {UTM, 1, 1, 439136.400000, 5273706.600000, 0.600000, 0.600000, 32, North} -band names = { -Band 1} diff --git a/Data/Input/InputForRoadDetection_WrongRem.raw b/Data/Input/InputForRoadDetection_WrongRem.raw deleted file mode 100644 index b77cb61709..0000000000 --- a/Data/Input/InputForRoadDetection_WrongRem.raw +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cfce41cafcedca2eec656277cda36f4c5dceaef30abfb367858a0a274d41b2aa -size 8000000 diff --git a/Data/Input/InputForRoadDetection_WrongRem.raw.hdr b/Data/Input/InputForRoadDetection_WrongRem.raw.hdr deleted file mode 100644 index a809330924..0000000000 --- a/Data/Input/InputForRoadDetection_WrongRem.raw.hdr +++ /dev/null @@ -1,14 +0,0 @@ -ENVI -description = { -/home2/julien/ORFEO-TOOLBOX/otb-build/debug/OTB/Testing/Temporary/feTvRemoveWrongDirectionOutput} -samples = 1000 -lines = 1000 -bands = 1 -header offset = 0 -file type = ENVI Standard -data type = 5 -interleave = bsq -byte order = 0 -map info = {UTM, 1, 1, 439136.400000, 5273706.600000, 0.600000, 0.600000, 32, North} -band names = { -Band 1} diff --git a/Examples/FeatureExtraction/CMakeLists.txt b/Examples/FeatureExtraction/CMakeLists.txt index 19c504f658..c1e0fbdb00 100644 --- a/Examples/FeatureExtraction/CMakeLists.txt +++ b/Examples/FeatureExtraction/CMakeLists.txt @@ -38,18 +38,6 @@ target_link_libraries(CorrelationLineDetectorExample ${OTB_LIBRARIES}) add_executable(EdgeDensityExample EdgeDensityExample.cxx) target_link_libraries(EdgeDensityExample ${OTB_LIBRARIES}) -#OTBRoadExtraction depends OTBMathParser. But OTB_USE_MUPARSER is OFF -if(OTBMathParser_LOADED) -add_executable(ExtractRoadByStepsExample ExtractRoadByStepsExample.cxx) -target_link_libraries(ExtractRoadByStepsExample ${OTB_LIBRARIES}) - -add_executable(ExtractRoadExample ExtractRoadExample.cxx) -target_link_libraries(ExtractRoadExample ${OTB_LIBRARIES}) - -add_executable(ParallelLineDetectionExample ParallelLineDetectionExample.cxx) -target_link_libraries(ParallelLineDetectionExample ${OTB_LIBRARIES}) -endif() - add_executable(FlusserMomentsImageFunctionExample FlusserMomentsImageFunctionExample.cxx) target_link_libraries(FlusserMomentsImageFunctionExample ${OTB_LIBRARIES}) diff --git a/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx b/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx deleted file mode 100644 index 54891d83c8..0000000000 --- a/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -// This example illustrates the details of the \doxygen{otb}{RoadExtractionFilter}. -// This filter, described in the previous section, is a composite filter that includes -// all the steps below. Individual filters can be replaced to design a road detector -// targeted at SAR images for example. - -#include "otbPolyLineParametricPathWithValue.h" -#include "otbSpectralAngleDistanceImageFilter.h" -#include "itkGradientRecursiveGaussianImageFilter.h" -#include "otbNeighborhoodScalarProductFilter.h" -#include "otbRemoveIsolatedByDirectionFilter.h" -#include "otbRemoveWrongDirectionFilter.h" -#include "otbNonMaxRemovalByDirectionFilter.h" -#include "otbVectorizationPathListFilter.h" -#include "otbSimplifyPathListFilter.h" -#include "otbBreakAngularPathListFilter.h" -#include "otbRemoveTortuousPathListFilter.h" -#include "otbLinkPathListFilter.h" -#include "otbLikelihoodPathListFilter.h" -#include "otbDrawPathListFilter.h" -#include "otbLikelihoodPathListFilter.h" -#include "otbMultiToMonoChannelExtractROI.h" -#include "itkUnaryFunctorImageFilter.h" -#include "itkRescaleIntensityImageFilter.h" -#include "itkSqrtImageFilter.h" - -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" -#include "otbMultiChannelExtractROI.h" -#include "otbVectorRescaleIntensityImageFilter.h" -#include "itkAddImageFilter.h" -#include "itkSubtractImageFilter.h" -#include "itkRGBPixel.h" -#include "itkComposeImageFilter.h" -#include "itkThresholdImageFilter.h" -#include "itkSigmoidImageFilter.h" -#include "itkThresholdImageFilter.h" -#include "itkBinaryBallStructuringElement.h" -#include "itkGrayscaleDilateImageFilter.h" - -/* Example usage: -./ExtractRoadByStepsExample Input/qb_RoadExtract.tif Output/ExtractRoadByStepsExampleOutput.jpg Output/qb_ExtractRoad_pretty.jpg 337 557 432 859 0.00005 1.0 -*/ - -/* Example usage: -./ExtractRoadByStepsExample Input/qb_RoadExtract2.tif Output/ExtractRoadByStepsExampleOutput2.jpg Output/qb_ExtractRoad_pretty2.jpg 228 316 207 282 0.00005 1.0 -*/ - - -int main(int itkNotUsed(argc), char* argv[]) -{ - - const unsigned int Dimension = 2; - typedef double PixelType; - typedef unsigned char OutputPixelType; - typedef itk::CovariantVector<PixelType, Dimension> VectorPixelType; - typedef otb::Image<PixelType, Dimension> InternalImageType; - typedef otb::VectorImage<PixelType, Dimension> MultiSpectralImageType; - typedef otb::Image<VectorPixelType, Dimension> VectorImageType; - - typedef otb::PolyLineParametricPathWithValue<double, Dimension> PathType; - - typedef otb::ImageFileReader<MultiSpectralImageType> MultispectralReaderType; - - MultispectralReaderType::Pointer multispectralReader = MultispectralReaderType::New(); - multispectralReader->SetFileName(argv[1]); - - // Create an 3 band image for the software guide - typedef otb::VectorImage<OutputPixelType, Dimension> OutputVectorImageType; - typedef otb::ImageFileWriter<OutputVectorImageType> VectorWriterType; - typedef otb::VectorRescaleIntensityImageFilter<MultiSpectralImageType, OutputVectorImageType> VectorRescalerType; - typedef otb::MultiChannelExtractROI<unsigned char, unsigned char> ChannelExtractorType; - - // The GenerateOutputInformation() information is required here so - // that the number of component per pixel is update and known to set - // up the maximum and minimum values for the rescaling filter - multispectralReader->GenerateOutputInformation(); - - OutputVectorImageType::PixelType minimum, maximum; - minimum.SetSize(multispectralReader->GetOutput()->GetNumberOfComponentsPerPixel()); - maximum.SetSize(multispectralReader->GetOutput()->GetNumberOfComponentsPerPixel()); - minimum.Fill(0); - maximum.Fill(255); - - VectorRescalerType::Pointer vr = VectorRescalerType::New(); - vr->SetInput(multispectralReader->GetOutput()); - vr->SetOutputMinimum(minimum); - vr->SetOutputMaximum(maximum); - vr->SetClampThreshold(0.01); - - ChannelExtractorType::Pointer selecter = ChannelExtractorType::New(); - selecter->SetInput(vr->GetOutput()); - selecter->SetExtractionRegion(multispectralReader->GetOutput()->GetLargestPossibleRegion()); - selecter->SetChannel(3); - selecter->SetChannel(2); - selecter->SetChannel(1); - - VectorWriterType::Pointer vectWriter = VectorWriterType::New(); - vectWriter->SetFileName(argv[3]); - vectWriter->SetInput(selecter->GetOutput()); - vectWriter->Update(); - - MultiSpectralImageType::PixelType pixelRef; - pixelRef.SetSize(4); - pixelRef[0] = atoi(argv[4]); - pixelRef[1] = atoi(argv[5]); - pixelRef[2] = atoi(argv[6]); - pixelRef[3] = atoi(argv[7]); - - double resolution = 0.6; // to get directly from metadata - double alpha = atof(argv[9]); - - // The spectral angle is used to compute a grayscale image from the - // multispectral original image using - // \doxygen{otb}{SpectralAngleDistanceImageFilter}. The spectral - // angle is illustrated on - // Figure~\ref{fig:RoadExtractionSpectralAngleDiagram}. Pixels - // corresponding to roads are in darker color. - // - // \begin{figure} - // \center - // \includegraphics[width=0.40\textwidth]{RoadExtractionSpectralAngleDiagram.eps} - // \itkcaption[Spectral Angle]{Illustration of the spectral angle - // for one pixel of a three-band image. One of the vector is the - // reference pixel and the other is the current pixel.} - // \label{fig:RoadExtractionSpectralAngleDiagram} - // \end{figure} - // - // - - typedef otb::SpectralAngleDistanceImageFilter<MultiSpectralImageType, InternalImageType> SAFilterType; - SAFilterType::Pointer saFilter = SAFilterType::New(); - saFilter->SetReferencePixel(pixelRef); - saFilter->SetInput(multispectralReader->GetOutput()); - - // A square root is applied to the spectral angle image in order to enhance contrast between - // darker pixels (which are pixels of interest) with \doxygen{itk}{SqrtImageFilter}. - - typedef itk::SqrtImageFilter<InternalImageType, InternalImageType> SqrtFilterType; - SqrtFilterType::Pointer sqrtFilter = SqrtFilterType::New(); - sqrtFilter->SetInput(saFilter->GetOutput()); - - // Use the Gaussian gradient filter compute the gradient in x and y direction - // respectively - // (\doxygen{itk}{GradientRecursiveGaussianImageFilter}). - - double sigma = alpha * (1.2 / resolution + 1); - typedef itk::GradientRecursiveGaussianImageFilter<InternalImageType, VectorImageType> GradientFilterType; - GradientFilterType::Pointer gradientFilter = GradientFilterType::New(); - gradientFilter->SetSigma(sigma); - gradientFilter->SetInput(sqrtFilter->GetOutput()); - - // Compute the scalar product of the neighboring pixels and keep the - // minimum value and the direction with \doxygen{otb}{NeighborhoodScalarProductFilter}. - // This is the line detector described - // in \cite{Lacroix1998}. - - typedef otb::NeighborhoodScalarProductFilter<VectorImageType, InternalImageType, InternalImageType> NeighborhoodScalarProductType; - NeighborhoodScalarProductType::Pointer scalarFilter = NeighborhoodScalarProductType::New(); - scalarFilter->SetInput(gradientFilter->GetOutput()); - - // The resulting image is passed to the \doxygen{otb}{RemoveIsolatedByDirectionFilter} - // filter to remove pixels - // with no neighbor having the same direction. - - typedef otb::RemoveIsolatedByDirectionFilter<InternalImageType, InternalImageType, InternalImageType> RemoveIsolatedByDirectionType; - RemoveIsolatedByDirectionType::Pointer removeIsolatedByDirectionFilter = RemoveIsolatedByDirectionType::New(); - removeIsolatedByDirectionFilter->SetInput(scalarFilter->GetOutput()); - removeIsolatedByDirectionFilter->SetInputDirection(scalarFilter->GetOutputDirection()); - - // We remove pixels having a direction corresponding to bright lines - // as we know that after the spectral angle, roads are in darker color - // with the \doxygen{otb}{RemoveWrongDirectionFilter} filter. - - typedef otb::RemoveWrongDirectionFilter<InternalImageType, InternalImageType, InternalImageType> RemoveWrongDirectionType; - RemoveWrongDirectionType::Pointer removeWrongDirectionFilter = RemoveWrongDirectionType::New(); - removeWrongDirectionFilter->SetInput(removeIsolatedByDirectionFilter->GetOutput()); - removeWrongDirectionFilter->SetInputDirection(scalarFilter->GetOutputDirection()); - - // We remove pixels which are not maximum on the direction - // perpendicular to the road direction with the \doxygen{otb}{NonMaxRemovalByDirectionFilter}. - - typedef otb::NonMaxRemovalByDirectionFilter<InternalImageType, InternalImageType, InternalImageType> NonMaxRemovalByDirectionType; - NonMaxRemovalByDirectionType::Pointer nonMaxRemovalByDirectionFilter = NonMaxRemovalByDirectionType::New(); - nonMaxRemovalByDirectionFilter->SetInput(removeWrongDirectionFilter->GetOutput()); - nonMaxRemovalByDirectionFilter->SetInputDirection(scalarFilter->GetOutputDirection()); - - // Extracted road are vectorized into polylines with \doxygen{otb}{VectorizationPathListFilter}. - - typedef otb::VectorizationPathListFilter<InternalImageType, InternalImageType, PathType> VectorizationFilterType; - VectorizationFilterType::Pointer vectorizationFilter = VectorizationFilterType::New(); - vectorizationFilter->SetInput(nonMaxRemovalByDirectionFilter->GetOutput()); - vectorizationFilter->SetInputDirection(scalarFilter->GetOutputDirection()); - vectorizationFilter->SetAmplitudeThreshold(atof(argv[8])); - - // However, this vectorization is too simple and need to be refined - // to be usable. First, we remove all aligned points to make one segment with - // \doxygen{otb}{SimplifyPathListFilter}. - // Then we break the polylines which have sharp angles as they are probably - // not road with \doxygen{otb}{BreakAngularPathListFilter}. - // Finally we remove path which are too short with \doxygen{otb}{RemoveTortuousPathListFilter}. - - typedef otb::SimplifyPathListFilter<PathType> SimplifyPathType; - SimplifyPathType::Pointer simplifyPathListFilter = SimplifyPathType::New(); - simplifyPathListFilter->GetFunctor().SetTolerance(1.0); - simplifyPathListFilter->SetInput(vectorizationFilter->GetOutput()); - - typedef otb::BreakAngularPathListFilter<PathType> BreakAngularPathType; - BreakAngularPathType::Pointer breakAngularPathListFilter = BreakAngularPathType::New(); - breakAngularPathListFilter->SetMaxAngle(otb::CONST_PI / 8.); - breakAngularPathListFilter->SetInput(simplifyPathListFilter->GetOutput()); - - typedef otb::RemoveTortuousPathListFilter<PathType> RemoveTortuousPathType; - RemoveTortuousPathType::Pointer removeTortuousPathListFilter = RemoveTortuousPathType::New(); - removeTortuousPathListFilter->GetFunctor().SetThreshold(1.0); - removeTortuousPathListFilter->SetInput(breakAngularPathListFilter->GetOutput()); - - // Polylines within a certain range are linked (\doxygen{otb}{LinkPathListFilter}) to - // try to fill gaps due to occultations by vehicules, trees, etc. before simplifying - // polylines (\doxygen{otb}{SimplifyPathListFilter}) and - // removing the shortest ones with \doxygen{otb}{RemoveTortuousPathListFilter}. - - typedef otb::LinkPathListFilter<PathType> LinkPathType; - LinkPathType::Pointer linkPathListFilter = LinkPathType::New(); - linkPathListFilter->SetDistanceThreshold(25.0 / resolution); - linkPathListFilter->SetAngularThreshold(otb::CONST_PI / 8); - linkPathListFilter->SetInput(removeTortuousPathListFilter->GetOutput()); - - SimplifyPathType::Pointer simplifyPathListFilter2 = SimplifyPathType::New(); - simplifyPathListFilter2->GetFunctor().SetTolerance(1.0); - simplifyPathListFilter2->SetInput(linkPathListFilter->GetOutput()); - - RemoveTortuousPathType::Pointer removeTortuousPathListFilter2 = RemoveTortuousPathType::New(); - removeTortuousPathListFilter2->GetFunctor().SetThreshold(10.0); - removeTortuousPathListFilter2->SetInput(simplifyPathListFilter2->GetOutput()); - - // A value can be associated with each polyline according to pixel values - // under the polyline with \doxygen{otb}{LikelihoodPathListFilter}. A higher value - // will mean a higher Likelihood to be a road. - - typedef otb::LikelihoodPathListFilter<PathType, InternalImageType> PathListToPathListWithValueType; - PathListToPathListWithValueType::Pointer pathListConverter = PathListToPathListWithValueType::New(); - pathListConverter->SetInput(removeTortuousPathListFilter2->GetOutput()); - pathListConverter->SetInputImage(nonMaxRemovalByDirectionFilter->GetOutput()); - - // A black background image is built to draw the path on. - - InternalImageType::Pointer output = InternalImageType::New(); - output->CopyInformation(multispectralReader->GetOutput()); - output->SetRegions(output->GetLargestPossibleRegion()); - output->Allocate(); - output->FillBuffer(0.0); - - // Polylines are drawn on a black background image with \doxygen{otb}{DrawPathListFilter}. - // The \code{SetUseIternalValues()} tell the drawing filter to draw the path with its Likelihood - // value. - - typedef otb::DrawPathListFilter<InternalImageType, PathType, InternalImageType> DrawPathType; - DrawPathType::Pointer drawPathListFilter = DrawPathType::New(); - drawPathListFilter->SetInput(output); - drawPathListFilter->SetInputPath(pathListConverter->GetOutput()); - drawPathListFilter->SetUseInternalPathValue(true); - - // The output from the drawing filter contains very small values (Likelihood values). Therefore - // the image has to be rescaled to be viewed. The whole pipeline is executed by invoking - // the \code{Update()} method on this last filter. - - typedef itk::RescaleIntensityImageFilter<InternalImageType, InternalImageType> RescalerType; - RescalerType::Pointer rescaler = RescalerType::New(); - rescaler->SetOutputMaximum(255); - rescaler->SetOutputMinimum(0); - rescaler->SetInput(drawPathListFilter->GetOutput()); - rescaler->Update(); - - // this small piece of code aims at producing a pretty RGB png result image. - typedef otb::MultiToMonoChannelExtractROI<OutputPixelType, PixelType> ChannelExtractionFilterType; - typedef itk::AddImageFilter<InternalImageType, InternalImageType, InternalImageType> AddFilterType; - typedef itk::SubtractImageFilter<InternalImageType, InternalImageType, InternalImageType> SubtractFilterType; - typedef itk::ThresholdImageFilter<InternalImageType> ThresholdFilterType; - typedef itk::RGBPixel<OutputPixelType> RGBPixelType; - typedef otb::Image<RGBPixelType, Dimension> RGBImageType; - typedef itk::ComposeImageFilter<InternalImageType, RGBImageType> ComposeFilterType; - typedef otb::ImageFileWriter<RGBImageType> RGBWriterType; - typedef itk::BinaryBallStructuringElement<PixelType, Dimension> StructuringElementType; - typedef itk::GrayscaleDilateImageFilter<InternalImageType, InternalImageType, StructuringElementType> DilateFilterType; - - StructuringElementType se; - se.SetRadius(1); - se.CreateStructuringElement(); - - // Filters definitions - ChannelExtractionFilterType::Pointer channelExtractor1 = ChannelExtractionFilterType::New(); - ChannelExtractionFilterType::Pointer channelExtractor2 = ChannelExtractionFilterType::New(); - ChannelExtractionFilterType::Pointer channelExtractor3 = ChannelExtractionFilterType::New(); - - AddFilterType::Pointer addFilter = AddFilterType::New(); - SubtractFilterType::Pointer subtract2 = SubtractFilterType::New(); - SubtractFilterType::Pointer subtract3 = SubtractFilterType::New(); - ThresholdFilterType::Pointer threshold11 = ThresholdFilterType::New(); - ThresholdFilterType::Pointer threshold21 = ThresholdFilterType::New(); - ThresholdFilterType::Pointer threshold31 = ThresholdFilterType::New(); - ThresholdFilterType::Pointer threshold12 = ThresholdFilterType::New(); - ThresholdFilterType::Pointer threshold22 = ThresholdFilterType::New(); - ThresholdFilterType::Pointer threshold32 = ThresholdFilterType::New(); - - ComposeFilterType::Pointer composer = ComposeFilterType::New(); - RGBWriterType::Pointer writer = RGBWriterType::New(); - - DilateFilterType::Pointer dilater = DilateFilterType::New(); - - dilater->SetInput(rescaler->GetOutput()); - dilater->SetKernel(se); - - // Extract each channel - channelExtractor1->SetInput(vr->GetOutput()); - channelExtractor2->SetInput(vr->GetOutput()); - channelExtractor3->SetInput(vr->GetOutput()); - - channelExtractor1->SetChannel(3); - channelExtractor2->SetChannel(2); - channelExtractor3->SetChannel(1); - - // Add the path to the red component - addFilter->SetInput1(channelExtractor1->GetOutput()); - addFilter->SetInput2(dilater->GetOutput()); - - subtract2->SetInput1(channelExtractor2->GetOutput()); - subtract2->SetInput2(dilater->GetOutput()); - subtract3->SetInput1(channelExtractor3->GetOutput()); - subtract3->SetInput2(dilater->GetOutput()); - - // Threshold outside the [0, 255] range - - threshold11->SetInput(addFilter->GetOutput()); - threshold11->ThresholdBelow(0); - threshold11->SetOutsideValue(0); - threshold12->SetInput(threshold11->GetOutput()); - threshold12->ThresholdAbove(255); - threshold12->SetOutsideValue(255); - - threshold21->SetInput(subtract2->GetOutput()); - threshold21->ThresholdBelow(0); - threshold21->SetOutsideValue(0); - threshold22->SetInput(threshold21->GetOutput()); - threshold22->ThresholdAbove(255); - threshold22->SetOutsideValue(255); - - threshold31->SetInput(subtract3->GetOutput()); - threshold31->ThresholdBelow(0); - threshold31->SetOutsideValue(0); - threshold32->SetInput(threshold31->GetOutput()); - threshold32->ThresholdAbove(255); - threshold32->SetOutsideValue(255); - - // Compose the output image - composer->SetInput(0, threshold12->GetOutput()); - composer->SetInput(1, threshold22->GetOutput()); - composer->SetInput(2, threshold32->GetOutput()); - - // Write the new rgb image - writer->SetInput(composer->GetOutput()); - writer->SetFileName(argv[2]); - writer->Update(); - - // Figures~\ref{fig:ROADEXTRACTIONBYSTEPS} and \ref{fig:ROADEXTRACTIONBYSTEPS2} - // show the result of applying - // the road extraction by steps to a fusionned Quickbird image. The result image - // is a RGB composition showing the extracted path in red. Full processing took - // about 3 seconds for each image. - // - // \begin{figure}[htbp] - // \center - // \includegraphics[width=0.44\textwidth]{qb_ExtractRoad_pretty.eps} - // \includegraphics[width=0.44\textwidth]{ExtractRoadByStepsExampleOutput.eps} - // \itkcaption[Road extraction filter application]{Result of applying - // the road extraction by steps pipeline to a fusionned Quickbird - // image. From left to right : original image, extracted road with their - // Likelihood values.} - // \label{fig:ROADEXTRACTIONBYSTEPS} - // \end{figure} - // - // \begin{figure}[htbp] - // \center - // \includegraphics[width=0.44\textwidth]{qb_ExtractRoad_pretty2.eps} - // \includegraphics[width=0.44\textwidth]{ExtractRoadByStepsExampleOutput2.eps} - // \itkcaption[Road extraction filter application]{Result of applying - // the road extraction by steps pipeline to a fusionned Quickbird - // image. From left to right : original image, extracted road with their - // Likelihood values.} - // \label{fig:ROADEXTRACTIONBYSTEPS2} - // \end{figure} - - return EXIT_SUCCESS; -} diff --git a/Examples/FeatureExtraction/ExtractRoadExample.cxx b/Examples/FeatureExtraction/ExtractRoadExample.cxx deleted file mode 100644 index 94c4361e0d..0000000000 --- a/Examples/FeatureExtraction/ExtractRoadExample.cxx +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/* Example usage: -./ExtractRoadExample Input/qb_RoadExtract.tif Output/ExtractRoadOutput.png 337 557 432 859 1.0 0.00005 1.0 0.39269 1.0 10.0 25. -*/ - - -// The easiest way to use the road extraction filter provided by OTB is to use the composite -// filter. If a modification in the pipeline is required to adapt to a particular situation, -// the step by step example, described in the next section can be adapted. -// -// This example demonstrates the use of the \doxygen{otb}{RoadExtractionFilter}. -// This filter is a composite filter achieving road extraction according to the algorithm -// adapted by E. Christophe and J. Inglada \cite{Christophe2007} from an original method -// proposed in \cite{Lacroix1998}. -// -// The first step toward the use of this filter is the inclusion of the proper header files. - -#include "otbPolyLineParametricPathWithValue.h" -#include "otbRoadExtractionFilter.h" -#include "otbDrawPathListFilter.h" - -#include "otbImage.h" -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" -#include "itkRescaleIntensityImageFilter.h" -#include "otbMath.h" - -#include "itkInvertIntensityImageFilter.h" -#include "itkGrayscaleDilateImageFilter.h" -#include "itkBinaryBallStructuringElement.h" - -int main(int argc, char* argv[]) -{ - - if (argc != 14) - { - std::cerr << "Usage: " << argv[0]; - std::cerr << " inputFileName outputFileName firstPixelComponent secondPixelComponent "; - std::cerr << "thirdPixelComponent fourthPixelComponent alpha amplitudeThrehsold tolerance "; - std::cerr << "angularThreshold-maxAngle firstMeanDistanceThreshold secondMeanDistanceThreshold "; - std::cerr << "distanceThreshold" << std::endl; - return EXIT_FAILURE; - } - - const unsigned int Dimension = 2; - // Then we must decide what pixel type to use for the image. We choose to do - // all the computation in floating point precision and rescale the results - // between 0 and 255 in order to export PNG images. - - typedef double InputPixelType; - typedef unsigned char OutputPixelType; - - // The images are defined using the pixel type and the dimension. Please note that - // the \doxygen{otb}{RoadExtractionFilter} needs an \doxygen{otb}{VectorImage} as input - // to handle multispectral images. - - typedef otb::VectorImage<InputPixelType, Dimension> InputVectorImageType; - typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - - // We define the type of the polyline that the filter produces. We use the - // \doxygen{otb}{PolyLineParametricPathWithValue}, which allows the filter to produce - // a likehood value along with each polyline. The filter is able to produce - // \doxygen{itk}{PolyLineParametricPath} as well. - - typedef otb::PolyLineParametricPathWithValue<InputPixelType, Dimension> PathType; - - // Now we can define the \doxygen{otb}{RoadExtractionFilter} that takes a multi-spectral - // image as input and produces a list of polylines. - - typedef otb::RoadExtractionFilter<InputVectorImageType, PathType> RoadExtractionFilterType; - - // We also define an \doxygen{otb}{DrawPathListFilter} to draw the output - // polylines on an image, taking their likehood values into account. - - typedef otb::DrawPathListFilter<InputImageType, PathType, InputImageType> DrawPathFilterType; - - // The intensity rescaling of the results will be carried out by the - // \doxygen{itk}{RescaleIntensityImageFilter} which is templated by the - // input and output image types. - - typedef itk::RescaleIntensityImageFilter<InputImageType, OutputImageType> RescalerType; - - // An \doxygen{otb}{ImageFileReader} class is also instantiated in order to read - // image data from a file. Then, an \doxygen{otb}{ImageFileWriter} - // is instantiated in order to write the output image to a file. - - typedef otb::ImageFileReader<InputVectorImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - - // The different filters composing our pipeline are created by invoking their - // \code{New()} methods, assigning the results to smart pointers. - - ReaderType::Pointer reader = ReaderType::New(); - RoadExtractionFilterType::Pointer roadExtractionFilter = RoadExtractionFilterType::New(); - DrawPathFilterType::Pointer drawingFilter = DrawPathFilterType::New(); - RescalerType::Pointer rescaleFilter = RescalerType::New(); - WriterType::Pointer writer = WriterType::New(); - - reader->SetFileName(argv[1]); - - // The \doxygen{otb}{RoadExtractionFilter} needs to have a reference pixel - // corresponding to the spectral content likely to represent a road. This is done - // by passing a pixel to the filter. Here we suppose that the input image - // has four spectral bands. - - InputVectorImageType::PixelType ReferencePixel; - ReferencePixel.SetSize(4); - ReferencePixel.SetElement(0, ::atof(argv[3])); - ReferencePixel.SetElement(1, ::atof(argv[4])); - ReferencePixel.SetElement(2, ::atof(argv[5])); - ReferencePixel.SetElement(3, ::atof(argv[6])); - roadExtractionFilter->SetReferencePixel(ReferencePixel); - - // We must also set the alpha parameter of the filter which allows us to tune the width of the roads - // we want to extract. Typical value is $1.0$ and should be working in most situations. - - roadExtractionFilter->SetAlpha(atof(argv[7])); - - // All other parameter should not influence the results too much in most situation and can - // be kept at the default value. - // - // The amplitude threshold parameter tunes the sensitivity of the vectorization step. A typical - // value is $5 \cdot 10^{-5}$. - - roadExtractionFilter->SetAmplitudeThreshold(atof(argv[8])); - - // The tolerance threshold tunes the sensitivity of the path simplification step. - // Typical value is $1.0$. - - roadExtractionFilter->SetTolerance(atof(argv[9])); - - // Roads are not likely to have sharp turns. Therefore we set the max angle parameter, - // as well as the link angular threshold. The value is typically $\frac{\pi}{8}$. - - roadExtractionFilter->SetMaxAngle(atof(argv[10])); - roadExtractionFilter->SetAngularThreshold(atof(argv[10])); - - // The \doxygen{otb}{RoadExtractionFilter} performs two odd path removing operations at different stage of - // its execution. The first mean distance threshold and the second mean distance threshold set their criterion - // for removal. Path are removed if their mean distance between nodes is to small, since such path coming - // from previous filters are likely to be tortuous. The first removal operation as a typical mean distance - // threshold parameter of $1.0$, and the second of $10.0$. - - roadExtractionFilter->SetFirstMeanDistanceThreshold(atof(argv[11])); - roadExtractionFilter->SetSecondMeanDistanceThreshold(atof(argv[12])); - - // The \doxygen{otb}{RoadExtractionFilter} is able to link path whose ends are near - // according to an euclidean distance criterion. The threshold for this distance - // to link a path is the distance threshold parameter. A typical value is $25$. - - roadExtractionFilter->SetDistanceThreshold(atof(argv[13])); - - // We will now create a black background image to draw the resulting polyline on. - // To achieve this we need to know the size of our input image. Therefore we trigger the - // \code{GenerateOutputInformation()} of the reader. - - reader->GenerateOutputInformation(); - InputImageType::Pointer blackBackground = InputImageType::New(); - blackBackground->CopyInformation(reader->GetOutput()); - blackBackground->SetRegions(blackBackground->GetLargestPossibleRegion()); - blackBackground->Allocate(); - blackBackground->FillBuffer(0); - - // We tell the \doxygen{otb}{DrawPathListFilter} to try to use the likehood value - // embedded within the polyline as a value for drawing this polyline if possible. - - drawingFilter->UseInternalPathValueOn(); - - // The \code{itk::RescaleIntensityImageFilter} needs to know which - // is the minimum and maximum values of the output generated - // image. Those can be chosen in a generic way by using the - // \code{NumericTraits} functions, since they are templated over - // the pixel type. - - rescaleFilter->SetOutputMinimum(itk::NumericTraits<OutputPixelType>::min()); - rescaleFilter->SetOutputMaximum(itk::NumericTraits<OutputPixelType>::max()); - - // Now it is time for some pipeline wiring. - - roadExtractionFilter->SetInput(reader->GetOutput()); - drawingFilter->SetInput(blackBackground); - drawingFilter->SetInputPath(roadExtractionFilter->GetOutput()); - rescaleFilter->SetInput(drawingFilter->GetOutput()); - - // The update of the pipeline is triggered by the \code{Update()} method - // of the rescale intensity filter. - - rescaleFilter->Update(); - - // output image enhancement - typedef itk::BinaryBallStructuringElement<OutputPixelType, Dimension> StructuringElementType; - typedef itk::GrayscaleDilateImageFilter<OutputImageType, OutputImageType, StructuringElementType> DilateFilterType; - typedef itk::InvertIntensityImageFilter<OutputImageType, OutputImageType> InvertFilterType; - - StructuringElementType se; - se.SetRadius(1); - se.CreateStructuringElement(); - - DilateFilterType::Pointer dilater = DilateFilterType::New(); - - dilater->SetInput(rescaleFilter->GetOutput()); - dilater->SetKernel(se); - - InvertFilterType::Pointer invertFilter = InvertFilterType::New(); - invertFilter->SetInput(dilater->GetOutput()); - - writer->SetFileName(argv[2]); - writer->SetInput(invertFilter->GetOutput()); - writer->Update(); - - // Figure~\ref{fig:ROADEXTRACTION_FILTER} shows the result of applying - // the road extraction filter to a fusionned Quickbird image. - // \begin{figure} - // \center - // \includegraphics[width=0.44\textwidth]{qb_ExtractRoad_pretty.eps} - // \includegraphics[width=0.44\textwidth]{ExtractRoadOutput.eps} - // \itkcaption[Road extraction filter application]{Result of applying - // the \doxygen{otb}{RoadExtractionFilter} to a fusionned Quickbird - // image. From left to right : original image, extracted road with their - // likehood values (color are inverted for display).} - // \label{fig:ROADEXTRACTION_FILTER} - // \end{figure} - - return EXIT_SUCCESS; -} diff --git a/Examples/FeatureExtraction/ParallelLineDetectionExample.cxx b/Examples/FeatureExtraction/ParallelLineDetectionExample.cxx deleted file mode 100644 index 305fd72b5a..0000000000 --- a/Examples/FeatureExtraction/ParallelLineDetectionExample.cxx +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -/* Example usage: -./ParallelLineDetectionExample Output/Lines.png Output/ParallelLines.png 20 2 10 -*/ - - -// This example illustrates the details of the \doxygen{otb}{ParallelLinePathListFilter}. -// - -#include "itkPolyLineParametricPath.h" -#include "otbDrawPathListFilter.h" - -#include "otbParallelLinePathListFilter.h" - -#include "otbImage.h" -#include "otbImageFileWriter.h" - -int main(int argc, char* argv[]) -{ - if (argc != 6) - { - std::cerr << "Usage: " << std::endl; - std::cerr << argv[0] << " outputImage "; - std::cerr << " outputParallelLineImage "; - std::cerr << " distThreshParallel angThreshParallel commonDistThreshParallel" << std::endl; - return EXIT_FAILURE; - } - - double distThreshParallel = atof(argv[3]); - double angThreshParallel = atof(argv[4]); - double commonDistThreshParallel = atof(argv[5]); - - // We start by creating an empty image - const unsigned int Dimension = 2; - typedef unsigned char PixelType; - - typedef otb::Image<PixelType, Dimension> ImageType; - - ImageType::Pointer image = ImageType::New(); - - ImageType::IndexType start; - - start[0] = 0; - start[1] = 0; - - ImageType::SizeType size; - size[0] = 600; - size[1] = 300; - - ImageType::RegionType region; - - region.SetSize(size); - region.SetIndex(start); - image->SetRegions(region); - image->Allocate(); - image->FillBuffer(itk::NumericTraits<PixelType>::Zero); - - // We create some lines - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::ObjectList<PathType> PathListType; - - PathListType::Pointer lineList = PathListType::New(); - - typedef PathType::ContinuousIndexType ContinuousIndexType; - ContinuousIndexType cindex; - - /*-----*/ - PathType::Pointer aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 1; - cindex[1] = 41; - aLine->AddVertex(cindex); - - cindex[0] = 175; - cindex[1] = 204; - aLine->AddVertex(cindex); - - lineList->PushBack(aLine); - - /*-----*/ - aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 60; - cindex[1] = 18; - aLine->AddVertex(cindex); - - cindex[0] = 203; - cindex[1] = 164; - aLine->AddVertex(cindex); - - lineList->PushBack(aLine); - - /*-----*/ - aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 174; - cindex[1] = 99; - aLine->AddVertex(cindex); - - cindex[0] = 281; - cindex[1] = 1; - aLine->AddVertex(cindex); - - lineList->PushBack(aLine); - - /*-----*/ - aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 3; - cindex[1] = 233; - aLine->AddVertex(cindex); - - cindex[0] = 191; - cindex[1] = 227; - aLine->AddVertex(cindex); - - lineList->PushBack(aLine); - - /*-----*/ - aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 254; - cindex[1] = 279; - aLine->AddVertex(cindex); - - cindex[0] = 351; - cindex[1] = 110; - aLine->AddVertex(cindex); - - lineList->PushBack(aLine); - - /*-----*/ - aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 270; - cindex[1] = 287; - aLine->AddVertex(cindex); - - cindex[0] = 368; - cindex[1] = 120; - aLine->AddVertex(cindex); - - lineList->PushBack(aLine); - - /*-----*/ - aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 355; - cindex[1] = 204; - aLine->AddVertex(cindex); - - cindex[0] = 528; - cindex[1] = 199; - aLine->AddVertex(cindex); - - lineList->PushBack(aLine); - - /*-----*/ - aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 437; - cindex[1] = 243; - aLine->AddVertex(cindex); - - cindex[0] = 591; - cindex[1] = 237; - aLine->AddVertex(cindex); - - lineList->PushBack(aLine); - - // Polylines are drawn on a black - typedef otb::DrawPathListFilter<ImageType, PathType, ImageType> DrawPathType; - DrawPathType::Pointer drawPathListFilter = DrawPathType::New(); - drawPathListFilter->SetInput(image); - drawPathListFilter->SetInputPath(lineList); - drawPathListFilter->SetPathValue(itk::NumericTraits<PixelType>::max()); - - typedef otb::ImageFileWriter<ImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); - writer->SetInput(drawPathListFilter->GetOutput()); - writer->SetFileName(argv[1]); - writer->Update(); - - // Parallel lines are detected. A minimum common length, an angular - // threshold and a maximum distance threshold have to specified. - // The input is a pathList of the previously extracted line segments. - typedef otb::ParallelLinePathListFilter<PathType> ParallelLinePathType; - ParallelLinePathType::Pointer parallelLinePathListFilter = ParallelLinePathType::New(); - parallelLinePathListFilter->SetDistanceThreshold(distThreshParallel); - parallelLinePathListFilter->SetAngularThreshold(angThreshParallel); - parallelLinePathListFilter->SetCommonDistanceThreshold(commonDistThreshParallel); - parallelLinePathListFilter->SetInput(lineList); - parallelLinePathListFilter->Update(); - - // A black background image is built to draw the path on. - ImageType::Pointer outputParallel = ImageType::New(); - outputParallel->SetRegions(image->GetLargestPossibleRegion()); - outputParallel->Allocate(); - outputParallel->FillBuffer(itk::NumericTraits<PixelType>::Zero); - - // Parallel lines are drawn on a black background image with \doxygen{otb}{DrawPathListFilter}. - // The \code{SetUseIternalValues()} tells the drawing filter to draw the path with its likelihood - // value. - // typedef otb::DrawPathListFilter<ImageType, PathType, ImageType> DrawPathType; - DrawPathType::Pointer drawPathListFilterParallel = DrawPathType::New(); - drawPathListFilterParallel->SetInput(outputParallel); - drawPathListFilterParallel->SetInputPath(parallelLinePathListFilter->GetOutput()); - drawPathListFilter->SetPathValue(itk::NumericTraits<PixelType>::max()); - drawPathListFilterParallel->SetUseInternalPathValue(false); - - // Write the Line image - WriterType::Pointer writerParallel = WriterType::New(); - writerParallel->SetInput(drawPathListFilterParallel->GetOutput()); - writerParallel->SetFileName(argv[2]); - writerParallel->Update(); - - return EXIT_SUCCESS; -} diff --git a/Examples/FeatureExtraction/test/CMakeLists.txt b/Examples/FeatureExtraction/test/CMakeLists.txt index 0f1e957d04..50b5174bbe 100644 --- a/Examples/FeatureExtraction/test/CMakeLists.txt +++ b/Examples/FeatureExtraction/test/CMakeLists.txt @@ -90,33 +90,6 @@ otb_add_test(NAME feTeRatioLineDetectorExampleTest COMMAND ${OTB_TEST_DRIVER} 5 1 ) -# ------- RoadExtractionExamplesTest---------- - - -otb_add_test(NAME feTeExtractRoadByStepsExampleTest COMMAND ${OTB_TEST_DRIVER} - --compare-n-images ${NOTOL} 2 - ${BASELINE}/qb_ExtractRoad_pretty.png - ${TEMP}/qb_ExtractRoad_pretty.png - ${BASELINE}/ExtractRoadByStepsExampleOutput.png - ${TEMP}/ExtractRoadByStepsExampleOutput.png - Execute $<TARGET_FILE:ExtractRoadByStepsExample> - ${INPUTDATA}/qb_RoadExtract.tif - ${TEMP}/ExtractRoadByStepsExampleOutput.png - ${TEMP}/qb_ExtractRoad_pretty.png - 337 557 432 859 0.00005 1.0 -) - - -otb_add_test(NAME feTeExtractRoadExampleTest COMMAND ${OTB_TEST_DRIVER} - --compare-image ${NOTOL} - ${BASELINE}/ExtractRoadExampleOutput.png - ${TEMP}/ExtractRoadExampleOutput.png - Execute $<TARGET_FILE:ExtractRoadExample> - ${INPUTDATA}/qb_RoadExtract.tif - ${TEMP}/ExtractRoadExampleOutput.png - 337 557 432 859 1.0 0.00005 1.0 0.39269 1.0 10.0 25. -) - # ------- SeamCarvingExamplesTest---------- otb_add_test(NAME feTeSeamCarvingExampleTest COMMAND ${OTB_TEST_DRIVER} diff --git a/Modules/Detection/RoadExtraction/CMakeLists.txt b/Modules/Detection/RoadExtraction/CMakeLists.txt deleted file mode 100644 index 7bb7b02fa9..0000000000 --- a/Modules/Detection/RoadExtraction/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) -# -# This file is part of Orfeo Toolbox -# -# https://www.orfeo-toolbox.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -project(OTBRoadExtraction) -otb_module_impl() diff --git a/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h deleted file mode 100644 index fda5cfa3c1..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbBreakAngularPathListFilter_h -#define otbBreakAngularPathListFilter_h - -#include "otbPathListToPathListFilter.h" -#include "otbMacro.h" - -namespace otb -{ -/** \class BreakAngularPathListFilter - * \brief CBase class for breaking angulars the input PathList, returning a PathList. - * - * \example FeatureExtraction/ExtractRoadByStepsExample.cxx - * - * - * \ingroup OTBRoadExtraction - */ -template <class TPath> -class ITK_EXPORT BreakAngularPathListFilter - : public PathListToPathListFilter<TPath> -{ -public: - /** Standard typedefs */ - typedef BreakAngularPathListFilter Self; - typedef PathListToPathListFilter<TPath> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Type macro */ - itkNewMacro(Self); - - /** Creation through object factory macro */ - itkTypeMacro(BreakAngularPathListFilter, PathListToPathListFilter); - - /** Template parameters typedefs */ - typedef typename Superclass::PathType PathType; - typedef typename Superclass::PathListType PathListType; - typedef typename Superclass::PathPointerType PathPointerType; - typedef typename PathListType::Pointer PathListPointerType; - - typedef double MaxAngleType; - - /** Set/Get the max angle */ - itkSetMacro(MaxAngle, MaxAngleType); - itkGetConstMacro(MaxAngle, MaxAngleType); - -protected: - /** Constructor */ - BreakAngularPathListFilter(); - /** Destructor */ - ~BreakAngularPathListFilter() override {} - /** GenerateData method */ - void GenerateData() override; - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - -private: - BreakAngularPathListFilter(const Self &) = delete; - void operator =(const Self&) = delete; - - /** Calculate break angular for a path */ - void BreakAngularPath(const MaxAngleType maxAngle, - const PathPointerType inputPath, - PathListPointerType outputPathList); - - /** Max angle value */ - MaxAngleType m_MaxAngle; - -}; -} // End namespace otb -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbBreakAngularPathListFilter.hxx" -#endif - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.hxx b/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.hxx deleted file mode 100644 index 5fcec599fd..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbBreakAngularPathListFilter.hxx +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbBreakAngularPathListFilter_hxx -#define otbBreakAngularPathListFilter_hxx - -#include "otbBreakAngularPathListFilter.h" -#include "otbMath.h" - -namespace otb -{ -/** - * Constructor - */ -template <class TPath> -BreakAngularPathListFilter<TPath> -::BreakAngularPathListFilter() -{ -} - -template <class TPath> -void -BreakAngularPathListFilter<TPath> -::BreakAngularPath(const MaxAngleType maxAngle, const PathPointerType inputPath, PathListPointerType outputPathList) -{ - typename PathType::VertexListType::ConstPointer vertexList = inputPath->GetVertexList(); - typename PathType::VertexListType::ConstIterator pathIt = vertexList->Begin(); - - typename PathType::VertexType pixel1, pixel2, pixel3; - - // Initialization - PathPointerType newPath = PathType::New(); - newPath->Initialize(); - - double alpha1(0.), alpha2(0.); - - while (pathIt != vertexList->End()) - { - // Add Pixel 1 - newPath->AddVertex(pathIt.Value()); - pixel1 = pathIt.Value(); - ++pathIt; - if (pathIt != vertexList->End()) - { - pixel2 = pathIt.Value(); - ++pathIt; - if (pathIt != vertexList->End()) - { - pixel3 = pathIt.Value(); - - alpha1 = std::atan2((pixel1[1] - pixel2[1]), (pixel1[0] - pixel2[0])); - alpha2 = std::atan2((pixel2[1] - pixel3[1]), (pixel2[0] - pixel3[0])); - alpha1 = (alpha1 >= 0) ? alpha1 : (alpha1 + CONST_2PI); - alpha2 = (alpha2 >= 0) ? alpha2 : (alpha2 + CONST_2PI); - if (std::abs(alpha1 - alpha2) > static_cast<double>(maxAngle)) - { - // Add Pixel 2 - newPath->AddVertex(pixel2); - //Create new PathType in the out path list - outputPathList->PushBack(newPath); - // Reinit - newPath = PathType::New(); - - } - --pathIt; // Return previous pixel - } - else - { - // Add last Pixel (Pixel 2) - newPath->AddVertex(pixel2); - } - } - } - //Create new PathType in the out list - outputPathList->PushBack(newPath); -} - -template <class TPath> -void -BreakAngularPathListFilter<TPath> -::GenerateData() -{ - const PathListType * inputPathList = this->GetInput(); - PathListType * outputPathList = this->GetOutput(); - - typename PathListType::ConstIterator listIt = inputPathList->Begin(); - outputPathList->Clear(); - - PathListPointerType newTempPathList = PathListType::New(); - while (listIt != inputPathList->End()) - { - (void) BreakAngularPath(m_MaxAngle, listIt.Get(), outputPathList); - ++listIt; - } -} - -/** - * PrintSelf Method - */ -template <class TPath> -void -BreakAngularPathListFilter<TPath> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); - os << indent << "Angular max value : " << m_MaxAngle << std::endl; -} - -} // End namespace otb -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h b/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h deleted file mode 100644 index 6c57fa13c9..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbGenericRoadExtractionFilter_h -#define otbGenericRoadExtractionFilter_h - -#include "itkUnaryFunctorImageFilter.h" -#include "itkGradientRecursiveGaussianImageFilter.h" - -#include "otbVectorImage.h" -#include "otbImageToPathListFilter.h" -#include "itkSqrtImageFilter.h" -#include "otbNeighborhoodScalarProductFilter.h" -#include "otbNonMaxRemovalByDirectionFilter.h" -#include "otbVectorizationPathListFilter.h" -#include "otbSimplifyPathListFilter.h" -#include "otbBreakAngularPathListFilter.h" -#include "otbRemoveTortuousPathListFilter.h" -#include "otbLinkPathListFilter.h" -#include "otbRemoveIsolatedByDirectionFilter.h" -#include "otbRemoveWrongDirectionFilter.h" -#include "otbLikelihoodPathListFilter.h" - -namespace otb -{ -/** - * \class GenericRoadExtractionFilter - * \brief This class performs the extraction of roads from an image. - * - * This composite filter implements a fast and robust road extraction - * for high resolution satellite images. The line - * detection is done using a Gaussian gradient with a scalar product to find - * the road directions. Finally, extracted roads are vectorized and - * processed to improve the results removing some occultations and false - * detections. - * - * The full method is detailed in E. Christophe and J. Inglada, "Robust Road - * Extraction for High Resolution Satellite Images," in IEEE International - * Conference on Image Processing, ICIP'07, 2007. - * - * This filter is fast, as the detection typically takes 3 seconds for a - * 1000 \f$ \times \f$ 1000 images with four spectral bands. Results can be - * used as an initialization for more complex algorithms. - * - * \sa itk::SqrtImageFilter - * \sa itk::GradientRecursiveGaussianImageFilter - * \sa NeighborhoodScalarProductFilter - * \sa RemoveIsolatedByDirectionFilter - * \sa RemoveWrongDirectionFilter - * \sa NonMaxRemovalByDirectionFilter - * \sa VectorizationPathListFilter - * \sa SimplifyPathListFilter - * \sa BreakAngularPathListFilter - * \sa RemoveTortuousPathListFilter - * \sa LinkPathListFilter - * \sa LikelihoodPathListFilter - * - * \ingroup OTBRoadExtraction - */ -template <class TInputImage, class TOutputPath> -class ITK_EXPORT GenericRoadExtractionFilter - : public ImageToPathListFilter<TInputImage, TOutputPath> -{ -public: - /** Standard typedefs */ - typedef GenericRoadExtractionFilter Self; - typedef ImageToPathListFilter<TInputImage, TOutputPath> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - /** Creation through object factory macro */ - itkNewMacro(Self); - /** Type macro */ - itkTypeMacro(GenericRoadExtractionFilter, ImageToPathListFilter); - /** Template parameters typedefs */ - typedef typename Superclass::InputImageType InputImageType; - typedef typename Superclass::OutputPathType OutputPathType; - typedef typename Superclass::OutputPathListType OutputPathListType; - typedef typename InputImageType::PixelType InputPixelType; - typedef double InternalPixelType; - - typedef otb::VectorImage<InternalPixelType, InputImageType::ImageDimension> VectorImageType; - typedef otb::Image<InternalPixelType, InputImageType::ImageDimension> ModulusType; - typedef otb::Image<InternalPixelType, InputImageType::ImageDimension> DirectionType; - - typedef itk::CovariantVector<InternalPixelType, InputImageType::ImageDimension> - VectorPixelType; - typedef otb::Image<VectorPixelType, InputImageType::ImageDimension> CovariantVectorImageType; - - typedef itk::SqrtImageFilter< - InputImageType, - InputImageType> SquareRootImageFilterType; - - typedef itk::GradientRecursiveGaussianImageFilter< - InputImageType, - CovariantVectorImageType> GradientFilterType; - - typedef NeighborhoodScalarProductFilter< - CovariantVectorImageType, - ModulusType, - DirectionType> NeighborhoodScalarProductFilterType; - - typedef RemoveIsolatedByDirectionFilter< - ModulusType, - DirectionType, - ModulusType> RemoveIsolatedByDirectionFilterType; - - typedef RemoveWrongDirectionFilter< - ModulusType, - DirectionType, - ModulusType> RemoveWrongDirectionFilterType; - - typedef NonMaxRemovalByDirectionFilter< - ModulusType, - DirectionType, - ModulusType> NonMaxRemovalByDirectionFilterType; - - typedef VectorizationPathListFilter< - ModulusType, - DirectionType, - OutputPathType> VectorizationPathListFilterType; - - typedef SimplifyPathListFilter<OutputPathType> SimplifyPathListFilterType; - typedef BreakAngularPathListFilter<OutputPathType> BreakAngularPathListFilterType; - typedef RemoveTortuousPathListFilter<OutputPathType> RemoveTortuousPathListFilterType; - typedef LinkPathListFilter<OutputPathType> LinkPathListFilterType; - typedef LikelihoodPathListFilter<OutputPathType, ModulusType> LikelihoodPathListFilterType; - - /** Template parameters typedefs for internals filters */ - typedef typename GradientFilterType::RealType SigmaType; - typedef typename VectorizationPathListFilterType::InputPixelType AmplitudeThresholdType; -// typedef typename SimplifyPathListFilterType::ToleranceType ToleranceType; - typedef double ToleranceType; - typedef typename BreakAngularPathListFilterType::MaxAngleType MaxAngleType; -// typedef typename RemoveTortuousPathListFilterType::MeanDistanceThresholdType MeanDistanceThresholdType; - typedef double MeanDistanceThresholdType; - typedef typename LinkPathListFilterType::RealType LinkRealType; - - /** Get/Set the alpha value */ - itkGetConstReferenceMacro(Alpha, double); - itkSetMacro(Alpha, double); - - /** Get/Set the amplitude threshold to start following a path (use by the VectorizationPathListFilter)*/ - itkSetMacro(AmplitudeThreshold, AmplitudeThresholdType); - itkGetMacro(AmplitudeThreshold, AmplitudeThresholdType); - - /** Get/Set the tolerance for segment consistency (tolerance in terms of distance) (use by the SimplifyPathListFilter)*/ - itkGetMacro(Tolerance, ToleranceType); - itkSetMacro(Tolerance, ToleranceType); - - /** Get/Set the resolution */ - itkGetMacro(Resolution, double); - itkSetMacro(Resolution, double); - - /** Set/Get the max angle (use bye the BreakAngularPathListFilter)*/ - itkSetMacro(MaxAngle, MaxAngleType); - itkGetConstMacro(MaxAngle, MaxAngleType); - - /** Get/Set the tolerance for segment consistency (tolerance in terms of distance) (use by RemoveTortuousPathListFilter)*/ - itkGetMacro(FirstMeanDistanceThreshold, MeanDistanceThresholdType); - itkSetMacro(FirstMeanDistanceThreshold, MeanDistanceThresholdType); - itkGetMacro(SecondMeanDistanceThreshold, MeanDistanceThresholdType); - itkSetMacro(SecondMeanDistanceThreshold, MeanDistanceThresholdType); - - /** Get/Set the angular threshold (use by LinkPathFilter)*/ - itkSetMacro(AngularThreshold, LinkRealType); - itkGetMacro(AngularThreshold, LinkRealType); - /** Get/Set the distance threshold (use by LinkPathFilter)*/ - itkSetMacro(DistanceThreshold, LinkRealType); - itkGetMacro(DistanceThreshold, LinkRealType); - -protected: - /** Constructor */ - GenericRoadExtractionFilter(); - /** Destructor */ - ~GenericRoadExtractionFilter() override {} - - /** Prepare main computation method - * Note : this function isn't called - */ - void BeforeGenerateData(void); - - /** Main computation method */ - void GenerateData(void) override; - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - -private: - - GenericRoadExtractionFilter(const Self &) = delete; - void operator =(const Self&) = delete; - - typename SquareRootImageFilterType::Pointer m_SquareRootImageFilter; - typename GradientFilterType::Pointer m_GradientFilter; - typename NeighborhoodScalarProductFilterType::Pointer m_NeighborhoodScalarProductFilter; - typename RemoveIsolatedByDirectionFilterType::Pointer m_RemoveIsolatedByDirectionFilter; - typename RemoveWrongDirectionFilterType::Pointer m_RemoveWrongDirectionFilter; - typename NonMaxRemovalByDirectionFilterType::Pointer m_NonMaxRemovalByDirectionFilter; - typename VectorizationPathListFilterType::Pointer m_VectorizationPathListFilter; - typename SimplifyPathListFilterType::Pointer m_FirstSimplifyPathListFilter; - typename SimplifyPathListFilterType::Pointer m_SecondSimplifyPathListFilter; - typename BreakAngularPathListFilterType::Pointer m_BreakAngularPathListFilter; - typename RemoveTortuousPathListFilterType::Pointer m_FirstRemoveTortuousPathListFilter; - typename RemoveTortuousPathListFilterType::Pointer m_SecondRemoveTortuousPathListFilter; - typename LinkPathListFilterType::Pointer m_LinkPathListFilter; - typename LikelihoodPathListFilterType::Pointer m_LikelihoodPathListFilter; - - /** Amplitude threshold to start following a path (use by the VectorizationPathListFilter)*/ - AmplitudeThresholdType m_AmplitudeThreshold; - /** Tolerance for segment consistency (tolerance in terms of distance) (use by the SimplifyPathListFilter)*/ - ToleranceType m_Tolerance; - /** Max angle (use bye the BreakAngularPathListFilter)*/ - MaxAngleType m_MaxAngle; - /** Tolerance for segment consistency (tolerance in terms of distance) (use by RemoveTortuousPathListFilter)*/ - MeanDistanceThresholdType m_FirstMeanDistanceThreshold; - MeanDistanceThresholdType m_SecondMeanDistanceThreshold; - /** The angular threshold (use by LinkPathListFilter) */ - LinkRealType m_AngularThreshold; - - /** The distance threshold (use by LinkPathListFilter) */ - double m_DistanceThreshold; - - /** Alpha. Use to calculate the sigma value used by the GradientRecursiveGaussianImageFilter */ - double m_Alpha; - - /** Resolution of the image. Use to calculate the sigma value used by the GradientRecursiveGaussianImageFilter - and the m_DistanceThreshold value used by the LinkPathListFilter - This value is set bye the image's spacing.*/ - double m_Resolution; - -}; - -} // End namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbGenericRoadExtractionFilter.hxx" -#endif - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.hxx b/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.hxx deleted file mode 100644 index fe69fd3c78..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.hxx +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbGenericRoadExtractionFilter_hxx -#define otbGenericRoadExtractionFilter_hxx - -#include "otbGenericRoadExtractionFilter.h" -#include "otbMath.h" - -namespace otb -{ -/** - * Constructor - */ -template <class TInputImage, class TOutputPath> -GenericRoadExtractionFilter<TInputImage, TOutputPath> -::GenericRoadExtractionFilter() -{ - this->SetNumberOfRequiredInputs(1); - this->SetNumberOfRequiredOutputs(1); - - m_SquareRootImageFilter = SquareRootImageFilterType::New(); - m_GradientFilter = GradientFilterType::New(); - m_NeighborhoodScalarProductFilter = NeighborhoodScalarProductFilterType::New(); - m_RemoveIsolatedByDirectionFilter = RemoveIsolatedByDirectionFilterType::New(); - m_RemoveWrongDirectionFilter = RemoveWrongDirectionFilterType::New(); - m_NonMaxRemovalByDirectionFilter = NonMaxRemovalByDirectionFilterType::New(); - m_VectorizationPathListFilter = VectorizationPathListFilterType::New(); - m_FirstSimplifyPathListFilter = SimplifyPathListFilterType::New(); - m_SecondSimplifyPathListFilter = SimplifyPathListFilterType::New(); - m_BreakAngularPathListFilter = BreakAngularPathListFilterType::New(); - m_FirstRemoveTortuousPathListFilter = RemoveTortuousPathListFilterType::New(); - m_SecondRemoveTortuousPathListFilter = RemoveTortuousPathListFilterType::New(); - m_LinkPathListFilter = LinkPathListFilterType::New(); - m_LikelihoodPathListFilter = LikelihoodPathListFilterType::New(); - - /** Amplitude threshold to start following a path (use by the VectorizationPathListFilter)*/ - m_AmplitudeThreshold = static_cast<AmplitudeThresholdType>(0.00005); - /** Tolerance for segment consistency (tolerance in terms of distance) (use by the SimplifyPathFilter)*/ - m_Tolerance = static_cast<ToleranceType>(1.); - /** Max angle (use bye the BreakAngularPathListFilter)*/ - m_MaxAngle = static_cast<MaxAngleType>(CONST_PI_8); - /** Tolerance for segment consistency (tolerance in terms of distance) (use by RemoveTortuousPathFilter)*/ - m_FirstMeanDistanceThreshold = static_cast<MeanDistanceThresholdType>(1.); - m_SecondMeanDistanceThreshold = static_cast<MeanDistanceThresholdType>(10.); - /** The angular threshold (use by LinkPathFilter) */ - m_AngularThreshold = static_cast<LinkRealType>(CONST_PI_8); - - /** The distance threshold (use by LinkPathFilter) */ - m_DistanceThreshold = 25.; - - /** Alpha value */ - /** Use to calculate the sigma value use by the GradientRecursiveGaussianImageFilter */ - m_Alpha = 1.0; - - /** Resolution of the image */ - m_Resolution = 1.; -} -/** - * Prepare main computation method - */ -template <class TInputImage, class TOutputPath> -void -GenericRoadExtractionFilter<TInputImage, TOutputPath> -::BeforeGenerateData() -{ - /** Calculation of resolution value */ - typename InputImageType::SpacingType spacing = this->GetInput()->GetSignedSpacing(); - // Getting x Spacing for the resolution - m_Resolution = static_cast<double>(spacing[0]); - if (m_Resolution == 0.) - { - itkWarningMacro(<< "The image spacing is zero. So the resolution used in the filter is forced to 1."); - m_Resolution = 1.; - } - -} - -/** - * Main computation method - */ -template <class TInputImage, class TOutputPath> -void -GenericRoadExtractionFilter<TInputImage, TOutputPath> -::GenerateData() -{ - // // Input images pointers - typename InputImageType::ConstPointer inputImage = this->GetInput(); - typename OutputPathListType::Pointer outputPathList = this->GetOutput(); - - /////////////////////////////////////// - //// Algorithm for road extraction //// - /////////////////////////////////////// - - // - - m_SquareRootImageFilter->SetInput(inputImage); - - m_GradientFilter->SetInput(m_SquareRootImageFilter->GetOutput()); - /** Sigma calculated with the alpha and image resolution parameters */ - m_GradientFilter->SetSigma(static_cast<SigmaType>(m_Alpha * (1.2 / m_Resolution + 1.))); - m_GradientFilter->SetUseImageDirection(false); - - m_NeighborhoodScalarProductFilter->SetInput(m_GradientFilter->GetOutput()); - - m_RemoveIsolatedByDirectionFilter->SetInput(m_NeighborhoodScalarProductFilter->GetOutput()); - m_RemoveIsolatedByDirectionFilter->SetInputDirection(m_NeighborhoodScalarProductFilter->GetOutputDirection()); - - m_RemoveWrongDirectionFilter->SetInput(m_RemoveIsolatedByDirectionFilter->GetOutput()); - m_RemoveWrongDirectionFilter->SetInputDirection(m_NeighborhoodScalarProductFilter->GetOutputDirection()); - - m_NonMaxRemovalByDirectionFilter->SetInput(m_RemoveWrongDirectionFilter->GetOutput()); - m_NonMaxRemovalByDirectionFilter->SetInputDirection(m_NeighborhoodScalarProductFilter->GetOutputDirection()); - - m_VectorizationPathListFilter->SetInput(m_NonMaxRemovalByDirectionFilter->GetOutput()); - m_VectorizationPathListFilter->SetInputDirection(m_NeighborhoodScalarProductFilter->GetOutputDirection()); - m_VectorizationPathListFilter->SetAmplitudeThreshold(m_AmplitudeThreshold); - - m_FirstSimplifyPathListFilter->SetInput(m_VectorizationPathListFilter->GetOutput()); - m_FirstSimplifyPathListFilter->GetFunctor().SetTolerance(m_Tolerance); - - m_BreakAngularPathListFilter->SetInput(m_FirstSimplifyPathListFilter->GetOutput()); - m_BreakAngularPathListFilter->SetMaxAngle(m_MaxAngle); - - m_FirstRemoveTortuousPathListFilter->SetInput(m_BreakAngularPathListFilter->GetOutput()); - m_FirstRemoveTortuousPathListFilter->GetFunctor().SetThreshold(m_FirstMeanDistanceThreshold); - - m_LinkPathListFilter->SetInput(m_FirstRemoveTortuousPathListFilter->GetOutput()); - m_LinkPathListFilter->SetAngularThreshold(m_AngularThreshold); - m_LinkPathListFilter->SetDistanceThreshold(static_cast<LinkRealType>(m_DistanceThreshold / m_Resolution)); - - m_SecondSimplifyPathListFilter->SetInput(m_LinkPathListFilter->GetOutput()); - m_SecondSimplifyPathListFilter->GetFunctor().SetTolerance(m_Tolerance); - - m_SecondRemoveTortuousPathListFilter->SetInput(m_SecondSimplifyPathListFilter->GetOutput()); - m_SecondRemoveTortuousPathListFilter->GetFunctor().SetThreshold(m_SecondMeanDistanceThreshold); - - m_LikelihoodPathListFilter->SetInput(m_SecondRemoveTortuousPathListFilter->GetOutput()); - m_LikelihoodPathListFilter->SetInputImage(m_NonMaxRemovalByDirectionFilter->GetOutput()); - - // Graft output seems to be broken for PolylineParametricPath - // So we use update, and copy the path to the output path list. - // m_LikelihoodPathListFilter->GraftOutput(this->GetOutput()); - m_LikelihoodPathListFilter->Update(); - // outputPathList = m_LikelihoodPathListFilter->GetOutput(); - for (typename LikelihoodPathListFilterType::PathListType::ConstIterator it - = m_LikelihoodPathListFilter->GetOutput()->Begin(); - it != m_LikelihoodPathListFilter->GetOutput()->End(); - ++it) - { - outputPathList->PushBack(it.Get()); - } -} -/** - * PrintSelf method - */ -template <class TInputImage, class TOutputPath> -void -GenericRoadExtractionFilter<TInputImage, TOutputPath> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); - os << indent << "m_Alpha:" << m_Alpha << std::endl; - os << indent << "m_Resolution:" << m_Resolution << std::endl; - os << indent << "m_AmplitudeThreshold: " << m_AmplitudeThreshold << std::endl; - os << indent << "m_Tolerance: " << m_Tolerance << std::endl; - os << indent << "m_MaxAngle: " << m_MaxAngle << std::endl; - os << indent << "m_FirstMeanDistanceThreshold: " << m_FirstMeanDistanceThreshold << std::endl; - os << indent << "m_SecondMeanDistanceThreshold: " << m_SecondMeanDistanceThreshold << std::endl; - os << indent << "m_DistanceThreshold: " << m_DistanceThreshold << std::endl; - os << indent << "m_AngularThreshold: " << m_AngularThreshold << std::endl; - -} -} // End namespace otb -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h b/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h deleted file mode 100644 index bdb44cf1f0..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbImageToPathListAlignFilter_h -#define otbImageToPathListAlignFilter_h - -#include "itkImageSource.h" -#include "itkConceptChecking.h" -#include "otbImage.h" -#include "otbImageToPathListFilter.h" -#include <vector> - -namespace otb -{ - -/** \class ImageToPathListAlignFilter - * \brief Base class used to implement filter to extract align points or group of points and give the coordinates. - * - * - * \ingroup OTBRoadExtraction - */ -template <class TInputImage, class TOutputPath> -class ITK_EXPORT ImageToPathListAlignFilter : public ImageToPathListFilter<TInputImage, TOutputPath> -{ -public: - /** Standard class typedefs. */ - typedef ImageToPathListAlignFilter Self; - typedef ImageToPathListFilter<TInputImage, TOutputPath> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(ImageToPathListAlignFilter, ImageToPathListFilter); -// itkTypeMacro(ImageToPathListAlignFilter, itk::ImageSource); - - /** ImageDimension constants */ - itkStaticConstMacro(InputImageDimension, unsigned int, - TInputImage::ImageDimension); - - /** Some convenient typedefs. */ - typedef typename Superclass::OutputPathListType OutputPathListType; - - typedef typename Superclass::InputImageType InputImageType; - typedef typename Superclass::InputImageRegionType InputImageRegionType; - typedef typename InputImageType::Pointer InputImagePointer; - typedef typename InputImageType::ConstPointer InputImageConstPointer; - - typedef typename InputImageType::SizeType SizeType; - typedef typename InputImageType::ValueType ValueType; - typedef typename InputImageType::PixelType PixelType; - - typedef typename Superclass::OutputPathType OutputPathType; - // typedef typename Superclass::OutputPathListType OutputPathListType; - typedef typename Superclass::OutputPathPointerType OutputPathPointerType; - -// typedef float RealType; -//typedef typename itk::NumericTraits<PixelType>::RealType RealType; - typedef double RealType; -// typedef typename itk::Image<RealType, InputImageDimension> RealImageType; - typedef typename otb::Image<RealType, InputImageDimension> RealImageType; - typedef typename RealImageType::Pointer RealImageTypePointer; - typedef typename RealImageType::IndexType RealImageTypeIndexType; - - /** Spacing (size of a pixel) of the output image. The - * spacing is the geometric distance between image samples. - * It is stored internally as double, but may be set from - * float. \sa GetSpacing() */ - virtual void SetSpacing(const double* spacing); - virtual void SetSpacing(const float* spacing); - virtual const double* GetSpacing() const; - - /** Set/Get the value for pixels on and off the path. - * By default, this filter will return a "0" image with path pixels set to 1 */ - itkSetMacro(PathValue, ValueType); - itkGetMacro(PathValue, ValueType); - itkSetMacro(BackgroundValue, ValueType); - itkGetMacro(BackgroundValue, ValueType); - - /** The origin of the output image. The origin is the geometric - * coordinates of the index (0, 0, ..., 0). It is stored internally - * as double but may be set from float. - * \sa GetOrigin() */ - virtual void SetOrigin(const double* origin); - virtual void SetOrigin(const float* origin); - virtual const double * GetOrigin() const; - - /** Set/Get Size */ - itkSetMacro(Size, SizeType); - itkGetMacro(Size, SizeType); - - itkSetMacro(isMeaningfulSegment, bool); - itkSetMacro(NbGradDirection, int); - itkSetMacro(NbLineDirection, int); - itkSetMacro(MinGradNorm, double); - itkSetMacro(Eps, double); - itkGetConstReferenceMacro(isMeaningfulSegment, bool); - itkGetConstReferenceMacro(NbGradDirection, int); - itkGetConstReferenceMacro(NbLineDirection, int); - itkGetConstReferenceMacro(MinGradNorm, double); - itkGetConstReferenceMacro(Eps, double); - -protected: - ImageToPathListAlignFilter(); - ~ImageToPathListAlignFilter() override; - - void GenerateOutputInformation() override {} // do nothing - void GenerateData() override; - virtual std::vector<double> tab(int n, double p, double m); - virtual void AngleCalculate(const InputImageType* InputImageIn); - - SizeType m_Size; - double m_Spacing[InputImageDimension]; - double m_Origin[InputImageDimension]; - ValueType m_PathValue; - ValueType m_BackgroundValue; - - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - -private: - ImageToPathListAlignFilter(const Self &) = delete; - void operator =(const Self&) = delete; - bool m_isMeaningfulSegment; /// to get all meaningful segments (maximal or not - int m_NbGradDirection; /// Number of allowed gradient direction, default 16 - int m_NbLineDirection; /// Number of line directions to scan, default 96) - double m_MinGradNorm; /// Minimum gradient norm to define a direction, default 2. - double m_Eps; /// -log10(max. number of false alarms), default 0 - std::vector<double> m_seglist; - - RealImageType * m_AngleImage; //Angle image use by GenerateData and AngleCalculate methods -}; - -} // end namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbImageToPathListAlignFilter.hxx" -#endif - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.hxx b/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.hxx deleted file mode 100644 index 3ba3ef83d4..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.hxx +++ /dev/null @@ -1,585 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbImageToPathListAlignFilter_hxx -#define otbImageToPathListAlignFilter_hxx - -#include "otbImageToPathListAlignFilter.h" -#include "itkImageRegionIteratorWithIndex.h" -#include "itkConstNeighborhoodIterator.h" -#include "itkPathIterator.h" -#include "itkNumericTraits.h" -#include "itkImageLinearIteratorWithIndex.h" -#include "otbMath.h" - -namespace otb -{ - -struct one_segment -{ - short start; /* starting position (distance from border) */ - short end; /* ending position (hence, length is end-start+1) */ - double nfa; /* number of false alarms */ - char ok; -}; - -/** Constructor */ -template <class TInputImage, class TOutputPath> -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::ImageToPathListAlignFilter() -{ - this->SetNumberOfRequiredInputs(1); - m_Size.Fill(0); - m_isMeaningfulSegment = false; - m_NbGradDirection = 16; - m_NbLineDirection = 96; - m_MinGradNorm = 2.0; - m_Eps = 0.0; - - for (unsigned int i = 0; i < InputImageDimension; ++i) - { - // Set an image spacing for the user - m_Spacing[i] = 1.0; - m_Origin[i] = 0; - } - - m_PathValue = itk::NumericTraits<ValueType>::One; - m_BackgroundValue = itk::NumericTraits<ValueType>::Zero; -} - -/** Destructor */ -template <class TInputImage, class TOutputPath> -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::~ImageToPathListAlignFilter() -{ -} - -//---------------------------------------------------------------------------- -template <class TInputImage, class TOutputPath> -void -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::SetSpacing(const double* spacing) -{ - unsigned int i; - for (i = 0; i < InputImageDimension; ++i) - { - if (spacing[i] != m_Spacing[i]) - { - break; - } - } - if (i < InputImageDimension) - { - for (i = 0; i < InputImageDimension; ++i) - { - m_Spacing[i] = spacing[i]; - } - this->Modified(); - } -} - -template <class TInputImage, class TOutputPath> -void -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::SetSpacing(const float* spacing) -{ - unsigned int i; - for (i = 0; i < InputImageDimension; ++i) - { - if ((double) spacing[i] != m_Spacing[i]) - { - break; - } - } - if (i < InputImageDimension) - { - for (i = 0; i < InputImageDimension; ++i) - { - m_Spacing[i] = spacing[i]; - } - this->Modified(); - } -} - -template <class TInputImage, class TOutputPath> -const double * -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::GetSpacing() const -{ - return m_Spacing; -} - -//---------------------------------------------------------------------------- -template <class TInputImage, class TOutputPath> -void -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::SetOrigin(const double* origin) -{ - unsigned int i; - for (i = 0; i < InputImageDimension; ++i) - { - if (origin[i] != m_Origin[i]) - { - break; - } - } - if (i < InputImageDimension) - { - for (i = 0; i < InputImageDimension; ++i) - { - m_Origin[i] = origin[i]; - } - } -} - -template <class TInputImage, class TOutputPath> -void -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::SetOrigin(const float* origin) -{ - unsigned int i; - for (i = 0; i < InputImageDimension; ++i) - { - if ((double) origin[i] != m_Origin[i]) - { - break; - } - } - if (i < InputImageDimension) - { - for (i = 0; i < InputImageDimension; ++i) - { - m_Origin[i] = origin[i]; - } - } -} - -template <class TInputImage, class TOutputPath> -const double * -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::GetOrigin() const -{ - return m_Origin; -} - -//---------------------------------------------------------------------------- -/* Algorithm */ -template <class TInputImage, class TOutputPath> -std::vector<double> -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::tab(int n, double p, double m) -{ - std::vector<double> out; - int adr1, adr2, x, y; -// double lambda; - double q; - - q = 1.0 - p; - out.resize((n + 1) * (n + 1)); - adr1 = 0; - - /*** compute proba (=x among y) ***/ - out[0] = 1.0; - for (y = 1, adr2 = 0; y <= n; ++y) - { - adr1 = adr2; - adr2 += n + 1; - out[adr2] = q * out[adr1]; - for (x = 1; x <= y; ++x) - out[adr2 + x] = p * out[adr1 + x - 1] + q * out[adr1 + x]; - } - - /*** sum to obtain proba (>=k among y) ***/ - for (y = 1, adr1 = n + 1; y <= n; ++y, adr1 += n + 1) - for (x = y - 1; x >= 0; x--) - out[adr1 + x] += out[adr1 + x + 1]; - - /*** multiply by m (number of segments) to obtain expectation***/ - for (adr1 = (n + 1) * (n + 1); --adr1 >= 0; ) - out[adr1] *= m; - - return out; -} - -template <class TInputImage, class TOutputPath> -void -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::AngleCalculate(const InputImageType* InputImage) -{ - double threshold; - int n, p, x, y; - - typename InputImageType::SizeType Taille; - typename RealImageType::IndexType IndexOut; - - Taille = InputImage->GetLargestPossibleRegion().GetSize(); - - typename RealImageType::RegionType region; - region.SetSize(InputImage->GetLargestPossibleRegion().GetSize()); - IndexOut[0] = 0; - IndexOut[1] = 0; -// region.SetIndex(InputImage->GetLargestPossibleRegion().GetIndex()); - region.SetIndex(IndexOut); - m_AngleImage->SetRegions(region); - m_AngleImage->SetOrigin(InputImage->GetOrigin()); - m_AngleImage->SetSignedSpacing(InputImage->GetSignedSpacing()); - m_AngleImage->Allocate(); - - n = Taille[0]; - p = Taille[1]; - - threshold = m_MinGradNorm; - threshold *= threshold; - - typename InputImageType::IndexType idx; - - for (x = 0; x < p; ++x) - { - idx[0] = (n - 1); - idx[1] = x; -// indice = (n-1)*p +x - m_AngleImage->SetPixel(idx, static_cast<RealType>(-1000.0)); - } - for (y = 0; y < n; ++y) - { - idx[0] = y; - idx[1] = p - 1; -// indice = p*y+p-1 - m_AngleImage->SetPixel(idx, static_cast<RealType>(-1000.0)); - } - - typename InputImageType::IndexType adr; - RealType PixelA, PixelB, PixelC, PixelD; - RealType com1, com2, gx, gy, norm; - - for (x = 0; x < p - 1; ++x) - for (y = 0; y < n - 1; ++y) - { -// indice = y*p+x - adr[0] = y; - adr[1] = x; - idx[0] = adr[0] + 1; - idx[1] = adr[1] + 1; - PixelA = static_cast<RealType>(InputImage->GetPixel(idx)); - idx[0] = adr[0]; - idx[1] = adr[1]; - assert(idx[0] < n); - assert(idx[1] < p); - assert(idx[0] >= 0); - assert(idx[1] >= 0); - PixelB = static_cast<RealType>(InputImage->GetPixel(idx)); - idx[0] = adr[0] + 1; - idx[1] = adr[1]; - assert(idx[0] < n); - assert(idx[1] < p); - assert(idx[0] >= 0); - assert(idx[1] >= 0); - PixelC = static_cast<RealType>(InputImage->GetPixel(idx)); - idx[0] = adr[0]; - idx[1] = adr[1] + 1; - assert(idx[0] < n); - assert(idx[1] < p); - assert(idx[0] >= 0); - assert(idx[1] >= 0); - PixelD = static_cast<RealType>(InputImage->GetPixel(idx)); - com1 = PixelA - PixelB; - com2 = PixelC - PixelD; - gx = 0.5 * (com1 + com2); - gy = 0.5 * (com1 - com2); - norm = gx * gx + gy * gy; - - if (norm <= threshold) m_AngleImage->SetPixel(adr, static_cast<RealType>(-1000.0)); - else m_AngleImage->SetPixel(adr, static_cast<RealType>(std::atan2(gx, -gy))); - } -} - -template <class TInputImage, class TOutputPath> -void -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::GenerateData(void) -{ -// SizeType size; -// double origin[InputImageDimension]; - typename InputImageType::SizeType Taille; - RealImageTypeIndexType indexAngle; -// Flist result; - int iseglist, size_seglist; /* associated counter and dynamic size */ - int iseg, size_seg; - double nfa, max_nfa; - std::vector<double> test; - std::vector<int> count, startbloc, endbloc; - std::vector<double> seglist; /* list of recorded segments */ - std::vector<one_segment> seg; - int mx, my, ox, oy, nx, ny, n; - int xx, yy, pos, posmax, nblocs, inbloc, max_nblocs; - int cur, i, j, side, l, lphase; - // int tmp; - int itheta, ntheta; - double theta, theta0, dtheta, dx, dy, prec; - double error = 0.0; - itkDebugMacro(<< "ImageToPathListAlignFilter::GenerateData() called"); - - // Get the input and output pointers - const InputImageType * InputImage = this->GetInput(); - OutputPathListType * OutputPath = this->GetOutput(); - // Generate the image - - /* Filter algorithm */ - - Taille = InputImage->GetLargestPossibleRegion().GetSize(); - nx = Taille[0]; - ny = Taille[1]; - max_nfa = std::pow(10.0, -(m_Eps)); - -// typename InputImageType::IndexType adr; - - /*** maximal length for a line */ - n = (int) std::ceil(hypot((double) nx, (double) ny)) + 1; - - /*** compute angle map of u ***/ - RealImageTypePointer lAngleImagePointer = RealImageType::New(); - m_AngleImage = static_cast<RealImageType*>(lAngleImagePointer.GetPointer()); - this->AngleCalculate(InputImage); - - /*** compute P(k, l) ***/ - test = tab(n, 1.0 / (double) (m_NbGradDirection), (double) (nx * ny) * (double) (nx * ny)); - - /*** initialization ***/ - prec = CONST_PI / (double) (m_NbGradDirection); - ntheta = m_NbLineDirection / 2; /* i.e. # directions of NON-ORIENTED lines */ - dtheta = CONST_PI / (double) ntheta; - - /******************** memory allocation ********************/ - - max_nblocs = n / 2 + 1; /* maximal number of blocs */ - count.resize(max_nblocs); - startbloc.resize(max_nblocs); - endbloc.resize(max_nblocs); - - size_seg = 10000; /* initial allocation (may reallocate later) */ - seg.resize(size_seg); - - size_seglist = 10000; /* initial allocation (may reallocate later) */ - seglist.resize(5 * size_seglist); - - /* counter for recorded segments (seglist) */ - iseglist = 0; - - /******************** first loop : the four sides ********************/ - - for (side = 0; side < 4; side++) - { - printf("side %d/4 ", side + 1); - - theta0 = CONST_PI_2 * (double) side; - mx = ((side == 0 || side == 2) ? 1 : 0); - my = ((side == 1 || side == 3) ? 1 : 0); - ox = ((side == 1) ? nx - 1 : 0); - oy = ((side == 2) ? ny - 1 : 0); - - posmax = nx * mx + ny * my; - - /*** second loop : angles ***/ - for (itheta = 0; itheta < ntheta; itheta++) - { - printf("."); - fflush(stdout); - theta = theta0 + (double) (itheta) * dtheta; - dx = (double) std::cos((double) theta); - dy = (double) std::sin((double) theta); - - /*** third loop : start positions ***/ - for (pos = 0; pos < posmax; ++pos) - { - - /* clear segment array */ - iseg = 0; - - /*** fourth loop : phase for two-spaced pixels ***/ - for (lphase = 0; lphase < 2; lphase++) - { - - /*** detect aligned points by blocs ***/ - inbloc = nblocs = cur = l = count[0] = 0; - xx = ox + pos * mx + (int) (dx * (double) (l * 2 + lphase)); - yy = oy + pos * my + (int) (dy * (double) (l * 2 + lphase)); - - for (; xx >= 0 && xx < nx && yy >= 0 && yy < ny; ) - { - indexAngle[0] = xx; - indexAngle[1] = yy; - // indice = yy*nx+xx - assert(indexAngle[0] < nx); - assert(indexAngle[1] < ny); - assert(indexAngle[0] >= 0); - assert(indexAngle[1] >= 0); - - error = static_cast<double>(m_AngleImage->GetPixel(indexAngle)); - if (error > -100.0) - { - error -= theta; - while (error <= -CONST_PI) - error += CONST_2PI; - while (error > CONST_PI) - error -= CONST_2PI; - if (error < 0.0) error = -error; - if (error < prec) - { - ++cur; - if (!inbloc) - { - startbloc[nblocs] = l; - inbloc = 1; - } - } - else - { - if (inbloc) - { - endbloc[nblocs] = l - 1; - ++nblocs; - count[nblocs] = cur; - } - inbloc = 0; - } - } - /* compute next point */ - ++l; - xx = ox + pos * mx + (int) (dx * (double) (l * 2 + lphase)); - yy = oy + pos * my + (int) (dy * (double) (l * 2 + lphase)); - } - - /*** detect meaningful segments ***/ - for (i = 0; i < nblocs; ++i) - for (j = i; j < nblocs; ++j) - if ((nfa = test[count[j + 1] - count[i] - + (n + 1) * (1 + endbloc[j] - startbloc[i])]) < max_nfa) - { - seg[iseg].start = startbloc[i] * 2 + lphase; - seg[iseg].end = endbloc[j] * 2 + lphase; - seg[iseg].nfa = nfa; - seg[iseg].ok = 1; - iseg++; - /* reallocate if necessary */ - if (iseg == size_seg) - { - size_seg = (size_seg * 3) / 2; - seg.resize(size_seg); -// if (!seg) -// mwerror(FATAL, 1,"Not enough memory."); - } - } - } - /*** end of phase loop ***/ - - /*** remove non-maximal segments ***/ - if (!m_isMeaningfulSegment) - for (i = 0; i < iseg; ++i) - for (j = 0; j < iseg; ++j) - if (i != j) - - /* seg[i] is included in seg[j] ? */ - if (seg[i].start >= seg[j].start && seg[i].end <= seg[j].end) - { - - /* remove the less meaningful of seg[i] and seg[j] */ - if (seg[i].nfa < seg[j].nfa) seg[j].ok = 0; - else seg[i].ok = 0; - - } - - /*** store detected segments ***/ - for (i = 0; i < iseg; ++i) - if (seg[i].ok) - { - seglist[iseglist * 5] = (double) (ox + pos * mx) + dx * (double) (seg[i].start); - seglist[iseglist * 5 + 1] = (double) (oy + pos * my) + dy * (double) (seg[i].start); - seglist[iseglist * 5 + 2] = (double) (ox + pos * mx) + dx * (double) (seg[i].end); - seglist[iseglist * 5 + 3] = (double) (oy + pos * my) + dy * (double) (seg[i].end); - seglist[iseglist * 5 + 4] = -(double) log10(seg[i].nfa); - iseglist++; - /* reallocate seglist if necessary */ - if (iseglist == size_seglist) - { - size_seglist = (size_seglist * 3) / 2; - seglist.resize(size_seglist); -// if (!seglist) -// mwerror(FATAL, 1,"Not enough memory."); - } - } - } - } - /*** end of second loop ***/ - - printf(" nb de segments: %d\n", iseglist); - } - /******************** end of first loop ********************/ - - seg.clear(); - endbloc.clear(); - startbloc.clear(); - count.clear(); - test.clear(); - - /* build segments list */ - seglist.resize(5 * iseglist); - - /* build segments list */ - OutputPath->Clear(); -// OutputPath->Resize(iseglist); - - typedef typename OutputPathType::ContinuousIndexType ContinuousIndexType; - typename InputImageType::PointType point; - - ContinuousIndexType cindex; - for (i = 0; i < iseglist; ++i) - { - - OutputPathPointerType path = OutputPathType::New(); - - path->Initialize(); - point[0] = seglist[i * 5]; - point[1] = seglist[i * 5 + 1]; - InputImage->TransformPhysicalPointToContinuousIndex(point, cindex); - path->AddVertex(cindex); - cindex[0] = seglist[i * 5 + 2]; - cindex[1] = seglist[i * 5 + 3]; - path->AddVertex(cindex); - - OutputPath->PushBack(path); - } - itkDebugMacro(<< "ImageToPathListAlignFilter::GenerateData() finished"); - -} // end update function - -template <class TInputImage, class TOutputPath> -void -ImageToPathListAlignFilter<TInputImage, TOutputPath> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -// os << indent << "Size : " << m_Size << std::endl; -// os << indent << "Path Value : " << m_PathValue << std::endl; -// os << indent << "Background Value : " << m_BackgroundValue << std::endl; -} - -} // end namespace otb - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h deleted file mode 100644 index 26b8f1c84b..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbLikelihoodPathListFilter_h -#define otbLikelihoodPathListFilter_h - -#include "otbPathListToPathListFilter.h" -#include "otbMacro.h" -#include <string> - -namespace otb -{ -/** \class LikelihoodPathListFilter - * \brief Affect a value to each path of the list based on the image - * - * PathList and image are given as an input, the filter affect a value to each - * path: this value is equal to the sum of the pixels crossed by the path - * (using a PolyLineImageConstIterator) divided by the number of points in the - * path - * - * - * \ingroup OTBRoadExtraction - */ -template <class TPath, class TImage> -class ITK_EXPORT LikelihoodPathListFilter - : public PathListToPathListFilter<TPath> -{ -public: - /** Standard typedefs */ - typedef LikelihoodPathListFilter Self; - typedef PathListToPathListFilter<TPath> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Type macro */ - itkNewMacro(Self); - - /** Creation through object factory macro */ - itkTypeMacro(LikelihoodPathListFilter, PathListToPathListFilter); - - /** Template parameters typedefs */ - typedef typename Superclass::PathType PathType; - typedef typename Superclass::PathListType PathListType; - typedef typename Superclass::PathPointerType PathPointerType; - typedef typename PathListType::Pointer PathListPointerType; - typedef typename PathListType::ConstIterator IteratorType; - typedef typename PathType::VertexType VertexType; - typedef typename PathType::VertexListType VertexListType; - typedef typename VertexListType::ConstIterator VertexIteratorType; - typedef double RealType; - - typedef TImage ImageType; - typedef typename ImageType::Pointer ImagePointerType; - typedef typename ImageType::ConstPointer ImageConstPointerType; - - /** - * Set the input Likelihood image. - * \param image The Likelihood image. - */ - void SetInputImage(const ImageType * image); - - /** - * Get the input Likelihood image. - * \return The input Likelihood image. - */ - const ImageType * GetInputImage(void); - -protected: - /** Constructor */ - LikelihoodPathListFilter(); - /** Destructor */ - ~LikelihoodPathListFilter() override {} - /** GenerateData method */ - void GenerateData() override; - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - -private: - LikelihoodPathListFilter(const Self &) = delete; - void operator =(const Self&) = delete; - - std::string m_Key; -}; -} // End namespace otb -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbLikelihoodPathListFilter.hxx" -#endif - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.hxx b/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.hxx deleted file mode 100644 index f1bcde145d..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbLikelihoodPathListFilter.hxx +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbLikelihoodPathListFilter_hxx -#define otbLikelihoodPathListFilter_hxx - -#include "otbLikelihoodPathListFilter.h" -#include "otbPolyLineImageConstIterator.h" -#include "itkMetaDataObject.h" - -namespace otb -{ -/** - * Constructor - */ -template <class TPath, class TImage> -LikelihoodPathListFilter<TPath, TImage> -::LikelihoodPathListFilter() -{ - m_Key = "Value"; - this->SetNumberOfRequiredInputs(2); - this->SetNumberOfRequiredInputs(2); -} -template <class TPath, class TImage> -void -LikelihoodPathListFilter<TPath, TImage> -::SetInputImage(const ImageType * image) -{ - this->itk::ProcessObject::SetNthInput(1, const_cast<ImageType *>(image)); -} -template <class TPath, class TImage> -const typename LikelihoodPathListFilter<TPath, TImage> -::ImageType * -LikelihoodPathListFilter<TPath, TImage> -::GetInputImage(void) -{ - if (this->GetNumberOfInputs() < 1) - { - return nullptr; - } - return static_cast<const ImageType *>(this->itk::ProcessObject::GetInput(1)); -} - -template <class TPath, class TImage> -void -LikelihoodPathListFilter<TPath, TImage> -::GenerateData() -{ - // I/O wiring - ImageConstPointerType inputImagePtr = this->GetInputImage(); - const PathListType * inputPtr = this->GetInput(); - PathListType * outputPtr = this->GetOutput(); - - typedef otb::PolyLineImageConstIterator<ImageType, PathType> ImageIteratorType; - - for (IteratorType it = inputPtr->Begin(); it != inputPtr->End(); ++it) - { - PathPointerType path = it.Get(); - ImageIteratorType imageIt(inputImagePtr, path); - double cumulatedValues = 0.0; - double nbPoints = 0.0; - for (imageIt.GoToBegin(); !imageIt.IsAtEnd(); ++imageIt, ++nbPoints) - { - cumulatedValues += static_cast<double>(imageIt.Get()); - } - itk::MetaDataDictionary& dict = path->GetMetaDataDictionary(); - itk::EncapsulateMetaData<double>(dict, m_Key, cumulatedValues / nbPoints); - outputPtr->PushBack(path); - } -} -/** - * PrintSelf Method - */ -template <class TPath, class TImage> -void -LikelihoodPathListFilter<TPath, TImage> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - -} // End namespace otb -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h deleted file mode 100644 index 6fb1aef06f..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbLinkPathListFilter_h -#define otbLinkPathListFilter_h - -#include "otbPathListToPathListFilter.h" -#include "otbMacro.h" - -namespace otb -{ -/** \class LinkPathListFilter - * \brief This filters link path from the input path list according to distance and angular criterions. - * - * This filter examines both ends of each path to link and is able to link several path into one single path. - * The two criterions to link a path are : - * - The two ends to link must be closer than the user defined threshold in terms of euclidean distance, - * - The angle at the link must not be sharp (less than the user defined threshold). - * - * Please note that this filter may invert the order of the vertices in the newly created path. - * - * This filter is part of the road extraction framework. - * - * \sa ParallelLinePathListFilter - * - * \ingroup PathFilters - * - * - * \ingroup OTBRoadExtraction - */ -template <class TPath> -class ITK_EXPORT LinkPathListFilter - : public PathListToPathListFilter<TPath> -{ -public: - /** Standard typedefs */ - typedef LinkPathListFilter Self; - typedef PathListToPathListFilter<TPath> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Type macro */ - itkNewMacro(Self); - - /** Creation through object factory macro */ - itkTypeMacro(LinkPathListFilter, PathListToPathListFilter); - - /** Template parameters typedefs */ - typedef typename Superclass::PathType PathType; - typedef typename Superclass::PathListType PathListType; - typedef typename Superclass::PathPointerType PathPointerType; - typedef typename PathListType::Pointer PathListPointerType; - typedef typename PathListType::ConstIterator IteratorType; - typedef typename PathType::VertexType VertexType; - typedef typename PathType::VertexListType VertexListType; - typedef typename VertexListType::ConstIterator VertexIteratorType; - typedef double RealType; - - itkSetMacro(AngularThreshold, RealType); - itkGetMacro(AngularThreshold, RealType); - itkSetMacro(DistanceThreshold, RealType); - itkGetMacro(DistanceThreshold, RealType); - itkSetMacro(ModuloPI, bool); - itkGetMacro(ModuloPI, bool); - -protected: - /** Constructor */ - LinkPathListFilter(); - /** Destructor */ - ~LinkPathListFilter() override {} - /** GenerateData method */ - void GenerateData() override; - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - - /** - * Verify the angular condition to link a path. - * \param v1 First vertex (before first path ending), - * \param v2 second vertex (first path ending), - * \param v3 third vertex (second path beginning), - * \param v4 fourth vertex (second path after beginning), - * \return True or false whether the condition is verified or not. - **/ - bool VerifyAngularCondition(VertexType v1, VertexType v2, VertexType v3, VertexType v4); - - /** - * Actually link the end of path p1 to the beginning of path p2. - * \param p1 First path to link, - * \param revert1 whether p1 need to be reverted or not, - * \param p2 second path to link, - * \param revert2 whether p2 need to be reverted or not, - * \return the linked path. - */ - PathPointerType LinkPath(PathPointerType p1, bool revert1, PathPointerType p2, bool revert2); - -private: - LinkPathListFilter(const Self &) = delete; - void operator =(const Self&) = delete; - - RealType m_AngularThreshold; - RealType m_DistanceThreshold; - - /// Do not use the sign of the orientation of the lines - bool m_ModuloPI; - -}; -} // End namespace otb -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbLinkPathListFilter.hxx" -#endif - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.hxx b/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.hxx deleted file mode 100644 index 7b25703382..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbLinkPathListFilter.hxx +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbLinkPathListFilter_hxx -#define otbLinkPathListFilter_hxx - -#include "otbLinkPathListFilter.h" -#include "otbMath.h" - -namespace otb -{ -/** - * Constructor - */ -template <class TPath> -LinkPathListFilter<TPath> -::LinkPathListFilter() -{ - m_DistanceThreshold = 10.; - m_AngularThreshold = 3.14; - m_ModuloPI = false; -} - -template <class TPath> -void -LinkPathListFilter<TPath> -::GenerateData() -{ - // IO - const PathListType * inputPtr = this->GetInput(); - PathListType * outputPtr = this->GetOutput(); - - // Input iterator - IteratorType inputIt = inputPtr->Begin(); - - std::vector<bool> eraseFlagVector; - - // First we copy all input path to output - while (inputIt != inputPtr->End()) - { - outputPtr->PushBack(inputIt.Get()); - eraseFlagVector.push_back(false); - ++inputIt; - } - - IteratorType outputIt1 = outputPtr->Begin(); - unsigned int index1 = 0; - - while (outputIt1 != outputPtr->End()) - { - if (!eraseFlagVector[index1]) - { - IteratorType outputIt2 = outputIt1; - ++outputIt2; - // indicate if a path was found and wath is its index - unsigned int pathToLinkIndex = 0; - double distance = -1.0; - unsigned int index2 = index1 + 1; - bool found = false; - bool revert1 = false; - bool revert2 = false; - if (!eraseFlagVector[index1]) - { - while (outputIt2 != outputPtr->End()) - { - if (!eraseFlagVector[index2]) - { - //otbMsgDevMacro(<<"Examining links between path "<<index1<<" and path "<<index2); - // Examining end of path1 with beginning of path2 - VertexIteratorType vSourceIt = outputIt1.Get()->GetVertexList()->End(); - VertexIteratorType vTargetIt = outputIt2.Get()->GetVertexList()->Begin(); - --vSourceIt; - VertexType v2 = vSourceIt.Value(); - --vSourceIt; - VertexType v1 = vSourceIt.Value(); - VertexType v3 = vTargetIt.Value(); - ++vTargetIt; - VertexType v4 = vTargetIt.Value(); - double tmpDistance = std::sqrt(std::pow(v2[0] - v3[0], 2) + std::pow(v2[1] - v3[1], 2)); - if ((tmpDistance < static_cast<double>(m_DistanceThreshold)) && ((!found) || (tmpDistance < distance))) - { - if (VerifyAngularCondition(v1, v2, v3, v4)) - { - // we found a better candidate - //otbMsgDevMacro(<<"Link between end of path "<<index1<<" and beginning of path "<<index2<<" is currently the best choice"); - distance = tmpDistance; - pathToLinkIndex = index2; - revert1 = false; - revert2 = false; - if (!found) - { - found = true; - } - } - } - // Examining end of path1 with end of path2 - vTargetIt = outputIt2.Get()->GetVertexList()->End(); - --vTargetIt; - v3 = vTargetIt.Value(); - --vTargetIt; - v4 = vTargetIt.Value(); - tmpDistance = std::sqrt(std::pow(v2[0] - v3[0], 2) + std::pow(v2[1] - v3[1], 2)); - - if ((tmpDistance < static_cast<double>(m_DistanceThreshold)) && ((!found) || (tmpDistance < distance))) - { - if (VerifyAngularCondition(v1, v2, v3, v4)) - { - // we found a better candidate - //otbMsgDevMacro(<<"Link between end of path "<<index1<<" and end of path "<<index2<<" is currently the best choice"); - distance = tmpDistance; - pathToLinkIndex = index2; - revert1 = false; - revert2 = true; - if (!found) - { - found = true; - } - } - } - // Examining beginning of path1 with end of path2 - vSourceIt = outputIt1.Get()->GetVertexList()->Begin(); - v2 = vSourceIt.Value(); - ++vSourceIt; - v1 = vSourceIt.Value(); - tmpDistance = std::sqrt(std::pow(v2[0] - v3[0], 2) + std::pow(v2[1] - v3[1], 2)); - - if ((tmpDistance < static_cast<double>(m_DistanceThreshold)) && ((!found) || (tmpDistance < distance))) - { - if (VerifyAngularCondition(v1, v2, v3, v4)) - { - // we found a better candidate - //otbMsgDevMacro(<<"Link between beginning of path "<<index1<<" and end of path "<<index2<<" is currently the best choice"); - distance = tmpDistance; - pathToLinkIndex = index2; - revert1 = true; - revert2 = true; - if (!found) - { - found = true; - } - } - } - // Examining beginning of path1 with beginning of path2 - vTargetIt = outputIt2.Get()->GetVertexList()->Begin(); - v3 = vTargetIt.Value(); - ++vTargetIt; - v4 = vTargetIt.Value(); - tmpDistance = std::sqrt(std::pow(v2[0] - v3[0], 2) + std::pow(v2[1] - v3[1], 2)); - if ((tmpDistance < static_cast<double>(m_DistanceThreshold)) && ((!found) || (tmpDistance < distance))) - { - if (VerifyAngularCondition(v1, v2, v3, v4)) - { - // we found a better candidate - //otbMsgDevMacro(<<"Link between beginning of path "<<index1<<" and beginning of path "<<index2<<" is currently the best choice"); - distance = tmpDistance; - pathToLinkIndex = index2; - revert1 = true; - revert2 = false; - if (!found) - { - found = true; - } - } - } - } - ++index2; - ++outputIt2; - } - if (found) - { - //otbMsgDevMacro(<<"Search ended, merging path "<<index1<<" and path "<<pathToLinkIndex); - // an appropriate path was found - outputIt2 = outputPtr->Begin() + pathToLinkIndex; - PathPointerType newPath = this->LinkPath(outputIt1.Get(), revert1, outputIt2.Get(), revert2); - outputPtr->PushBack(newPath); - // add a non erased flag for the new path - eraseFlagVector.push_back(false); - // mark the old path as erased - eraseFlagVector[index1] = true; - eraseFlagVector[pathToLinkIndex] = true; - } - } - } - ++index1; - // This replaces ++outputIt1 because the iterators is somehow invalidated by a pushback. - outputIt1 = outputPtr->Begin() + index1; - } - - // search ended, now removing the erased path - typename std::vector<bool>::reverse_iterator it = eraseFlagVector.rbegin(); - index1 = eraseFlagVector.size() - 1; - while (it != eraseFlagVector.rend()) - { - if (eraseFlagVector[index1]) - { - outputPtr->Erase(index1); - } - --index1; - ++it; - } -} -/** - * Verify the angular condition to link a path. - * \param v1 First vertex (before first path ending), - * \param v2 second vertex (first path ending), - * \param v3 third vertex (second path beginning), - * \param v4 fourth vertex (second path after beginning), - * \return True or false whether the condition is verified or not. - **/ -template <class TPath> -bool -LinkPathListFilter<TPath> -::VerifyAngularCondition(VertexType v1, VertexType v2, VertexType v3, VertexType v4) -{ - double alpha1 = std::atan2((v2[1] - v1[1]), (v2[0] - v1[0])); - double alpha2 = std::atan2((v4[1] - v3[1]), (v4[0] - v3[0])); - double alpha3 = std::atan2((v3[1] - v2[1]), (v3[0] - v2[0])); - - if (m_ModuloPI) - { - alpha1 = (alpha1 >= 0) ? alpha1 : (alpha1 + CONST_PI); - alpha2 = (alpha2 >= 0) ? alpha2 : (alpha2 + CONST_PI); - alpha3 = (alpha3 >= 0) ? alpha3 : (alpha3 + CONST_PI); - } - else - { - alpha1 = (alpha1 >= 0) ? alpha1 : (alpha1 + CONST_2PI); - alpha2 = (alpha2 >= 0) ? alpha2 : (alpha2 + CONST_2PI); - alpha3 = (alpha3 >= 0) ? alpha3 : (alpha3 + CONST_2PI); - } - - bool resp = (std::abs(alpha1 - alpha2) < static_cast<double>(m_AngularThreshold)) - && (std::abs(alpha1 - alpha3) < static_cast<double>(m_AngularThreshold)) - && (std::abs(alpha2 - alpha3) < static_cast<double>(m_AngularThreshold)); - return resp; -} -/** - * Actually link the end of path p1 to the beginning of path p2. - * \param p1 First path to link, - * \param revert1 whether p1 need to be reverted or not, - * \param p2 second path to link, - * \param revert2 whether p2 need to be reverted or not, - * \return the linked path. - */ -template <class TPath> -typename LinkPathListFilter<TPath> -::PathPointerType -LinkPathListFilter<TPath> -::LinkPath(PathPointerType p1, bool revert1, PathPointerType p2, bool revert2) -{ - PathPointerType resp = PathType::New(); - - VertexIteratorType it; - - if (revert1) - { - for (it = (p1->GetVertexList()->End()); it != p1->GetVertexList()->Begin(); ) - { - --it; - resp->AddVertex((it).Value()); - } - } - else - { - for (it = p1->GetVertexList()->Begin(); it != p1->GetVertexList()->End(); ++it) - { - resp->AddVertex((it).Value()); - } - } - - if (revert2) - { - for (it = (p2->GetVertexList()->End()); it != p2->GetVertexList()->Begin(); ) - { - --it; - resp->AddVertex((it).Value()); - } - } - else - { - for (it = p2->GetVertexList()->Begin(); it != p2->GetVertexList()->End(); ++it) - { - resp->AddVertex(it.Value()); - } - } - return resp; -} -/** - * PrintSelf Method - */ -template <class TPath> -void -LinkPathListFilter<TPath> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - -} // End namespace otb -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h b/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h deleted file mode 100644 index 9406349db1..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbModulusAndDirectionImageToImageFilter_h -#define otbModulusAndDirectionImageToImageFilter_h - -#include "itkImageToImageFilter.h" - -namespace otb -{ - -/** \class ModulusAndDirectionImageToImageFilter - * - * \brief Base class for modulus and direction image filters. - * - * This is the base class for alls class' generate an image dulus and - * by using an modulus and a direction images intputs. - * SetInput() method set the modulus image input and - * SetInputDirection() set the image direction input. - * - * - * \ingroup OTBRoadExtraction - */ -template <class TInputImage, - class TInputImageDirection, - class TOutputImage> -class ITK_EXPORT ModulusAndDirectionImageToImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage> -{ -public: - /** Extract dimensions as well of the images of entry of exit. */ - itkStaticConstMacro(InputImageDimension, - unsigned int, - TInputImage::ImageDimension); - itkStaticConstMacro(OutputImageDimension, - unsigned int, - TOutputImage::ImageDimension); - - /** typedef for the classes standards. */ - typedef ModulusAndDirectionImageToImageFilter Self; - typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for management of the object factory. */ - itkNewMacro(Self); - - /** Return the name of the class. */ - itkTypeMacro(ModulusAndDirectionImageToImageFilter, itk::ImageToImageFilter); - - typedef typename Superclass::InputImageType InputImageType; - typedef TInputImageDirection InputImageDirectionType; - typedef typename Superclass::OutputImageType OutputImageType; - - /** Set/Get the image input of this process object. */ - using Superclass::SetInput; - void SetInput(const InputImageType *input) override; - virtual void SetInputDirection(const InputImageDirectionType *direction); - const InputImageType * GetInput(void); - const InputImageDirectionType * GetInputDirection(void); - -protected: - ModulusAndDirectionImageToImageFilter(); - ~ModulusAndDirectionImageToImageFilter() override {} - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - -private: - ModulusAndDirectionImageToImageFilter(const Self &) = delete; - void operator =(const Self&) = delete; - -}; -} // end namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbModulusAndDirectionImageToImageFilter.hxx" -#endif - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.hxx b/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.hxx deleted file mode 100644 index 159b2b95d7..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbModulusAndDirectionImageToImageFilter.hxx +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbModulusAndDirectionImageToImageFilter_hxx -#define otbModulusAndDirectionImageToImageFilter_hxx - -#include "otbModulusAndDirectionImageToImageFilter.h" -#include "itkProcessObject.h" - -namespace otb -{ - -/** - * - */ -template <class TInputImage, class TOutputImage, class TOutputImageDirection> -ModulusAndDirectionImageToImageFilter<TInputImage, TOutputImage, TOutputImageDirection>:: -ModulusAndDirectionImageToImageFilter() -{ - this->SetNumberOfRequiredInputs(2); - this->SetNumberOfRequiredInputs(2); - this->SetNumberOfRequiredOutputs(1); - this->SetNumberOfRequiredOutputs(1); - - this->SetNthOutput(0, OutputImageType::New()); -} - -template <class TInputImage, class TInputImageDirection, class TOutputImage> -void -ModulusAndDirectionImageToImageFilter<TInputImage, TInputImageDirection, TOutputImage>:: -SetInput(const InputImageType *input) -{ - // Process object is not const-correct so the const_cast is required here - this->itk::ProcessObject::SetNthInput(0, - const_cast<InputImageType *>(input)); -} - -template <class TInputImage, class TInputImageDirection, class TOutputImage> -void -ModulusAndDirectionImageToImageFilter<TInputImage, TInputImageDirection, TOutputImage>:: -SetInputDirection(const InputImageDirectionType *direction) -{ - // Process object is not const-correct so the const_cast is required here - this->itk::ProcessObject::SetNthInput(1, - const_cast<InputImageDirectionType *>(direction)); -} - -/** Return the input image modulus */ -template <class TInputImage, class TInputImageDirection, class TOutputImage> -const typename ModulusAndDirectionImageToImageFilter<TInputImage, TInputImageDirection, TOutputImage>::InputImageType * -ModulusAndDirectionImageToImageFilter<TInputImage, TInputImageDirection, TOutputImage>:: -GetInput(void) -{ - if (this->GetNumberOfInputs() < 1) - { - return nullptr; - } - - return static_cast<const TInputImage *> - (this->itk::ProcessObject::GetInput(0)); -} - -/** Return the intput image direction */ -template <class TInputImage, class TInputImageDirection, class TOutputImage> -const typename ModulusAndDirectionImageToImageFilter<TInputImage, TInputImageDirection, - TOutputImage>::InputImageDirectionType * -ModulusAndDirectionImageToImageFilter<TInputImage, TInputImageDirection, TOutputImage>:: -GetInputDirection(void) -{ - if (this->GetNumberOfInputs() < 2) - { - return nullptr; - } - - return static_cast<const TInputImageDirection *> - (this->itk::ProcessObject::GetInput(1)); - -} - -/** - * Standard "PrintSelf" method - */ -template <class TInputImage, class TInputImageDirection, class TOutputImage> -void -ModulusAndDirectionImageToImageFilter<TInputImage, TInputImageDirection, TOutputImage>:: -PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); - -} - -} // end namespace otb - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h b/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h deleted file mode 100644 index b5f2ccb57d..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbNeighborhoodScalarProductFilter_h -#define otbNeighborhoodScalarProductFilter_h - -#include "otbImageToModulusAndDirectionImageFilter.h" - -namespace otb -{ -/** \class NeighborhoodScalarProductFilter - * \brief This filter is designed to be part of a pipeline aiming at linear feature extraction, such as roads. - * - * This filter takes as input a two-band image resulting from a gradient operator. The first channel contains - * the gradient value in the first image direction, the second contains the gradient value in the second image direction. - * - * Assuming that the linear feature we want to detect is darker than its surrounding environnement, we can deduce that - * the gradient direction will be opposite on each side of the road. Therefore, we compute for each pixel to compute the scalar - * product of the gradient vector for each opposite pixels in the neighborhood of radius 1 of the pixel to compute. - * - * The lower negativ scalar product value along these four pairs of pixel gives us the direction in which there is most - * likely a linear feature. - * - * This filters has two outputs : - * - The first output (from the GetOutput() method) gives the modulus of the lower negativ scalar product value for this pixel. - * - The second output (from the GetOutputDirection() method) gives the direction in radian of this linear feature. - * - * Please note that there are only 8 possible values for the direction image, corresponding to two directions for each pair of opposite - * pixels. In our conventions, negatives angle values represent opposite gradient vectors, whereas positive angle values represent convergent - * gradient vectors. - * \ingroup Streamed - * \ingroup Threaded - * - * \ingroup OTBRoadExtraction - */ -template <class TInputImage, class TOutputModulus, class TOutputDirection> -class ITK_EXPORT NeighborhoodScalarProductFilter - : public ImageToModulusAndDirectionImageFilter<TInputImage, TOutputModulus, TOutputDirection> -{ -public: - /** Standard typedefs */ - typedef NeighborhoodScalarProductFilter Self; - typedef ImageToModulusAndDirectionImageFilter<TInputImage, TOutputModulus, TOutputDirection> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Type macro */ - itkNewMacro(Self); - - /** Creation through object factory macro */ - itkTypeMacro(NeighborhoodScalarProductFilter, ImageToModulusAndDirectionImageFilter); - - /** Template parameters typedefs */ - typedef TInputImage InputImageType; - typedef typename InputImageType::ConstPointer InputImageConstPointerType; - typedef typename InputImageType::PixelType InputPixelType; - typedef TOutputModulus OutputModulusType; - typedef typename OutputModulusType::Pointer OutputModulusPointerType; - typedef typename OutputModulusType::RegionType RegionType; - typedef typename OutputModulusType::SizeType SizeType; - typedef typename OutputModulusType::IndexType IndexType; - typedef TOutputDirection OutputDirectionType; - typedef typename OutputDirectionType::Pointer OutputDirectionPointerType; - typedef typename OutputDirectionType::RegionType OutputImageRegionType; - -protected: - /** Constructor */ - NeighborhoodScalarProductFilter(); - /** Destructor */ - ~NeighborhoodScalarProductFilter() override {} - /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - /** NeighborhoodScalarProductImageFilter can be implemented as a multithreaded filter. - * Therefore, this implementation provides a ThreadedGenerateData() routine - * which is called for each processing thread. The output image data is - * allocated automatically by the superclass prior to calling - * ThreadedGenerateData(). ThreadedGenerateData can only write to the - * portion of the output image specified by the parameter - * "outputRegionForThread" - * - * \sa ImageToImageFilter::ThreadedGenerateData(), - * ImageToImageFilter::GenerateData() */ - void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) override; -private: - NeighborhoodScalarProductFilter(const Self &) = delete; - void operator =(const Self&) = delete; -}; -} // End namespace otb -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbNeighborhoodScalarProductFilter.hxx" -#endif - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.hxx b/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.hxx deleted file mode 100644 index a2f66c9a02..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbNeighborhoodScalarProductFilter.hxx +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbNeighborhoodScalarProductFilter_hxx -#define otbNeighborhoodScalarProductFilter_hxx - -#include "otbNeighborhoodScalarProductFilter.h" -#include "itkImageRegionIterator.h" -#include "itkConstNeighborhoodIterator.h" -#include "itkNeighborhoodAlgorithm.h" -#include "itkProgressReporter.h" - -#include "otbMath.h" - -namespace otb -{ -/** - * Constructor - */ -template <class TInputImage, class TOutputModulus, class TOutputDirection> -NeighborhoodScalarProductFilter<TInputImage, TOutputModulus, TOutputDirection> -::NeighborhoodScalarProductFilter() -{} - -template <class TInputImage, class TOutputModulus, class TOutputDirection> -void -NeighborhoodScalarProductFilter<TInputImage, TOutputModulus, TOutputDirection> -::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) -{ - // some typedefs - typedef itk::ConstNeighborhoodIterator<InputImageType> NeighborhoodIteratorType; - typedef typename NeighborhoodIteratorType::RadiusType RadiusType; - typedef typename NeighborhoodIteratorType::OffsetType OffsetType; - typedef itk::ImageRegionIterator<OutputModulusType> OutputIteratorType; - typedef itk::ImageRegionIterator<OutputDirectionType> OutputDirectionIteratorType; - typedef itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImageType> BoundaryFacesCalculatorType; - typedef typename BoundaryFacesCalculatorType::FaceListType FaceListType; - typedef typename FaceListType::iterator FaceListIteratorType; - - // Pointers on inputs/outputs - InputImageType * inputPtr = const_cast<InputImageType *>(this->GetInput()); - OutputModulusPointerType outputPtr = this->GetOutput(); - OutputDirectionPointerType outputDirPtr = this->GetOutputDirection(); - - // Neighborhood radius - RadiusType r; - r.Fill(1); - - // Find the data-set boundary "faces" - BoundaryFacesCalculatorType bC; - FaceListType faceList = bC(inputPtr, outputRegionForThread, r); - FaceListIteratorType fit; - - // support progress methods/callbacks - itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); - - // Process each of the boundary faces. These are N-d regions which border - // the edge of the buffer. - for (fit = faceList.begin(); fit != faceList.end(); ++fit) - { - NeighborhoodIteratorType neighInputIt(r, inputPtr, *fit); - OutputIteratorType outputIt(outputPtr, *fit); - OutputDirectionIteratorType outputDirIt(outputDirPtr, *fit); - neighInputIt.GoToBegin(); - outputIt.GoToBegin(); - outputDirIt.GoToBegin(); - - while ((!neighInputIt.IsAtEnd()) && (!outputIt.IsAtEnd()) && (!outputDirIt.IsAtEnd())) - { - // local variable initialization - int neighborhoodNumberMax = 0; - double scalarMaxValue = 0; - //TODO for a more general algorithm this might be replaced by: - //double scalarMaxValue = itk::NumericTraits<double>::NonpositiveMin(); - int flagPosNegDirection = 0; - - // walk through each case - for (int neighborhoodNumber = 0; neighborhoodNumber < 4; ++neighborhoodNumber) - { - double scalarCurrentValue = 0.0; - OffsetType offset1; - OffsetType offset2; - switch (neighborhoodNumber) - { - case 0: - offset1[0] = 1; - offset1[1] = -1; - offset2[0] = -1; - offset2[1] = 1; - break; - case 1: - offset1[0] = 1; - offset1[1] = 0; - offset2[0] = -1; - offset2[1] = 0; - break; - case 2: - offset1[0] = 1; - offset1[1] = 1; - offset2[0] = -1; - offset2[1] = -1; - break; - case 3: - offset1[0] = 0; - offset1[1] = 1; - offset2[0] = 0; - offset2[1] = -1; - break; - } - // Get the gradient values - InputPixelType pixel1 = neighInputIt.GetPixel(offset1); - InputPixelType pixel2 = neighInputIt.GetPixel(offset2); - - // Compute the scalar product - scalarCurrentValue = -(pixel1[0] * pixel2[0] + pixel1[1] * pixel2[1]); - - // If the value is higher than the current max value - if (scalarCurrentValue > scalarMaxValue) - { - // keep this configuration - scalarMaxValue = scalarCurrentValue; - neighborhoodNumberMax = neighborhoodNumber; - - // Also keep the direction - if (pixel1[0] < 0) - { - flagPosNegDirection = 1; - } - else - { - flagPosNegDirection = 0; - } - - } - } - // Compute the direction - double angle = static_cast<double>((1 + neighborhoodNumberMax)) * static_cast<double>(CONST_PI_4); - if (flagPosNegDirection) - { - angle -= CONST_PI; - } - - // Set the output values - outputIt.Set(scalarMaxValue); - outputDirIt.Set(angle); - ++neighInputIt; - ++outputIt; - ++outputDirIt; - progress.CompletedPixel(); - } - } -} -/** - * PrintSelf Method - */ -template <class TInputImage, class TOutputModulus, class TOutputDirection> -void -NeighborhoodScalarProductFilter<TInputImage, TOutputModulus, TOutputDirection> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} -} // End namespace otb -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h b/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h deleted file mode 100644 index 4e6d12cce2..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbNonMaxRemovalByDirectionFilter.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbNonMaxRemovalByDirectionFilter_h -#define otbNonMaxRemovalByDirectionFilter_h - -#include "otbModulusAndDirectionImageToImageFilter.h" -#include "otbBinaryFunctorNeighborhoodImageFilter.h" - -#include "otbMath.h" - -namespace otb -{ -namespace Functor -{ -/** \class NonMaxRemovalByDirectionFunctor - * \brief This functor is used by the NonMaxRemovalByDirectionFilter - * \sa NonMaxRemovalByDirectionFilter - * \ingroup Functor - * - * \ingroup OTBRoadExtraction - */ -template <class TInput1, class TInput2, class TOutput> -class NonMaxRemovalByDirectionFunctor -{ -public: - NonMaxRemovalByDirectionFunctor() {} - virtual ~NonMaxRemovalByDirectionFunctor() {} - inline TOutput operator ()(const TInput1& itA, const TInput2& itB) - { - TOutput resp = 0; - if (itA.GetCenterPixel() != 0) - { - typename TInput1::OffsetType offset1, offset2; - offset1.Fill(0); - offset2.Fill(0); - int neighborhoodNumber; - if (itB.GetCenterPixel() > 0) - { - neighborhoodNumber = static_cast<int>(itB.GetCenterPixel() / (CONST_PI_4) -1); - } - else - { - neighborhoodNumber = static_cast<int>((itB.GetCenterPixel() + CONST_PI) / (CONST_PI_4) -1); - } - switch (neighborhoodNumber) - { - case 0: - offset1[0] = 1; - offset1[1] = -1; - offset2[0] = -1; - offset2[1] = 1; - break; - case 1: - offset1[0] = 1; - offset1[1] = 0; - offset2[0] = -1; - offset2[1] = 0; - break; - case 2: - offset1[0] = 1; - offset1[1] = 1; - offset2[0] = -1; - offset2[1] = -1; - break; - case 3: - offset1[0] = 0; - offset1[1] = 1; - offset2[0] = 0; - offset2[1] = -1; - break; - } - if ((itA.GetCenterPixel() > itA.GetPixel(offset1)) - && (itA.GetCenterPixel() > itA.GetPixel(offset2))) - { - resp = itA.GetCenterPixel(); - } - } - return resp; - } -}; -} -/** \class NonMaxRemovalByDirectionFilter - * \brief This filters removes (sets to null intensity) pixels which are not the maxima of the - * scalar product modulus value in the given direction. - * - * \ingroup Streamed - * \ingroup Threaded - * - * \ingroup OTBRoadExtraction - */ -template <class TInputModulus, class TInputDirection, class TOutputImage> -class ITK_EXPORT NonMaxRemovalByDirectionFilter - : public ModulusAndDirectionImageToImageFilter<TInputModulus, TInputDirection, TOutputImage> -{ -public: - /** Standard typedefs */ - typedef NonMaxRemovalByDirectionFilter Self; - typedef ModulusAndDirectionImageToImageFilter<TInputModulus, TInputDirection, TOutputImage> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Type macro */ - itkNewMacro(Self); - - /** Creation through object factory macro */ - itkTypeMacro(NonMaxRemovalByDirectionFilter, ModulusAndDirectionImageToImageFilter); - - /** typedef of the computing filter (this allows us to derive from ModulusAndDirectionToImageFilter as well as - using the BinaryFunctorNeighBorhoodImageFilter, which is appropriate here */ - typedef Functor::NonMaxRemovalByDirectionFunctor< - typename itk::ConstNeighborhoodIterator<TInputModulus>, - typename itk::ConstNeighborhoodIterator<TInputDirection>, - typename TOutputImage::PixelType> FunctorType; - typedef otb::BinaryFunctorNeighborhoodImageFilter<TInputModulus, TInputDirection, TOutputImage, - FunctorType> ComputingFilterType; - -protected: - /** Constructor */ - NonMaxRemovalByDirectionFilter() {}; - /** Destructor */ - ~NonMaxRemovalByDirectionFilter() override {} - /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override - { - Superclass::PrintSelf(os, indent); - } - /** Main computation method */ - void GenerateData(void) override - { - typename ComputingFilterType::Pointer filter = ComputingFilterType::New(); - filter->SetInput1(this->GetInput()); - filter->SetInput2(this->GetInputDirection()); - filter->GraftOutput(this->GetOutput()); - filter->Update(); - this->GraftOutput(filter->GetOutput()); - } - -private: - NonMaxRemovalByDirectionFilter(const Self &) = delete; - void operator =(const Self&) = delete; -}; -} // End namespace otb -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h b/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h deleted file mode 100644 index 3cabe035ad..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbParallelLinePathListFilter_h -#define otbParallelLinePathListFilter_h - -#include "otbPathListToPathListFilter.h" -#include "otbMacro.h" - -namespace otb -{ -/** \class ParallelLinePathListFilter - * \brief Detects parallel lines in imagery, the required input data are a PathList object. - * - * The class consists of three basic functions that determine the angle between two lines, - * the distance between the lines and the common part of the lines. First, all input lines - * are checked if there is a second line running in the same direction. Thereafter, all line - * pairs that already fulfilled the angular criterion are checked whether they are close to - * each other or not, i.e. the orthogonal distance between them is calculated. Finally, it - * has to be verified if the two lines have a common part since lines may fulfill the two - * first criteria but be located in different parts of the image. In order to adapt the - * detection algorithm to the user's needs, the thresholds AngularThreshold, DistanceThreshold - * and CommonDistanceThreshold can be set. - * - * A possible processing chain would be to extract lines with a line detector, to convert the - * result to PathList object (an ObjectList of PolyLineParametricPath), to link short line - * segments with the otbLinkPathListFilter to longer lines and to finally detect all parallel - * long lines. - * - * \sa LinkPathListFilter - * - * \ingroup PathFilters - * - * - * \ingroup OTBRoadExtraction - */ -template <class TPath> -class ITK_EXPORT ParallelLinePathListFilter - : public PathListToPathListFilter<TPath> -{ -public: - /** Standard typedefs */ - typedef ParallelLinePathListFilter Self; - typedef PathListToPathListFilter<TPath> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Type macro */ - itkNewMacro(Self); - - /** Creation through object factory macro */ - itkTypeMacro(ParallelLinePathListFilter, PathListToPathListFilter); - - /** Template parameters typedefs */ - typedef typename Superclass::PathType PathType; - typedef typename Superclass::PathListType PathListType; - typedef typename Superclass::PathPointerType PathPointerType; - typedef typename PathListType::Pointer PathListPointerType; - typedef typename PathListType::ConstIterator IteratorType; - typedef typename PathType::VertexType VertexType; - typedef typename PathType::VertexListType VertexListType; - typedef typename VertexListType::ConstIterator VertexIteratorType; - typedef double RealType; - - itkSetMacro(AngularThreshold, RealType); - itkGetMacro(AngularThreshold, RealType); - itkSetMacro(DistanceThreshold, RealType); - itkGetMacro(DistanceThreshold, RealType); - itkSetMacro(CommonDistanceThreshold, RealType); - itkGetMacro(CommonDistanceThreshold, RealType); - -protected: - /** Constructor */ - ParallelLinePathListFilter(); - /** Destructor */ - ~ParallelLinePathListFilter() override {} - /** GenerateData method */ - void GenerateData() override; - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - - /** - * Verify the angular condition to find parallel lines. - * This function verifies if two lines are parallel by - * computing the angle in relation to the y-axis. - * First line segment: v1 is the first vertex, v2 the second one - * (not necessarily the path ending). - * Second line segment: v3 is the first vertex, v4 the second one - * (not necessarily the path ending). - * Return true if the condition is verified. - * - * This is the first criteria to be fulfilled. - **/ - bool VerifyAngularCondition(VertexType v1, VertexType v2, VertexType v3, VertexType v4); - - /** - * Verify the maximum distance condition to find parallel lines. - * The orthogonal distance between two parallel lines is calculated. - * First line segment: v1 is the first vertex, v2 the second one - * (not necessarily the path ending). - * Second line segment: v3 is the first vertex, v4 the second one - * (not necessarily the path ending). - * Return true if the condition is verified. - * - * This is the second criteria to be fulfilled. - **/ - bool VerifyMaxDistanceCondition(VertexType v1, VertexType v2, VertexType v3, VertexType v4); - - /** - * Verify the common distance condition to find parallel lines. - * The overlapping part of the parallel lines is computed. In case - * no overlapping part exists or the value is below the specified - * threshold, false is returned. - * First line segment: v1 is the first vertex, v2 the second one - * (not necessarily the path ending). - * Second line segment: v3 is the first vertex, v4 the second one - * (not necessarily the path ending). - * Return true if the condition is verified. - * - * This is the third criteria to be fulfilled. - **/ - bool VerifyCommonDistanceCondition(VertexType v1, VertexType v2, VertexType v3, VertexType v4); - - /** - * Write the first parallel path. - * p1: First parallel path (line segment), - */ - PathPointerType WriteParallelPath(PathPointerType p1); - -private: - ParallelLinePathListFilter(const Self &) = delete; - void operator =(const Self&) = delete; - - RealType m_AngularThreshold; - RealType m_DistanceThreshold; - RealType m_CommonDistanceThreshold; - -}; -} // End namespace otb -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbParallelLinePathListFilter.hxx" -#endif - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.hxx b/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.hxx deleted file mode 100644 index 44eb3c082f..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbParallelLinePathListFilter.hxx +++ /dev/null @@ -1,536 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbParallelLinePathListFilter_hxx -#define otbParallelLinePathListFilter_hxx - -#include "otbParallelLinePathListFilter.h" -#include "otbMath.h" - -namespace otb -{ -/** - * Constructor - */ -template <class TPath> -ParallelLinePathListFilter<TPath> -::ParallelLinePathListFilter() -{ - m_DistanceThreshold = 100.; - m_CommonDistanceThreshold = 10.; - m_AngularThreshold = 3.14; -} - -template <class TPath> -void -ParallelLinePathListFilter<TPath> -::GenerateData() -{ - // IO - const PathListType * inputPtr = this->GetInput(); - PathListType * outputPtr = this->GetOutput(); - - // Input iterator - IteratorType inputIt = inputPtr->Begin(); - - std::vector<bool> eraseFlagVector1; - std::vector<unsigned int> parallelLineIndex; - - // First we copy all input path to output - while (inputIt != inputPtr->End()) - { - // Write the next input path always to the - // last element of the list. This last element is - // newly created. - outputPtr->PushBack(inputIt.Get()); - - // If a new element is copied to the output vector, - // "false" is written to the corresponding index of - // the vector eraseFlagVector. - eraseFlagVector1.push_back(false); - - ++inputIt; - } - - unsigned int VectorSize = static_cast<unsigned int>(eraseFlagVector1.size()); - //std::cout<<" Number of Lines: "<< VectorSize <<std::endl; - - IteratorType outputIt1 = outputPtr->Begin(); - unsigned int index1 = 0; - unsigned int firstLineCounter = 0, parallelLineCounter = 0; - unsigned int commonDistCounter = 0, maxDistCounter = 0; - -// Iterate through all lines of the pathlist - while (firstLineCounter < VectorSize) - { - if (!eraseFlagVector1[index1]) - { - IteratorType outputIt2 = outputIt1; - ++outputIt2; - unsigned int index2 = index1 + 1; - - // Check if any of the following lines are parallel - while (outputIt2 != outputPtr->End()) - { - - if (!eraseFlagVector1[index2]) - { // Read the first and the last vertex of each line pair that is checked - VertexIteratorType vSourceIt = outputIt1.Get()->GetVertexList()->Begin(); - VertexType v1 = vSourceIt.Value(); - vSourceIt = outputIt1.Get()->GetVertexList()->End(); - --vSourceIt; - VertexType v2 = vSourceIt.Value(); - - VertexIteratorType vTargetIt = outputIt2.Get()->GetVertexList()->Begin(); - VertexType v3 = vTargetIt.Value(); - vTargetIt = outputIt2.Get()->GetVertexList()->End(); - --vTargetIt; - VertexType v4 = vTargetIt.Value(); - - // Check for parallel lines - if (VerifyAngularCondition(v1, v2, v3, v4)) - { - ++parallelLineCounter; - if (VerifyMaxDistanceCondition(v1, v2, v3, v4)) - { - ++maxDistCounter; - if (VerifyCommonDistanceCondition(v1, v2, v3, v4)) - { - ++commonDistCounter; - // Write index of first parallel path - parallelLineIndex.push_back(index1); - - // Write index of second parallel path - parallelLineIndex.push_back(index2); - } - } - } - } - - ++index2; - ++outputIt2; - } - } - - // mark the old path as erased - eraseFlagVector1[index1] = true; - ++firstLineCounter; - ++index1; - ++outputIt1; - } // end of for loop - - otbMsgDevMacro( << "Number of line pairs that pass the angular condition: " << parallelLineCounter ); - otbMsgDevMacro( << "Number of line pairs that pass the maximum distance condition: " << maxDistCounter ); - otbMsgDevMacro( << "Number of line pairs that pass the common distance condition: " << commonDistCounter ); - - // Write all parallel lines and set the non-erase flagg. - typename std::vector<unsigned int>::iterator lineIt1 = parallelLineIndex.begin(); - unsigned int sortLineIndex = 0; - while (lineIt1 != parallelLineIndex.end()) - { - IteratorType outputIt3 = outputPtr->Begin() + parallelLineIndex[sortLineIndex]; - - PathPointerType newPath1 = this->WriteParallelPath(outputIt3.Get()); - outputPtr->PushBack(newPath1); - // add a non-erase flag for the new path - eraseFlagVector1.push_back(false); - ++sortLineIndex; - otbMsgDevMacro( << "Number of lines written in the path list: " << sortLineIndex ); - ++lineIt1; - } - - // Search ended, now removing the erased path from the first line pointer - typename std::vector<bool>::reverse_iterator it1 = eraseFlagVector1.rbegin(); - index1 = eraseFlagVector1.size() - 1; - while (it1 != eraseFlagVector1.rend()) - { - if (eraseFlagVector1[index1]) - { - outputPtr->Erase(index1); - } - - --index1; - ++it1; - } - -} -/** - * Verify the angular condition to find parallel lines. - * This function verifies if two lines are parallel by - * computing the angle in relation to the y-axis. - * First line segment: v1 is the first vertex, v2 the second one - * (not necessarily the path ending). - * Second line segment: v3 is the first vertex, v4 the second one - * (not necessarily the path ending). - * Return true if the condition is verified. - * - * This is the first criteria to be fulfilled. - **/ -template <class TPath> -bool -ParallelLinePathListFilter<TPath> -::VerifyAngularCondition(VertexType v1, VertexType v2, VertexType v3, VertexType v4) -{ - double alpha1 = std::atan2((v2[1] - v1[1]), (v2[0] - v1[0])); - double alpha2 = std::atan2((v4[1] - v3[1]), (v4[0] - v3[0])); - - alpha1 = (alpha1 >= 0) ? alpha1 : (alpha1 + CONST_PI); - alpha2 = (alpha2 >= 0) ? alpha2 : (alpha2 + CONST_PI); - - // Return true if the angle between the two lines is smaller than - // the specified threshold. - bool angle = (std::abs(alpha1 - alpha2) < static_cast<double>(m_AngularThreshold)); - - return angle; -} - -/** - * Verify the maximum distance condition to find parallel lines. - * The orthogonal distance between two parallel lines is calculated. - * First line segment: v1 is the first vertex, v2 the second one - * (not necessarily the path ending). - * Second line segment: v3 is the first vertex, v4 the second one - * (not necessarily the path ending). - * Return true if the condition is verified. - * - * This is the second criteria to be fulfilled. - **/ -template <class TPath> -bool -ParallelLinePathListFilter<TPath> -::VerifyMaxDistanceCondition(VertexType v1, VertexType v2, VertexType v3, VertexType itkNotUsed(v4)) -{ - // Compute the direction vector of the first line - VertexType vectorDir12; - - vectorDir12[0] = v2[0] - v1[0]; - vectorDir12[1] = v2[1] - v1[1]; - - // Compute the orthogonal distance between the two parallel lines - // with equation d = |(v3 - v1)X(v2 - v1)|/|v2 - v1| - double distance = 0., denominator = 0., nominator = 0.; - denominator = std::abs((v3[0] - v1[0]) * vectorDir12[1] - (v3[1] - v1[1]) * vectorDir12[0]); - nominator = sqrt(pow(vectorDir12[0], 2) + pow(vectorDir12[1], 2)); - distance = denominator / nominator; - //std::cout<< "Distance between two parallel lines: " << distance <<std::endl; - - // Check if the orthogonal distance between the lines - // is beneath the chosen threshold. - bool dist = (distance <= static_cast<double>(m_DistanceThreshold)); - - return dist; -} - -/** - * Verify the common distance condition to find parallel lines. - * The overlapping part of the parallel lines is computed. In case - * no overlapping part exists or the value is below the specified - * threshold, false is returned. - * First line segment: v1 is the first vertex, v2 the second one - * (not necessarily the path ending). - * Second line segment: v3 is the first vertex, v4 the second one - * (not necessarily the path ending). - * Return true if the condition is verified. - * - * This is the third criteria to be fulfilled. - **/ -template <class TPath> -bool -ParallelLinePathListFilter<TPath> -::VerifyCommonDistanceCondition(VertexType v1, VertexType v2, VertexType v3, VertexType v4) -{ -// Compute the length of each line - double length12 = 0.; - // double length34 = 0.; - length12 = sqrt(pow((v2[0] - v1[0]), 2) + pow((v2[1] - v1[1]), 2)); - //length34 = sqrt(pow((v4[0] - v3[0]), 2) + pow((v4[1] - v3[1]), 2)); - - // Set v1[0] to zero and align the y-axis of - // the new coordinate system with line one (v1 and v2). - // Compute the coordinates of the first and of the - // second line in the new coordinate system. - VertexType tempv1, tempv2, tempv3, tempv4; - - //Initialization - tempv1.Fill(0.); - tempv2.Fill(0.); - tempv3.Fill(0.); - tempv4.Fill(0.); - - if (v1[1] == v2[1]) - { - if (v1[0] < v2[0]) - { - tempv1[0] = 0., tempv1[1] = 0.; - tempv2[0] = 0., tempv2[1] = length12; - tempv3[0] = v3[0] - v1[0], tempv3[1] = v3[1] - v1[1]; - tempv4[0] = v4[0] - v1[0], tempv4[1] = v4[1] - v1[1]; - } - else - { - tempv2[0] = 0., tempv2[1] = 0.; - tempv1[0] = 0., tempv1[1] = length12; - tempv3[0] = v3[0] - v2[0], tempv3[1] = v3[1] - v2[1]; - tempv4[0] = v4[0] - v2[0], tempv4[1] = v4[1] - v2[1]; - } - } - // Check the direction of the line (vector). - // The origin of the new coordinate system is - // set to the smaller of the two vertices. - // Then, a rotation and translation of the vertices - // of the second line (v3 and v4) to the new coordinate - // system is performed. - - VertexType temptransv3, temptransv4; - - if (v1[1] < v2[1]) - { - if (v1[0] == v2[0]) - { - tempv1[0] = 0., tempv1[1] = 0.; - tempv2[0] = 0., tempv2[1] = length12; - tempv3[0] = v3[0] - v1[0], tempv3[1] = v3[1] - v1[1]; - tempv4[0] = v4[0] - v1[0], tempv4[1] = v4[1] - v1[1]; - } - - else - { - // Coordinates of the first line in the new coordinate system - tempv1[0] = 0.; - tempv1[1] = 0.; - tempv2[0] = 0.; - tempv2[1] = length12; - - // Rotate the system clockwise - double sinealpha; - if (v2[0] > v1[0]) - { - sinealpha = (v2[0] - v1[0]) / length12; - } - else - { - sinealpha = (v1[0] - v2[0]) / length12; - } - double alpha1 = std::asin(sinealpha); - - // Translation - temptransv3[0] = v3[0] - v1[0]; - temptransv3[1] = v3[1] - v1[1]; - temptransv4[0] = v4[0] - v1[0]; - temptransv4[1] = v4[1] - v1[1]; - - // Rotation - tempv3[0] = temptransv3[0] * cos(alpha1) + temptransv3[1] * sin(alpha1); - tempv3[1] = temptransv3[1] * cos(alpha1) - temptransv3[0] * sin(alpha1); - tempv4[0] = temptransv4[0] * cos(alpha1) + temptransv4[1] * sin(alpha1); - tempv4[1] = temptransv4[1] * cos(alpha1) - temptransv4[0] * sin(alpha1); - - otbMsgDevMacro(<< "tempv1[0], tempv1[1], tempv2[0], tempv2[1]: " ); - otbMsgDevMacro(<< tempv1[0] << ", " << tempv1[1] << ", " << tempv2[0] << ", " << tempv2[1] ); - otbMsgDevMacro(<< "Alpha: " << alpha1 ); - otbMsgDevMacro(<< "tempv3[0], tempv3[1], tempv4[0], tempv4[1]: " - << tempv3[0] << ", " << tempv3[1] << ", " - << tempv4[0] << ", " << tempv4[1] ); - otbMsgDevMacro(<< "Calculated length of the second line: " - << sqrt(pow((tempv4[0] - tempv3[0]), 2) + pow((tempv4[1] - tempv3[1]), 2)) ); - otbMsgDevMacro(<< "Original length of line 1: " << length12 ); - } - } - - if (v2[1] < v1[1]) - { - - if (v1[0] == v2[0]) - { - tempv2[0] = 0., tempv2[1] = 0.; - tempv1[0] = 0., tempv1[1] = length12; - tempv3[0] = v3[0] - v2[0], tempv3[1] = v3[1] - v2[1]; - tempv4[0] = v4[0] - v2[0], tempv4[1] = v4[1] - v2[1]; - } - else - { - tempv1[0] = 0.; - tempv1[1] = 0.; - tempv2[0] = 0.; - tempv2[1] = length12; - - // Rotate the system clockwise - double sinealpha; - if (v2[0] > v1[0]) - { - sinealpha = (v2[0] - v1[0]) / length12; - } - else - { - sinealpha = (v1[0] - v2[0]) / length12; - } - - double alpha1 = std::asin(sinealpha); - - // Translation - temptransv3[0] = v3[0] - v2[0]; - temptransv3[1] = v3[1] - v2[1]; - temptransv4[0] = v4[0] - v2[0]; - temptransv4[1] = v4[1] - v2[1]; - - // Rotation - tempv3[0] = temptransv3[0] * cos(alpha1) + temptransv3[1] * sin(alpha1); - tempv3[1] = temptransv3[1] * cos(alpha1) - temptransv3[0] * sin(alpha1); - tempv4[0] = temptransv4[0] * cos(alpha1) + temptransv4[1] * sin(alpha1); - tempv4[1] = temptransv4[1] * cos(alpha1) - temptransv4[0] * sin(alpha1); - - otbMsgDevMacro( << "tempv1[0], tempv1[1], tempv2[0], tempv2[1]: " ); - otbMsgDevMacro( << tempv1[0] << ", " << tempv1[1] << ", " << tempv2[0] << ", " << tempv2[1] ); - otbMsgDevMacro( << "Alpha: " << alpha1 ); - otbMsgDevMacro( << "tempv3[0], tempv3[1], tempv4[0], tempv4[1]: " - << tempv3[0] << ", " << tempv3[1] << ", " << tempv4[0] << ", " << tempv4[1] ); - otbMsgDevMacro( << "Calculated length of the second line: " - << sqrt(pow((tempv4[0] - tempv3[0]), 2) + pow((tempv4[1] - tempv3[1]), 2)) ); - otbMsgDevMacro( << "Original length of line 1: " << length12 ); - } - } - - // Compute the length of the overlapping part - // of the two lines. This is done by simply - // comparing the y-values of the lines (remember - // that both lines are parallel and also parallel - // to the new y-axis). - double commonDist = 0.; - - if (tempv3[1] >= tempv4[1]) - { - if (tempv3[1] >= 0 && tempv3[1] <= tempv2[1]) - { - if (tempv4[1] >= 0) - { - commonDist = std::abs(tempv4[1] - tempv3[1]); - } - - else if (tempv4[1] < 0) - { - commonDist = tempv3[1]; - } - } - else if (tempv3[1] >= 0 && tempv3[1] >= tempv2[1]) - { - if (tempv4[1] >= 0) - { - commonDist = tempv2[1] - tempv4[1]; - } - - else if (tempv4[1] < 0) - { - commonDist = tempv2[1]; - } - - } - else if (tempv4[1] >= tempv2[1]) - { // No overlapping parts exist. The (negative) distance - // between the two closest endpoints is calculated. - commonDist = -std::abs(tempv4[1] - tempv2[1]); - } - else if (tempv3[1] < 0) - { // No overlapping parts exist. The (negative) distance - // between the two closest endpoints is calculated. - commonDist = tempv3[1]; - } - } - - else - { - if (tempv4[1] >= 0 && tempv4[1] <= tempv2[1]) - { - if (tempv3[1] >= 0) - { - commonDist = std::abs(tempv3[1] - tempv4[1]); - } - - else if (tempv3[1] < 0) - { - commonDist = tempv4[1]; - } - } - else if (tempv4[1] >= 0 && tempv4[1] >= tempv2[1]) - { - if (tempv3[1] >= 0) - { - commonDist = tempv2[1] - tempv3[1]; - } - - else if (tempv3[1] < 0) - { - commonDist = tempv2[1]; - } - - } - else if (tempv3[1] >= tempv2[1]) - { // No overlapping parts exist. The (negative) distance - // between the two closest endpoints is calculated. - commonDist = -std::abs(tempv3[1] - tempv2[1]); - } - else if (tempv4[1] < 0) - { // No overlapping parts exist. The (negative) distance - // between the two closest endpoints is calculated. - commonDist = tempv4[1]; - } - } - // The common parallel parts of the two lines have to be greater than - // the provided threshold. - otbMsgDevMacro( << "Calculated common distance of the parallel lines: " << commonDist ); - bool common = (commonDist >= static_cast<double>(m_CommonDistanceThreshold)); - - return common; -} - -/** - * Write parallel line in a new path list. - * p1: First parallel path (line segment) - */ -template <class TPath> -typename ParallelLinePathListFilter<TPath> -::PathPointerType -ParallelLinePathListFilter<TPath> -::WriteParallelPath(PathPointerType p1) -{ - PathPointerType resp = PathType::New(); - - VertexIteratorType it; - - for (it = p1->GetVertexList()->Begin(); it != p1->GetVertexList()->End(); ++it) - { - resp->AddVertex((it).Value()); - } - - return resp; -} - -/** - * PrintSelf Method - */ -template <class TPath> -void -ParallelLinePathListFilter<TPath> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - -} // End namespace otb -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h b/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h deleted file mode 100644 index cc60ea4b97..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbRemoveIsolatedByDirectionFilter.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbRemoveIsolatedByDirectionFilter_h -#define otbRemoveIsolatedByDirectionFilter_h - -#include "otbModulusAndDirectionImageToImageFilter.h" -#include "otbBinaryFunctorNeighborhoodImageFilter.h" - -namespace otb -{ -namespace Functor -{ -/** \class RemoveIsolatedByDirectionFunctor - * \brief Binary neighborhood functor to remove isolated pixels by direction. - * Used by the RemoveIsolatedByDirectionFilter. - * \sa RemoveIsolatedByDirectionFilter - * \ingroup Functor - * - * \ingroup OTBRoadExtraction - */ -template <class TInput1, class TInput2, class TOutput> -class RemoveIsolatedByDirectionFunctor -{ -public: - RemoveIsolatedByDirectionFunctor() {} - virtual ~RemoveIsolatedByDirectionFunctor() {} - inline TOutput operator ()(const TInput1& itA, const TInput2& itB) - { - double currentDirection = itB.GetCenterPixel(); - int nEqualNeighbors = 0; - for (int neighborhoodIndex = 0; neighborhoodIndex < 9; ++neighborhoodIndex) - { - if (itB.GetPixel(neighborhoodIndex) == currentDirection) - { - ++nEqualNeighbors; - } - } - if (nEqualNeighbors <= 1) - { - //should never be 0 as it is at least equal to itself - return 0; - } - else - { - return static_cast<TOutput>(itA.GetCenterPixel()); - } - } -}; -} -/** \class RemoveIsolatedByDirectionFilter - * \brief This filter removes (sets to null intensity) pixels isolated by direction. - * - * For a given pixel, the filter walk through its neighborhood in direction image, counting pixels having - * the same direction as the center pixel. If there is no such a pixel, the center pixel is considered to be - * isolated in direction, and thus will be removed (set to 0). If the pixel is not isolated in direction, the output - * value is the value of the pixel in the modulus image. - * Of course this filter requires the direction to be discrete, in order to be able to count the directions. - * - * \ingroup Streamed - * \ingroup Threaded - * - * \ingroup OTBRoadExtraction - */ -template <class TInputModulus, class TInputDirection, class TOutputImage> -class ITK_EXPORT RemoveIsolatedByDirectionFilter - : public ModulusAndDirectionImageToImageFilter<TInputModulus, TInputDirection, TOutputImage> -{ -public: - /** Standard typedefs */ - typedef RemoveIsolatedByDirectionFilter Self; - typedef ModulusAndDirectionImageToImageFilter<TInputModulus, TInputDirection, TOutputImage> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Type macro */ - itkNewMacro(Self); - - /** Creation through object factory macro */ - itkTypeMacro(RemoveIsolatedByDirectionFilter, ModulusAndDirectionImageToImageFilter); - - /** typedef of the computing filter (this allows us to derive from ModulusAndDirectionToImageFilter as well as - using the BinaryFunctorNeighBorhoodImageFilter, which is appropriate here */ - typedef Functor::RemoveIsolatedByDirectionFunctor< - typename itk::ConstNeighborhoodIterator<TInputModulus>, - typename itk::ConstNeighborhoodIterator<TInputDirection>, - typename TOutputImage::PixelType> FunctorType; - typedef otb::BinaryFunctorNeighborhoodImageFilter<TInputModulus, TInputDirection, TOutputImage, - FunctorType> ComputingFilterType; - -protected: - /** Constructor */ - RemoveIsolatedByDirectionFilter() {}; - /** Destructor */ - ~RemoveIsolatedByDirectionFilter() override {} - /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override - { - Superclass::PrintSelf(os, indent); - } - /** Main computation method */ - void GenerateData(void) override - { - typename ComputingFilterType::Pointer filter = ComputingFilterType::New(); - filter->SetInput1(this->GetInput()); - filter->SetInput2(this->GetInputDirection()); - filter->GraftOutput(this->GetOutput()); - filter->Update(); - this->GraftOutput(filter->GetOutput()); - } - -private: - RemoveIsolatedByDirectionFilter(const Self &) = delete; - void operator =(const Self&) = delete; -}; -} // End namespace otb -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbRemoveTortuousPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbRemoveTortuousPathListFilter.h deleted file mode 100644 index abe69a7b58..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbRemoveTortuousPathListFilter.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbRemoveTortuousPathListFilter_h -#define otbRemoveTortuousPathListFilter_h - -#include "otbUnaryFunctorObjectListBooleanFilter.h" -#include "otbPathMeanDistanceFunctor.h" -#include "otbObjectList.h" - -namespace otb -{ -/** \class RemoveTortuousPathListFilter - * \brief This filter remove path considered as tortuous. - * - * A path is considered to be tortuous if the mean distance between each consecutive vertices - * is strictly lower than the user provided threshold. - * - * This class is just a shortcut to the UnaryFunctorObjectListBooleanFilter with - * the PathMeanDistanceFunctor. - * - *<b>Recent API changes:</b> - * Now part of the UnaryFunctorObjectListBooleanFilter hierarchy, replace call to SetMeanDistanceThreshold() - * by GetFunctor().SetThreshold(). - * - * The inequality is now a strict one. - * - * \sa BreakAngularPathListFilter - * \sa SimplifyPathFilter - * \sa UnaryFunctorObjectListBooleanFilter - * \sa PathMeanDistanceFunctor - * - * \example FeatureExtraction/ExtractRoadByStepsExample.cxx - * - * - * \ingroup OTBRoadExtraction - */ - -// template <class TPath> -template <class TPath> -class ITK_EXPORT RemoveTortuousPathListFilter : - public UnaryFunctorObjectListBooleanFilter< - ObjectList<TPath>, - ObjectList<TPath>, - PathMeanDistanceFunctor<typename TPath::Pointer> > -{}; - -} // End namespace otb - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h b/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h deleted file mode 100644 index b0d4fffb99..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbRemoveWrongDirectionFilter.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbRemoveWrongDirectionFilter_h -#define otbRemoveWrongDirectionFilter_h - -#include "otbModulusAndDirectionImageToImageFilter.h" -#include "itkBinaryFunctorImageFilter.h" -#include "otbMath.h" - -namespace otb -{ -namespace Functor -{ -/** \class RemoveWrongDirectionFunctor - * \brief This functor is used by the RemoveWrongDirectionFilter - * - * \sa RemoveWrongDirectionFilter - * \ingroup Functor - * - * \example FeatureExtraction/ExtractRoadByStepsExample.cxx - * - * - * \ingroup OTBRoadExtraction - */ -template <class TInput1, class TInput2, class TOutput> -class RemoveWrongDirectionFunctor -{ -public: - RemoveWrongDirectionFunctor() {} - virtual ~RemoveWrongDirectionFunctor() {} - inline TOutput operator ()(const TInput1& A, const TInput2& B) - { - if (B < CONST_PI_8) - { - return 0; - } - else - { - return A; - } - } -}; -} -/** \class RemoveWrongDirectionFilter - * \brief This filter removes (sets to null intensity) pixels with wrong direction. - * - * This filter is part of the road extraction framework. By using the Spectral Angle filter, - * we can assume that the direction of a road on our scalar product image is positive (greater - * than \f$ \pi/8 \f$). - * Therefore in the input modulus and direction images, pixels whose direction is lower than - * this threshold are suppressed - * (in fact, their intensity is set to 0). - * - * \sa NeighborhoodScalarProductFilter - * \ingroup Streamed - * \ingroup Threaded - * - * \ingroup OTBRoadExtraction - */ -template <class TInputModulus, class TInputDirection, class TOutputImage> -class ITK_EXPORT RemoveWrongDirectionFilter - : public ModulusAndDirectionImageToImageFilter<TInputModulus, TInputDirection, TOutputImage> -{ -public: - /** Standard typedefs */ - typedef RemoveWrongDirectionFilter Self; - typedef ModulusAndDirectionImageToImageFilter<TInputModulus, TInputDirection, TOutputImage> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Type macro */ - itkNewMacro(Self); - - /** Creation through object factory macro */ - itkTypeMacro(RemoveWrongDirectionFilter, ModulusAndDirectionImageToImageFilter); - - /** typedef of the computing filter (this allows us to derive from ModulusAndDirectionToImageFilter as well as - using the BinaryFunctorImageFilter, which is appropriate here */ - typedef Functor::RemoveWrongDirectionFunctor< - typename TInputModulus::PixelType, - typename TInputDirection::PixelType, - typename TOutputImage::PixelType> FunctorType; - typedef itk::BinaryFunctorImageFilter<TInputModulus, TInputDirection, TOutputImage, FunctorType> ComputingFilterType; - -protected: - /** Constructor */ - RemoveWrongDirectionFilter() {}; - /** Destructor */ - ~RemoveWrongDirectionFilter() override {} - /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override - { - Superclass::PrintSelf(os, indent); - } - /** Main computation method */ - void GenerateData(void) override - { - typename ComputingFilterType::Pointer filter = ComputingFilterType::New(); - filter->SetInput1(this->GetInput()); - filter->SetInput2(this->GetInputDirection()); - filter->GraftOutput(this->GetOutput()); - filter->Update(); - this->GraftOutput(filter->GetOutput()); - } - -private: - RemoveWrongDirectionFilter(const Self &) = delete; - void operator =(const Self&) = delete; -}; -} // End namespace otb -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h b/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h deleted file mode 100644 index 77c19f0ca3..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbRoadExtractionFilter_h -#define otbRoadExtractionFilter_h - - -#include "otbSpectralAngleDistanceImageFilter.h" -#include "otbGenericRoadExtractionFilter.h" - -namespace otb -{ -/** - * \class RoadExtractionFilter - * \brief This class performs the extraction of roads from an image. - * - * This composite filter implements a fast and robust road extraction - * for high resolution satellite images. This is a composite filter using the - * SpectralAngleDistanceImageFilter and the GenericRoadExtractionFilter and is - * intended to be used with optical high resolution data. The full method is - * described in E. Christophe and J. Inglada, "Robust Road Extraction for High - * Resolution Satellite Images," in IEEE International Conference on - * Image Processing, ICIP 2007. - * - * The algorithm uses all spectral - * bands based on the spectral angle with a reference pixel. Then, the line - * detection is done using a Gaussian gradient with a scalar product to find - * the road directions. Finally, extracted roads are vectorized and - * processed to improve the results removing some occultations and false - * detections. - * - * This filter is fast, as the detection typically takes 3 seconds for a - * 1000 \f$ \times \f$ 1000 images with four spectral bands. Results can be - * used as an initialization for more complex algorithms. - * - * \sa SpectralAngleDistanceImageFilter - * \sa GenericRoadExtractionFilter - * - * \example FeatureExtraction/ExtractRoadExample.cxx - * - * - * \ingroup OTBRoadExtraction - */ -template <class TInputImage, class TOutputPath> -class ITK_EXPORT RoadExtractionFilter - : public ImageToPathListFilter<TInputImage, TOutputPath> -{ -public: - /** Standard typedefs */ - typedef RoadExtractionFilter Self; - typedef ImageToPathListFilter<TInputImage, TOutputPath> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - /** Creation through object factory macro */ - itkNewMacro(Self); - /** Type macro */ - itkTypeMacro(RoadExtractionFilter, ImageToPathListFilter); - /** Template parameters typedefs */ - typedef typename Superclass::InputImageType InputImageType; - typedef typename Superclass::OutputPathType OutputPathType; - typedef typename Superclass::OutputPathListType OutputPathListType; - typedef typename InputImageType::PixelType InputPixelType; - typedef double InternalPixelType; - - typedef otb::VectorImage<InternalPixelType, InputImageType::ImageDimension> VectorImageType; - typedef otb::Image<InternalPixelType, InputImageType::ImageDimension> SpectralAngleType; - typedef otb::Image<InternalPixelType, InputImageType::ImageDimension> ModulusType; - typedef otb::Image<InternalPixelType, InputImageType::ImageDimension> DirectionType; - - typedef itk::CovariantVector<InternalPixelType, InputImageType::ImageDimension> - VectorPixelType; - typedef otb::Image<VectorPixelType, InputImageType::ImageDimension> CovariantVectorImageType; - - /* Template parameters typedefs for composites filters */ - typedef SpectralAngleDistanceImageFilter< - InputImageType, - SpectralAngleType> SpectralAngleDistanceImageFilterType; - - typedef GenericRoadExtractionFilter<SpectralAngleType, OutputPathType> - GenericRoadExtractionFilterType; - - /** Template parameters typedefs for internals filters */ - typedef typename GenericRoadExtractionFilterType::SigmaType SigmaType; - typedef typename GenericRoadExtractionFilterType::AmplitudeThresholdType AmplitudeThresholdType; - typedef typename GenericRoadExtractionFilterType::ToleranceType ToleranceType; - typedef typename GenericRoadExtractionFilterType::MaxAngleType MaxAngleType; - typedef typename GenericRoadExtractionFilterType::MeanDistanceThresholdType MeanDistanceThresholdType; - typedef typename GenericRoadExtractionFilterType::LinkRealType LinkRealType; - - /** Get/Set the reference pixel (use by the SpectralAngleDistanceImageFilter)*/ - otbGetObjectMemberConstReferenceMacro(SpectralAngleDistanceImageFilter, ReferencePixel, InputPixelType); - otbSetObjectMemberMacro(SpectralAngleDistanceImageFilter, ReferencePixel, InputPixelType); - - /** Get/Set the alpha value */ - otbGetObjectMemberConstReferenceMacro(GenericRoadExtractionFilter, Alpha, double); - otbSetObjectMemberMacro(GenericRoadExtractionFilter, Alpha, double); - - /** Get/Set the amplitude threshold to start following a path (use by the VectorizationPathListFilter)*/ - otbSetObjectMemberMacro(GenericRoadExtractionFilter, AmplitudeThreshold, AmplitudeThresholdType); - otbGetObjectMemberMacro(GenericRoadExtractionFilter, AmplitudeThreshold, AmplitudeThresholdType); - - /** Get/Set the tolerance for segment consistency (tolerance in terms of distance) (use by the SimplifyPathListFilter)*/ - otbGetObjectMemberMacro(GenericRoadExtractionFilter, Tolerance, ToleranceType); - otbSetObjectMemberMacro(GenericRoadExtractionFilter, Tolerance, ToleranceType); - - /** Set/Get the max angle (use bye the BreakAngularPathListFilter)*/ - otbSetObjectMemberMacro(GenericRoadExtractionFilter, MaxAngle, MaxAngleType); - otbGetObjectMemberConstMacro(GenericRoadExtractionFilter, MaxAngle, MaxAngleType); - - /** Get/Set the tolerance for segment consistency (tolerance in terms of distance) (use by RemoveTortuousPathListFilter)*/ - otbGetObjectMemberMacro(GenericRoadExtractionFilter, FirstMeanDistanceThreshold, MeanDistanceThresholdType); - otbSetObjectMemberMacro(GenericRoadExtractionFilter, FirstMeanDistanceThreshold, MeanDistanceThresholdType); - otbGetObjectMemberMacro(GenericRoadExtractionFilter, SecondMeanDistanceThreshold, MeanDistanceThresholdType); - otbSetObjectMemberMacro(GenericRoadExtractionFilter, SecondMeanDistanceThreshold, MeanDistanceThresholdType); - - /** Get/Set the angular threshold (use by LinkPathFilter)*/ - otbSetObjectMemberMacro(GenericRoadExtractionFilter, AngularThreshold, LinkRealType); - otbGetObjectMemberMacro(GenericRoadExtractionFilter, AngularThreshold, LinkRealType); - /** Get/Set the distance threshold (use by LinkPathFilter)*/ - otbSetObjectMemberMacro(GenericRoadExtractionFilter, DistanceThreshold, LinkRealType); - otbGetObjectMemberMacro(GenericRoadExtractionFilter, DistanceThreshold, LinkRealType); - -protected: - /** Constructor */ - RoadExtractionFilter(); - /** Destructor */ - ~RoadExtractionFilter() override {} - - /** Prepare main computation method */ - void BeforeGenerateData(void); - - /** Main computation method */ - void GenerateData(void) override; - /** PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - -private: - - RoadExtractionFilter(const Self &) = delete; - void operator =(const Self&) = delete; - - /** SpectralAngleDistanceImageFilter use by the composite filter */ - typename SpectralAngleDistanceImageFilterType::Pointer m_SpectralAngleDistanceImageFilter; - typename GenericRoadExtractionFilterType::Pointer m_GenericRoadExtractionFilter; - -}; - -} // End namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbRoadExtractionFilter.hxx" -#endif - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.hxx b/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.hxx deleted file mode 100644 index 67ee3a9fbb..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbRoadExtractionFilter.hxx +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbRoadExtractionFilter_hxx -#define otbRoadExtractionFilter_hxx - -#include "otbRoadExtractionFilter.h" -#include "otbMath.h" - -namespace otb -{ -/** - * Constructor - */ -template <class TInputImage, class TOutputPath> -RoadExtractionFilter<TInputImage, TOutputPath> -::RoadExtractionFilter() -{ - this->SetNumberOfRequiredInputs(1); - this->SetNumberOfRequiredOutputs(1); - - m_SpectralAngleDistanceImageFilter = SpectralAngleDistanceImageFilterType::New(); - m_GenericRoadExtractionFilter = GenericRoadExtractionFilterType::New(); - -} - -/** - * Main computation method - */ -template <class TInputImage, class TOutputPath> -void -RoadExtractionFilter<TInputImage, TOutputPath> -::GenerateData() -{ - // Input images pointers - typename InputImageType::ConstPointer inputImage = this->GetInput(); - typename OutputPathListType::Pointer outputPathList = this->GetOutput(); - - m_SpectralAngleDistanceImageFilter->SetInput(inputImage); - - m_GenericRoadExtractionFilter->SetInput(m_SpectralAngleDistanceImageFilter->GetOutput()); - - m_GenericRoadExtractionFilter->Update(); - for (typename GenericRoadExtractionFilterType::OutputPathListType::ConstIterator it - = m_GenericRoadExtractionFilter->GetOutput()->Begin(); - it != m_GenericRoadExtractionFilter->GetOutput()->End(); - ++it) - { - outputPathList->PushBack(it.Get()); - } -} -/** - * PrintSelf method - */ -template <class TInputImage, class TOutputPath> -void -RoadExtractionFilter<TInputImage, TOutputPath> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); - os << indent << "m_ReferencePixel: " << m_SpectralAngleDistanceImageFilter->GetReferencePixel() << std::endl; -} - -} // End namespace otb -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbSimplifyPathListFilter.h b/Modules/Detection/RoadExtraction/include/otbSimplifyPathListFilter.h deleted file mode 100644 index 2c0f99fad1..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbSimplifyPathListFilter.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbSimplifyPathListFilter_h -#define otbSimplifyPathListFilter_h - -#include "otbUnaryFunctorObjectListFilter.h" -#include "otbSimplifyPathFunctor.h" -#include "otbObjectList.h" - -namespace otb -{ -/** \class SimplifyPathListFilter - * \brief This filter performs a simplification of the path in the input list. - * - * It reduces the number of vertices in each path, according to a tolerance criterion. It aims at - * removing aligned vertices while keeping sharp angular points. - * - * In order to ensure the unicity of its output, each path is considered first from begin to end, then - * from begin to the first vertex before the end. At each step, the consistency of the path is checked : - * the equation of the line passing by the first and last vertices is computed. Then, for each - * vertices between them, the euclidean distance to this line is computed. If for one vertex, this distance - * is upper than the tolerance threshold, the path is considered to be inconsistent and no vertices can be removed. - * - * If the path is considered consistent (which will occur at least with a 2 vertices path), - * only the beginning and ending - * vertices are kept and a new search iteration begin at its end. - * - * This filter is part of the road extraction framework. - * - * This class is just a shortcut to the UnaryFunctorObjectListFilter with - * the SimplifyPathFunctor. - * - * <b>Recent API changes:</b> - * Now part of the UnaryFunctorObjectListFilter hierarchy, replace call to SetTolerance() - * by GetFunctor().SetTolerance(). - * - * - * \sa BreakAngularPathListFilter - * \sa RemoveTortuousPathFilter. - * \sa UnaryFunctorObjectListFilter - * \sa SimplifyPathFunctor - * - * \example FeatureExtraction/ExtractRoadByStepsExample.cxx - * - * - * \ingroup OTBRoadExtraction - */ - -template <class TPath> -class ITK_EXPORT SimplifyPathListFilter : - public UnaryFunctorObjectListFilter< - ObjectList<TPath>, - ObjectList<TPath>, - SimplifyPathFunctor<TPath, TPath> > -{}; - -} // End namespace otb - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h b/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h deleted file mode 100644 index 476725d3af..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbVectorDataToRoadDescriptionFilter_h -#define otbVectorDataToRoadDescriptionFilter_h - -#include "otbVectorDataToSpecificDescriptionFilterBase.h" -#include "otbVectorData.h" - -//#include "otbNDVIDataNodeFeatureFunction.h" -//#include "otbSpectralAngleDataNodeFeatureFunction.h" -#include "otbParserConditionDataNodeFeatureFunction.h" -#include "otbDBOverlapDataNodeFeatureFunction.h" - -namespace otb -{ -/** \class VectorDataToRoadDescriptionFilter - * \brief VectorDataToRoadDescriptionFilter associates a score to each - * adapted input VectorData DataNode. - * - * VectorDataToRoadDescriptionFilter is dedicated to road description. - * Input and output are both VectorDatas in index coordinate. - * Each DataNode of the output VectorData contains its scores - * regarding to the associated descriptors. - * The support is an Optical Image and the descriptor are: - * - (NDVI >= threshold) per cent along the tested lines - * - mean Spectral Angle regarding a reference pixel along the tested lines - * - DB Overlap compute the number of building crossed by the data node in percent - * regarding all the buildings within a data node neighborhood - * - * \ingroup VectorDataFilter - * \sa VectorDataToSpecificDescriptionFilterBase - * \sa VectorDataToBuildingDescriptionFilter - * - * \ingroup OTBRoadExtraction - */ - -template <class TVectorData, class TOpticalImage> -class ITK_EXPORT VectorDataToRoadDescriptionFilter : -public otb::VectorDataToSpecificDescriptionFilterBase<TVectorData> -{ -public: - /** Standard class typedefs. */ - typedef VectorDataToRoadDescriptionFilter Self; - typedef otb::VectorDataToSpecificDescriptionFilterBase<TVectorData> - Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(VectorDataToRoadDescriptionFilter, VectorDataToSpecificDescriptionFilterBase); - - /** Some typedefs. */ - typedef TVectorData VectorDataType; - typedef typename TVectorData::Pointer VectorDataPointer; - typedef typename VectorDataType::DataNodeType DataNodeType; - typedef itk::PreOrderTreeIterator<typename VectorDataType::DataTreeType> - TreeIteratorType; - typedef typename DataNodeType::ValuePrecisionType - PrecisionType; - typedef typename DataNodeType::PrecisionType - CoordRepType; - - typedef TOpticalImage OpticalImageType; - typedef typename TOpticalImage::Pointer OpticalImageTypePointer; - - typedef std::vector<std::string> DescriptorsListType; - - /* - typedef otb::NDVIDataNodeFeatureFunction<OpticalImageType, CoordRepType, PrecisionType> - NDVIFeatureFunctionType; - typedef otb::SpectralAngleDataNodeFeatureFunction<OpticalImageType, CoordRepType, PrecisionType> - SpectralAngleFeatureFunctionType; - */ - typedef otb::ParserConditionDataNodeFeatureFunction<OpticalImageType, CoordRepType, PrecisionType> - ParserConditionFeatureFunctionType; - - typedef otb::DBOverlapDataNodeFeatureFunction<CoordRepType, PrecisionType> - DBOverlapFeatureFunctionType; - - typedef itk::DataObject::Pointer DataObjectPointer; - typedef itk::DataObject DataObject; - - virtual void AddOpticalImage(const OpticalImageType * support); - const OpticalImageType * GetOpticalImage(); - - virtual void AddBuildingsDB(const VectorDataType * support); - const VectorDataType * GetBuildingsDB(); - - const DescriptorsListType& GetDescriptorsList() const - { - return m_DescriptorsList; - } - -protected: - /** Constructor */ - VectorDataToRoadDescriptionFilter(); - /** Destructor */ - ~VectorDataToRoadDescriptionFilter() override {} - /**PrintSelf method */ - void PrintSelf(std::ostream& os, itk::Indent indent) const override; - /** Triggers the Computation of the Descriptors */ - void GenerateData(void) override; - -private: - VectorDataToRoadDescriptionFilter(const Self &) = delete; - void operator =(const Self&) = delete; - - typename ParserConditionFeatureFunctionType::Pointer m_NDVIFeatureFunction; - typename ParserConditionFeatureFunctionType::Pointer m_SpectralAngleFeatureFunction; - typename DBOverlapFeatureFunctionType::Pointer m_DBOverlapFeatureFunction; - DescriptorsListType m_DescriptorsList; - -}; - -} // end namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbVectorDataToRoadDescriptionFilter.hxx" -#endif - -#endif diff --git a/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.hxx b/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.hxx deleted file mode 100644 index e58488f536..0000000000 --- a/Modules/Detection/RoadExtraction/include/otbVectorDataToRoadDescriptionFilter.hxx +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbVectorDataToRoadDescriptionFilter_hxx -#define otbVectorDataToRoadDescriptionFilter_hxx - -#include "otbVectorDataToRoadDescriptionFilter.h" - -namespace otb -{ - -// Constructor -template <class TVectorData, class TOpticalImage> -VectorDataToRoadDescriptionFilter<TVectorData, TOpticalImage> -::VectorDataToRoadDescriptionFilter() -{ - this->SetNumberOfRequiredInputs(3); - - m_NDVIFeatureFunction = ParserConditionFeatureFunctionType::New(); - m_NDVIFeatureFunction->SetExpression("ndvi(b3, b4) > 0.4"); - - m_SpectralAngleFeatureFunction = ParserConditionFeatureFunctionType::New(); - m_SpectralAngleFeatureFunction->SetExpression("spectralAngle > 0.25"); - - //Example for QuickBird images (on a specific image) - typename ParserConditionFeatureFunctionType::PixelType refPixel; - refPixel.SetSize(4); - refPixel[0] = 252; - refPixel[1] = 357; - refPixel[2] = 232; - refPixel[3] = 261; - m_SpectralAngleFeatureFunction->SetSpectralAngleReferencePixel(refPixel); - - m_DBOverlapFeatureFunction = DBOverlapFeatureFunctionType::New(); - - m_DescriptorsList.push_back("NONDVI"); - m_DescriptorsList.push_back("ROADSA"); - m_DescriptorsList.push_back("NOBUIL"); -} - -template <class TVectorData, class TOpticalImage> -void -VectorDataToRoadDescriptionFilter<TVectorData, TOpticalImage> -::AddOpticalImage(const OpticalImageType * support) -{ - this->AddSupport(const_cast<OpticalImageType *>(support), 0); -} - -template <class TVectorData, class TOpticalImage> -const typename VectorDataToRoadDescriptionFilter<TVectorData, TOpticalImage> -::OpticalImageType * -VectorDataToRoadDescriptionFilter<TVectorData, TOpticalImage> -::GetOpticalImage() -{ - return static_cast<const OpticalImageType *> - (this->GetSupport(0)); -} - - -template <class TVectorData, class TOpticalImage> -void -VectorDataToRoadDescriptionFilter<TVectorData, TOpticalImage> -::AddBuildingsDB(const VectorDataType * support) -{ - this->AddSupport(const_cast<VectorDataType *>(support), 1); -} - -template <class TVectorData, class TOpticalImage> -const typename VectorDataToRoadDescriptionFilter<TVectorData, TOpticalImage> -::VectorDataType * -VectorDataToRoadDescriptionFilter<TVectorData, TOpticalImage> -::GetBuildingsDB() -{ - return static_cast<const VectorDataType *> - (this->GetSupport(1)); -} - -template <class TVectorData, class TOpticalImage> -void -VectorDataToRoadDescriptionFilter<TVectorData, TOpticalImage> -::GenerateData() -{ - m_NDVIFeatureFunction->SetInputImage(const_cast<OpticalImageType *>(this->GetOpticalImage())); - m_SpectralAngleFeatureFunction->SetInputImage(const_cast<OpticalImageType *>(this->GetOpticalImage())); - m_DBOverlapFeatureFunction->SetInputVectorData(const_cast<VectorDataType *>(this->GetBuildingsDB())); - - // Retrieving root node - typename DataNodeType::Pointer root = this->GetOutput(0)->GetDataTree()->GetRoot()->Get(); - // Create the document node - typename DataNodeType::Pointer document = DataNodeType::New(); - document->SetNodeType(otb::DOCUMENT); - // Adding the layer to the data tree - this->GetOutput(0)->GetDataTree()->Add(document, root); - // Create the folder node - typename DataNodeType::Pointer folder = DataNodeType::New(); - folder->SetNodeType(otb::FOLDER); - // Adding the layer to the data tree - this->GetOutput(0)->GetDataTree()->Add(folder, document); - - TreeIteratorType itVector(this->GetInput()->GetDataTree()); - itVector.GoToBegin(); - while (!itVector.IsAtEnd()) - { - if (!itVector.Get()->IsRoot() && !itVector.Get()->IsDocument() && !itVector.Get()->IsFolder()) - { - typename DataNodeType::Pointer currentGeometry = itVector.Get(); - currentGeometry->SetFieldAsDouble("NONDVI", (double)(m_NDVIFeatureFunction->Evaluate(*(currentGeometry.GetPointer()))[0])); - currentGeometry->SetFieldAsDouble("ROADSA", (double)(m_SpectralAngleFeatureFunction->Evaluate(*(currentGeometry.GetPointer()))[0])); - currentGeometry->SetFieldAsDouble("NOBUIL", (double)(m_DBOverlapFeatureFunction->Evaluate(*(currentGeometry.GetPointer()))[0])); - - this->GetOutput(0)->GetDataTree()->Add(currentGeometry, folder); - } - ++itVector; - } -} - -// PrintSelf Method -template <class TVectorData, class TOpticalImage> -void -VectorDataToRoadDescriptionFilter<TVectorData, TOpticalImage> -::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - -} // end namespace otb - -#endif diff --git a/Modules/Detection/RoadExtraction/otb-module.cmake b/Modules/Detection/RoadExtraction/otb-module.cmake deleted file mode 100644 index 0af2a5ba03..0000000000 --- a/Modules/Detection/RoadExtraction/otb-module.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) -# -# This file is part of Orfeo Toolbox -# -# https://www.orfeo-toolbox.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set(DOCUMENTATION "Everything users need to extract roads.") - -otb_module(OTBRoadExtraction - DEPENDS - OTBVectorDataBase - OTBITK - OTBImageBase - OTBVectorDataManipulation - OTBImageManipulation - OTBMathParser - OTBPath - OTBObjectList - OTBCommon - - TEST_DEPENDS - OTBTestKernel - OTBImageIO - OTBProjection - OTBVectorDataIO - - DESCRIPTION - "${DOCUMENTATION}" -) diff --git a/Modules/Detection/RoadExtraction/test/AlignementsQB.cxx b/Modules/Detection/RoadExtraction/test/AlignementsQB.cxx deleted file mode 100644 index 2188101cb2..0000000000 --- a/Modules/Detection/RoadExtraction/test/AlignementsQB.cxx +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <iostream> -#include "itkPolyLineParametricPath.h" - -#include "otbImageFileWriter.h" -#include "otbImageFileReader.h" -#include "otbExtractROI.h" -#include "otbImageToPathListAlignFilter.h" -#include "otbDrawPathFilter.h" -//#include "otbColorImageViewer.h" - -#include <stdio.h> - -int main(int argc, char ** argv) -{ - if (argc != 3) - { - - std::cout << "Usage : " << argv[0] << " inputImage outputImage" << std::endl; - return 1; - - } - - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - - const unsigned int Dimension = 2; - - typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - - reader->SetFileName(inputFilename); - writer->SetFileName(outputFilename); - - reader->Update(); - - std::cout << "Lecture terminee" << std::endl; - - typedef otb::ExtractROI<InputPixelType, InputPixelType> ROIFilterType; - - ROIFilterType::Pointer roiFilter = ROIFilterType::New(); - - roiFilter->SetInput(reader->GetOutput()); - roiFilter->SetStartX(10); - roiFilter->SetStartY(0); - roiFilter->SetSizeX(256); - roiFilter->SetSizeY(256); - - roiFilter->Update(); - - std::cout << "Extraction ROI" << std::endl; - - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::ImageToPathListAlignFilter<InputImageType, PathType> ListAlignFilterType; - - ListAlignFilterType::Pointer alignFilter = ListAlignFilterType::New(); - - alignFilter->SetInput(roiFilter->GetOutput()); - - alignFilter->Update(); - - std::cout << "Alignements termines" << std::endl; - - typedef ROIFilterType::OutputImageType BackgroundImageType; - - typedef otb::DrawPathFilter<BackgroundImageType, PathType, OutputImageType> DrawPathFilterType; - - DrawPathFilterType::Pointer drawPathFilter = DrawPathFilterType::New(); - - typedef ListAlignFilterType::OutputPathListType ListType; - - ListType* listePaths = alignFilter->GetOutput(); - - ListType::Iterator listIt = listePaths->Begin(); - - BackgroundImageType::Pointer backgroundImage = roiFilter->GetOutput(); - - roiFilter->Update(); - - unsigned int color = 0; - - while (listIt != listePaths->End()) - { - - drawPathFilter->SetImageInput(backgroundImage); - drawPathFilter->SetInputPath(listIt.Get()); - //drawPathFilter->SetPathValue( color ); - - drawPathFilter->Update(); - - backgroundImage = drawPathFilter->GetOutput(); - - ++listIt; - ++color; - - } - - writer->SetInput(drawPathFilter->GetOutput()); - - writer->Update(); - -/* typedef otb::ColorImageViewer<unsigned char, double> ViewerType; - ViewerType viewer; - - viewer.SetLabel( "Input Image" ); - viewer.SetImage( drawPathFilter->GetOutput() ); - - viewer.Show(); - Fl::run(); -*/ - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/CMakeLists.txt b/Modules/Detection/RoadExtraction/test/CMakeLists.txt deleted file mode 100644 index 8c99e4420f..0000000000 --- a/Modules/Detection/RoadExtraction/test/CMakeLists.txt +++ /dev/null @@ -1,218 +0,0 @@ -# -# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) -# -# This file is part of Orfeo Toolbox -# -# https://www.orfeo-toolbox.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -otb_module_test() - -set(OTBRoadExtractionTests -otbRoadExtractionTestDriver.cxx -otbLikelihoodPathListFilter.cxx -otbRemoveWrongDirectionFilter.cxx -otbSimplifyPathListFilter.cxx -otbAlignImageToPath.cxx -otbNonMaxRemovalByDirectionFilter.cxx -otbRoadExtractionFilter.cxx -otbLinkPathListFilter.cxx -otbRemoveTortuousPathListFilter.cxx -otbParallelLinePathListFilter.cxx -otbRemoveIsolatedByDirectionFilter.cxx -otbVectorDataToRoadDescriptionFilter.cxx -otbSimplifyManyPathListFilter.cxx -otbNeighborhoodScalarProductFilter.cxx -otbDrawPathAlign.cxx -otbBreakAngularPathListFilter.cxx -) - -add_executable(otbRoadExtractionTestDriver ${OTBRoadExtractionTests}) -target_link_libraries(otbRoadExtractionTestDriver ${OTBRoadExtraction-Test_LIBRARIES}) -otb_module_target_label(otbRoadExtractionTestDriver) - -# Tests Declaration - -otb_add_test(NAME feTvLikelihoodPathListFilter COMMAND otbRoadExtractionTestDriver - --compare-ascii ${EPSILON_3} - ${BASELINE_FILES}/feTvLikelihoodPathOutput.txt - ${TEMP}/feTvLikelihoodPathOutput.txt - otbLikelihoodPathListFilter - ${INPUTDATA}/InputForRoadDetection_NonMaxRem.raw.hdr - ${TEMP}/feTvLikelihoodPathOutput.txt - 157 335 204 376 | - 21 305 35 308 77 354 85 358 | - 73 160 126 173 - ) - -otb_add_test(NAME feTvRemoveWrongDirectionFilter COMMAND otbRoadExtractionTestDriver - --compare-image ${EPSILON_8} - ${BASELINE}/feTvRemoveWrongDirectionOutput.tif - ${TEMP}/feTvRemoveWrongDirectionOutput.tif - otbRemoveWrongDirectionFilter - ${INPUTDATA}/InputForRoadDetection_IsolatedRem.raw.hdr - ${INPUTDATA}/InputForRoadDetectionScalarProductDir.raw.hdr - ${TEMP}/feTvRemoveWrongDirectionOutput.tif - ) - -otb_add_test(NAME feTvSimplifyPathListFilter COMMAND otbRoadExtractionTestDriver - --compare-ascii ${EPSILON_3} - ${BASELINE_FILES}/feTvSimplifyPathOutput.txt - ${TEMP}/feTvSimplifyPathOutput.txt - otbSimplifyPathListFilter - ${TEMP}/feTvSimplifyPathOutput.txt - 1.0 - 1 1 5 1 7 1 11 1 21 1 31 1 | - 1 1 5 1 7 1 11 1 21 11 31 11 | - 1 1 5 5 7 7 11 11 21 21 31 31 41 41 | - 1 1 5 1 7 1 11 1 21 11 31 11 41 11 58 11 70 11 - ) - -otb_add_test(NAME feTvAlignMV2ITK COMMAND otbRoadExtractionTestDriver - --compare-ascii ${EPSILON_3} ${BASELINE_FILES}/feAlign.txt - ${TEMP}/feAlign.txt - otbAlignImageToPath - ${INPUTDATA}/poupees.raw.hdr - ${TEMP}/feAlign.txt) - -otb_add_test(NAME feTvNonMaxRemovalByDirectionFilter COMMAND otbRoadExtractionTestDriver - --compare-image ${EPSILON_8} - ${BASELINE}/feTvNonMaxRemovalByDirectionOutput.tif - ${TEMP}/feTvNonMaxRemovalByDirectionOutput.tif - otbNonMaxRemovalByDirectionFilter - ${INPUTDATA}/InputForRoadDetection_WrongRem.raw.hdr - ${INPUTDATA}/InputForRoadDetectionScalarProductDir.raw.hdr - ${TEMP}/feTvNonMaxRemovalByDirectionOutput.tif - ) - -otb_add_test(NAME feTvRoadExtractionFilter COMMAND otbRoadExtractionTestDriver - --compare-image ${EPSILON_8} - ${BASELINE}/feTvOutputRoadDetection.tif - ${TEMP}/feTvOutputRoadDetection.tif - otbRoadExtractionFilter - ${INPUTDATA}/qb_RoadExtract.img.hdr - ${TEMP}/feTvOutputRoadDetection.tif - 337 557 432 859 # ReferencePixel - 1.0 # Alpha - 0.00005 # AmplitudeThreshold - 1.0 # Tolerance - 22.5 # (degre) MaxAngle (3.14159265358979323846/8.) - 1.0 # FirstMeanDistanceThreshold - 10.0 # SecondMeanDistanceThreshold - 25. # DistanceThreshold for LinkPathFiler - 22.5 # AngularThreshold for LinkPathFiler - ) - -otb_add_test(NAME feTvLinkPathListFilter COMMAND otbRoadExtractionTestDriver - --compare-ascii ${EPSILON_3} - ${BASELINE_FILES}/feTvLinkPathOutput.txt - ${TEMP}/feTvLinkPathOutput.txt - otbLinkPathListFilter - ${TEMP}/feTvLinkPathOutput.txt - 30 40 - 1 1 51 1 | - 61 1 91 1 | - 111 11 211 11 | - 1 51 51 51 | - 71 71 71 91 | - 71 131 71 201 | - 141 111 101 111 | - 151 111 191 111 | - 111 71 141 71 | - 181 71 151 71 | - 11 131 11 101 | - 11 171 11 141 - ) - -otb_add_test(NAME feTvRemoveTortuousPathListFilter COMMAND otbRoadExtractionTestDriver - --compare-ascii ${EPSILON_3} - ${BASELINE_FILES}/feTvRemoveTortuousPathOutput.txt - ${TEMP}/feTvRemoveTortuousPathOutput.txt - otbRemoveTortuousPathListFilter - ${TEMP}/feTvRemoveTortuousPathOutput.txt - 10.0 - 1 1 1 11 | - 1 1 5 1 7 1 11 1 | - 1 1 7 7 21 21 31 31 41 41 | - 1 1 5 1 7 1 11 1 21 11 31 11 41 11 58 11 70 11 - ) - -otb_add_test(NAME feTvParallelLinePathListFilter COMMAND otbRoadExtractionTestDriver - otbParallelLinePathListFilter) - -otb_add_test(NAME feTvRemoveIsolatedByDirectionFilter COMMAND otbRoadExtractionTestDriver - --compare-image ${EPSILON_8} - ${BASELINE}/feTvRemoveIsolatedByDirectionOutput.tif - ${TEMP}/feTvRemoveIsolatedByDirectionOutput.tif - otbRemoveIsolatedByDirectionFilter - ${INPUTDATA}/InputForRoadDetectionScalarProductMod.raw.hdr - ${INPUTDATA}/InputForRoadDetectionScalarProductDir.raw.hdr - ${TEMP}/feTvRemoveIsolatedByDirectionOutput.tif - ) - -otb_add_test(NAME fzTvVectorDataToRoadDescriptionFilter COMMAND otbRoadExtractionTestDriver - --compare-ogr ${EPSILON_9} - ${BASELINE_FILES}/fzTvVectorDataToRoadDescriptionFilterOutput.shp - ${TEMP}/fzTvVectorDataToRoadDescriptionFilterOutput.shp - otbVectorDataToRoadDescriptionFilter - ${INPUTDATA}/Dempster-Shafer/ROI_QB_TOULOUSE_ROADS.shp - ${INPUTDATA}/Dempster-Shafer/ROI_QB_TOULOUSE.TIF - ${INPUTDATA}/Dempster-Shafer/ROI_QB_TOULOUSE_BUILDINGS.shp - ${TEMP}/fzTvVectorDataToRoadDescriptionFilterOutput.shp - ${INPUTDATA}/DEM/srtm_directory - 0 - ) - -otb_add_test(NAME feTpSimplifyManyPathListFilter COMMAND otbRoadExtractionTestDriver - otbSimplifyManyPathListFilter - ${TEMP}/feTvSimplifyManyPathOutput.txt - 1.0 - ) - -otb_add_test(NAME feTvNeighborhoodScalarProductFilter COMMAND otbRoadExtractionTestDriver - --compare-n-images ${EPSILON_6} 2 - ${BASELINE}/feTvNeighborhoodScalarProductModulusOutput.tif - ${TEMP}/feTvNeighborhoodScalarProductModulusOutput.tif - ${BASELINE}/feTvNeighborhoodScalarProductDirectionOutput.tif - ${TEMP}/feTvNeighborhoodScalarProductDirectionOutput.tif - otbNeighborhoodScalarProductFilter - ${INPUTDATA}/InputForRoadDetection_SpectralAngle.raw.hdr - ${TEMP}/feTvNeighborhoodScalarProductModulusOutput.tif - ${TEMP}/feTvNeighborhoodScalarProductDirectionOutput.tif - 1.0 - ) - -otb_add_test(NAME feTvDrawPathTestAlign COMMAND otbRoadExtractionTestDriver - --compare-image ${NOTOL} ${BASELINE}/feDrawPathAlignDeuxTraits.png - ${TEMP}/feDrawPathAlignDeuxTraits.png - otbDrawPathAlign - ${INPUTDATA}/DeuxTraits.png - ${TEMP}/feDrawPathAlignDeuxTraits.png) - -otb_add_test(NAME feTvBreakAngularPathListFilter COMMAND otbRoadExtractionTestDriver - --compare-ascii ${NOTOL} ${BASELINE_FILES}/feBreakAngularPathListOutput.txt - ${TEMP}/feBreakAngularPathListOutput.txt - otbBreakAngularPathListFilter - ${TEMP}/feBreakAngularPathListOutput.txt - 10 20 30 50 90 140 180 | - 1 1 5 1 7 1 11 1 21 1 31 1 | - 1 1 5 1 7 1 11 1 21 11 31 11 | - 1 1 5 1 7 1 11 1 21 11 31 11 41 11 | - 1 1 5 1 7 1 11 1 21 11 31 11 41 11 58 11 70 11 | - 1 11 5 11 7 11 11 11 21 1 31 1 41 1 | - 1 1 5 1 7 1 11 1 21 11 31 21 41 31 | - 1 1 5 1 5 11 5 21 | - 1 1 31 1 41 1 - ) diff --git a/Modules/Detection/RoadExtraction/test/otbAlignImageToPath.cxx b/Modules/Detection/RoadExtraction/test/otbAlignImageToPath.cxx deleted file mode 100644 index 567713ab74..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbAlignImageToPath.cxx +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - - - -#include <iostream> -#include "itkPolyLineParametricPath.h" - -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" -#include "otbImageToPathListAlignFilter.h" - -#include "itkPathSource.h" - -#include <stdio.h> - -int otbAlignImageToPath(int itkNotUsed(argc), char * argv[]) -{ - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - - typedef double InputPixelType; - typedef double OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image<InputPixelType, Dimension> InputImageType; - - typedef itk::PolyLineParametricPath<Dimension> PathType; - - PathType::Pointer ltoto = PathType::New(); - - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - - typedef otb::ImageFileReader<InputImageType> ReaderType; - - typedef otb::ImageToPathListAlignFilter<InputImageType, PathType> ListAlignFilterType; - typedef ListAlignFilterType::ValueType ValueType; - typedef ListAlignFilterType::SizeType SizeType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - InputImageType::Pointer ImageIn = InputImageType::New(); - - ListAlignFilterType::Pointer testList = ListAlignFilterType::New(); - - reader->SetFileName(inputFilename); - - //OTB-FA-00010-CS - testList->SetInput(reader->GetOutput()); - - typedef ListAlignFilterType::OutputPathListType ListAlignFilterOutputPathListType; - - otbGenericMsgDebugMacro(<< "Before update"); - testList->Update(); - otbGenericMsgDebugMacro(<< "After update"); - - ValueType pathValue; - pathValue = testList->GetPathValue(); - testList->SetPathValue(pathValue); - - ValueType backgroundValue; - backgroundValue = testList->GetBackgroundValue(); - testList->SetBackgroundValue(backgroundValue); - - SizeType size; - size = testList->GetSize(); - testList->SetSize(size); - - bool isMeaningfulSegment; - isMeaningfulSegment = testList->GetisMeaningfulSegment(); - testList->SetisMeaningfulSegment(isMeaningfulSegment); - - int NbGradDirection; - NbGradDirection = testList->GetNbGradDirection(); - testList->SetNbGradDirection(NbGradDirection); - - int NbLineDirection; - NbLineDirection = testList->GetNbLineDirection(); - testList->SetNbLineDirection(NbLineDirection); - - double MinGradNorm; - MinGradNorm = testList->GetMinGradNorm(); - testList->SetMinGradNorm(MinGradNorm); - - double Eps; - Eps = testList->GetEps(); - testList->SetEps(Eps); - - ListAlignFilterOutputPathListType * sortiePath = testList->GetOutput(); - - otbGenericMsgDebugMacro(<< "Writing :"); - - FILE *file = fopen(outputFilename, "w"); - if (file == nullptr) - { - fprintf(stderr, "Error, can't open file"); - exit(-1); - } - typedef itk::ContinuousIndex<double, 2> VertexType; - typedef itk::VectorContainer<unsigned, VertexType> VertexListType; - typedef VertexListType::ConstPointer VertexListTypePointer; - VertexListTypePointer vertexList; - VertexType cindex; - double x1, y1; - //double x2, y2; - - int nbPath = sortiePath->Size(); - otbGenericMsgDebugMacro(<< "NbSegment: " << nbPath); - fprintf(file, "Nb Segment: %d\n", nbPath); - for (int i = 0; i < nbPath; ++i) - { - vertexList = sortiePath->GetNthElement(i)->GetVertexList(); - cindex = vertexList->GetElement(0); - x1 = cindex[0]; - y1 = cindex[1]; - cindex = vertexList->GetElement(1); - //x2 = cindex[0]; - //y2 = cindex[1]; - fprintf(file, "%8.3f %8.3f\n", x1, y1); - } - fclose(file); - - // writer->Update(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbBreakAngularPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbBreakAngularPathListFilter.cxx deleted file mode 100644 index dde12b6ad8..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbBreakAngularPathListFilter.cxx +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" -#include "otbBreakAngularPathListFilter.h" - -#include "itkPolyLineParametricPath.h" -#include <fstream> -#include <vector> -#include "otbMath.h" -#include <cstdlib> - -int otbBreakAngularPathListFilter(int itkNotUsed(argc), char * argv[]) -{ - const char * outfname = argv[1]; - - typedef std::vector<double> PointsVectorType; - typedef std::vector<PointsVectorType> PointsMatrixType; - PointsMatrixType MatricePoints; - PointsVectorType ListPoints; - PointsVectorType ListMaxAngle; - - int cpt = 2; - - ListMaxAngle.clear(); - while (argv[cpt][0] != '|') - { - ListMaxAngle.push_back(static_cast<double>(::atof(argv[cpt]))); - ++cpt; - } - ++cpt; - ListPoints.clear(); - - while (argv[cpt] != nullptr) - { - if (argv[cpt][0] == '|') - { - if ((ListPoints.size() % 2) != 0) - { - itkGenericExceptionMacro(<< "Missing point in parameters !"); - } - MatricePoints.push_back(ListPoints); - ListPoints.clear(); - } - else - { - ListPoints.push_back(static_cast<double>(::atof(argv[cpt]))); - } - ++cpt; - } - MatricePoints.push_back(ListPoints); - - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::BreakAngularPathListFilter<PathType> BreakAngularPathListFilterType; - typedef BreakAngularPathListFilterType::PathListType PathListType; - PathType::ContinuousIndexType cindex; - - PathListType::Pointer InputPathList = PathListType::New(); - - //Generate PathList - for (PointsMatrixType::iterator listpos = MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) - { - PathType::Pointer path = PathType::New(); - //Generate PathList - std::cout << "List " << std::endl; - for (PointsVectorType::iterator it = (*listpos).begin(); it != (*listpos).end(); ++it) - { - cindex[0] = *it; - ++it; - cindex[1] = *it; - std::cout << "Point Index :" << cindex[0] << ";" << cindex[1] << std::endl; - path->AddVertex(cindex); - } - InputPathList->PushBack(path); - } - - // Instantiating object - BreakAngularPathListFilterType::Pointer breakAngularFilter = BreakAngularPathListFilterType::New(); - breakAngularFilter->SetInput(InputPathList); - - std::ofstream file; - file.open(outfname); - - for (PointsVectorType::iterator itAngle = ListMaxAngle.begin(); itAngle != ListMaxAngle.end(); ++itAngle) - { - - breakAngularFilter->SetMaxAngle((*itAngle) * otb::CONST_PI / 180.); - breakAngularFilter->Update(); - - PathListType::Pointer OutputPathList = breakAngularFilter->GetOutput(); - - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; - typedef VertexListType::ConstIterator VertexIteratorType; - - unsigned int counter = 1; - PathListIteratorType pathListIt = InputPathList->Begin(); - - file << "--------------------------------------------------------------------------" << std::endl; - file << "MAX ANGULAR :" << breakAngularFilter->GetMaxAngle() << "(" << (*itAngle) << " deg.)" << std::endl; - file << "INPUT list of Path " << ": " << std::endl; - while (pathListIt != InputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << std::endl; - ++pathListIt; - ++counter; - } - - counter = 1; - pathListIt = OutputPathList->Begin(); - file << "OUTPUT list of Path " << ": " << std::endl; - while (pathListIt != OutputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << std::endl; - ++pathListIt; - ++counter; - } - - } //Enf for angle - file.close(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbDrawPathAlign.cxx b/Modules/Detection/RoadExtraction/test/otbDrawPathAlign.cxx deleted file mode 100644 index c5847cc841..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbDrawPathAlign.cxx +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - - -#include "itkMacro.h" -#include "itkPolyLineParametricPath.h" - -#include "otbImageFileReader.h" -#include "otbPathListSource.h" -#include "otbImageToPathListAlignFilter.h" -#include "otbDrawPathListFilter.h" -#include "otbImageFileWriter.h" - -int otbDrawPathAlign(int itkNotUsed(argc), char * argv[]) -{ - const char * inputFilename = argv[1]; - const char * outputFilename = argv[2]; - - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - - typedef itk::PolyLineParametricPath<Dimension> PathType; - - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - - typedef otb::ImageToPathListAlignFilter<InputImageType, PathType> PathListType; - typedef PathListType::OutputPathListType OutputPathListType; - - typedef otb::DrawPathListFilter<InputImageType, PathType, OutputImageType> DrawPathFilterType; - - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - - DrawPathFilterType::Pointer DrawPath = DrawPathFilterType::New(); - PathType::Pointer VertexList = PathType::New(); - - reader->SetFileName(inputFilename); - writer->SetFileName(outputFilename); - - typedef otb::ImageToPathListAlignFilter<InputImageType, PathType> PathListAlignType; - PathListAlignType::Pointer testList = PathListAlignType::New(); - - //OTB-FA-00010-CS - testList->SetInput(reader->GetOutput()); - testList->Update(); - - OutputPathListType * sortiePath = testList->GetOutput(); - int nbPath = sortiePath->Size(); - std::cout << "NbPath: " << nbPath << std::endl; - - InputImageType::ConstPointer imageIn = reader->GetOutput(); - - DrawPath->SetInput(imageIn); - DrawPath->SetInputPath(sortiePath); - - writer->SetInput(DrawPath->GetOutput()); - writer->Update(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbLikelihoodPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbLikelihoodPathListFilter.cxx deleted file mode 100644 index a1a7054b0f..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbLikelihoodPathListFilter.cxx +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" - -#include "otbLikelihoodPathListFilter.h" -#include "otbPolyLineParametricPathWithValue.h" -#include "otbImage.h" -#include "otbImageFileReader.h" -#include <fstream> - -int otbLikelihoodPathListFilter(int itkNotUsed(argc), char * argv[]) -{ - - std::cout << std::endl; - - const char * infname = argv[1]; - const char * outfname = argv[2]; - - typedef std::vector<double> PointsVectorType; - typedef std::vector<PointsVectorType> PointsMatrixType; - PointsMatrixType MatricePoints; - PointsVectorType ListPoints; - - int cpt = 3; - ListPoints.clear(); - - while (argv[cpt] != nullptr) - { - if (argv[cpt][0] == '|') - { - if ((ListPoints.size() % 2) != 0) - { - itkGenericExceptionMacro(<< "Missing point in parameters !"); - } - MatricePoints.push_back(ListPoints); - ListPoints.clear(); - } - else - { - ListPoints.push_back(static_cast<double>(::atof(argv[cpt]))); - } - ++cpt; - } - MatricePoints.push_back(ListPoints); - - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::PolyLineParametricPathWithValue<double, Dimension> PathType; - typedef otb::LikelihoodPathListFilter<PathType, ImageType> LikelihoodPathListFilterType; - typedef LikelihoodPathListFilterType::PathListType PathListType; - PathType::ContinuousIndexType cindex; - - PathListType::Pointer InputPathList = PathListType::New(); - - //Generate PathList - for (PointsMatrixType::iterator listpos = MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) - { - PathType::Pointer path = PathType::New(); - //Generate PathList - std::cout << "List " << std::endl; - for (PointsVectorType::iterator it = (*listpos).begin(); it != (*listpos).end(); ++it) - { - cindex[0] = *it; - ++it; - cindex[1] = *it; - std::cout << "Point Index :" << cindex[0] << ";" << cindex[1] << std::endl; - path->AddVertex(cindex); - } - InputPathList->PushBack(path); - } - - //Instantiating object - LikelihoodPathListFilterType::Pointer filter = LikelihoodPathListFilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(infname); - reader->Update(); - - filter->SetInput(InputPathList); - filter->SetInputImage(reader->GetOutput()); - filter->Update(); - - std::cout << "Filter execution ended" << std::endl; - - PathListType::Pointer OutputPathList = filter->GetOutput(); - - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; - typedef VertexListType::ConstIterator VertexIteratorType; - - std::ofstream file; - file.open(outfname); - unsigned int counter = 1; - PathListIteratorType pathListIt = InputPathList->Begin(); - - file << "INPUT list of Path " << ": " << std::endl; - while (pathListIt != InputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << std::endl; - ++pathListIt; - ++counter; - } - counter = 1; - pathListIt = OutputPathList->Begin(); - file << "OUTPUT list of Path " << ": " << std::endl; - while (pathListIt != OutputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << " Value: " << pathListIt.Get()->GetValue(); - file << std::endl; - ++pathListIt; - ++counter; - } - file.close(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbLinkPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbLinkPathListFilter.cxx deleted file mode 100644 index c41995abfa..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbLinkPathListFilter.cxx +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" - -#include "otbLinkPathListFilter.h" -#include "itkPolyLineParametricPath.h" -#include "otbMath.h" -#include <fstream> -#include <cstdlib> - -int otbLinkPathListFilter(int itkNotUsed(argc), char * argv[]) -{ - - std::cout << std::endl; - - const char * outfname = argv[1]; - const double distance = atof(argv[2]); - const double angle = ::atof(argv[3]) * otb::CONST_PI / 180.; - - typedef std::vector<double> PointsVectorType; - typedef std::vector<PointsVectorType> PointsMatrixType; - PointsMatrixType MatricePoints; - PointsVectorType ListPoints; - - int cpt = 4; - ListPoints.clear(); - - while (argv[cpt] != nullptr) - { - if (argv[cpt][0] == '|') - { - if ((ListPoints.size() % 2) != 0) - { - itkGenericExceptionMacro(<< "Missing point in parameters !"); - } - MatricePoints.push_back(ListPoints); - ListPoints.clear(); - } - else - { - ListPoints.push_back(static_cast<double>(::atof(argv[cpt]))); - } - ++cpt; - } - MatricePoints.push_back(ListPoints); - - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::LinkPathListFilter<PathType> LinkPathListFilterType; - typedef LinkPathListFilterType::PathListType PathListType; - PathType::ContinuousIndexType cindex; - - PathListType::Pointer InputPathList = PathListType::New(); - - //Generate PathList - for (PointsMatrixType::iterator listpos = MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) - { - PathType::Pointer path = PathType::New(); - //Generate PathList - std::cout << "List " << std::endl; - for (PointsVectorType::iterator it = (*listpos).begin(); it != (*listpos).end(); ++it) - { - cindex[0] = *it; - ++it; - cindex[1] = *it; - std::cout << "Point Index :" << cindex[0] << ";" << cindex[1] << std::endl; - path->AddVertex(cindex); - } - InputPathList->PushBack(path); - } - //Instantiating object - LinkPathListFilterType::Pointer filter = LinkPathListFilterType::New(); - - filter->SetInput(InputPathList); - filter->SetDistanceThreshold(distance); - filter->SetAngularThreshold(angle); - filter->Update(); - - std::cout << "Filter execution ended" << std::endl; - - PathListType::Pointer OutputPathList = filter->GetOutput(); - - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; - typedef VertexListType::ConstIterator VertexIteratorType; - - std::ofstream file; - file.open(outfname); - unsigned int counter = 1; - PathListIteratorType pathListIt = InputPathList->Begin(); - - file << "Maximum distance threshold: " << filter->GetDistanceThreshold() << " (" << distance << ")" << std::endl; - file << "Maximum angle threshold: " << filter->GetAngularThreshold() << " (" << angle * 180 / otb::CONST_PI << ")" << - std::endl; - file << "INPUT list of Path " << ": " << std::endl; - while (pathListIt != InputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << std::endl; - ++pathListIt; - ++counter; - } - counter = 1; - pathListIt = OutputPathList->Begin(); - file << "OUTPUT list of Path " << ": " << std::endl; - while (pathListIt != OutputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << std::endl; - ++pathListIt; - ++counter; - } - file.close(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbNeighborhoodScalarProductFilter.cxx b/Modules/Detection/RoadExtraction/test/otbNeighborhoodScalarProductFilter.cxx deleted file mode 100644 index 75c62bb6ab..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbNeighborhoodScalarProductFilter.cxx +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" - -#include "otbNeighborhoodScalarProductFilter.h" -#include "otbImage.h" -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" -#include "itkGradientRecursiveGaussianImageFilter.h" - -int otbNeighborhoodScalarProductFilter(int itkNotUsed(argc), char * argv[]) -{ - - const char * infname = argv[1]; - const char * outfname = argv[2]; - const char * diroutfname = argv[3]; - const double sigma = atof(argv[4]); - - const unsigned int Dimension = 2; - typedef double PixelType; - typedef itk::CovariantVector<PixelType, Dimension> VectorPixelType; - typedef otb::Image<VectorPixelType, Dimension> VectorImageType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::NeighborhoodScalarProductFilter<VectorImageType, ImageType, ImageType> FilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef itk::GradientRecursiveGaussianImageFilter<ImageType, VectorImageType> GradientFilterType; - - // Instantiating object - FilterType::Pointer filter = FilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - GradientFilterType::Pointer gradient = GradientFilterType::New(); - - reader->SetFileName(infname); - reader->Update(); - - gradient->SetInput(reader->GetOutput()); - gradient->SetSigma(sigma); - filter->SetInput(gradient->GetOutput()); - writer->SetInput(filter->GetOutput()); - writer->SetFileName(outfname); - writer->Update(); - writer = WriterType::New(); - writer->SetFileName(diroutfname); - writer->SetInput(filter->GetOutputDirection()); - writer->Update(); - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbNonMaxRemovalByDirectionFilter.cxx b/Modules/Detection/RoadExtraction/test/otbNonMaxRemovalByDirectionFilter.cxx deleted file mode 100644 index cb8970e5de..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbNonMaxRemovalByDirectionFilter.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" -#include "otbNonMaxRemovalByDirectionFilter.h" -#include "otbImage.h" -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" - -int otbNonMaxRemovalByDirectionFilter(int itkNotUsed(argc), char * argv[]) -{ - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::NonMaxRemovalByDirectionFilter<ImageType, ImageType, ImageType> NonMaxRemovalByDirectionFilterType; - - // Instantiating object - ReaderType::Pointer modReader = ReaderType::New(); - ReaderType::Pointer dirReader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - modReader->SetFileName(argv[1]); - dirReader->SetFileName(argv[2]); - writer->SetFileName(argv[3]); - NonMaxRemovalByDirectionFilterType::Pointer filter = NonMaxRemovalByDirectionFilterType::New(); - filter->SetInput(modReader->GetOutput()); - filter->SetInputDirection(dirReader->GetOutput()); - writer->SetInput(filter->GetOutput()); - writer->Update(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbParallelLinePathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbParallelLinePathListFilter.cxx deleted file mode 100644 index f2b67fc6ad..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbParallelLinePathListFilter.cxx +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" - -#include "otbParallelLinePathListFilter.h" -#include "itkPolyLineParametricPath.h" -#include <cstdlib> - -int otbParallelLinePathListFilter(int itkNotUsed(argc), char * itkNotUsed(argv) []) -{ - - // We create some lines - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::ObjectList<PathType> PathListType; - - PathListType::Pointer lineList = PathListType::New(); - PathListType::Pointer parallelList = PathListType::New(); - - typedef PathType::ContinuousIndexType ContinuousIndexType; - ContinuousIndexType cindex; - - /*-----*/ - PathType::Pointer aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 1; - cindex[1] = 1; - aLine->AddVertex(cindex); - - cindex[0] = 1; - cindex[1] = 100; - aLine->AddVertex(cindex); - - lineList->PushBack(aLine); - parallelList->PushBack(aLine); - - /*-----*/ - aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 10; - cindex[1] = 1; - aLine->AddVertex(cindex); - - cindex[0] = 10; - cindex[1] = 100; - aLine->AddVertex(cindex); - parallelList->PushBack(aLine); - lineList->PushBack(aLine); - - /*-----*/ - aLine = PathType::New(); - aLine->Initialize(); - cindex[0] = 174; - cindex[1] = 99; - aLine->AddVertex(cindex); - - cindex[0] = 281; - cindex[1] = 1; - aLine->AddVertex(cindex); - - lineList->PushBack(aLine); - - // Parallel lines are detected. - - typedef otb::ParallelLinePathListFilter<PathType> ParallelLinePathType; - ParallelLinePathType::Pointer parallelLinePathListFilter = ParallelLinePathType::New(); - parallelLinePathListFilter->SetDistanceThreshold(10); - parallelLinePathListFilter->SetAngularThreshold(10); - parallelLinePathListFilter->SetCommonDistanceThreshold(10); - parallelLinePathListFilter->SetInput(lineList); - parallelLinePathListFilter->Update(); - - PathListType::Pointer pathList = parallelLinePathListFilter->GetOutput(); - PathListType::Iterator listIt = pathList->Begin(); - - PathListType::Iterator parListIt = parallelList->Begin(); - - // A path is a line segment in this case. - while (listIt != pathList->End() && parListIt != parallelList->End()) - { - PathType::VertexListType::ConstPointer vertexList = (listIt.Get())->GetVertexList(); - - PathType::VertexListType::ConstPointer parVertexList = (parListIt.Get())->GetVertexList(); - - PathType::VertexListType::ConstIterator pathIt = vertexList->Begin(); - PathType::VertexListType::ConstIterator parPathIt = parVertexList->Begin(); - // Loop over all the vertices in one path - while (pathIt != vertexList->End() && - parPathIt != parVertexList->End()) - { - - if (pathIt.Value() != parPathIt.Value()) - { - std::cout << pathIt.Index() << pathIt.Value() << std::endl; - return EXIT_FAILURE; - - } - ++pathIt; - ++parPathIt; - } - ++listIt; - ++parListIt; - } - - return EXIT_SUCCESS; - -} diff --git a/Modules/Detection/RoadExtraction/test/otbRemoveIsolatedByDirectionFilter.cxx b/Modules/Detection/RoadExtraction/test/otbRemoveIsolatedByDirectionFilter.cxx deleted file mode 100644 index a2a9ade450..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbRemoveIsolatedByDirectionFilter.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" -#include "otbRemoveIsolatedByDirectionFilter.h" -#include "otbImage.h" -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" - -int otbRemoveIsolatedByDirectionFilter(int itkNotUsed(argc), char * argv[]) -{ - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::RemoveIsolatedByDirectionFilter<ImageType, ImageType, ImageType> RemoveIsolatedByDirectionFilterType; - - // Instantiating object - ReaderType::Pointer modReader = ReaderType::New(); - ReaderType::Pointer dirReader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - modReader->SetFileName(argv[1]); - dirReader->SetFileName(argv[2]); - writer->SetFileName(argv[3]); - RemoveIsolatedByDirectionFilterType::Pointer filter = RemoveIsolatedByDirectionFilterType::New(); - filter->SetInput(modReader->GetOutput()); - filter->SetInputDirection(dirReader->GetOutput()); - writer->SetInput(filter->GetOutput()); - writer->Update(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbRemoveTortuousPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbRemoveTortuousPathListFilter.cxx deleted file mode 100644 index 21b28e0c90..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbRemoveTortuousPathListFilter.cxx +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" - -#include "otbRemoveTortuousPathListFilter.h" -#include "itkPolyLineParametricPath.h" -#include <fstream> -#include <cstdlib> - -int otbRemoveTortuousPathListFilter(int itkNotUsed(argc), char * argv[]) -{ - const char * outfname = argv[1]; - const double threshold = atof(argv[2]); - - typedef std::vector<double> PointsVectorType; - typedef std::vector<PointsVectorType> PointsMatrixType; - PointsMatrixType MatricePoints; - PointsVectorType ListPoints; - - int cpt = 3; - ListPoints.clear(); - - while (argv[cpt] != nullptr) - { - if (argv[cpt][0] == '|') - { - if ((ListPoints.size() % 2) != 0) - { - itkGenericExceptionMacro(<< "Missing point in parameters !"); - } - MatricePoints.push_back(ListPoints); - ListPoints.clear(); - } - else - { - ListPoints.push_back(static_cast<double>(::atof(argv[cpt]))); - } - ++cpt; - } - MatricePoints.push_back(ListPoints); - - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::RemoveTortuousPathListFilter<PathType> RemoveTortuousPathListFilterType; - typedef RemoveTortuousPathListFilterType::InputListType PathListType; - PathType::ContinuousIndexType cindex; - - PathListType::Pointer InputPathList = PathListType::New(); - - //Generate PathList - for (PointsMatrixType::iterator listpos = MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) - { - PathType::Pointer path = PathType::New(); - //Generate PathList - std::cout << "List " << std::endl; - for (PointsVectorType::iterator it = (*listpos).begin(); it != (*listpos).end(); ++it) - { - cindex[0] = *it; - ++it; - cindex[1] = *it; - std::cout << "Point Index :" << cindex[0] << ";" << cindex[1] << std::endl; - path->AddVertex(cindex); - } - InputPathList->PushBack(path); - } - // Instantiating object - RemoveTortuousPathListFilterType::Pointer filter = RemoveTortuousPathListFilterType::New(); - - filter->SetInput(InputPathList); - filter->GetFunctor().SetThreshold(threshold); - filter->Update(); - - PathListType::Pointer OutputPathList = filter->GetOutput(); - - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; - typedef VertexListType::ConstIterator VertexIteratorType; - - std::ofstream file; - file.open(outfname); - unsigned int counter = 1; - PathListIteratorType pathListIt = InputPathList->Begin(); - - file << "Minimum Mean Distance: " << filter->GetFunctor().GetThreshold() << " (" << threshold << ")" << std::endl; - file << "INPUT list of Path " << ": " << std::endl; - while (pathListIt != InputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << std::endl; - ++pathListIt; - ++counter; - } - counter = 1; - pathListIt = OutputPathList->Begin(); - file << "OUTPUT list of Path " << ": " << std::endl; - while (pathListIt != OutputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << std::endl; - ++pathListIt; - ++counter; - } - file.close(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbRemoveWrongDirectionFilter.cxx b/Modules/Detection/RoadExtraction/test/otbRemoveWrongDirectionFilter.cxx deleted file mode 100644 index 146623060c..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbRemoveWrongDirectionFilter.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" -#include "otbRemoveWrongDirectionFilter.h" -#include "otbImage.h" -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" - -int otbRemoveWrongDirectionFilter(int itkNotUsed(argc), char * argv[]) -{ - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::RemoveWrongDirectionFilter<ImageType, ImageType, ImageType> RemoveWrongDirectionFilterType; - - // Instantiating object - ReaderType::Pointer modReader = ReaderType::New(); - ReaderType::Pointer dirReader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - modReader->SetFileName(argv[1]); - dirReader->SetFileName(argv[2]); - writer->SetFileName(argv[3]); - RemoveWrongDirectionFilterType::Pointer filter = RemoveWrongDirectionFilterType::New(); - filter->SetInput(modReader->GetOutput()); - filter->SetInputDirection(dirReader->GetOutput()); - writer->SetInput(filter->GetOutput()); - writer->Update(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbRoadExtractionFilter.cxx b/Modules/Detection/RoadExtraction/test/otbRoadExtractionFilter.cxx deleted file mode 100644 index 80e757ab1b..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbRoadExtractionFilter.cxx +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" - -#include "otbImage.h" -#include "otbRoadExtractionFilter.h" -#include "otbDrawPathListFilter.h" -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" -#include "otbPolyLineParametricPathWithValue.h" -#include "otbMath.h" - -int otbRoadExtractionFilter(int itkNotUsed(argc), char * argv[]) -{ - const unsigned int Dimension = 2; - typedef otb::VectorImage<double, Dimension> InputImageType; - typedef otb::Image<double, Dimension> OutputImageType; - typedef otb::PolyLineParametricPathWithValue<double, Dimension> PathType; - - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::RoadExtractionFilter<InputImageType, PathType> RoadExtractionFilterType; - typedef RoadExtractionFilterType::InputPixelType InputPixelType; - typedef otb::DrawPathListFilter<OutputImageType, PathType, OutputImageType> DrawPathFilterType; - - //Parameters - const char * inputFileName(argv[1]); - const char * outputFileName(argv[2]); - InputPixelType ReferencePixel; - ReferencePixel.Reserve(4); - ReferencePixel.SetElement(0, ::atof(argv[3])); - ReferencePixel.SetElement(1, ::atof(argv[4])); - ReferencePixel.SetElement(2, ::atof(argv[5])); - ReferencePixel.SetElement(3, ::atof(argv[6])); - const double Alpha = ::atof(argv[7]); - const double AmplitudeThreshold = ::atof(argv[8]); - const double Tolerance = ::atof(argv[9]); - const double MaxAngle = ((otb::CONST_PI * ::atof(argv[10])) / 180.); - const double FirstMeanDistanceThreshold = ::atof(argv[11]); - const double SecondMeanDistanceThreshold = ::atof(argv[12]); - const double LinkAngularThreshold = ((otb::CONST_PI * ::atof(argv[13])) / 180.); - const double LinkDistanceThreshold = ::atof(argv[14]); - - // Instantiating object - ReaderType::Pointer reader = ReaderType::New(); - RoadExtractionFilterType::Pointer roadExtraction = RoadExtractionFilterType::New(); - DrawPathFilterType::Pointer draw = DrawPathFilterType::New(); - WriterType::Pointer writer = WriterType::New(); - - //Initialization parameters - reader->SetFileName(inputFileName); - - roadExtraction->SetInput(reader->GetOutput()); - roadExtraction->SetReferencePixel(ReferencePixel); - roadExtraction->SetAlpha(Alpha); - roadExtraction->SetAmplitudeThreshold(AmplitudeThreshold); - roadExtraction->SetTolerance(Tolerance); - roadExtraction->SetMaxAngle(MaxAngle); - roadExtraction->SetFirstMeanDistanceThreshold(FirstMeanDistanceThreshold); - roadExtraction->SetSecondMeanDistanceThreshold(SecondMeanDistanceThreshold); - roadExtraction->SetAngularThreshold(LinkAngularThreshold); - roadExtraction->SetDistanceThreshold(LinkDistanceThreshold); - - reader->GenerateOutputInformation(); - OutputImageType::Pointer image = OutputImageType::New(); - image->CopyInformation(reader->GetOutput()); - image->SetRegions(image->GetLargestPossibleRegion()); - image->Allocate(); - image->FillBuffer(0); - - draw->SetInput(image); - //Use internal value of path - draw->UseInternalPathValueOn(); - draw->SetInputPath(roadExtraction->GetOutput()); - - writer->SetFileName(outputFileName); - writer->SetInput(draw->GetOutput()); - writer->Update(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbRoadExtractionTestDriver.cxx b/Modules/Detection/RoadExtraction/test/otbRoadExtractionTestDriver.cxx deleted file mode 100644 index 2765863108..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbRoadExtractionTestDriver.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "otbTestMain.h" - -void RegisterTests() -{ - REGISTER_TEST(otbLikelihoodPathListFilter); - REGISTER_TEST(otbRemoveWrongDirectionFilter); - REGISTER_TEST(otbSimplifyPathListFilter); - REGISTER_TEST(otbAlignImageToPath); - REGISTER_TEST(otbNonMaxRemovalByDirectionFilter); - REGISTER_TEST(otbRoadExtractionFilter); - REGISTER_TEST(otbLinkPathListFilter); - REGISTER_TEST(otbRemoveTortuousPathListFilter); - REGISTER_TEST(otbParallelLinePathListFilter); - REGISTER_TEST(otbRemoveIsolatedByDirectionFilter); - REGISTER_TEST(otbVectorDataToRoadDescriptionFilter); - REGISTER_TEST(otbSimplifyManyPathListFilter); - REGISTER_TEST(otbNeighborhoodScalarProductFilter); - REGISTER_TEST(otbDrawPathAlign); - REGISTER_TEST(otbBreakAngularPathListFilter); -} diff --git a/Modules/Detection/RoadExtraction/test/otbSimplifyManyPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbSimplifyManyPathListFilter.cxx deleted file mode 100644 index 12a79b10a8..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbSimplifyManyPathListFilter.cxx +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" - -#include "otbSimplifyPathListFilter.h" -#include "itkPolyLineParametricPath.h" -#include <fstream> -#include <cstdlib> - -/** - * This filter is intended to test the multithreading capabilities - * of the otb::UnaryFunctorObjectListFilter - */ - -int otbSimplifyManyPathListFilter(int itkNotUsed(argc), char * argv[]) -{ - const char * outfname = argv[1]; - const double tolerance = atof(argv[2]); - -// typedef std::vector<double> PointsVectorType; -// typedef std::vector< PointsVectorType > PointsMatrixType; -// PointsMatrixType MatricePoints; -// PointsVectorType ListPoints; - - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::SimplifyPathListFilter<PathType> SimplifyPathListFilterType; - typedef SimplifyPathListFilterType::InputListType PathListType; - PathType::ContinuousIndexType cindex; - - PathListType::Pointer InputPathList = PathListType::New(); - - //Generate PathList - unsigned long int numberOfPaths = 10000; - srand(123456); - - for (unsigned long int i = 0; i < numberOfPaths; ++i) - { - PathType::Pointer path = PathType::New(); - //Generate PathList - unsigned int numberOfPoints = static_cast<int>((rand() / (RAND_MAX + 1.0)) * 90) + 10; -// std::cout << "List :" << numberOfPoints << " points" << std::endl; - cindex[0] = 0; - cindex[1] = 0; - for (unsigned int j = 0; j < numberOfPoints; ++j) - { - cindex[0] += (rand() / (RAND_MAX + 1.0)) * 100 - 50; - cindex[1] += (rand() / (RAND_MAX + 1.0)) * 100 - 50; -// std::cout << "Point Index :"<<cindex[0]<<", "<<cindex[1]<<std::endl; - path->AddVertex(cindex); - } - InputPathList->PushBack(path); - } - // Instantiating object - SimplifyPathListFilterType::Pointer simplifyFilter = SimplifyPathListFilterType::New(); - - simplifyFilter->SetInput(InputPathList); - simplifyFilter->GetFunctor().SetTolerance(tolerance); - simplifyFilter->Update(); - - PathListType::Pointer OutputPathList = simplifyFilter->GetOutput(); - - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; - typedef VertexListType::ConstIterator VertexIteratorType; - - std::ofstream file; - file.open(outfname); - unsigned int counter = 1; - PathListIteratorType pathListIt = InputPathList->Begin(); - - file << "TOLERANCE: " << simplifyFilter->GetFunctor().GetTolerance() << "(" << tolerance << ")" << std::endl; - - pathListIt = OutputPathList->Begin(); - file << "OUTPUT list of Path " << ": " << std::endl; - while (pathListIt != OutputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << std::endl; - ++pathListIt; - ++counter; - } - file.close(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbSimplifyPathListFilter.cxx b/Modules/Detection/RoadExtraction/test/otbSimplifyPathListFilter.cxx deleted file mode 100644 index 54095a10ec..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbSimplifyPathListFilter.cxx +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "itkMacro.h" - -#include "otbSimplifyPathListFilter.h" -#include "itkPolyLineParametricPath.h" -#include <fstream> -#include <cstdlib> - -int otbSimplifyPathListFilter(int itkNotUsed(argc), char * argv[]) -{ - const char * outfname = argv[1]; - const double tolerance = atof(argv[2]); - - typedef std::vector<double> PointsVectorType; - typedef std::vector<PointsVectorType> PointsMatrixType; - PointsMatrixType MatricePoints; - PointsVectorType ListPoints; - - int cpt = 3; - ListPoints.clear(); - - while (argv[cpt] != nullptr) - { - if (argv[cpt][0] == '|') - { - if ((ListPoints.size() % 2) != 0) - { - itkGenericExceptionMacro(<< "Missing point in parameters !"); - } - MatricePoints.push_back(ListPoints); - ListPoints.clear(); - } - else - { - ListPoints.push_back(static_cast<double>(::atof(argv[cpt]))); - } - ++cpt; - } - MatricePoints.push_back(ListPoints); - - const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; - typedef otb::SimplifyPathListFilter<PathType> SimplifyPathListFilterType; - typedef SimplifyPathListFilterType::InputListType PathListType; - PathType::ContinuousIndexType cindex; - - PathListType::Pointer InputPathList = PathListType::New(); - - //Generate PathList - for (PointsMatrixType::iterator listpos = MatricePoints.begin(); listpos != MatricePoints.end(); ++listpos) - { - PathType::Pointer path = PathType::New(); - //Generate PathList - std::cout << "List " << std::endl; - for (PointsVectorType::iterator it = (*listpos).begin(); it != (*listpos).end(); ++it) - { - cindex[0] = *it; - ++it; - cindex[1] = *it; - std::cout << "Point Index :" << cindex[0] << ";" << cindex[1] << std::endl; - path->AddVertex(cindex); - } - InputPathList->PushBack(path); - } - // Instantiating object - SimplifyPathListFilterType::Pointer simplifyFilter = SimplifyPathListFilterType::New(); - - simplifyFilter->SetInput(InputPathList); - simplifyFilter->GetFunctor().SetTolerance(tolerance); - simplifyFilter->Update(); - - PathListType::Pointer OutputPathList = simplifyFilter->GetOutput(); - - typedef PathListType::ConstIterator PathListIteratorType; - typedef PathType::VertexListType VertexListType; - typedef VertexListType::ConstIterator VertexIteratorType; - - std::ofstream file; - file.open(outfname); - unsigned int counter = 1; - PathListIteratorType pathListIt = InputPathList->Begin(); - - file << "TOLERANCE: " << simplifyFilter->GetFunctor().GetTolerance() << "(" << tolerance << ")" << std::endl; - file << "INPUT list of Path " << ": " << std::endl; - while (pathListIt != InputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << std::endl; - ++pathListIt; - ++counter; - } - counter = 1; - pathListIt = OutputPathList->Begin(); - file << "OUTPUT list of Path " << ": " << std::endl; - while (pathListIt != OutputPathList->End()) - { - file << "Path " << counter << ": "; - for (VertexIteratorType vIt = pathListIt.Get()->GetVertexList()->Begin(); - vIt != pathListIt.Get()->GetVertexList()->End(); - ++vIt) - { - if (vIt != pathListIt.Get()->GetVertexList()->Begin()) - { - file << ", "; - } - file << vIt.Value(); - } - file << std::endl; - ++pathListIt; - ++counter; - } - file.close(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Detection/RoadExtraction/test/otbVectorDataToRoadDescriptionFilter.cxx b/Modules/Detection/RoadExtraction/test/otbVectorDataToRoadDescriptionFilter.cxx deleted file mode 100644 index 98715c2b86..0000000000 --- a/Modules/Detection/RoadExtraction/test/otbVectorDataToRoadDescriptionFilter.cxx +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - - -#include "otbVectorDataToRoadDescriptionFilter.h" - -#include "otbVectorImage.h" -#include "otbImageFileReader.h" -#include "otbVectorDataFileReader.h" -#include "otbVectorDataFileWriter.h" -#include "otbVectorDataProperties.h" -#include "otbRemoteSensingRegion.h" -#include "otbVectorDataIntoImageProjectionFilter.h" - - - - - -int otbVectorDataToRoadDescriptionFilter(int itkNotUsed(argc), char* argv[]) -{ - const char * inputVD = argv[1]; - const char * inputImg = argv[2]; - const char * inputDB = argv[3]; - const char * outputVD = argv[4]; - const char * DEMDirectory = argv[5]; - int DisplayWarnings = atoi(argv[6]); - - typedef double PrecisionType; - typedef otb::VectorData<PrecisionType, 2> VectorDataType; - typedef otb::VectorImage<PrecisionType> ImageType; - - typedef otb::VectorDataToRoadDescriptionFilter<VectorDataType, ImageType> - VectorDataToRoadDescriptionFilterType; - - typedef otb::ImageFileReader<ImageType> ImageReaderType; - typedef otb::VectorDataFileReader<VectorDataType> - VectorDataReaderType; - typedef otb::VectorDataFileWriter<VectorDataType> - VectorDataWriterType; - typedef otb::VectorDataIntoImageProjectionFilter<VectorDataType, ImageType> - VectorDataReProjFilter; - - - VectorDataReaderType::Pointer vdReader = VectorDataReaderType::New(); - VectorDataReaderType::Pointer DBReader = VectorDataReaderType::New(); - ImageReaderType::Pointer reader = ImageReaderType::New(); - VectorDataWriterType::Pointer vdWriter = VectorDataWriterType::New(); - VectorDataReProjFilter::Pointer vdReProjFilter = VectorDataReProjFilter::New(); - - VectorDataToRoadDescriptionFilterType::Pointer filter = - VectorDataToRoadDescriptionFilterType::New(); - - if (!DisplayWarnings) - { - reader->SetGlobalWarningDisplay(0); - } - otb::DEMHandler::Instance()->OpenDEMDirectory(DEMDirectory); - - reader->SetFileName(inputImg); - reader->UpdateOutputInformation(); - - DBReader->SetFileName(inputDB); - DBReader->Update(); - - vdReader->SetFileName(inputVD); - vdReader->Update(); - - vdReProjFilter->SetInputImage(reader->GetOutput()); - vdReProjFilter->SetInputVectorData(vdReader->GetOutput()); - vdReProjFilter->SetUseOutputSpacingAndOriginFromImage(true); - vdReProjFilter->Update(); - - filter->SetInput(vdReProjFilter->GetOutput()); - filter->AddOpticalImage(reader->GetOutput()); - filter->AddBuildingsDB(DBReader->GetOutput()); - - vdWriter->SetFileName(outputVD); - vdWriter->SetInput(filter->GetOutput()); - vdWriter->Update(); - - return EXIT_SUCCESS; -} -- GitLab