CMakeLists.txt 8.34 KB
Newer Older
1 2
#--- MeanShift ---#

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

# VALIDATION should be enabled (baseline is same same as bfTvMeanShiftSmoothingImageFilterQBSuburbNonOptim) 
# results should be the same if thres is stored as double
#OTB_TEST_APPLICATION(NAME apTvSeMeanShiftSmoothing
OTB_TEST_APPLICATION(NAME apTuSeMeanShiftSmoothing 
                     APP  MeanShiftSmoothing
                     OPTIONS -in  ${INPUTDATA}/QB_Suburb.png
                             -fout ${TEMP}/apTvSeMeanShiftSmoothing_FilterOutput.tif
                 			 -spatialr 4
                 			 -ranger 25
                 			 -maxiter 100
                 			 -thres 0.1
                 			 -modesearch 0)
#                     VALID   --compare-image ${EPSILON_7} 
#                               ${BASELINE}/bfMeanShiftSmoothingImageFilterSpectralOutput_QBSuburbNonOptim.tif
#                    		   ${TEMP}/apTvSeMeanShiftSmoothing_FilterOutput.tif)
19 20 21 22 23

#--- ConnectedComponentSegmentation ---#

OTB_TEST_APPLICATION(NAME  apTvCcConnectedComponentSegmentationMaskMuParserShp
                     APP  ConnectedComponentSegmentation
24 25 26 27 28 29
                     OPTIONS -in ${INPUTDATA}/ROI_QB_MUL_4.tif
                             -out ${TEMP}/apTvCcConnectedComponentSegmentationMaskMuParser.shp
                             -mask "((b1>80)*intensity>95)"
                             -expr "distance<10"
                             -minsize 15
                             -obia "SHAPE_Elongation>8"
30 31 32 33 34 35
                     VALID   --compare-ogr ${NOTOL}
                             ${BASELINE_FILES}/apTvCcConnectedComponentSegmentationMaskMuParser.shp
                             ${TEMP}/apTvCcConnectedComponentSegmentationMaskMuParser.shp)

OTB_TEST_APPLICATION(NAME  apTvCcConnectedComponentSegmentatioNoMask
                     APP  ConnectedComponentSegmentation
36 37 38 39 40
                     OPTIONS -in ${INPUTDATA}/ROI_QB_MUL_4.tif
                             -out ${TEMP}/apTvCcConnectedComponentSegmentationNoMask.shp
                             -expr "distance<10"
                             -minsize 15
                             -obia "SHAPE_Elongation>8"
41 42 43
                     VALID   --compare-ogr ${NOTOL}
                             ${BASELINE_FILES}/apTvCcConnectedComponentSegmentationNoMask.shp
                             ${TEMP}/apTvCcConnectedComponentSegmentationNoMask.shp)                    		   
44 45 46 47 48 49

#--- HooverCompareSegmentation ---#
OTB_TEST_APPLICATION(NAME     apTvSeHooverCompareSegmentationTest
                     APP      HooverCompareSegmentation
                     OPTIONS  -ingt ${INPUTDATA}/maur_GT.tif
                              -inms ${INPUTDATA}/maur_labelled.tif
50 51
                              -outgt ${TEMP}/apTvSeHooverCompareSegmentationTestOutgt.tif
                              -outms ${TEMP}/apTvSeHooverCompareSegmentationTestOutms.tif
52 53 54 55 56
                     TESTENVOPTIONS ${TEMP}/apTvSeHooverCompareSegmentationTest.txt
                     VALID    --compare-ascii ${EPSILON_7}
                             ${BASELINE_FILES}/apTvSeHooverCompareSegmentationTest.txt
                	         ${TEMP}/apTvSeHooverCompareSegmentationTest.txt
                     )
57
                     
58
#--- Segmentation ---#
59 60 61

# Segmentation algorithms parameters
SET(cc_parameters "-filter.cc.expr distance<25")
62 63
SET(edison_parameters "-filter.edison.spatialr 5 -filter.edison.ranger 50 -filter.edison.minsize 10")
SET(meanshift_parameters "-filter.meanshift.spatialr 5 -filter.meanshift.ranger 50 -filter.meanshift.minsize 10")
64
SET(vector_parameters "-mode.vector.tilesize 500 -mode.vector.minsize 50 -mode.vector.simplify 0.1 -mode.vector.outmode ovw")
65

66 67 68
# validation option
SET(meanshift_option "--without-threads")

69 70 71
# Output type dependning on mode
SET(raster_output_format ".tif")
SET(raster_output_option " uint16")
72 73
SET(vector_output_format ".sqlite")

74 75 76 77 78 79 80 81
# Validation depending on mode 
SET(vector_comparison --compare-ogr ${NOTOL})
SET(raster_comparison --compare-image ${NOTOL})

# Reference ffiles depending on modes
SET(vector_ref_path ${BASELINE_FILES})
SET(raster_ref_path ${BASELINE})

82 83 84
# Loop on modes
FOREACH(mode "Raster" "Vector")
STRING(TOLOWER ${mode} lmode)
85

