diff --git a/CMake/ImportJPEG2000.cmake b/CMake/ImportJPEG2000.cmake index e72207f752780a2793ac30a9dedd846d07a556de..27f02f821d3f6dc46ba6a515b9d4378b834ceecd 100644 --- a/CMake/ImportJPEG2000.cmake +++ b/CMake/ImportJPEG2000.cmake @@ -1,8 +1,12 @@ message(STATUS "Importing Jpeg2000...") # Use the openjpeg library. -option(OTB_USE_JPEG2000 "Use to support jpeg2000 image file format." ON) +option(OTB_USE_JPEG2000 "Enable internal support for jpeg2000 image file format." ON) mark_as_advanced(OTB_USE_JPEG2000) +cmake_dependent_option(OTB_USE_JPEG2000_TESTING "Use jpeg2000 images in tests." OFF + "NOT OTB_USE_JPEG2000" ON) +mark_as_advanced(OTB_USE_JPEG2000_TESTING) + if(OTB_USE_JPEG2000) message(STATUS " Enabling Jpeg2000 support") diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index 0c7b3478322fd06034e3e5090368fb126f352de5..bd898a51cb1a2caf32654fe98b53bbb88698db6f 100644 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -25,7 +25,7 @@ set(IO_TESTS10 ${CXX_TEST_PATH}/otbIOTests10) set(IO_TESTS11 ${CXX_TEST_PATH}/otbIOTests11) set(IO_TESTS12 ${CXX_TEST_PATH}/otbIOTests12) -if(OTB_USE_JPEG2000) +if(OTB_USE_JPEG2000_TESTING) set(IO_TESTS13 ${CXX_TEST_PATH}/otbIOTests13) endif() @@ -2025,11 +2025,11 @@ add_test(ioTvMapProjectionAdapterTest ${IO_TESTS12} # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbIOTESTS13 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -if(OTB_USE_JPEG2000) +if(OTB_USE_JPEG2000_TESTING) # -------------------------------------------------------------------------------- # old test suite: - +if(OTB_USE_JPEG2000) # --- JPEG2000 can read --- add_test(ioTuJ2KImageIOCanRead ${IO_TESTS13} otbJPEG2000ImageIOTestCanRead @@ -2043,6 +2043,8 @@ add_test(ioTuJP2ImageIOCanRead ${IO_TESTS13} ) endif() +endif() + #NOTE: baseline generated by openjpeg if(OTB_DATA_USE_LARGEINPUT) add_test(ioTvVectorImageFileReaderWriterJP22TIF ${IO_TESTS9} @@ -2217,6 +2219,7 @@ add_test(ioTvMultiChannelROI_JPEG2000_2_TIF_res5 ${COMMON_TESTS2} ${INPUTDATA}/bretagne.j2k?&resol=5 ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res5_OUT.tif ) +if(OTB_USE_JPEG2000) # -------------------------------------------------------------------------------- # Test the possibility to modify the size of cache used to reduce the decoding operations # O tile in the cache (500K) @@ -2257,6 +2260,7 @@ add_test(ioTvJPEG2000ImageIO_CacheSize_25000 ${IO_TESTS13} otbGenerateClassicalQLWithJPEG2000 ${INPUTDATA}/bretagne.j2k ${TEMP}/ioClassicalQLJPEG2K_bretagne_OUT.tif) +endif() # -------------------------------------------------------------------------------- # Special Case (deactivated by MSD, OpenJPEG now support the larges files so this tests is not relevant @@ -2287,7 +2291,7 @@ foreach( current_file ${GenericTestPHR_DATA_INPUTS} ) math(EXPR GenericTestPHR_TESTNB "${GenericTestPHR_TESTNB} + 1") string(REGEX MATCH "TIFF" PHR_TIFF_FILE ${current_type}) - if(NOT PHR_TIFF_FILE) + if((NOT PHR_TIFF_FILE) AND OTB_USE_JPEG2000) # CanRead add_test(ioTuJ2KImageIOCanRead_${current_type} ${IO_TESTS13} otbJPEG2000ImageIOTestCanRead @@ -3890,18 +3894,25 @@ otbMapProjectionAdapterTest.cxx ) -if(OTB_USE_JPEG2000) +if(OTB_USE_JPEG2000_TESTING) #Reserved for jpeg 2000 + set(BasicIO_SRCS13 otbIOTests13.cxx -otbJPEG2000ImageIOTestCanRead.cxx -otbJPEG2000ImageIOTestCanWrite.cxx otbVectorImageTest.cxx otbMultiResolutionReadingInfo.cxx +) +# add tests specific for JPEG2000ImageIO +if(OTB_USE_JPEG2000) +set(BasicIO_SRCS13 ${BasicIO_SRCS13} +otbJPEG2000ImageIOTestCanRead.cxx +otbJPEG2000ImageIOTestCanWrite.cxx otbGenerateClassicalQLWithJPEG2000.cxx ) endif() +endif() + set(BasicIO_SRCS14 otbIOTests14.cxx @@ -4051,7 +4062,7 @@ OTB_ADD_EXECUTABLE(otbIOTests10 "${BasicIO_SRCS10}" "OTBIO;OTBTesting") OTB_ADD_EXECUTABLE(otbIOTests11 "${BasicIO_SRCS11}" "OTBIO;OTBTesting") OTB_ADD_EXECUTABLE(otbIOTests12 "${BasicIO_SRCS12}" "OTBIO;OTBTesting") -if(OTB_USE_JPEG2000) +if(OTB_USE_JPEG2000_TESTING) if(NOT BUILD_SHARED_LIBS) add_definitions(-DOPJ_STATIC) endif() diff --git a/Testing/Code/IO/otbIOTests13.cxx b/Testing/Code/IO/otbIOTests13.cxx index 85e6958853ed01cb87d30ee176cbbd4394962acf..c513ca47f07f7d776dd535364463ffc565dedb71 100644 --- a/Testing/Code/IO/otbIOTests13.cxx +++ b/Testing/Code/IO/otbIOTests13.cxx @@ -24,10 +24,14 @@ void RegisterTests() { +#ifdef OTB_USE_JPEG2000 REGISTER_TEST(otbJPEG2000ImageIOTestCanRead); REGISTER_TEST(otbJPEG2000ImageIOTestCanWrite); +#endif REGISTER_TEST(otbMultiResolutionReadingInfo); REGISTER_TEST(otbVectorImageTest); REGISTER_TEST(otbVectorImageLegacyTest); +#ifdef OTB_USE_JPEG2000 REGISTER_TEST(otbGenerateClassicalQLWithJPEG2000); +#endif }