MITK_CREATE_MODULE_TESTS()

if(TARGET ${TESTDRIVER})
  mitk_use_modules(TARGET ${TESTDRIVER} PACKAGES ITK|IOXML)
endif()

# mitkAddCustomModuleTest(mitkRoiMeasurementsTests mitkRoiMeasurementsTest ${MITK_DATA_DIR}/ImageStatisticsTestData/)

# All hotspot tests are currently deactivated. See T30375 for details
if (false)
  file(GLOB allHotSpotTests RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/Data/Hotspot" "${CMAKE_CURRENT_SOURCE_DIR}/Data/Hotspot/*.xml")
  foreach(testcase ${allHotSpotTests})
    string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" testcaseName ${testcase})
    mitkAddCustomModuleTest(mitkImageStatisticsHotspotTest_${testcaseName} mitkImageStatisticsHotspotTest ${CMAKE_CURRENT_SOURCE_DIR}/Data/Hotspot/${testcase})
  endforeach()

  #
  # The following lines may be activated to generate new test cases for mitkImageStatisticsHotspotTest.
  # Test cases are generated by mitkMultiGaussianTest. All .xml files in Data/TestGeneration/Input will
  # be processed and transformed into new .xml files containing statistics in Data/TestGeneration/Output.
  #
  if (false)
    set(testInputDir ${CMAKE_CURRENT_SOURCE_DIR}/Data/TestGeneration/Input)
    set(testOutputDir ${CMAKE_CURRENT_SOURCE_DIR}/Data/TestGeneration/Output)
    file(GLOB testcasesToGenerate RELATIVE "${testInputDir}" "${testInputDir}/*.xml")

    if (NOT EXISTS ${testOutputDir})
      file(MAKE_DIRECTORY ${testOutputDir})
    endif()

    foreach(testinput ${testcasesToGenerate})
      string(REGEX REPLACE "[^a-zA-Z0-9_]\\+" "_" testcaseName ${testinput})
      string(REGEX REPLACE "\\.xml" "" testoutput ${testinput})
      message("Generate hotspot test case '${testinput}'. Output in '${testoutput}.xml' and '${testoutput}.nrrd'")
      mitkAddCustomModuleTest(mitkMultiGaussianTest_${testcaseName}
              mitkMultiGaussianTest
              ${testOutputDir}/${testoutput}
              ${testInputDir}/${testinput})
    endforeach()
  endif()
endif()