86 87 88 89
# Loop on filters
FOREACH(filter "Edison" "Meanshift" "CC" "Watershed")
STRING(TOLOWER ${filter} lfilter)

90 91
# Derive output file name
SET(OUTFILE apTvSeSegmentation${filter}${mode}${${lmode}_output_format})
92 93

OTB_TEST_APPLICATION(NAME     apTvSeSegmentation${filter}${mode}
94
                     APP      Segmentation
95 96 97 98
                     OPTIONS  -in ${EXAMPLEDATA}/qb_RoadExtract2.tif
                              -filter ${lfilter}
                              ${${lfilter}_parameters}
                              -mode ${lmode}
99
                              -mode.${lmode}.out ${TEMP}/${OUTFILE}${${lmode}_output_option}
100
                              ${${lmode}_parameters}
101
                     VALID    ${${lfilter}_option}
102
                              ${${lmode}_comparison}
103
                              ${${lmode}_ref_path}/${OUTFILE}
104
                              ${TEMP}/${OUTFILE}                           
105
                     )
106 107 108

ENDFOREACH(filter)
ENDFOREACH(mode)
109 110 111 112

SET(filter "CC")
SET(mode "Vector")

Julien Malik's avatar
Julien Malik committed
113 114
STRING(TOLOWER ${filter} lfilter)

115 116
# Add a test for ULOVW
SET(vector_parameters "-mode.vector.tilesize 500 -mode.vector.minsize 50 -mode.vector.simplify 0.1 -mode.vector.outmode ulovw")
117
                     
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
SET(OUTFILE apTvSeSegmentation${filter}${mode}${${lmode}_output_format})

OTB_TEST_APPLICATION(NAME     apTvSeSegmentation${filter}${mode}_ULOVW
                     APP      Segmentation
                     OPTIONS  -in ${EXAMPLEDATA}/qb_RoadExtract2.tif
                              -filter ${lfilter}
                              ${${lfilter}_parameters}
                              -mode ${lmode}
                              -mode.${lmode}.out ${TEMP}/${OUTFILE}${${lmode}_output_option}
                              ${${lmode}_parameters}
                     VALID    ${${lfilter}_option}
                              ${${lmode}_comparison}
                              ${${lmode}_ref_path}/${OUTFILE}
                              ${TEMP}/${OUTFILE}                           
                     )

SET_TESTS_PROPERTIES(apTvSeSegmentation${filter}${mode}_ULOVW PROPERTIES DEPENDS apTvSeSegmentation${filter}${mode})

# Add a test for ULU
SET(vector_parameters "-mode.vector.tilesize 500 -mode.vector.minsize 50 -mode.vector.simplify 0.1 -mode.vector.outmode ulu")
                     
SET(OUTFILE apTvSeSegmentation${filter}${mode}${${lmode}_output_format})

OTB_TEST_APPLICATION(NAME     apTvSeSegmentation${filter}${mode}_ULU
                     APP      Segmentation
                     OPTIONS  -in ${EXAMPLEDATA}/qb_RoadExtract2.tif
                              -filter ${lfilter}
                              ${${lfilter}_parameters}
                              -mode ${lmode}
                              -mode.${lmode}.out ${TEMP}/${OUTFILE}${${lmode}_output_option}
                              ${${lmode}_parameters}
                     VALID    ${${lfilter}_option}
                              ${${lmode}_comparison}
Julien Malik's avatar
Julien Malik committed
151
                              ${${lmode}_ref_path}/${OUTFILE}_ULU
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
                              ${TEMP}/${OUTFILE}                           
                     )

SET_TESTS_PROPERTIES(apTvSeSegmentation${filter}${mode}_ULU PROPERTIES DEPENDS apTvSeSegmentation${filter}${mode})

# Add a test for ULCO
SET(vector_parameters "-mode.vector.tilesize 500 -mode.vector.minsize 50 -mode.vector.simplify 0.1 -mode.vector.outmode ulco")
                     
SET(OUTFILE apTvSeSegmentation${filter}${mode}${${lmode}_output_format})

OTB_TEST_APPLICATION(NAME     apTvSeSegmentation${filter}${mode}_ULCO
                     APP      Segmentation
                     OPTIONS  -in ${EXAMPLEDATA}/qb_RoadExtract2.tif
                              -filter ${lfilter}
                              ${${lfilter}_parameters}
                              -mode ${lmode}
                              -mode.${lmode}.out ${TEMP}/${OUTFILE}${${lmode}_output_option}
                              ${${lmode}_parameters}
                     VALID    ${${lfilter}_option}
                              ${${lmode}_comparison}
Julien Malik's avatar
Julien Malik committed
172
                              ${${lmode}_ref_path}/${OUTFILE}
173 174 175 176
                              ${TEMP}/${OUTFILE}                           
                     )

SET_TESTS_PROPERTIES(apTvSeSegmentation${filter}${mode}_ULCO PROPERTIES DEPENDS apTvSeSegmentation${filter}${mode} WILL_FAIL TRUE)