├── .gitattributes ├── .gitignore ├── CMakeLists.txt ├── GNU_LICENSE ├── INSTALL ├── Makefile.am ├── Makefile.bcc ├── Makefile.in ├── Makefile.vc6 ├── Makefile.vc9 ├── README ├── TODO ├── aclocal.m4 ├── autom4te.cache ├── output.0 ├── output.1 ├── output.2 ├── output.3 ├── requests ├── traces.0 ├── traces.1 ├── traces.2 └── traces.3 ├── bootstrap.sh ├── cmake └── libicsConfig.cmake.in ├── compile ├── config.guess ├── config.h.in ├── config.sub ├── configure ├── configure.ac ├── depcomp ├── docs ├── Credits.html ├── Documentation.html ├── Enums.html ├── Ics_DataRepresentation.html ├── Ics_Error.html ├── Ics_Header.html ├── Ics_ImelRepresentation.html ├── Links.html ├── LowLevelFunctions.html ├── TopLevelFunctions.html ├── Usage.html ├── iexplorefix.css ├── index.html └── libics.css ├── install-sh ├── libics.def ├── libics.h ├── libics_binary.c ├── libics_compress.c ├── libics_conf.h.in ├── libics_data.c ├── libics_gzip.c ├── libics_history.c ├── libics_intern.h ├── libics_ll.h ├── libics_preview.c ├── libics_read.c ├── libics_sensor.c ├── libics_sensor.h ├── libics_test.c ├── libics_test.h ├── libics_top.c ├── libics_util.c ├── libics_write.c ├── ltmain.sh ├── m4 ├── libtool.m4 ├── ltoptions.m4 ├── ltsugar.m4 ├── ltversion.m4 └── lt~obsolete.m4 ├── missing ├── support ├── cpp_interface │ ├── CMakeLists.txt │ ├── libics.cpp │ ├── libics.hpp │ ├── test_history.cpp │ ├── test_ics2a.cpp │ ├── test_ics2b.cpp │ └── test_metadata.cpp ├── icsviewer │ ├── README │ ├── icsviewer.dsp │ ├── icsviewer.dsw │ ├── readics.c │ ├── resource.h │ ├── viewer.c │ ├── viewer.ico │ ├── viewer.rc │ └── writedib.c └── matlab │ ├── README │ ├── icsread.c │ ├── icswrite.c │ └── makefile ├── test-driver ├── test ├── testim.ics ├── testim.ids ├── testim_c.ics └── testim_c.ids.Z ├── test_compress.c ├── test_compress.sh ├── test_gzip.c ├── test_gzip.sh ├── test_history.c ├── test_history.sh ├── test_ics1.c ├── test_ics1.sh ├── test_ics2a.c ├── test_ics2a.sh ├── test_ics2b.c ├── test_ics2b.sh ├── test_metadata.c ├── test_metadata1.sh ├── test_metadata2.sh ├── test_strides.c ├── test_strides.sh ├── test_strides2.c ├── test_strides2.sh ├── test_strides3.c └── test_strides3.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Fix incorrect language classifications on GitHub.com 2 | /aclocal.m4 linguist-vendored 3 | /autom4te.cache/* linguist-language=text linguist-generated=true 4 | /compile linguist-vendored 5 | /config.* linguist-vendored 6 | /configure linguist-vendored 7 | /depcomp linguist-vendored 8 | /install-sh linguist-vendored 9 | /ltmain.sh linguist-vendored 10 | /m4/* linguist-vendored 11 | /Makefile.in linguist-vendored 12 | /missing linguist-vendored 13 | /test-driver linguist-vendored 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .deps/ 3 | .libs/ 4 | *.la 5 | *.lo 6 | *.o 7 | *.tar.gz 8 | *~ 9 | config.h 10 | config.log 11 | config.status 12 | libics_conf.h 13 | libtool 14 | Makefile 15 | stamp-* 16 | stamp-h2 17 | target* 18 | 19 | # aclocal.m4 20 | # autom4te.cache/ 21 | # compile 22 | # config.guess 23 | # config.h.in 24 | # config.sub 25 | # configure 26 | # depcomp 27 | # install-sh 28 | # ltmain.sh 29 | # m4/ 30 | # Makefile.in 31 | # missing 32 | # test-driver 33 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # libics: Image Cytometry Standard file reading and writing. 4 | # 5 | # Copyright (C) 2000-2013, 2016 Cris Luengo and others 6 | # Copyright 2015, 2016: 7 | # Scientific Volume Imaging Holding B.V. 8 | # Hilversum, The Netherlands. 9 | # https://www.svi.nl 10 | # 11 | # CMakeLists.txt 12 | # Created by Paul Barber , Feb 2017 13 | # Heavily modified by Cris Luengo, July 2017 14 | # 15 | ############################################################################## 16 | cmake_minimum_required(VERSION 3.5) 17 | if(POLICY CMP0068) 18 | cmake_policy(SET CMP0068 NEW) 19 | endif() 20 | 21 | project(libics VERSION 1.6.8) 22 | 23 | # Note: the version number above is not yet used anywhere. 24 | # TODO: rewrite the header file with this version number. 25 | # The line below does not work: we need the installed header file to contain the version number also. 26 | #add_definitions(-DICSLIB_VERSION="${libics_VERSION}") 27 | 28 | # Compiler flags 29 | set(CMAKE_C_STANDARD 99) 30 | set(CMAKE_C_STANDARD_REQUIRED on) 31 | 32 | if(CMAKE_C_COMPILER_ID MATCHES "Clang") # also matchs "AppleClang" 33 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wconversion -Wsign-conversion -pedantic") 34 | elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU") 35 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wconversion -Wsign-conversion -Wno-unused-parameter -pedantic") 36 | elseif(CMAKE_C_COMPILER_ID STREQUAL "Intel") 37 | # TODO: compiler flags for Intel compiler 38 | elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") 39 | # TODO: compiler flags for MSVC compiler 40 | endif() 41 | 42 | # Debug or Release? 43 | if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) 44 | set(CMAKE_BUILD_TYPE Release) 45 | endif() 46 | 47 | # ICS 48 | configure_file(libics_conf.h.in ${CMAKE_CURRENT_SOURCE_DIR}/libics_conf.h COPYONLY) 49 | set(SOURCES 50 | libics_binary.c 51 | libics_compress.c 52 | libics_data.c 53 | libics_gzip.c 54 | libics_history.c 55 | libics_preview.c 56 | libics_read.c 57 | libics_sensor.c 58 | libics_test.c 59 | libics_top.c 60 | libics_util.c 61 | libics_write.c 62 | libics_conf.h 63 | ) 64 | 65 | set(HEADERS 66 | libics.h 67 | libics_intern.h 68 | libics_ll.h 69 | libics_sensor.h 70 | libics_test.h 71 | ) 72 | 73 | add_library(libics ${SOURCES} ${HEADERS}) 74 | 75 | if(BUILD_SHARED_LIBS) 76 | target_compile_definitions(libics PRIVATE BUILD_ICSLIB) # When compiling DLL/SO 77 | target_compile_definitions(libics INTERFACE USE_ICSLIB_DLL) # When linking against DLL/SO 78 | endif() 79 | 80 | target_include_directories(libics PUBLIC $) 81 | 82 | if(UNIX) 83 | set_target_properties(libics PROPERTIES OUTPUT_NAME "ics") 84 | target_link_libraries(libics PUBLIC m) 85 | endif(UNIX) 86 | 87 | # Link against zlib 88 | find_package(ZLIB) 89 | if(ZLIB_FOUND) 90 | set(LIBICS_USE_ZLIB TRUE CACHE BOOL "Use Zlib in libics") 91 | endif() 92 | if(LIBICS_USE_ZLIB) 93 | target_link_libraries(libics PUBLIC ${ZLIB_LIBRARIES}) 94 | target_include_directories(libics PRIVATE ${ZLIB_INCLUDE_DIRS}) 95 | target_compile_definitions(libics PUBLIC -DICS_ZLIB) 96 | endif() 97 | 98 | # Reentrant string tokenization 99 | include(CheckFunctionExists) 100 | check_function_exists(strtok_r HAVE_STRTOK_R) 101 | if(HAVE_STRTOK_R) 102 | target_compile_definitions(libics PRIVATE -DHAVE_STRTOK_R) 103 | endif() 104 | 105 | # Install 106 | export(TARGETS libics FILE cmake/libicsTargets.cmake) 107 | 108 | include(CMakePackageConfigHelpers) 109 | write_basic_package_version_file( 110 | cmake/libicsConfigVersion.cmake 111 | VERSION ${PACKAGE_VERSION} 112 | COMPATIBILITY AnyNewerVersion) 113 | 114 | configure_package_config_file( 115 | cmake/libicsConfig.cmake.in 116 | cmake/libicsConfig.cmake 117 | INSTALL_DESTINATION cmake/) 118 | 119 | install(TARGETS libics 120 | EXPORT libicsTargets 121 | ARCHIVE DESTINATION lib 122 | LIBRARY DESTINATION lib 123 | RUNTIME DESTINATION bin 124 | INCLUDES DESTINATION include) 125 | 126 | install(FILES ${HEADERS} DESTINATION include) 127 | 128 | install(FILES 129 | ${CMAKE_CURRENT_BINARY_DIR}/cmake/libicsConfig.cmake 130 | ${CMAKE_CURRENT_BINARY_DIR}/cmake/libicsConfigVersion.cmake 131 | DESTINATION cmake/) 132 | 133 | install(EXPORT libicsTargets DESTINATION cmake) 134 | 135 | 136 | # Unit tests 137 | enable_testing() 138 | 139 | add_executable(test_ics1 EXCLUDE_FROM_ALL test_ics1.c) 140 | target_link_libraries(test_ics1 libics) 141 | add_executable(test_ics2a EXCLUDE_FROM_ALL test_ics2a.c) 142 | target_link_libraries(test_ics2a libics) 143 | add_executable(test_ics2b EXCLUDE_FROM_ALL test_ics2b.c) 144 | target_link_libraries(test_ics2b libics) 145 | if(LIBICS_USE_ZLIB) 146 | add_executable(test_gzip EXCLUDE_FROM_ALL test_gzip.c) 147 | target_link_libraries(test_gzip libics) 148 | endif() 149 | add_executable(test_compress EXCLUDE_FROM_ALL test_compress.c) 150 | target_link_libraries(test_compress libics) 151 | add_executable(test_strides EXCLUDE_FROM_ALL test_strides.c) 152 | target_link_libraries(test_strides libics) 153 | add_executable(test_strides2 EXCLUDE_FROM_ALL test_strides2.c) 154 | target_link_libraries(test_strides2 libics) 155 | add_executable(test_strides3 EXCLUDE_FROM_ALL test_strides3.c) 156 | target_link_libraries(test_strides3 libics) 157 | add_executable(test_metadata EXCLUDE_FROM_ALL test_metadata.c) 158 | target_link_libraries(test_metadata libics) 159 | add_executable(test_history EXCLUDE_FROM_ALL test_history.c) 160 | target_link_libraries(test_history libics) 161 | 162 | set(TEST_PROGRAMS 163 | test_ics1 164 | test_ics2a 165 | test_ics2b 166 | test_compress 167 | test_strides 168 | test_strides2 169 | test_strides3 170 | test_metadata 171 | test_history 172 | ) 173 | if(LIBICS_USE_ZLIB) 174 | set(TEST_PROGRAMS ${TEST_PROGRAMS} test_gzip) 175 | endif() 176 | add_custom_target(all_tests DEPENDS ${TEST_PROGRAMS}) 177 | 178 | add_test(ctest_build_test_code "${CMAKE_COMMAND}" --build "${PROJECT_BINARY_DIR}" --target all_tests) 179 | add_test(NAME test_ics1 COMMAND test_ics1 "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_v1.ics) 180 | set_tests_properties(test_ics1 PROPERTIES DEPENDS ctest_build_test_code) 181 | add_test(NAME test_ics2a COMMAND test_ics2a "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_v2a.ics) 182 | set_tests_properties(test_ics2a PROPERTIES DEPENDS ctest_build_test_code) 183 | add_test(NAME test_ics2b COMMAND test_ics2b "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_v2b.ics) 184 | set_tests_properties(test_ics2b PROPERTIES DEPENDS ctest_build_test_code) 185 | if(LIBICS_USE_ZLIB) 186 | add_test(NAME test_gzip COMMAND test_gzip "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_v2z.ics) 187 | set_tests_properties(test_gzip PROPERTIES DEPENDS ctest_build_test_code) 188 | endif() 189 | add_test(NAME test_compress COMMAND test_compress "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" "${CMAKE_CURRENT_SOURCE_DIR}/test/testim_c.ics") 190 | set_tests_properties(test_compress PROPERTIES DEPENDS ctest_build_test_code) 191 | add_test(NAME test_strides COMMAND test_strides "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_s.ics) 192 | set_tests_properties(test_strides PROPERTIES DEPENDS ctest_build_test_code) 193 | add_test(NAME test_strides2 COMMAND test_strides2 "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_s2.ics) 194 | set_tests_properties(test_strides2 PROPERTIES DEPENDS ctest_build_test_code) 195 | add_test(NAME test_strides3 COMMAND test_strides3 "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_s3.ics) 196 | set_tests_properties(test_strides3 PROPERTIES DEPENDS ctest_build_test_code) 197 | add_test(NAME test_metadata1 COMMAND test_metadata result_v1.ics) 198 | set_tests_properties(test_metadata1 PROPERTIES DEPENDS test_ics1) 199 | add_test(NAME test_metadata2 COMMAND test_metadata result_v2a.ics) 200 | set_tests_properties(test_metadata2 PROPERTIES DEPENDS test_ics2a) 201 | add_test(NAME test_metadata3 COMMAND test_metadata result_v2b.ics) 202 | set_tests_properties(test_metadata3 PROPERTIES DEPENDS test_ics2b) 203 | if(LIBICS_USE_ZLIB) 204 | add_test(NAME test_metadata4 COMMAND test_metadata result_v2z.ics) 205 | set_tests_properties(test_metadata4 PROPERTIES DEPENDS test_gzip) 206 | endif() 207 | add_test(NAME test_history COMMAND test_history result_v1.ics) 208 | set_tests_properties(test_history PROPERTIES DEPENDS test_ics1) 209 | 210 | 211 | # Include the C++ interface? 212 | set(LIBICS_INCLUDE_CPP TRUE CACHE BOOL "Include the C++ interface") 213 | if(LIBICS_INCLUDE_CPP) 214 | include(support/cpp_interface/CMakeLists.txt) 215 | endif() 216 | 217 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # libics: Image Cytometry Standard file reading and writing. 3 | # 4 | # Copyright (C) 2000-2013, 2016 Cris Luengo and others 5 | # Copyright 2015, 2016: 6 | # Scientific Volume Imaging Holding B.V. 7 | # Hilversum, The Netherlands. 8 | # https://www.svi.nl 9 | # 10 | # Script for automake and autoconfig. 11 | # Written by Peter Verveer, Cris Luengo 12 | 13 | ACLOCAL_AMFLAGS = -I m4 14 | AUTOMAKE_OPTIONS = foreign 15 | 16 | lib_LTLIBRARIES = libics.la 17 | libics_la_LDFLAGS = -version-info $(ICS_LT_VERSION) -no-undefined 18 | 19 | # list all sources and include files that are not installed, but are 20 | # distributed, except for libics_conf.h, which is generated from 21 | # libics_conf.h.in: 22 | libics_la_SOURCES = libics_binary.c \ 23 | libics_compress.c \ 24 | libics_data.c \ 25 | libics_gzip.c \ 26 | libics_history.c \ 27 | libics_preview.c \ 28 | libics_read.c \ 29 | libics_sensor.c \ 30 | libics_test.c \ 31 | libics_top.c \ 32 | libics_util.c \ 33 | libics_write.c \ 34 | libics_intern.h 35 | 36 | # list all include files that must be installed and distributed: 37 | include_HEADERS = libics.h \ 38 | libics_ll.h \ 39 | libics_sensor.h \ 40 | libics_test.h 41 | 42 | # list all test programs 43 | check_PROGRAMS = test_ics1 \ 44 | test_ics2a \ 45 | test_ics2b \ 46 | test_compress \ 47 | test_gzip \ 48 | test_strides \ 49 | test_strides2 \ 50 | test_strides3 \ 51 | test_metadata \ 52 | test_history 53 | 54 | test_ics1_SOURCES = test_ics1.c 55 | test_ics2a_SOURCES = test_ics2a.c 56 | test_ics2b_SOURCES = test_ics2b.c 57 | test_compress_SOURCES = test_compress.c 58 | test_gzip_SOURCES = test_gzip.c 59 | test_strides_SOURCES = test_strides.c 60 | test_strides2_SOURCES = test_strides2.c 61 | test_strides3_SOURCES = test_strides3.c 62 | test_metadata_SOURCES = test_metadata.c 63 | test_history_SOURCES = test_history.c 64 | 65 | test_ics1_LDADD = libics.la 66 | test_ics2a_LDADD = libics.la 67 | test_ics2b_LDADD = libics.la 68 | test_compress_LDADD = libics.la 69 | test_gzip_LDADD = libics.la 70 | test_strides_LDADD = libics.la 71 | test_strides2_LDADD = libics.la 72 | test_strides3_LDADD = libics.la 73 | test_metadata_LDADD = libics.la 74 | test_history_LDADD = libics.la 75 | 76 | TESTS1 = test_ics1.sh \ 77 | test_ics2a.sh \ 78 | test_ics2b.sh \ 79 | test_strides.sh \ 80 | test_strides2.sh \ 81 | test_strides3.sh \ 82 | test_metadata1.sh \ 83 | test_history.sh 84 | 85 | if ICS_ZLIB 86 | TESTS2 = test_gzip.sh test_metadata2.sh 87 | else 88 | TESTS2 = 89 | endif 90 | 91 | if ICS_DO_GZEXT 92 | TESTS3 = test_compress.sh 93 | else 94 | TESTS3 = 95 | endif 96 | 97 | TESTS = $(TESTS1) $(TESTS2) $(TESTS3) 98 | 99 | # list other files that must go into the distribution: 100 | EXTRA_DIST = INSTALL \ 101 | GNU_LICENSE \ 102 | README \ 103 | bootstrap.sh \ 104 | Makefile.bcc \ 105 | Makefile.vc6 \ 106 | Makefile.vc9 \ 107 | docs/index.html \ 108 | docs/Credits.html \ 109 | docs/Documentation.html \ 110 | docs/Enums.html \ 111 | docs/Ics_DataRepresentation.html \ 112 | docs/Ics_Error.html \ 113 | docs/Ics_Header.html \ 114 | docs/Ics_ImelRepresentation.html \ 115 | docs/LowLevelFunctions.html \ 116 | docs/TopLevelFunctions.html \ 117 | docs/Usage.html \ 118 | docs/libics.css \ 119 | docs/iexplorefix.css \ 120 | support/icsviewer/README \ 121 | support/icsviewer/icsviewer.dsp \ 122 | support/icsviewer/icsviewer.dsw \ 123 | support/icsviewer/readics.c \ 124 | support/icsviewer/resource.h \ 125 | support/icsviewer/viewer.c \ 126 | support/icsviewer/viewer.ico \ 127 | support/icsviewer/viewer.rc \ 128 | support/icsviewer/writedib.c \ 129 | support/matlab/README \ 130 | support/matlab/icsread.c \ 131 | support/matlab/icswrite.c \ 132 | support/matlab/makefile \ 133 | test/testim.ics \ 134 | test/testim.ids \ 135 | test/testim_c.ics \ 136 | test/testim_c.ids.Z \ 137 | $(TESTS) 138 | 139 | # list other files that should be cleaned 140 | #MOSTLYCLEANFILES = result_v1.ics result_v1.ids result_v2a.ics result_v2b.ics 141 | mostlyclean-local: 142 | -rm -f result* 143 | 144 | -------------------------------------------------------------------------------- /Makefile.bcc: -------------------------------------------------------------------------------- 1 | # 2 | # libics: Image Cytometry Standard file reading and writing. 3 | # 4 | # Copyright (C) 2000-2013, 2016 Cris Luengo and others 5 | # Copyright 2015, 2016: 6 | # Scientific Volume Imaging Holding B.V. 7 | # Hilversum, The Netherlands. 8 | # https://www.svi.nl 9 | # 10 | # Makefile to compile libics under Win32 with Borland C++ 5 11 | # 12 | # 13 | # TO COMPILE: 14 | # make -fMakefile.bcc 15 | # For a dynamic library: 16 | # make -fMakefile.bcc dynamic 17 | 18 | # 19 | # Remove the following line to disable ZLIB support 20 | # 21 | ZLIB_SUPPORT = 1 22 | 23 | # 24 | # Paths 25 | # 26 | BC_ROOT = C:\BCC55 27 | BC_LIB = $(BC_ROOT)\lib 28 | LIBPATH = . 29 | ZLIB_PATH = ..\bcc_zlib-1.2.3 30 | ZLIB_LIB = $(ZLIB_PATH)\zlib.lib 31 | 32 | # 33 | # Borland C++ tools 34 | # 35 | CC = bcc32 -c -P- 36 | LIB = tlib 37 | LINK = ilink32 -Tpd -Gi 38 | 39 | # 40 | # Other Defines 41 | # 42 | LIBNAME = $(LIBPATH)\libics.lib 43 | DLLNAME = $(LIBPATH)\libics.dll 44 | DLLIMPNAME = $(LIBPATH)\libics.dll.lib 45 | LIBOBJECTS = libics_read.obj \ 46 | libics_write.obj \ 47 | libics_binary.obj \ 48 | libics_gzip.obj \ 49 | libics_compress.obj \ 50 | libics_data.obj \ 51 | libics_util.obj \ 52 | libics_top.obj \ 53 | libics_history.obj \ 54 | libics_preview.obj \ 55 | libics_sensor.obj \ 56 | libics_test.obj 57 | 58 | # 59 | # Options 60 | # 61 | DEFINES = -DWIN32 -DBUILD_ICSLIB 62 | INCLUDE = -I.;$(BC_ROOT)\include 63 | CFLAGS = -3 -A -a8 64 | 65 | !ifdef DEBUG 66 | CFLAGS = $(CFLAGS) -v -y -w 67 | !else 68 | CFLAGS = $(CFLAGS) -O2 -d -w- 69 | !endif 70 | 71 | !ifdef ZLIB_SUPPORT 72 | DEFINES = $(DEFINES) -DICS_ZLIB 73 | INCLUDE = $(INCLUDE) -I"$(ZLIB_PATH)" 74 | LIBS = $(LIBS) "$(ZLIB_LIB)" 75 | !endif 76 | 77 | # 78 | # Dependency List 79 | # 80 | .AUTODEPEND 81 | .precious: $(LIBNAME) $(DLLNAME) 82 | all : static 83 | static : libics_conf.h $(LIBNAME) 84 | dynamic : libics_conf.h $(DLLNAME) 85 | 86 | $(LIBNAME) : $(LIBOBJECTS) 87 | @if not exist $(LIBPATH) md $(LIBPATH) 88 | @&-$(LIB) $@ /C -+$? 89 | 90 | $(DLLNAME) : $(LIBOBJECTS) 91 | @if not exist $(LIBPATH) md $(LIBPATH) 92 | @$(LINK) $** , $@ , , $(BC_LIB)\cw32.lib $(BC_LIB)\import32.lib $(LIBS) 93 | @move $(DLLNAME:.dll=.lib) $(DLLIMPNAME) 94 | 95 | .c.obj: 96 | @$(CC) $(CFLAGS) $(DEFINES) $(INCLUDE) -o$@ $** 97 | 98 | libics_conf.h : libics_conf.h.in 99 | @copy libics_conf.h.in libics_conf.h 100 | 101 | clean : 102 | @-del /q *.obj 103 | @-del /q $(LIBNAME) 104 | @-del /q $(LIBNAME:.lib=.BAK) 105 | @-del /q $(DLLNAME) 106 | @-del /q $(DLLIMPNAME) 107 | @-del /q $(DLLNAME:.dll=.lib) 108 | @-del /q $(DLLNAME:.dll=.exp) 109 | @-del /q $(DLLNAME:.dll=.il?) 110 | @-del /q $(DLLNAME:.dll=.tds) 111 | @-del /q $(DLLNAME:.dll=.map) 112 | 113 | -------------------------------------------------------------------------------- /Makefile.vc6: -------------------------------------------------------------------------------- 1 | # 2 | # libics: Image Cytometry Standard file reading and writing. 3 | # 4 | # Copyright (C) 2000-2013, 2016 Cris Luengo and others 5 | # Copyright 2015, 2016: 6 | # Copyright 2015, 2016: 7 | # Scientific Volume Imaging Holding B.V. 8 | # Hilversum, The Netherlands. 9 | # https://www.svi.nl 10 | # 11 | # Makefile to compile libics under Win32 with Visual C++ 5 / 6 12 | # 13 | # 14 | # TO COMPILE: 15 | # nmake /f Makefile.vc 16 | # For a dynamic library: 17 | # nmake /f Makefile.vc dynamic 18 | 19 | # 20 | # Remove the following line to disable ZLIB support 21 | # 22 | ZLIB_SUPPORT = 1 23 | 24 | # 25 | # Paths 26 | # 27 | MSVC_ROOT = $(MSVCDIR) 28 | MSVC_LIB = $(MSVCDIR)\lib 29 | LIBPATH = . 30 | ZLIB_PATH = ..\vc_zlib-1.2.3 31 | ZLIB_LIB = $(ZLIB_PATH)\zlib.lib 32 | 33 | # 34 | # Microsoft C++ tools 35 | # 36 | CC = cl /c 37 | LIB = lib 38 | LINK = link /DLL 39 | 40 | # 41 | # Other Defines 42 | # 43 | LIBNAME = $(LIBPATH)\libics.lib 44 | DLLNAME = $(LIBPATH)\libics.dll 45 | DLLIMPNAME = $(LIBPATH)\libics.dll.lib 46 | LIBOBJECTS = libics_read.obj \ 47 | libics_write.obj \ 48 | libics_binary.obj \ 49 | libics_gzip.obj \ 50 | libics_compress.obj \ 51 | libics_data.obj \ 52 | libics_util.obj \ 53 | libics_top.obj \ 54 | libics_history.obj \ 55 | libics_preview.obj \ 56 | libics_sensor.obj \ 57 | libics_test.obj 58 | 59 | # 60 | # Options 61 | # 62 | DEFINES = /DWIN32 /DBUILD_ICSLIB 63 | INCLUDE = /I. /I"$(MSVC_ROOT)\include" 64 | CFLAGS = /nologo /YX /Op /Zp8 /Gd /W3 65 | 66 | !ifdef DEBUG 67 | CFLAGS = $(CFLAGS) /MDd /LDd /Gm /Zi /Od 68 | !else 69 | CFLAGS = $(CFLAGS) /MD /LD /O2 /Ob2 /G5 /GD 70 | !endif 71 | 72 | !ifdef ZLIB_SUPPORT 73 | DEFINES = $(DEFINES) /DICS_ZLIB 74 | INCLUDE = $(INCLUDE) /I"$(ZLIB_PATH)" 75 | LIBS = $(LIBS) "$(ZLIB_LIB)" 76 | !endif 77 | 78 | # 79 | # Dependency List 80 | # 81 | all : static 82 | static : libics_conf.h $(LIBNAME) 83 | dynamic : libics_conf.h $(DLLNAME) 84 | 85 | $(LIBNAME) : $(LIBOBJECTS) 86 | @if not exist $(LIBPATH) md $(LIBPATH) 87 | @$(LIB) /out:$@ $** $(LIBS) 88 | 89 | $(DLLNAME) : $(LIBOBJECTS) 90 | @if not exist $(LIBPATH) md $(LIBPATH) 91 | $(LINK) $** $(LIBS) /OUT:$@ /LIBPATH:"$(MSVC_LIB)" /IMPLIB:$(DLLIMPNAME) 92 | 93 | .c.obj: 94 | @$(CC) $(CFLAGS) $(DEFINES) $(INCLUDE) /Fo$@ $** 95 | 96 | libics_conf.h : libics_conf.h.in 97 | @copy libics_conf.h.in libics_conf.h 98 | 99 | clean : 100 | @-del /q *.obj 101 | @-del /q *.pch 102 | @-del /q $(LIBNAME) 103 | @-del /q $(DLLNAME) 104 | @-del /q $(DLLNAME).exp 105 | @-del /q $(DLLIMPNAME) 106 | 107 | -------------------------------------------------------------------------------- /Makefile.vc9: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # libics: Image Cytometry Standard file reading and writing. 4 | # 5 | # Copyright (C) 2000-2013, 2016 Cris Luengo and others 6 | # Copyright 2015, 2016: 7 | # Scientific Volume Imaging Holding B.V. 8 | # Hilversum, The Netherlands. 9 | # https://www.svi.nl 10 | # 11 | # Makefile to compile libics under Win32 platfom with Visual C++ 9.0/2008 12 | # Modified by David Svoboda , October 2009 13 | # 14 | # 15 | # To compile and build: 16 | # nmake /f Makefile.vc9 17 | # 18 | # To clean: 19 | # name /f Makefile.vc9 clean 20 | # 21 | ############################################################################## 22 | !include 23 | 24 | # 25 | # debug/release version 26 | # 27 | DEBUG = 0 28 | 29 | # 30 | # shared/static version 31 | # 32 | SHARED = 1 33 | 34 | # 35 | # Comment the following line to disable ZLIB support 36 | # 37 | ZLIB_SUPPORT = 1 38 | 39 | !if $(ZLIB_SUPPORT) 40 | # change the path to fit the location of Zlib on your computer 41 | ZLIB_PATH = D:\devel\lib\zlib 42 | ZLIB_LIB = $(ZLIB_PATH)\lib\zlib.lib 43 | !endif 44 | 45 | # 46 | # Microsoft C++ tools and paths 47 | # 48 | MSVC_ROOT = $(VSINSTALLDIR)\VC 49 | MSVC_LIB = $(MSVC_ROOT)\lib 50 | MSVC_INCLUDE = $(MSVC_ROOT)\include 51 | 52 | # 53 | # Names 54 | # 55 | LIBNAME = libics 56 | SOURCES = libics_read.obj \ 57 | libics_write.obj \ 58 | libics_binary.obj \ 59 | libics_gzip.obj \ 60 | libics_compress.obj \ 61 | libics_data.obj \ 62 | libics_util.obj \ 63 | libics_top.obj \ 64 | libics_history.obj \ 65 | libics_preview.obj \ 66 | libics_sensor.obj \ 67 | libics_test.obj 68 | 69 | # 70 | # Options 71 | # 72 | DEFINES = /DWIN32 /DBUILD_ICSLIB 73 | INCLUDE = /I. /I"$(MSVC_ROOT)\include" 74 | LDFLAGS= /dll /manifest 75 | CFLAGS = /nologo /c 76 | 77 | !if $(DEBUG) 78 | CFLAGS = $(CFLAGS) /MDd 79 | DEFINES = $(DEFINES) /DDEBUG 80 | DEBUG_FLAG = d 81 | !else 82 | CFLAGS = $(CFLAGS) /MD /O2 83 | !endif 84 | 85 | !if $(ZLIB_SUPPORT) 86 | DEFINES = $(DEFINES) /DICS_ZLIB 87 | INCLUDE = $(INCLUDE) /I"$(ZLIB_PATH)\include" 88 | LIBS = $(LIBS) "$(ZLIB_LIB)" 89 | !endif 90 | 91 | # 92 | # Dependency list 93 | # 94 | !if $(SHARED) 95 | all: libics_conf.h $(LIBNAME)$(DEBUG_FLAG).dll 96 | !else 97 | all: libics_conf.h $(LIBNAME)$(DEBUG_FLAG).lib 98 | !endif 99 | 100 | $(LIBNAME)$(DEBUG_FLAG).lib: $(SOURCES) 101 | $(implib) /out:$@ $** $(LIBS) 102 | 103 | $(LIBNAME)$(DEBUG_FLAG).dll: $(SOURCES) 104 | $(link) $(LDFLAGS) $** /out:$@ /implib:"$(LIBNAME)$(DEBUG_FLAG).lib" /libpath:"$(MSVC_LIB)" $(LIBS) 105 | 106 | .c.obj: 107 | $(cc) $(CFLAGS) $(DEFINES) $(INCLUDE) /Fo$@ $** 108 | 109 | libics_conf.h : libics_conf.h.in 110 | copy libics_conf.h.in libics_conf.h 111 | 112 | clean: 113 | -del /q *.obj 114 | -del /q *.pch 115 | -del /q $(LIBNAME)$(DEBUG_FLAG).lib 116 | -del /q $(LIBNAME)$(DEBUG_FLAG).dll 117 | -del /q $(LIBNAME)$(DEBUG_FLAG).exp 118 | -del /q *.manifest 119 | -del /q libics_conf.h 120 | 121 | 122 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | libics to do list 2 | ----------------- 3 | 4 | - Add bzip2 support, or rather xz (through XZ Utils). 5 | 6 | - 1-bit-per-pixel data should be packed when written. Ics_DataType 7 | should then add a Ics_uint1 or Ics_binary data type. Tomás Majtner 8 | submitted some code that gets us pretty close to this. 9 | 10 | - IcsGetPreviewData() should look for dimensions labelled "x" and "y". 11 | If one of them is not present, use first available dimension instead. 12 | Read the data using IcsGetROIData(). Make sure the planes are counted 13 | over the dimensions that are not considered "x" and "y". 14 | 15 | - The MATLAB MEX-files ICSREAD should also look for dimensions labelled 16 | "x", "y", "z", "t" or "time" and "probe". Reorder so "probe" is at the 17 | end, and x, y, z, t are in that order at the beginning. 18 | 19 | - Make a function IcsGetROIDataWithStrides(). IcsGetROIData() and 20 | IcsGetDataWithStrides() should be direct calls to this function 21 | with some NULL pointers. Maybe even macros? 22 | 23 | - IrfanView plugin should be updated, it still has a 3 year old bug. 24 | -------------------------------------------------------------------------------- /autom4te.cache/output.3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svi-opensource/libics/996a49275150e7bedcc5f46b9dc39e168bb6b875/autom4te.cache/output.3 -------------------------------------------------------------------------------- /autom4te.cache/traces.3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svi-opensource/libics/996a49275150e7bedcc5f46b9dc39e168bb6b875/autom4te.cache/traces.3 -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | # only needed if you change Makefile.am or configure.in 2 | 3 | autoreconf --install --force 4 | -------------------------------------------------------------------------------- /cmake/libicsConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") 4 | check_required_components("@PROJECT_NAME@") 5 | -------------------------------------------------------------------------------- /compile: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Wrapper for compilers which do not understand '-c -o'. 3 | 4 | scriptversion=2012-10-14.11; # UTC 5 | 6 | # Copyright (C) 1999-2014 Free Software Foundation, Inc. 7 | # Written by Tom Tromey . 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | # This file is maintained in Automake, please report 28 | # bugs to or send patches to 29 | # . 30 | 31 | nl=' 32 | ' 33 | 34 | # We need space, tab and new line, in precisely that order. Quoting is 35 | # there to prevent tools from complaining about whitespace usage. 36 | IFS=" "" $nl" 37 | 38 | file_conv= 39 | 40 | # func_file_conv build_file lazy 41 | # Convert a $build file to $host form and store it in $file 42 | # Currently only supports Windows hosts. If the determined conversion 43 | # type is listed in (the comma separated) LAZY, no conversion will 44 | # take place. 45 | func_file_conv () 46 | { 47 | file=$1 48 | case $file in 49 | / | /[!/]*) # absolute file, and not a UNC file 50 | if test -z "$file_conv"; then 51 | # lazily determine how to convert abs files 52 | case `uname -s` in 53 | MINGW*) 54 | file_conv=mingw 55 | ;; 56 | CYGWIN*) 57 | file_conv=cygwin 58 | ;; 59 | *) 60 | file_conv=wine 61 | ;; 62 | esac 63 | fi 64 | case $file_conv/,$2, in 65 | *,$file_conv,*) 66 | ;; 67 | mingw/*) 68 | file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` 69 | ;; 70 | cygwin/*) 71 | file=`cygpath -m "$file" || echo "$file"` 72 | ;; 73 | wine/*) 74 | file=`winepath -w "$file" || echo "$file"` 75 | ;; 76 | esac 77 | ;; 78 | esac 79 | } 80 | 81 | # func_cl_dashL linkdir 82 | # Make cl look for libraries in LINKDIR 83 | func_cl_dashL () 84 | { 85 | func_file_conv "$1" 86 | if test -z "$lib_path"; then 87 | lib_path=$file 88 | else 89 | lib_path="$lib_path;$file" 90 | fi 91 | linker_opts="$linker_opts -LIBPATH:$file" 92 | } 93 | 94 | # func_cl_dashl library 95 | # Do a library search-path lookup for cl 96 | func_cl_dashl () 97 | { 98 | lib=$1 99 | found=no 100 | save_IFS=$IFS 101 | IFS=';' 102 | for dir in $lib_path $LIB 103 | do 104 | IFS=$save_IFS 105 | if $shared && test -f "$dir/$lib.dll.lib"; then 106 | found=yes 107 | lib=$dir/$lib.dll.lib 108 | break 109 | fi 110 | if test -f "$dir/$lib.lib"; then 111 | found=yes 112 | lib=$dir/$lib.lib 113 | break 114 | fi 115 | if test -f "$dir/lib$lib.a"; then 116 | found=yes 117 | lib=$dir/lib$lib.a 118 | break 119 | fi 120 | done 121 | IFS=$save_IFS 122 | 123 | if test "$found" != yes; then 124 | lib=$lib.lib 125 | fi 126 | } 127 | 128 | # func_cl_wrapper cl arg... 129 | # Adjust compile command to suit cl 130 | func_cl_wrapper () 131 | { 132 | # Assume a capable shell 133 | lib_path= 134 | shared=: 135 | linker_opts= 136 | for arg 137 | do 138 | if test -n "$eat"; then 139 | eat= 140 | else 141 | case $1 in 142 | -o) 143 | # configure might choose to run compile as 'compile cc -o foo foo.c'. 144 | eat=1 145 | case $2 in 146 | *.o | *.[oO][bB][jJ]) 147 | func_file_conv "$2" 148 | set x "$@" -Fo"$file" 149 | shift 150 | ;; 151 | *) 152 | func_file_conv "$2" 153 | set x "$@" -Fe"$file" 154 | shift 155 | ;; 156 | esac 157 | ;; 158 | -I) 159 | eat=1 160 | func_file_conv "$2" mingw 161 | set x "$@" -I"$file" 162 | shift 163 | ;; 164 | -I*) 165 | func_file_conv "${1#-I}" mingw 166 | set x "$@" -I"$file" 167 | shift 168 | ;; 169 | -l) 170 | eat=1 171 | func_cl_dashl "$2" 172 | set x "$@" "$lib" 173 | shift 174 | ;; 175 | -l*) 176 | func_cl_dashl "${1#-l}" 177 | set x "$@" "$lib" 178 | shift 179 | ;; 180 | -L) 181 | eat=1 182 | func_cl_dashL "$2" 183 | ;; 184 | -L*) 185 | func_cl_dashL "${1#-L}" 186 | ;; 187 | -static) 188 | shared=false 189 | ;; 190 | -Wl,*) 191 | arg=${1#-Wl,} 192 | save_ifs="$IFS"; IFS=',' 193 | for flag in $arg; do 194 | IFS="$save_ifs" 195 | linker_opts="$linker_opts $flag" 196 | done 197 | IFS="$save_ifs" 198 | ;; 199 | -Xlinker) 200 | eat=1 201 | linker_opts="$linker_opts $2" 202 | ;; 203 | -*) 204 | set x "$@" "$1" 205 | shift 206 | ;; 207 | *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) 208 | func_file_conv "$1" 209 | set x "$@" -Tp"$file" 210 | shift 211 | ;; 212 | *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) 213 | func_file_conv "$1" mingw 214 | set x "$@" "$file" 215 | shift 216 | ;; 217 | *) 218 | set x "$@" "$1" 219 | shift 220 | ;; 221 | esac 222 | fi 223 | shift 224 | done 225 | if test -n "$linker_opts"; then 226 | linker_opts="-link$linker_opts" 227 | fi 228 | exec "$@" $linker_opts 229 | exit 1 230 | } 231 | 232 | eat= 233 | 234 | case $1 in 235 | '') 236 | echo "$0: No command. Try '$0 --help' for more information." 1>&2 237 | exit 1; 238 | ;; 239 | -h | --h*) 240 | cat <<\EOF 241 | Usage: compile [--help] [--version] PROGRAM [ARGS] 242 | 243 | Wrapper for compilers which do not understand '-c -o'. 244 | Remove '-o dest.o' from ARGS, run PROGRAM with the remaining 245 | arguments, and rename the output as expected. 246 | 247 | If you are trying to build a whole package this is not the 248 | right script to run: please start by reading the file 'INSTALL'. 249 | 250 | Report bugs to . 251 | EOF 252 | exit $? 253 | ;; 254 | -v | --v*) 255 | echo "compile $scriptversion" 256 | exit $? 257 | ;; 258 | cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) 259 | func_cl_wrapper "$@" # Doesn't return... 260 | ;; 261 | esac 262 | 263 | ofile= 264 | cfile= 265 | 266 | for arg 267 | do 268 | if test -n "$eat"; then 269 | eat= 270 | else 271 | case $1 in 272 | -o) 273 | # configure might choose to run compile as 'compile cc -o foo foo.c'. 274 | # So we strip '-o arg' only if arg is an object. 275 | eat=1 276 | case $2 in 277 | *.o | *.obj) 278 | ofile=$2 279 | ;; 280 | *) 281 | set x "$@" -o "$2" 282 | shift 283 | ;; 284 | esac 285 | ;; 286 | *.c) 287 | cfile=$1 288 | set x "$@" "$1" 289 | shift 290 | ;; 291 | *) 292 | set x "$@" "$1" 293 | shift 294 | ;; 295 | esac 296 | fi 297 | shift 298 | done 299 | 300 | if test -z "$ofile" || test -z "$cfile"; then 301 | # If no '-o' option was seen then we might have been invoked from a 302 | # pattern rule where we don't need one. That is ok -- this is a 303 | # normal compilation that the losing compiler can handle. If no 304 | # '.c' file was seen then we are probably linking. That is also 305 | # ok. 306 | exec "$@" 307 | fi 308 | 309 | # Name of file we expect compiler to create. 310 | cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` 311 | 312 | # Create the lock directory. 313 | # Note: use '[/\\:.-]' here to ensure that we don't use the same name 314 | # that we are using for the .o file. Also, base the name on the expected 315 | # object file name, since that is what matters with a parallel build. 316 | lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d 317 | while true; do 318 | if mkdir "$lockdir" >/dev/null 2>&1; then 319 | break 320 | fi 321 | sleep 1 322 | done 323 | # FIXME: race condition here if user kills between mkdir and trap. 324 | trap "rmdir '$lockdir'; exit 1" 1 2 15 325 | 326 | # Run the compile. 327 | "$@" 328 | ret=$? 329 | 330 | if test -f "$cofile"; then 331 | test "$cofile" = "$ofile" || mv "$cofile" "$ofile" 332 | elif test -f "${cofile}bj"; then 333 | test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" 334 | fi 335 | 336 | rmdir "$lockdir" 337 | exit $ret 338 | 339 | # Local Variables: 340 | # mode: shell-script 341 | # sh-indentation: 2 342 | # eval: (add-hook 'write-file-hooks 'time-stamp) 343 | # time-stamp-start: "scriptversion=" 344 | # time-stamp-format: "%:y-%02m-%02d.%02H" 345 | # time-stamp-time-zone: "UTC" 346 | # time-stamp-end: "; # UTC" 347 | # End: 348 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_INTTYPES_H 8 | 9 | /* Define to 1 if you have the `m' library (-lm). */ 10 | #undef HAVE_LIBM 11 | 12 | /* Define to 1 if you have the header file. */ 13 | #undef HAVE_STDINT_H 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_STDIO_H 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_STDLIB_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_STRINGS_H 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STRING_H 26 | 27 | /* Define to 1 if the c library provides strtok_r */ 28 | #undef HAVE_STRTOK_R 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_SYS_STAT_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_SYS_TYPES_H 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #undef HAVE_UNISTD_H 38 | 39 | /* Whether to search for files with .ids.gz or .ids.Z extension. */ 40 | #undef ICS_DO_GZEXT 41 | 42 | /* Whether to force the c locale for reading and writing. */ 43 | #undef ICS_FORCE_C_LOCALE 44 | 45 | /* Using the configure script. */ 46 | #undef ICS_USING_CONFIGURE 47 | 48 | /* Whether to use zlib compression. */ 49 | #undef ICS_ZLIB 50 | 51 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 52 | #undef LT_OBJDIR 53 | 54 | /* Name of package */ 55 | #undef PACKAGE 56 | 57 | /* Define to the address where bug reports for this package should be sent. */ 58 | #undef PACKAGE_BUGREPORT 59 | 60 | /* Define to the full name of this package. */ 61 | #undef PACKAGE_NAME 62 | 63 | /* Define to the full name and version of this package. */ 64 | #undef PACKAGE_STRING 65 | 66 | /* Define to the one symbol short name of this package. */ 67 | #undef PACKAGE_TARNAME 68 | 69 | /* Define to the home page for this package. */ 70 | #undef PACKAGE_URL 71 | 72 | /* Define to the version of this package. */ 73 | #undef PACKAGE_VERSION 74 | 75 | /* Define to 1 if all of the C90 standard headers exist (not just the ones 76 | required in a freestanding environment). This macro is provided for 77 | backward compatibility; new code need not use it. */ 78 | #undef STDC_HEADERS 79 | 80 | /* Version number of package */ 81 | #undef VERSION 82 | 83 | /* Define to empty if `const' does not conform to ANSI C. */ 84 | #undef const 85 | 86 | /* Define to `unsigned int' if does not define. */ 87 | #undef size_t 88 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | dnl 2 | dnl libics: Image Cytometry Standard file reading and writing. 3 | dnl 4 | dnl Copyright (C) 2000-2013, 2016 Cris Luengo and others 5 | dnl Copyright 2015, 2016: 6 | dnl Scientific Volume Imaging Holding B.V. 7 | dnl Hilversum, The Netherlands. 8 | dnl https://www.svi.nl 9 | dnl 10 | dnl Script for automake and autoconfig. 11 | dnl Written by Peter Verveer, Cris Luengo 12 | dnl 13 | 14 | dnl Library version number (make sure to also change it in 'libics.h'): 15 | AC_INIT([libics],[1.6.8]) 16 | AC_CONFIG_SRCDIR([libics.h]) 17 | AC_CONFIG_HEADERS([config.h libics_conf.h]) 18 | AC_CONFIG_MACRO_DIR([m4]) 19 | AM_INIT_AUTOMAKE 20 | 21 | AM_MAINTAINER_MODE 22 | 23 | dnl Library versioning (CURRENT:REVISION:AGE) 24 | dnl See the libtool manual for an explanation of the numbers 25 | dnl 26 | dnl Version history: 27 | dnl ics-1.5.3 libics 0:0:0 28 | dnl 29 | dnl How to update library version number 30 | dnl ==================================== 31 | dnl 32 | dnl Update the version information only immediately before a public 33 | dnl release of the software. More frequent updates are unnecessary. 34 | dnl 35 | dnl CURRENT: increment if the interface has additions, changes, removals. 36 | dnl 37 | dnl REVISION: increment any time the source changes; set to 0 if you 38 | dnl incremented CURRENT 39 | dnl 40 | dnl AGE: increment if any interfaces have been added; set to 0 if any 41 | dnl interfaces have been removed. removal has precedence over adding, 42 | dnl so set to 0 if both happened. 43 | 44 | ICS_LT_VERSION="0:0:0" 45 | AC_SUBST(ICS_LT_VERSION) 46 | 47 | AC_PROG_CC 48 | LT_INIT 49 | m4_warn([obsolete], 50 | [The preprocessor macro `STDC_HEADERS' is obsolete. 51 | Except in unusual embedded environments, you can safely include all 52 | ISO C90 headers unconditionally.])dnl 53 | # Autoupdate added the next two lines to ensure that your configure 54 | # script's behavior did not change. They are probably safe to remove. 55 | AC_CHECK_INCLUDES_DEFAULT 56 | AC_PROG_EGREP 57 | 58 | AC_C_CONST 59 | AC_TYPE_SIZE_T 60 | 61 | AH_TEMPLATE([HAVE_STRTOK_R], [Define to 1 if the c library provides strtok_r]) 62 | 63 | # If this variable is not defined, libics_conf.h will revert to the old version. 64 | AC_DEFINE([ICS_USING_CONFIGURE], [], [Using the configure script.]) 65 | 66 | dnl Check if you want to use .ids.gz and .ids.Z extensions 67 | AC_ARG_ENABLE(gzext, AS_HELP_STRING([--disable-gz-extensions], [disable .ids.gz and .ids.Z extensions (enabled by default)]),,) 68 | 69 | dnl Check if we should force the C locale 70 | AC_ARG_ENABLE(c_locale, AS_HELP_STRING([--disable-c-locale], [disable force c locale (enabled by default)]),,) 71 | 72 | dnl --------------------------------------------------------------------------- 73 | dnl Check for ZLIB (copied from libtiff, with some additions) 74 | dnl --------------------------------------------------------------------------- 75 | 76 | HAVE_ZLIB=no 77 | 78 | AC_ARG_ENABLE(zlib, AS_HELP_STRING([--disable-zlib], [disable Zlib usage (required for zip compression, enabled by default)]),,) 79 | AC_ARG_WITH(zlib-include-dir, AS_HELP_STRING([--with-zlib-include-dir=DIR], [location of Zlib headers]),,) 80 | AC_ARG_WITH(zlib-lib-dir, AS_HELP_STRING([--with-zlib-lib-dir=DIR], [location of Zlib library binary]),,) 81 | 82 | if test "x$enable_zlib" != "xno" ; then 83 | 84 | if test "x$with_zlib_lib_dir" != "x" ; then 85 | LIBS="-L$with_zlib_lib_dir $LIBS" 86 | fi 87 | AC_CHECK_LIB(z, inflateEnd, [zlib_lib=yes], [zlib_lib=no],) 88 | if test "$zlib_lib" = "no" -a "x$with_zlib_lib_dir" != "x"; then 89 | AC_MSG_ERROR([Zlib library not found at $with_zlib_lib_dir]) 90 | fi 91 | 92 | if test "x$with_zlib_include_dir" != "x" ; then 93 | CPPFLAGS="-I$with_zlib_include_dir $CPPFLAGS" 94 | fi 95 | AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no]) 96 | if test "$zlib_h" = "no" -a "x$with_zlib_include_dir" != "x" ; then 97 | AC_MSG_ERROR([Zlib headers not found at $with_zlib_include_dir]) 98 | fi 99 | 100 | if test "$zlib_lib" = "yes" -a "$zlib_h" = "yes" ; then 101 | HAVE_ZLIB=yes 102 | fi 103 | 104 | fi 105 | 106 | if test "$HAVE_ZLIB" = "yes" ; then 107 | AC_DEFINE(ICS_ZLIB, 1, [Whether to use zlib compression.]) 108 | LIBS="-lz $LIBS" 109 | fi 110 | AM_CONDITIONAL([ICS_ZLIB], [test "x$HAVE_ZLIB" = "xyes"]) 111 | 112 | if test "x$enable_gz_extensions" != "xno" ; then 113 | AC_DEFINE(ICS_DO_GZEXT, 1, [Whether to search for files with .ids.gz or .ids.Z extension.]) 114 | fi 115 | AM_CONDITIONAL([ICS_DO_GZEXT], [test "x$enable_gz_extensions" != "xno"]) 116 | 117 | if test "x$enable_c_locale" != "xno" ; then 118 | AC_DEFINE(ICS_FORCE_C_LOCALE, 1, [Whether to force the c locale for reading and writing.]) 119 | fi 120 | 121 | dnl --------------------------------------------------------------------------- 122 | 123 | dnl Check for -lm: 124 | AC_CHECK_LIB(m, sqrt, [], [AC_MSG_ERROR([math lib is required])]) 125 | 126 | AC_CHECK_FUNC(strtok_r, [AC_DEFINE(HAVE_STRTOK_R, 1)], []) 127 | 128 | AC_CONFIG_FILES([Makefile]) 129 | AC_OUTPUT 130 | 131 | -------------------------------------------------------------------------------- /docs/Credits.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | libics: Credits 6 | 7 | 10 | 11 | 12 | 13 |

libics v.1\.6\.6 Online Documentation. 14 | ©2000-2010 by Cris Luengo and others.

15 | 16 | 26 | 27 |

Credits

28 | 29 |

As of 2016, this library is maintained by Scientific Volume Imaging:

30 |

Scientific Volume Imaging Holding B.V.
31 | Hilversum, The Netherlands.

32 | 33 |

This library was originally written and maintained by

34 |

Cris Luengo
35 | (previously at) Delft University of Technology, Delft, NL

36 | 37 |

With help from

38 |
    39 |
  • Bert Gijsbers, Scientific Volume Imaging BV, Hilversum, NL 40 | (Most changes for version 1.3)
  • 41 |
  • Fons Laan, Hubrecht Laboratorium, Utrecht, NL 42 | (SCIL_Image compatability, MAKE files, bug fixes)
  • 43 |
  • Frank de Jong, Delft University of Technology, Delft, NL 44 | (IcsViewer utility improvements)
  • 45 |
  • Peter Verveer, EMBL, Heidelberg, Germany 46 | (autoconf/automake script)
  • 47 |
  • David Svoboda, Masaryk University, Brno, Czech Republic 48 | (Windows make files)
  • 49 |
  • Glenn Pierce 50 | (Idea of opening in "rw" mode and history iterator)
  • 51 |
52 | 53 |

Most of the code herein hasn't changed since the previous version, 54 | by

55 |

Dr. Hans T.M. van der Voort
56 | Scientific Volume Imaging Holding B.V.
57 | Hilversum, The Netherlands.

58 | 59 |

Which ultimately is based upon stuff written by:

60 |

Damir Sudar, Geert van Kempen, Jan Jitze Krol, Chiel 61 | Baarslag, Fons Laan and Hans van der Voort.

62 | 63 |

Compression is realized with zlib version 1.1.3 or newer.

64 | 65 |

This project is hosted by GitHub

66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /docs/Documentation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | libics: Documentation index 6 | 7 | 10 | 11 | 12 | 13 |

libics v.1.6.8 Online Documentation. ©2000-2010 by Cris Luengo and others.

14 | 15 | 36 | 37 |

libics Documentation

38 | 39 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/Enums.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | libics: Enumerated data types 6 | 7 | 10 | 11 | 12 | 13 |

libics v.1.6.8 Online Documentation. ©2000-2010 by Cris Luengo and others.

14 | 15 | 44 | 45 |

Enumerated data types

46 | 47 |

Ics_DataType

48 | 49 |

Ics_DataType is an 50 | enum that defines the numeric representation 51 | for the imels in the following values:

52 |
    53 |
  • Ics_unknown
  • 54 | 55 |
  • Ics_uint8: 56 | unsigned char
  • 57 | 58 |
  • Ics_sint8: 59 | signed char
  • 60 | 61 |
  • Ics_uint16: 62 | unsigned short
  • 63 | 64 |
  • Ics_sint16: 65 | signed short
  • 66 | 67 |
  • Ics_uint32: 68 | unsigned int
  • 69 | 70 |
  • Ics_sint32: 71 | signed int
  • 72 | 73 |
  • Ics_uint64: 74 | unsigned long long
  • 75 | 76 |
  • Ics_sint64: 77 | signed long long
  • 78 | 79 |
  • Ics_real32: 80 | float
  • 81 | 82 |
  • Ics_real64: 83 | double
  • 84 | 85 |
  • Ics_complex32: 86 | { float, float }
  • 87 | 88 |
  • Ics_complex64: 89 | { double, double }
  • 90 |
91 | 92 |

Ics_Compression

93 | 94 |

Ics_Compression is an 95 | enum that defines the compression method used 96 | to store the imel data. These are the currently defined methods:

97 |
    98 |
  • IcsCompr_uncompressed
  • 99 | 100 |
  • IcsCompr_compress: Using the UNIX 101 | compress utility, which uses LZW compression. 102 | When setting this value for writing, it is automatically translated to 103 | IcsCompr_gzip, which is a better method. 104 | Files written with this method can be read, but only if all data is 105 | read in one go. That is, block-wise reading is not supported. For more 106 | flexibility, it is possible to manually uncompress 107 | (gunzip is also able to do this) the .ids file 108 | and edit the '.ics' header to read 109 | compression uncompressed.
  • 110 | 111 |
  • IcsCompr_gzip: Using the 112 | gzip compression method 113 | (the zlib library must be linked to). The compression parameter 114 | is a value between 0 and 9: 1 gives best speed, 9 gives best 115 | compression, 0 gives no compression at all. A good value to use 116 | is 6.
  • 117 |
118 | 119 |

Ics_ByteOrder

120 | 121 |

Ics_ByteOrder is an 122 | enum used by 123 | IcsSetByteOrder. 124 | It defines the following values:

125 |
    126 |
  • IcsByteOrder_littleEndian
  • 127 |
  • IcsByteOrder_bigEndian
  • 128 |
129 | 130 |

Ics_HistoryWhich

131 | 132 |

Ics_HistoryWhich is an 133 | enum used by 134 | IcsGetHistoryString. 135 | It defines the following values:

136 |
    137 |
  • IcsWhich_First
  • 138 |
  • IcsWhich_Next
  • 139 |
140 | 141 |

Ics_Format

142 | 143 |

Ics_Format is an 144 | enum used by the low-level interface functions 145 | IcsGetPropsDataType 146 | and 147 | IcsGetDataTypeProps. 148 | It defines the numeric representation in the following values:

149 |
    150 |
  • IcsForm_unknown
  • 151 |
  • IcsForm_integer
  • 152 |
  • IcsForm_real
  • 153 |
  • IcsForm_complex
  • 154 |
155 | 156 |

Ics_FileMode

157 | 158 |

Ics_FileMode is an 159 | enum used internally by the high-level interface 160 | functions to avoid the user doing something unexpected. 161 | It defines the following values:

162 |
    163 |
  • IcsFileMode_read: Reading data and metadata allowed.
  • 164 |
  • IcsFileMode_write: Writing data and metadata allowed, reading metadata allowed.
  • 165 |
  • IcsFileMode_update: Reading and writing metadata allowed, reading data allowed.
  • 166 |
167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /docs/Ics_DataRepresentation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | libics: Ics_DataRepresentation structure 6 | 7 | 10 | 11 | 12 | 13 |

libics v.1.6.8 Online Documentation. ©2000-2010 by Cris Luengo and others.

14 | 15 | 36 | 37 |

Ics_DataRepresentation structure

38 | 39 |

Size

40 | 41 |

Number of imels in this dimension.

42 | 43 |

type: 44 | size_t

45 | 46 |

Origin

47 | 48 |

Position of first imel. Useless without proper 49 | settings of Unit, and 50 | therefore ignored if Unit 51 | is empty.

52 | 53 |

type: 54 | double

55 | 56 |

Scale

57 | 58 |

Distance between imels. Useless without proper 59 | settings of Unit, and 60 | therefore ignored if Unit 61 | is empty.

62 | 63 |

type: 64 | double

65 | 66 |

Order

67 | 68 |

Determines the order of the dimensions. Typical 69 | values are "x", 70 | "y", "z", 71 | "t", "probe", etc.

72 | 73 |

type: 74 | char [ICS_STRLEN_TOKEN]

75 | 76 |

Label

77 | 78 |

A label for each dimension.

79 | 80 |

type: 81 | char [ICS_STRLEN_TOKEN]

82 | 83 |

Unit

84 | 85 |

Units which which 86 | Origin and 87 | Scale are measured.

88 | 89 |

type: 90 | char [ICS_STRLEN_TOKEN]

91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /docs/Ics_Error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | libics: Error codes 6 | 7 | 10 | 11 | 12 | 13 |

libics v.1.6.8 Online Documentation. ©2000-2010 by Cris Luengo and others.

14 | 15 | 36 | 37 |

Error codes returned by the library functions

38 | 39 |

Ics_Error is an 40 | enum that represents all the error codes 41 | returned by most of the functions in this library. They are sorted in alphabetical 42 | order, except for the first three values, which are special.

43 | 44 |

IcsErr_Ok

45 |

No error occurred. Its numerical value is 46 | 0, so you can test with 47 | "if (error) ..."

48 | 49 |

IcsErr_FSizeConflict

50 |

Unexpected data size (non fatal error).

51 | 52 |

IcsErr_OutputNotFilled

53 |

The output buffer could not be completely filled 54 | (non fatal error). Returned by data reading functions if the buffer given 55 | was larger than the amount of data read.

56 | 57 |

IcsErr_Alloc

58 |

Memory allocation error.

59 | 60 |

IcsErr_BitsVsSizeConfl

61 |

Image size conflicts with bits per element.

62 | 63 |

IcsErr_BlockNotAllowed

64 |

It is not possible to read COMPRESS-compressed data in blocks.

65 | 66 |

IcsErr_BufferTooSmall

67 |

The buffer was too small to hold the given ROI.

68 | 69 |

IcsErr_CompressionProblem

70 |

Some error occurred during compression.

71 | 72 |

IcsErr_CorruptedStream

73 |

The compressed input stream is corrupted.

74 | 75 |

IcsErr_DecompressionProblem

76 |

Some error occurred during decompression.

77 | 78 |

IcsErr_DuplicateData

79 |

The Data field has 80 | already been set.

81 | 82 |

IcsErr_EmptyField

83 |

Empty field.

84 | 85 |

IcsErr_EndOfHistory

86 |

All history lines have already been returned.

87 | 88 |

IcsErr_EndOfStream

89 |

Unexpected end of stream.

90 | 91 |

IcsErr_FailWriteLine

92 |

Failed to write a line in .ics file.

93 | 94 |

IcsErr_FCloseIcs

95 |

File close error on .ics file.

96 | 97 |

IcsErr_FCloseIds

98 |

File close error on data file.

99 | 100 |

IcsErr_FCopyIds

101 |

Failed to copy image data from temporary file on .ics file opened for updating.

102 | 103 |

IcsErr_FOpenIcs

104 |

File open error on .ics file.

105 | 106 |

IcsErr_FOpenIds

107 |

File open error on data file.

108 | 109 |

IcsErr_FReadIcs

110 |

File read error on .ics file.

111 | 112 |

IcsErr_FReadIds

113 |

File read error on data file.

114 | 115 |

IcsErr_FTempMoveIcs

116 |

Failed to rename .ics file opened for updating.

117 | 118 |

IcsErr_FWriteIcs

119 |

File write error on .ics file.

120 | 121 |

IcsErr_FWriteIds

122 |

File write error on data file.

123 | 124 |

IcsErr_IllegalROI

125 |

The given ROI extends outside the image.

126 | 127 |

IcsErr_IllIcsToken

128 |

Illegal ICS token detected.

129 | 130 |

IcsErr_IllParameter

131 |

A function parameter has a value that is not legal 132 | or does not match with a value previously given.

133 | 134 |

IcsErr_LineOverflow

135 |

Line overflow writing .ics file.

136 | 137 |

IcsErr_MissBits

138 |

Missing "bits" element in ICS file.

139 | 140 |

IcsErr_MissCat

141 |

Missing main category.

142 | 143 |

IcsErr_MissingData

144 |

The Data field is not 145 | yet been set.

146 | 147 |

IcsErr_MissLayoutSubCat

148 |

Missing layout subcategory.

149 | 150 |

IcsErr_MissParamSubCat

151 |

Missing parameter subcategory.

152 | 153 |

IcsErr_MissRepresSubCat

154 |

Missing representation subcategory.

155 | 156 |

IcsErr_MissSensorSubCat

157 |

Missing sensor subcategory.

158 | 159 |

IcsErr_MissSensorSubSubCat

160 |

Missing sensor subsubcategory.

161 | 162 |

IcsErr_MissSubCat

163 |

Missing sub category.

164 | 165 |

IcsErr_NoLayout

166 |

Layout parameters missing or not defined.

167 | 168 |

IcsErr_NoScilType

169 |

The function 170 | IcsGuessScilType 171 | could not create a SCIL_TYPE string for the image as currently defined.

172 | 173 |

IcsErr_NotIcsFile

174 |

Not an ICS file, or unrecognized ICS version.

175 | 176 |

IcsErr_NotValidAction

177 |

The function won't work on the ICS given. This is 178 | returned by the top-level functions when a 'Set' function is called on an 179 | ICS open for reading, or a 'Get' function is called on an ICS open for 180 | writing.

181 | 182 |

IcsErr_TooManyChans

183 |

Too many channels specified.

184 | 185 |

IcsErr_TooManyDims

186 |

Too many dimensions specified.

187 | 188 |

IcsErr_TooManyDetectors

189 |

Too many detectors specified.

190 | 191 |

IcsErr_UnknownCompression

192 |

Unknown compression type.

193 | 194 |

IcsErr_UnknownDataType

195 |

The data type is not recognized.

196 | 197 |

IcsErr_WrongZlibVersion

198 |

libics is linking to a different version of zlib 199 | than used during compilation.

200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /docs/Ics_ImelRepresentation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | libics: Ics_ImelRepresentation structure 6 | 7 | 10 | 11 | 12 | 13 |

libics v.1.6.8 Online Documentation. ©2000-2010 by Cris Luengo and others.

14 | 15 | 36 | 37 |

Ics_ImelRepresentation structure

38 | 39 |

DataType

40 | 41 |

Numeric representation for the imels.

42 | 43 |

type: 44 | Ics_DataType

45 | 46 |

SigBits

47 | 48 |

Number of significant bits. The default value 49 | (0), means all bits are significant.

50 | 51 |

type: 52 | size_t

53 | 54 |

Origin

55 | 56 |

Offset for imel values measured in 57 | Unit.

58 | 59 |

type: 60 | double

61 | 62 |

Scale

63 | 64 |

Scaling for imel values measured in 65 | Unit.

66 | 67 |

type: 68 | double

69 | 70 |

Unit

71 | 72 |

Units which which 73 | Origin and 74 | Scale are measured.

75 | 76 |

type: 77 | char [ICS_STRLEN_TOKEN]

78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/Links.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | libics: Links 6 | 7 | 10 | 11 | 12 | 13 |

libics v.1.6.8 Online Documentation. ©2000-2010 by Cris Luengo and others.

14 | 15 | 25 | 26 |

Links

27 | 28 |

Libraries that libics depends on:

29 |
    30 |
  • zlib is the compression library used by libics.
  • 31 |
32 | 33 |

Software that uses libics:

34 | 41 | 42 |

Software that uses the ICS file format:

43 |
    44 |
  • Bio-Formats, a standalone Java library for reading and writing life sciences image file formats.
  • 45 |
  • Ics Opener, an ImageJ plugin to read ICS files.
  • 46 |
  • NIS-Elements, the Nikon microscope imaging software (Nikon confocal microscopes produce ICS files).
  • 47 |
48 | 49 |

Other resources:

50 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /docs/iexplorefix.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Style file for libics documentation. (c)2005-2006 by Cris Luengo. 3 | * Fixes to display these pages in a not-so-terrible way on Internet Explorer 6. 4 | */ 5 | 6 | div.navbar { 7 | /*position: fixed; Doesn't work in IExplorer */ 8 | position: absolute; 9 | } 10 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | libics home 6 | 7 | 10 | 11 | 12 | 13 |

libics v.1.6.8 Online Documentation.©2000-2010 by Cris Luengo and others.

14 | 15 |

libics v.1.6.8
16 | Image Cytometry Standard file reading and writing.

17 | 18 |

This is the reference library for ICS (Image Cytometry Standard), an 19 | open standard for writing images of any dimensionality and data type to 20 | file, together with associated information regarding the recording 21 | equipment or recorded subject.

22 | 23 | 39 | 40 |

ICS version 1.0 and 2.0

41 | 42 |

ICS stands for Image Cytometry Standard, and was first proposed in:

43 |

P. Dean, L. Mascio, D. Ow, D. Sudar, J. Mullikin, 44 | "Proposed standard for image cytometry data files", Cytometry, n.11, 45 | pp.561-569, 1990. 46 | [DOI] 47 | [PubMed] 48 |

49 | 50 |

It writes 2 files, one is the header, with an '.ics' 51 | extension, and the other is the actual image data (with an 52 | '.ids' extension).

53 | 54 |

ICS version 2.0 extends this standard to allow for a more versatile 55 | placement of the image data. It can now be placed either in the same 56 | '.ics' file or embedded in any other file, by 57 | specifying the file name and the byte offset for the data.

58 | 59 |

The advantage of ICS over other open standards such as TIFF is that it 60 | allows data of any type and dimensionality to be stored. A TIFF file 61 | can contain a collection of 2D images; it's up to the user to determine 62 | how these relate to each other. An ICS file can contain, for example, a 63 | 5D image in which the 4th dimension is the light frequency and the 5th 64 | time. Also, all of the information regarding the microscope settings 65 | (or whatever instrument was used to acquire the image) and the sample 66 | preparation can be included in the file.

67 | 68 |

Contact

69 | 70 |

The libics library is currently maintained by Scientific Volume Imaging. 71 | You can mail comments, bugs and feature requests to 72 | libics(at)svi.nl

73 | 74 |

License

75 | 76 |

This library is distributed under the 77 | GNU LESSER GENERAL PUBLIC 78 | LICENSE (formerly the GNU Library Public License), version 2.1. This means you can use it 79 | for whatever purpose, commercial or not, open or not. However, if you re-distribute 80 | the sources in any form whatsoever you need to include the original copyright 81 | statement. And if you change anything you need to mention this too.

82 | 83 |

This also means that none of the people involved in this project can be held 84 | responsible for anything that goes wrong while you use this software. You use it 85 | at your own risk.

86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /docs/libics.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Style file for libics documentation. (c)2000-2010 by Cris Luengo. 3 | */ 4 | 5 | html { 6 | background-color: #AAA; 7 | } 8 | 9 | body { 10 | color: black; 11 | background-color: #FFF; 12 | max-width: 44em; 13 | margin-left: 10em; 14 | min-margin-right: 0.5em; 15 | margin-top: 0em; 16 | margin-bottom: 0em; 17 | padding-top: 1em; 18 | padding-bottom: 4em; 19 | padding-left: 4em; 20 | padding-right: 4em; 21 | text-indent: 0em; 22 | font-family: "Times New Roman", serif; 23 | font-size: 100%; 24 | } 25 | 26 | h1, h2 { 27 | font-family: Arial, Helvetica, sans-serif; 28 | } 29 | 30 | h1 { 31 | font-size: 180%; 32 | font-weight: bold; 33 | text-align: center; 34 | margin-top: 1em; 35 | padding-top: 1em; 36 | margin-bottom: 2em; 37 | padding-bottom: 1em; 38 | background-color: #CCF; 39 | border: 1px solid black; 40 | color: black; 41 | } 42 | 43 | h1 span.subtitle { /* for title on index.html */ 44 | font-size: 70%; 45 | } 46 | 47 | h2 { 48 | font-size: 150%; 49 | font-weight: normal; 50 | text-align: center; 51 | margin-top: 2em; 52 | margin-bottom: 1em; 53 | padding: 0.3em; 54 | /*border-top: 0.5em solid #DDF;*/ 55 | /*border-bottom: 0.5em solid #DDF;*/ 56 | border: 1px solid black; 57 | background-color: #CCF; 58 | } 59 | 60 | h3 { 61 | font-size: 120%; 62 | font-weight: normal; 63 | margin-top: 2em; 64 | margin-bottom: 0.5em; 65 | text-align: left; 66 | padding: 0.3em; 67 | border: 1px solid black; 68 | background-color: #EEF; 69 | } 70 | 71 | h3.ident { /* function / variable / constant name */ 72 | font-family: "Courier New", monospace; 73 | } 74 | 75 | p { 76 | margin-top: 0em; 77 | margin-bottom: 0.5em; 78 | text-align: justify; 79 | } 80 | 81 | p.indented { 82 | margin-left: 2em; 83 | } 84 | 85 | p.info { /* for data on functions */ 86 | text-align: left; 87 | } 88 | 89 | span.headtxt { 90 | font-family: Arial, Helvetica, sans-serif; 91 | font-size: 80%; 92 | font-weight: normal; 93 | text-decoration: underline; 94 | } 95 | 96 | span.download { 97 | font-size: 80%; 98 | } 99 | 100 | p.header { /* banner on the top of each page */ 101 | font-family: Arial, Helvetica, sans-serif; 102 | font-size: 80%; 103 | text-align: right; 104 | margin-top: 0em; 105 | margin-bottom: 0em; 106 | padding-bottom: 0.5em; 107 | border-bottom: 1px solid black; 108 | } 109 | 110 | ::-moz-selection { 111 | color: #FFF; 112 | background-color: #666680; 113 | } 114 | ::selection { 115 | color: #FFF; 116 | background-color: #666680; 117 | } 118 | 119 | :link, :visited { 120 | color: #007; 121 | text-decoration: underline; 122 | } 123 | a:hover { 124 | color: black; 125 | background-color: #CCF; 126 | } 127 | 128 | ul { 129 | margin-left: 2em; 130 | margin-top: 0em; 131 | margin-bottom: 0.5em; 132 | padding: 0em; 133 | list-style: inside; 134 | } 135 | ul.credits { 136 | list-style: none; 137 | } 138 | li { 139 | margin: 0em; 140 | margin-bottom: 0.5em; 141 | } 142 | 143 | /* Navigation bar */ 144 | div.navbar { 145 | position: fixed; 146 | left: 1em; 147 | top: 0em; 148 | width: 11em; 149 | padding: 0em; 150 | margin: 0em; 151 | border: none; 152 | text-align: center; 153 | } 154 | div.navbar ul { 155 | margin: 0ex; 156 | padding: 0ex; 157 | list-style-type: none; 158 | list-style-position: outside; 159 | } 160 | div.navbar li { 161 | margin: 1em 0em; 162 | padding: 0ex; 163 | background-color: #777; 164 | } 165 | div.navbar a { 166 | display: block; 167 | width: 100%; 168 | padding: 1ex 0ex; 169 | background-color: #EEE; 170 | position: relative; 171 | top: -0.5em; 172 | left: -0.5em; 173 | border: 1px solid black; 174 | } 175 | div.navbar a:hover { 176 | background-color: #CCF; 177 | } 178 | div.navbar a.selected { 179 | color: black; 180 | text-decoration: none; 181 | background-color: #CCF; 182 | } 183 | div.navbar ul ul { /* 2nd order menus */ 184 | background-color: #EEE; 185 | margin-bottom: 1ex; 186 | border: 1px solid black; 187 | border-top: none; 188 | position: relative; 189 | top: -0.5em; 190 | left: -0.5em; 191 | width: 100%; 192 | } 193 | div.navbar ul ul li { 194 | background-color: #CCF; 195 | margin: 0ex; 196 | font-size: 80%; 197 | } 198 | div.navbar ul ul li a { 199 | top: 0em; 200 | left: 0em; 201 | border: none; 202 | } 203 | div.navbar ul ul ul { /* 3rd order menus */ 204 | border: 1px solid black; 205 | margin: 0ex 1em; 206 | padding 0ex; 207 | left: 0em; 208 | width: auto; 209 | } 210 | div.navbar ul ul ul li { 211 | background-color: #EEE; 212 | font-size: 100%; 213 | } 214 | 215 | /* formatted code */ 216 | pre, tt, p.synopsis { 217 | font-family: "Courier New", monospace; 218 | font-size: 90%; 219 | } 220 | p.synopsis { /* for function declarations */ 221 | margin-left: 4em; 222 | text-align: left; 223 | } 224 | pre { 225 | margin-left: 2em; 226 | margin-right: 2em; 227 | margin-top: 2em; 228 | margin-bottom: 2em; 229 | text-align: left; 230 | padding: 1em; 231 | border: 1px solid black; 232 | background-color: #EEE; 233 | } 234 | .comment { font-style: italic; color: #070; } 235 | .constant { color: #700; } 236 | .preprocess { color: #770; } 237 | .keyword { font-weight: bold; } 238 | .varident { } 239 | .funcident { font-style: italic; /*color: #707*/ } /* can't give these colors because of the color of the links - iexplore doesn't do "inherit" for :link. */ 240 | .typeident { font-style: italic; /*color: #007*/ } 241 | -------------------------------------------------------------------------------- /libics.def: -------------------------------------------------------------------------------- 1 | LIBRARY "libics" 2 | EXPORTS 3 | IcsAddHistoryString 4 | IcsClose 5 | IcsCloseIds 6 | IcsDeleteHistory 7 | IcsDeleteHistoryStringI 8 | IcsEnableWriteSensor 9 | IcsEnableWriteSensorStates 10 | IcsExtensionFind 11 | IcsFreeHistory 12 | IcsGetCoordinateSystem 13 | IcsGetData 14 | IcsGetDataBlock 15 | IcsGetDataSize 16 | IcsGetDataTypeProps 17 | IcsGetDataTypeSize 18 | IcsGetDataWithStrides 19 | IcsGetErrorText 20 | IcsGetHistoryKeyValue 21 | IcsGetHistoryKeyValueI 22 | IcsGetHistoryString 23 | IcsGetHistoryStringI 24 | IcsGetIcsName 25 | IcsGetIdsName 26 | IcsGetImageSize 27 | IcsGetImelSize 28 | IcsGetImelUnits 29 | IcsGetLayout 30 | IcsGetLibVersion 31 | IcsGetNumHistoryStrings 32 | IcsGetOrder 33 | IcsGetPosition 34 | IcsGetPreviewData 35 | IcsGetPropsDataType 36 | IcsGetROIData 37 | IcsGetScilType 38 | IcsGetSensorChannels 39 | IcsGetSensorDetectorBaseline 40 | IcsGetSensorDetectorLineAvgCnt 41 | IcsGetSensorDetectorPPU 42 | IcsGetSensorEmissionWavelength 43 | IcsGetSensorExcitationWavelength 44 | IcsGetSensorLensRI 45 | IcsGetSensorMediumRI 46 | IcsGetSensorModel 47 | IcsGetSensorNumAperture 48 | IcsGetSensorParameter 49 | IcsGetSensorParameterInt 50 | IcsGetSensorParameterString 51 | IcsGetSensorParameterVector 52 | IcsGetSensorPhotonCount 53 | IcsGetSensorPinholeRadius 54 | IcsGetSensorPinholeSpacing 55 | IcsGetSensorSTEDDepletionMode 56 | IcsGetSensorSTEDImmFraction 57 | IcsGetSensorSTEDLambda 58 | IcsGetSensorSTEDSatFactor 59 | IcsGetSensorSTEDVPPM 60 | IcsGetSensorType 61 | IcsGetSignificantBits 62 | IcsGuessScilType 63 | IcsInit 64 | IcsLoadPreview 65 | IcsNewHistoryIterator 66 | IcsOpen 67 | IcsOpenIds 68 | IcsReadIcs 69 | IcsReadIds 70 | IcsReadIdsBlock 71 | IcsReplaceHistoryStringI 72 | IcsSetCompression 73 | IcsSetCoordinateSystem 74 | IcsSetData 75 | IcsSetDataWithStrides 76 | IcsSetIdsBlock 77 | IcsSetImelUnits 78 | IcsSetLayout 79 | IcsSetOrder 80 | IcsSetPosition 81 | IcsSetScilType 82 | IcsSetSensorChannels 83 | IcsSetSensorDetectorBaseline 84 | IcsSetSensorDetectorLineAvgCnt 85 | IcsSetSensorDetectorPPU 86 | IcsSetSensorEmissionWavelength 87 | IcsSetSensorExcitationWavelength 88 | IcsSetSensorLensRI 89 | IcsSetSensorMediumRI 90 | IcsSetSensorModel 91 | IcsSetSensorNumAperture 92 | IcsSetSensorParameter 93 | IcsSetSensorParameterInt 94 | IcsSetSensorParameterString 95 | IcsSetSensorParameterVector 96 | IcsSetSensorPhotonCount 97 | IcsSetSensorPinholeRadius 98 | IcsSetSensorPinholeSpacing 99 | IcsSetSensorSTEDDepletionMode 100 | IcsSetSensorSTEDImmFraction 101 | IcsSetSensorSTEDLambda 102 | IcsSetSensorSTEDSatFactor 103 | IcsSetSensorSTEDVPPM 104 | IcsSetSensorType 105 | IcsSetSignificantBits 106 | IcsSetSource 107 | IcsSkipDataBlock 108 | IcsSkipIdsBlock 109 | IcsVersion 110 | IcsWriteIcs 111 | IcsWriteIds 112 | 113 | -------------------------------------------------------------------------------- /libics_conf.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * libics: Image Cytometry Standard file reading and writing. 3 | * 4 | * Copyright (C) 2000-2013, 2017 Cris Luengo and others 5 | * Copyright 2015, 2017: 6 | * Scientific Volume Imaging Holding B.V. 7 | * Hilversum, The Netherlands. 8 | * https://www.svi.nl 9 | * 10 | * Large chunks of this library written by 11 | * Bert Gijsbers 12 | * Dr. Hans T.M. van der Voort 13 | * And also Damir Sudar, Geert van Kempen, Jan Jitze Krol, 14 | * Chiel Baarslag and Fons Laan. 15 | * 16 | * This library is free software; you can redistribute it and/or 17 | * modify it under the terms of the GNU Library General Public 18 | * License as published by the Free Software Foundation; either 19 | * version 2 of the License, or (at your option) any later version. 20 | * 21 | * This library is distributed in the hope that it will be useful, 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 | * Library General Public License for more details. 25 | * 26 | * You should have received a copy of the GNU Library General Public 27 | * License along with this library; if not, write to the Free 28 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 29 | */ 30 | 31 | /* 32 | * FILE : libics_conf.h 33 | * 34 | * This file allows you to configure libics. Only needed to build the 35 | * library 36 | * 37 | */ 38 | 39 | 40 | #ifndef LIBICS_CONF_H 41 | #define LIBICS_CONF_H 42 | 43 | 44 | /* These are used internally when the precise length of a variable is needed. 45 | We also use size_t and ptrdiff_t for a variables that are as wide as a 46 | pointer (i.e. can hold the size of any data block). */ 47 | #include 48 | typedef uint8_t ics_t_uint8; 49 | typedef int8_t ics_t_sint8; 50 | typedef uint16_t ics_t_uint16; 51 | typedef int16_t ics_t_sint16; 52 | typedef uint32_t ics_t_uint32; 53 | typedef int32_t ics_t_sint32; 54 | typedef uint64_t ics_t_uint64; 55 | typedef int64_t ics_t_sint64; 56 | typedef float ics_t_real32; 57 | typedef double ics_t_real64; 58 | 59 | 60 | /* Doubles larger than ICS_MAX_DOUBLE or smaller than ICS_MIN_DOUBLE are written 61 | in scientific notation. */ 62 | #define ICS_MAX_DOUBLE 10000000 63 | #define ICS_MIN_DOUBLE 0.001 64 | 65 | 66 | /* ICS_HISTARRAY_INCREMENT sets the increment for the array allocated to contain 67 | the history strings. */ 68 | #define ICS_HISTARRAY_INCREMENT 1024 69 | 70 | 71 | /* ICS_BUF_SIZE is the size of the buffer allocated to: 72 | - Do the compression. This is independent from the memory allocated by zlib 73 | for the dictionary. 74 | - Decompress stuff into when skipping a data block (IcsSetIdsBlock() for 75 | compressed files). 76 | - Copy data over from one IDS file to another when the ICS file is opened for 77 | updating. */ 78 | #define ICS_BUF_SIZE 16384 79 | 80 | 81 | #undef ICS_USING_CONFIGURE 82 | #if !defined(ICS_USING_CONFIGURE) 83 | 84 | /*********************************************************************/ 85 | /* If we are not using the configure script: */ 86 | /*********************************************************************/ 87 | 88 | 89 | /* If ICS_FORCE_C_LOCALE is set, the locale is set to "C" before each read or 90 | write operation. This ensures that the ICS header file is formatted 91 | properly. If your program does not modify the locale, you can safely comment 92 | out is line: the "C" locale is the default. If this constant is not defined 93 | and your program changes the locale, the resulting ICS header file might not 94 | be readable by other applications: it will only be readable if the reading 95 | application is set to the same locale as the writing application. The ICS 96 | standard calls for the locale to be set to "C". */ 97 | #define ICS_FORCE_C_LOCALE 98 | 99 | 100 | /* If ICS_DO_GZEXT is defined, the code will search for IDS files which have the 101 | .ids.gz or .ids.Z filename extension. */ 102 | #define ICS_DO_GZEXT 103 | 104 | 105 | /* If ICS_ZLIB is defined, the zlib dependency is included, and the library will 106 | be able to read GZIP compressed files. This variable is set by the makefile 107 | -- enable ZLIB support there. */ 108 | /*#define ICS_ZLIB*/ 109 | 110 | 111 | #else 112 | 113 | /******************************************************************************/ 114 | /* If we are using the configure script: */ 115 | /******************************************************************************/ 116 | 117 | 118 | /* If we should force the c locale. */ 119 | #undef ICS_FORCE_C_LOCALE 120 | 121 | 122 | /* Whether to search for IDS files with .ids.gz or .ids.Z extension. */ 123 | #undef ICS_DO_GZEXT 124 | 125 | 126 | /* Whether to use zlib compression. */ 127 | #undef ICS_ZLIB 128 | 129 | 130 | /* Whether to use the reentrant string tokenizer */ 131 | #undef HAVE_STRTOK_R 132 | 133 | 134 | #endif 135 | #endif 136 | 137 | -------------------------------------------------------------------------------- /libics_data.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libics: Image Cytometry Standard file reading and writing. 3 | * 4 | * Copyright 2015-2019: 5 | * Scientific Volume Imaging Holding B.V. 6 | * Hilversum, The Netherlands. 7 | * https://www.svi.nl 8 | * 9 | * Contact: libics@svi.nl 10 | * 11 | * Copyright (C) 2000-2013 Cris Luengo and others 12 | * 13 | * Large chunks of this library written by 14 | * Bert Gijsbers 15 | * Dr. Hans T.M. van der Voort 16 | * And also Damir Sudar, Geert van Kempen, Jan Jitze Krol, 17 | * Chiel Baarslag and Fons Laan. 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Library General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Library General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Library General Public 30 | * License along with this library; if not, write to the Free 31 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 32 | */ 33 | 34 | /* 35 | * FILE : libics_data.c 36 | * 37 | * This file declares some data structures used when reading and 38 | * writing the ICS headers. 39 | */ 40 | 41 | 42 | #include "libics_intern.h" 43 | 44 | 45 | Ics_Symbol G_CatSymbols[] = 46 | { 47 | { "source", ICSTOK_SOURCE}, 48 | { "layout", ICSTOK_LAYOUT}, 49 | { "representation", ICSTOK_REPRES}, 50 | { "parameter", ICSTOK_PARAM}, 51 | { ICS_HISTORY, ICSTOK_HISTORY}, /* Don't want duplicate strings... */ 52 | { "sensor", ICSTOK_SENSOR}, 53 | { "end", ICSTOK_END } 54 | }; 55 | 56 | 57 | Ics_Symbol G_SubCatSymbols[] = 58 | { 59 | {"file", ICSTOK_FILE}, 60 | {"offset", ICSTOK_OFFSET}, 61 | {"parameters", ICSTOK_PARAMS}, 62 | {"order", ICSTOK_ORDER}, 63 | {"sizes", ICSTOK_SIZES}, 64 | {"coordinates", ICSTOK_COORD}, 65 | {"significant_bits", ICSTOK_SIGBIT}, 66 | {"format", ICSTOK_FORMAT}, 67 | {"sign", ICSTOK_SIGN}, 68 | {"compression", ICSTOK_COMPR}, 69 | {"byte_order", ICSTOK_BYTEO}, 70 | {"origin", ICSTOK_ORIGIN}, 71 | {"scale", ICSTOK_SCALE}, 72 | {"units", ICSTOK_UNITS}, 73 | {"labels", ICSTOK_LABELS}, 74 | {"SCIL_TYPE", ICSTOK_SCILT}, 75 | {"type", ICSTOK_TYPE}, 76 | {"model", ICSTOK_MODEL}, 77 | {"s_params", ICSTOK_SPARAMS}, 78 | {"s_states", ICSTOK_SSTATES} 79 | }; 80 | 81 | 82 | Ics_Symbol G_SubSubCatSymbols[] = 83 | { 84 | {"Channels", ICSTOK_CHANS}, 85 | {"Detectors", ICSTOK_DETECTORS}, 86 | {"ImagingDirection", ICSTOK_IMDIR}, 87 | {"NumAperture", ICSTOK_NUMAPER}, 88 | {"ObjectiveQuality", ICSTOK_OBJQ}, 89 | {"RefrInxMedium", ICSTOK_REFRIME}, 90 | {"RefrInxLensMedium", ICSTOK_REFRILM}, 91 | {"PinholeRadius", ICSTOK_PINHRAD}, 92 | {"IllPinholeRadius", ICSTOK_ILLPINHRAD}, 93 | {"PinholeSpacing", ICSTOK_PINHSPA}, 94 | {"ExcitationBeamFill", ICSTOK_EXBFILL}, 95 | {"LambdaEx", ICSTOK_LAMBDEX}, 96 | {"LambdaEm", ICSTOK_LAMBDEM}, 97 | {"ExPhotonCnt", ICSTOK_PHOTCNT}, 98 | {"InterFacePrimary", ICSTOK_IFACE1}, 99 | {"InterFaceSecondary", ICSTOK_IFACE2}, 100 | {"Description", ICSTOK_DESCRIPTION}, 101 | {"DetectorMagnif", ICSTOK_DETMAG}, 102 | {"DetectorPPU", ICSTOK_DETPPU}, 103 | {"DetectorBaseline", ICSTOK_DETBASELINE}, 104 | {"DetectorLineAvgCnt", ICSTOK_DETLNAVGCNT}, 105 | {"DetectorNoiseGain", ICSTOK_DETNOISEGAIN}, 106 | {"DetectorOffset", ICSTOK_DETOFFSET}, 107 | {"DetectorSensitivity", ICSTOK_DETSENS}, 108 | {"DetectorRadius", ICSTOK_DETRADIUS}, 109 | {"DetectorScale", ICSTOK_DETSCALE}, 110 | {"DetectorStretch", ICSTOK_DETSTRETCH}, 111 | {"DetectorRot", ICSTOK_DETROT}, 112 | {"DetectorMirror", ICSTOK_DETMIRROR}, 113 | {"DetectorModel", ICSTOK_DETMODEL}, 114 | {"DetectorReduceHist", ICSTOK_DETREDUCEHIST}, 115 | {"STEDDeplMode", ICSTOK_STEDDEPLMODE}, 116 | {"STEDLambda", ICSTOK_STEDLAMBDA}, 117 | {"STEDSatFactor", ICSTOK_STEDSATFACTOR}, 118 | {"STEDImmFraction", ICSTOK_STEDIMMFRACTION}, 119 | {"STEDVPPM", ICSTOK_STEDVPPM}, 120 | {"SPIMExcType", ICSTOK_SPIMEXCTYPE}, 121 | {"SPIMFillFactor", ICSTOK_SPIMFILLFACTOR}, 122 | {"SPIMPlaneNA", ICSTOK_SPIMPLANENA}, 123 | {"SPIMPlaneGaussWidth", ICSTOK_SPIMPLANEGAUSSWIDTH}, 124 | {"SPIMPlanePropDir", ICSTOK_SPIMPLANEPROPDIR}, 125 | {"SPIMPlaneCenterOff", ICSTOK_SPIMPLANECENTEROFF}, 126 | {"SPIMPlaneFocusOff", ICSTOK_SPIMPLANEFOCUSOF}, 127 | {"ScatterModel", ICSTOK_SCATTERMODEL}, 128 | {"ScatterFreePath", ICSTOK_SCATTERFREEPATH}, 129 | {"ScatterRelContrib", ICSTOK_SCATTERRELCONTRIB}, 130 | {"ScatterBlurring", ICSTOK_SCATTERBLURRING} 131 | }; 132 | 133 | 134 | Ics_Symbol G_ValueSymbols[] = 135 | { 136 | {"uncompressed", ICSTOK_COMPR_UNCOMPRESSED}, 137 | {"compress", ICSTOK_COMPR_COMPRESS}, 138 | {"gzip", ICSTOK_COMPR_GZIP}, 139 | {"integer", ICSTOK_FORMAT_INTEGER}, 140 | {"real", ICSTOK_FORMAT_REAL}, 141 | {"float", ICSTOK_FORMAT_REAL}, /* CAUTION: this makes this list 142 | one longer than expected */ 143 | {"complex", ICSTOK_FORMAT_COMPLEX}, 144 | {"signed", ICSTOK_SIGN_SIGNED}, 145 | {"unsigned", ICSTOK_SIGN_UNSIGNED}, 146 | 147 | {"default", ICSTOK_STATE_DEFAULT}, 148 | {"estimated", ICSTOK_STATE_ESTIMATED}, 149 | {"reported", ICSTOK_STATE_REPORTED}, 150 | {"verified", ICSTOK_STATE_VERIFIED}, 151 | 152 | }; 153 | 154 | 155 | Ics_SymbolList G_Categories = 156 | { 157 | ICSTOK_LASTMAIN, 158 | G_CatSymbols 159 | }; 160 | 161 | 162 | Ics_SymbolList G_SubCategories = 163 | { 164 | ICSTOK_LASTSUB - ICSTOK_FIRSTSUB - 1, 165 | G_SubCatSymbols 166 | }; 167 | 168 | 169 | Ics_SymbolList G_SubSubCategories = 170 | { 171 | ICSTOK_LASTSUBSUB - ICSTOK_FIRSTSUBSUB - 1, 172 | G_SubSubCatSymbols 173 | }; 174 | 175 | 176 | Ics_SymbolList G_Values = 177 | { 178 | ICSTOK_LASTVALUE - ICSTOK_FIRSTVALUE - 1 + 1, /* See above: this list is one 179 | longer than expected. */ 180 | G_ValueSymbols 181 | }; 182 | 183 | -------------------------------------------------------------------------------- /libics_ll.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libics: Image Cytometry Standard file reading and writing. 3 | * 4 | * Copyright 2015-2017, 2022: 5 | * Scientific Volume Imaging Holding B.V. 6 | * Hilversum, The Netherlands. 7 | * https://www.svi.nl 8 | * 9 | * Contact: libics@svi.nl 10 | * 11 | * Copyright (C) 2000-2013 Cris Luengo and others 12 | * 13 | * Large chunks of this library written by 14 | * Bert Gijsbers 15 | * Dr. Hans T.M. van der Voort 16 | * And also Damir Sudar, Geert van Kempen, Jan Jitze Krol, 17 | * Chiel Baarslag and Fons Laan. 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Library General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Library General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Library General Public 30 | * License along with this library; if not, write to the Free 31 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 32 | */ 33 | 34 | /* 35 | * FILE : libics_ll.h 36 | * 37 | * This file defines the low-level interface functions. Include it in your 38 | * source code only if that is the way you want to go. 39 | */ 40 | 41 | 42 | #ifndef LIBICS_LL_H 43 | #define LIBICS_LL_H 44 | 45 | 46 | #include "libics.h" 47 | 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | 54 | typedef ICS Ics_Header; 55 | 56 | 57 | /* These are the known data formats for imels. */ 58 | typedef enum { 59 | IcsForm_unknown = 0, 60 | IcsForm_integer, 61 | IcsForm_real, 62 | IcsForm_complex 63 | } Ics_Format; 64 | 65 | 66 | /* Definitions of separators in the .ics file for writing: */ 67 | #define ICS_FIELD_SEP '\t' 68 | #define ICS_EOL '\n' 69 | 70 | 71 | /* Reads a .ics file into an Ics_Header structure. */ 72 | ICSEXPORT Ics_Error IcsReadIcs(Ics_Header *icsStruct, 73 | const char *filename, 74 | int forcename, 75 | int forcelocale); 76 | 77 | /* Writes an Ics_Header structure into a .ics file. */ 78 | ICSEXPORT Ics_Error IcsWriteIcs(Ics_Header *icsStruct, 79 | const char *filename); 80 | 81 | /* Initializes image data reading. */ 82 | ICSEXPORT Ics_Error IcsOpenIds(Ics_Header *icsStruct); 83 | 84 | /* Ends image data reading. */ 85 | ICSEXPORT Ics_Error IcsCloseIds(Ics_Header *icsStruct); 86 | 87 | /* Reads image data block from disk. */ 88 | ICSEXPORT Ics_Error IcsReadIdsBlock(Ics_Header *icsStruct, 89 | void *outbuf, 90 | size_t len); 91 | 92 | /* Skips image data block from disk (fseek forward). */ 93 | ICSEXPORT Ics_Error IcsSkipIdsBlock(Ics_Header *icsStruct, 94 | size_t len); 95 | 96 | /* Sets the file pointer into the image data on disk (fseek anywhere). */ 97 | ICSEXPORT Ics_Error IcsSetIdsBlock(Ics_Header *icsStruct, 98 | ptrdiff_t offset, 99 | int whence); 100 | 101 | /* Reads image data from disk. */ 102 | ICSEXPORT Ics_Error IcsReadIds(Ics_Header *icsStruct, 103 | void *dest, 104 | size_t n); 105 | 106 | /* Writes image data to disk. */ 107 | ICSEXPORT Ics_Error IcsWriteIds(const Ics_Header *icsStruct); 108 | 109 | /* Initializes the Ics_Header structure to default values and zeros. */ 110 | ICSEXPORT void IcsInit(Ics_Header *icsStruct); 111 | 112 | /* Appends ".ics" to the filename (removing ".ids" if present) If (forcename) we 113 | do change ".ids" into ".ics", but do not add anything. */ 114 | ICSEXPORT char *IcsGetIcsName(char *dest, 115 | const char *src, 116 | int forcename); 117 | 118 | /* Appends ".ids" to the filename (removing ".ics" if present). */ 119 | ICSEXPORT char *IcsGetIdsName(char *dest, 120 | const char *src); 121 | 122 | /* Return pointer to .ics or .ids extension or NULL if not found. */ 123 | ICSEXPORT char *IcsExtensionFind(const char *str); 124 | 125 | /* Returns the size in bytes of the data type. */ 126 | ICSEXPORT size_t IcsGetDataTypeSize(Ics_DataType DataType); 127 | 128 | /* Fills in format, sign and bits according to the data type. */ 129 | ICSEXPORT void IcsGetPropsDataType(Ics_DataType DataType, 130 | Ics_Format *format, 131 | int *sign, 132 | size_t *bits); 133 | 134 | /* Sets the data type according to format, sign and bits. */ 135 | ICSEXPORT void IcsGetDataTypeProps(Ics_DataType *DataType, 136 | Ics_Format format, 137 | int sign, 138 | size_t bits); 139 | 140 | /* Free the memory allocated for history. */ 141 | ICSEXPORT void IcsFreeHistory(Ics_Header *ics); 142 | 143 | 144 | #ifdef __cplusplus 145 | } 146 | #endif 147 | 148 | 149 | #endif 150 | 151 | -------------------------------------------------------------------------------- /libics_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libics: Image Cytometry Standard file reading and writing. 3 | * 4 | * Copyright 2015-2017: 5 | * Scientific Volume Imaging Holding B.V. 6 | * Hilversum, The Netherlands. 7 | * https://www.svi.nl 8 | * 9 | * Copyright (C) 2000-2013, 2016 Cris Luengo and others 10 | * 11 | * Large chunks of this library written by 12 | * Bert Gijsbers 13 | * Dr. Hans T.M. van der Voort 14 | * And also Damir Sudar, Geert van Kempen, Jan Jitze Krol, 15 | * Chiel Baarslag and Fons Laan. 16 | * 17 | * This library is free software; you can redistribute it and/or 18 | * modify it under the terms of the GNU Library General Public 19 | * License as published by the Free Software Foundation; either 20 | * version 2 of the License, or (at your option) any later version. 21 | * 22 | * This library is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Library General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU Library General Public 28 | * License along with this library; if not, write to the Free 29 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 30 | */ 31 | /* 32 | * FILE : libics_test.c 33 | * 34 | * The following library functions are contained in this file: 35 | * 36 | * IcsPrintIcs() 37 | * IcsPrintError() 38 | */ 39 | 40 | #include 41 | #include 42 | #include "libics_intern.h" 43 | #include "libics_test.h" 44 | 45 | void IcsPrintIcs (ICS const* ics) 46 | { 47 | int p, ii; 48 | Ics_Format Format; 49 | int Sign; 50 | size_t Bits; 51 | char* s; 52 | 53 | IcsGetPropsDataType (ics->imel.dataType, &Format, &Sign, &Bits); 54 | p = ics->dimensions; 55 | printf ("Version: %d\n", ics->version); 56 | printf ("FileMode: %d\n", ics->fileMode); 57 | printf ("Filename: %s\n", ics->filename); 58 | printf ("SrcFile: %s\n", ics->srcFile); 59 | printf ("SrcOffset: %ld\n", (long int)ics->srcOffset); 60 | printf ("Data: %p\n", ics->data); 61 | printf ("DataLength: %ld\n", (long int)ics->dataLength); 62 | printf ("Parameters: %d\n", ics->dimensions+1); 63 | printf ("Order: bits "); 64 | for (ii=0; iidim[ii].order); 66 | printf ("\n"); 67 | printf ("Sizes: %d ", (int)Bits); 68 | for (ii=0; iidim[ii].size); 70 | printf ("\n"); 71 | printf ("Sigbits: %d\n", (int)ics->imel.sigBits); 72 | printf ("Origin: %f ", ics->imel.origin); 73 | for (ii=0; iidim[ii].origin); 75 | printf ("\n"); 76 | printf ("Scale: %f ", ics->imel.scale); 77 | for (ii=0; iidim[ii].scale); 79 | printf ("\n"); 80 | printf ("Labels: intensity "); 81 | for (ii=0; iidim[ii].label); 83 | printf ("\n"); 84 | printf ("Units: %s ", ics->imel.unit); 85 | for (ii=0; iidim[ii].unit); 87 | printf ("\n"); 88 | switch (Format) { 89 | case IcsForm_real: 90 | s = "real"; 91 | break; 92 | case IcsForm_complex: 93 | s = "complex"; 94 | break; 95 | default: 96 | s = "integer"; 97 | } 98 | printf ("Format: %s\n", s); 99 | printf ("Sign: %s\n", Sign?"signed":"unsigned"); 100 | printf ("SCIL_TYPE: %s\n", ics->scilType); 101 | printf ("Coordinates: %s\n", ics->coord); 102 | switch (ics->compression) { 103 | case IcsCompr_uncompressed: 104 | s = "uncompressed"; 105 | break; 106 | case IcsCompr_compress: 107 | s = "compress"; 108 | break; 109 | case IcsCompr_gzip: 110 | s = "gzip"; 111 | break; 112 | default: 113 | s = "unknown"; 114 | } 115 | printf ("Compression: %s (level %d)\n", s, ics->compLevel); 116 | printf ("Byteorder: "); 117 | for (ii=0; iibyteOrder[ii] != 0) 119 | printf ("%d ", ics->byteOrder[ii]); 120 | else 121 | break; 122 | printf ("\n"); 123 | printf ("BlockRead: %p\n", ics->blockRead); 124 | if (ics->blockRead != NULL) { 125 | Ics_BlockRead* br = (Ics_BlockRead*)ics->blockRead; 126 | printf (" DataFilePtr: %p\n", (void*)br->dataFilePtr); 127 | #ifdef ICS_ZLIB 128 | printf (" ZlibStream: %p\n", br->zlibStream); 129 | printf (" ZlibInputBuffer: %p\n", br->zlibInputBuffer); 130 | #endif 131 | } 132 | printf ("Sensor data: \n"); 133 | printf (" Sensor type:"); 134 | for (ii=0; ii< ics->sensorChannels; ii++) 135 | printf(" %s", ics->type[ii]); 136 | printf("\n"); 137 | printf (" Sensor model: %s\n", ics->model); 138 | printf (" SensorChannels: %d\n", ics->sensorChannels); 139 | printf (" RefrInxMedium: %f\n", ics->refrInxMedium); 140 | printf (" NumAperture: %f\n", ics->numAperture); 141 | printf (" RefrInxLensMedium: %f\n", ics->refrInxLensMedium); 142 | printf (" PinholeSpacing: %f\n", ics->pinholeSpacing); 143 | printf (" PinholeRadius: "); 144 | for (ii = 0; ii < ICS_MAX_LAMBDA && ii < ics->sensorChannels; ++ii) { 145 | printf ("%f ", ics->pinholeRadius[ii]); 146 | } 147 | printf ("\n"); 148 | printf (" LambdaEx: "); 149 | for (ii = 0; ii < ICS_MAX_LAMBDA && ii < ics->sensorChannels; ++ii) { 150 | printf ("%f ", ics->lambdaEx[ii]); 151 | } 152 | printf ("\n"); 153 | printf (" LambdaEm: "); 154 | for (ii = 0; ii < ICS_MAX_LAMBDA && ii < ics->sensorChannels; ++ii) { 155 | printf ("%f ", ics->lambdaEm[ii]); 156 | } 157 | printf ("\n"); 158 | printf (" ExPhotonCnt: "); 159 | for (ii = 0; ii < ICS_MAX_LAMBDA && ii < ics->sensorChannels; ++ii) { 160 | printf ("%d ", ics->exPhotonCnt[ii]); 161 | } 162 | printf ("\n"); 163 | printf ("History Lines:\n"); 164 | if (ics->history != NULL) { 165 | Ics_History* hist = (Ics_History*)ics->history; 166 | for (ii = 0; ii < hist->nStr; ii++) { 167 | if (hist->strings[ii] != NULL) { 168 | printf (" %s\n", hist->strings[ii]); 169 | } 170 | } 171 | } 172 | } 173 | 174 | void IcsPrintError (Ics_Error error) 175 | { 176 | char const* msg; 177 | 178 | msg = IcsGetErrorText (error); 179 | printf ("libics error: %s.\n", msg); 180 | } 181 | 182 | -------------------------------------------------------------------------------- /libics_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libics: Image Cytometry Standard file reading and writing. 3 | * 4 | * Copyright 2015-2017: 5 | * Scientific Volume Imaging Holding B.V. 6 | * Hilversum, The Netherlands. 7 | * https://www.svi.nl 8 | * 9 | * Contact: libics@svi.nl 10 | * 11 | * Copyright (C) 2000-2013 Cris Luengo and others 12 | * 13 | * Large chunks of this library written by 14 | * Bert Gijsbers 15 | * Dr. Hans T.M. van der Voort 16 | * And also Damir Sudar, Geert van Kempen, Jan Jitze Krol, 17 | * Chiel Baarslag and Fons Laan. 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Library General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Library General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Library General Public 30 | * License along with this library; if not, write to the Free 31 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 32 | */ 33 | 34 | /* 35 | * FILE : libics_test.h 36 | * 37 | * Only needed to add debug functionality. 38 | */ 39 | 40 | #ifndef LIBICS_TEST_H 41 | #define LIBICS_TEST_H 42 | 43 | 44 | #include "libics.h" 45 | 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif 50 | 51 | 52 | /* Prints the contents of the ICS structure to stdout (using only printf). */ 53 | void IcsPrintIcs(ICS const* ics); 54 | 55 | /* Prints a textual representation of the error message to stdout (using only 56 | printf). */ 57 | void IcsPrintError(Ics_Error error); 58 | 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | 65 | #endif 66 | 67 | -------------------------------------------------------------------------------- /m4/ltsugar.m4: -------------------------------------------------------------------------------- 1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software 4 | # Foundation, Inc. 5 | # Written by Gary V. Vaughan, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 6 ltsugar.m4 12 | 13 | # This is to help aclocal find these macros, as it can't see m4_define. 14 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 15 | 16 | 17 | # lt_join(SEP, ARG1, [ARG2...]) 18 | # ----------------------------- 19 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 20 | # associated separator. 21 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 22 | # versions in m4sugar had bugs. 23 | m4_define([lt_join], 24 | [m4_if([$#], [1], [], 25 | [$#], [2], [[$2]], 26 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 27 | m4_define([_lt_join], 28 | [m4_if([$#$2], [2], [], 29 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 30 | 31 | 32 | # lt_car(LIST) 33 | # lt_cdr(LIST) 34 | # ------------ 35 | # Manipulate m4 lists. 36 | # These macros are necessary as long as will still need to support 37 | # Autoconf-2.59, which quotes differently. 38 | m4_define([lt_car], [[$1]]) 39 | m4_define([lt_cdr], 40 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 41 | [$#], 1, [], 42 | [m4_dquote(m4_shift($@))])]) 43 | m4_define([lt_unquote], $1) 44 | 45 | 46 | # lt_append(MACRO-NAME, STRING, [SEPARATOR]) 47 | # ------------------------------------------ 48 | # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. 49 | # Note that neither SEPARATOR nor STRING are expanded; they are appended 50 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 51 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different 52 | # than defined and empty). 53 | # 54 | # This macro is needed until we can rely on Autoconf 2.62, since earlier 55 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 56 | m4_define([lt_append], 57 | [m4_define([$1], 58 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 59 | 60 | 61 | 62 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 63 | # ---------------------------------------------------------- 64 | # Produce a SEP delimited list of all paired combinations of elements of 65 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 66 | # has the form PREFIXmINFIXSUFFIXn. 67 | # Needed until we can rely on m4_combine added in Autoconf 2.62. 68 | m4_define([lt_combine], 69 | [m4_if(m4_eval([$# > 3]), [1], 70 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 71 | [[m4_foreach([_Lt_prefix], [$2], 72 | [m4_foreach([_Lt_suffix], 73 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 74 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 75 | 76 | 77 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 78 | # ----------------------------------------------------------------------- 79 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 80 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 81 | m4_define([lt_if_append_uniq], 82 | [m4_ifdef([$1], 83 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 84 | [lt_append([$1], [$2], [$3])$4], 85 | [$5])], 86 | [lt_append([$1], [$2], [$3])$4])]) 87 | 88 | 89 | # lt_dict_add(DICT, KEY, VALUE) 90 | # ----------------------------- 91 | m4_define([lt_dict_add], 92 | [m4_define([$1($2)], [$3])]) 93 | 94 | 95 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 96 | # -------------------------------------------- 97 | m4_define([lt_dict_add_subkey], 98 | [m4_define([$1($2:$3)], [$4])]) 99 | 100 | 101 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 102 | # ---------------------------------- 103 | m4_define([lt_dict_fetch], 104 | [m4_ifval([$3], 105 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 106 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 107 | 108 | 109 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 110 | # ----------------------------------------------------------------- 111 | m4_define([lt_if_dict_fetch], 112 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 113 | [$5], 114 | [$6])]) 115 | 116 | 117 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 118 | # -------------------------------------------------------------- 119 | m4_define([lt_dict_filter], 120 | [m4_if([$5], [], [], 121 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 122 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 123 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 124 | ]) 125 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 4179 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.6]) 16 | m4_define([LT_PACKAGE_REVISION], [2.4.6]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.6' 20 | macro_revision='2.4.6' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /m4/lt~obsolete.m4: -------------------------------------------------------------------------------- 1 | # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software 4 | # Foundation, Inc. 5 | # Written by Scott James Remnant, 2004. 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 5 lt~obsolete.m4 12 | 13 | # These exist entirely to fool aclocal when bootstrapping libtool. 14 | # 15 | # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), 16 | # which have later been changed to m4_define as they aren't part of the 17 | # exported API, or moved to Autoconf or Automake where they belong. 18 | # 19 | # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN 20 | # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us 21 | # using a macro with the same name in our local m4/libtool.m4 it'll 22 | # pull the old libtool.m4 in (it doesn't see our shiny new m4_define 23 | # and doesn't know about Autoconf macros at all.) 24 | # 25 | # So we provide this file, which has a silly filename so it's always 26 | # included after everything else. This provides aclocal with the 27 | # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything 28 | # because those macros already exist, or will be overwritten later. 29 | # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 30 | # 31 | # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. 32 | # Yes, that means every name once taken will need to remain here until 33 | # we give up compatibility with versions before 1.7, at which point 34 | # we need to keep only those names which we still refer to. 35 | 36 | # This is to help aclocal find these macros, as it can't see m4_define. 37 | AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) 38 | 39 | m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) 40 | m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) 41 | m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) 42 | m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) 43 | m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) 44 | m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) 45 | m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) 46 | m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) 47 | m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) 48 | m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) 49 | m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) 50 | m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) 51 | m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) 52 | m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) 53 | m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) 54 | m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) 55 | m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) 56 | m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) 57 | m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) 58 | m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) 59 | m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) 60 | m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) 61 | m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) 62 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) 63 | m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) 64 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) 65 | m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) 66 | m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) 67 | m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) 68 | m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) 69 | m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) 70 | m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) 71 | m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) 72 | m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) 73 | m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) 74 | m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) 75 | m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) 76 | m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) 77 | m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) 78 | m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) 79 | m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) 80 | m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) 81 | m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) 82 | m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) 83 | m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) 84 | m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) 85 | m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) 86 | m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) 87 | m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) 88 | m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) 89 | m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) 90 | m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) 91 | m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) 92 | m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) 93 | m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) 94 | m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) 95 | m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) 96 | m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) 97 | m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) 98 | m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) 99 | m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) 100 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common wrapper for a few potentially missing GNU programs. 3 | 4 | scriptversion=2013-10-28.13; # UTC 5 | 6 | # Copyright (C) 1996-2014 Free Software Foundation, Inc. 7 | # Originally written by Fran,cois Pinard , 1996. 8 | 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | if test $# -eq 0; then 28 | echo 1>&2 "Try '$0 --help' for more information" 29 | exit 1 30 | fi 31 | 32 | case $1 in 33 | 34 | --is-lightweight) 35 | # Used by our autoconf macros to check whether the available missing 36 | # script is modern enough. 37 | exit 0 38 | ;; 39 | 40 | --run) 41 | # Back-compat with the calling convention used by older automake. 42 | shift 43 | ;; 44 | 45 | -h|--h|--he|--hel|--help) 46 | echo "\ 47 | $0 [OPTION]... PROGRAM [ARGUMENT]... 48 | 49 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50 | to PROGRAM being missing or too old. 51 | 52 | Options: 53 | -h, --help display this help and exit 54 | -v, --version output version information and exit 55 | 56 | Supported PROGRAM values: 57 | aclocal autoconf autoheader autom4te automake makeinfo 58 | bison yacc flex lex help2man 59 | 60 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61 | 'g' are ignored when checking the name. 62 | 63 | Send bug reports to ." 64 | exit $? 65 | ;; 66 | 67 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68 | echo "missing $scriptversion (GNU Automake)" 69 | exit $? 70 | ;; 71 | 72 | -*) 73 | echo 1>&2 "$0: unknown '$1' option" 74 | echo 1>&2 "Try '$0 --help' for more information" 75 | exit 1 76 | ;; 77 | 78 | esac 79 | 80 | # Run the given program, remember its exit status. 81 | "$@"; st=$? 82 | 83 | # If it succeeded, we are done. 84 | test $st -eq 0 && exit 0 85 | 86 | # Also exit now if we it failed (or wasn't found), and '--version' was 87 | # passed; such an option is passed most likely to detect whether the 88 | # program is present and works. 89 | case $2 in --version|--help) exit $st;; esac 90 | 91 | # Exit code 63 means version mismatch. This often happens when the user 92 | # tries to use an ancient version of a tool on a file that requires a 93 | # minimum version. 94 | if test $st -eq 63; then 95 | msg="probably too old" 96 | elif test $st -eq 127; then 97 | # Program was missing. 98 | msg="missing on your system" 99 | else 100 | # Program was found and executed, but failed. Give up. 101 | exit $st 102 | fi 103 | 104 | perl_URL=http://www.perl.org/ 105 | flex_URL=http://flex.sourceforge.net/ 106 | gnu_software_URL=http://www.gnu.org/software 107 | 108 | program_details () 109 | { 110 | case $1 in 111 | aclocal|automake) 112 | echo "The '$1' program is part of the GNU Automake package:" 113 | echo "<$gnu_software_URL/automake>" 114 | echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115 | echo "<$gnu_software_URL/autoconf>" 116 | echo "<$gnu_software_URL/m4/>" 117 | echo "<$perl_URL>" 118 | ;; 119 | autoconf|autom4te|autoheader) 120 | echo "The '$1' program is part of the GNU Autoconf package:" 121 | echo "<$gnu_software_URL/autoconf/>" 122 | echo "It also requires GNU m4 and Perl in order to run:" 123 | echo "<$gnu_software_URL/m4/>" 124 | echo "<$perl_URL>" 125 | ;; 126 | esac 127 | } 128 | 129 | give_advice () 130 | { 131 | # Normalize program name to check for. 132 | normalized_program=`echo "$1" | sed ' 133 | s/^gnu-//; t 134 | s/^gnu//; t 135 | s/^g//; t'` 136 | 137 | printf '%s\n' "'$1' is $msg." 138 | 139 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140 | case $normalized_program in 141 | autoconf*) 142 | echo "You should only need it if you modified 'configure.ac'," 143 | echo "or m4 files included by it." 144 | program_details 'autoconf' 145 | ;; 146 | autoheader*) 147 | echo "You should only need it if you modified 'acconfig.h' or" 148 | echo "$configure_deps." 149 | program_details 'autoheader' 150 | ;; 151 | automake*) 152 | echo "You should only need it if you modified 'Makefile.am' or" 153 | echo "$configure_deps." 154 | program_details 'automake' 155 | ;; 156 | aclocal*) 157 | echo "You should only need it if you modified 'acinclude.m4' or" 158 | echo "$configure_deps." 159 | program_details 'aclocal' 160 | ;; 161 | autom4te*) 162 | echo "You might have modified some maintainer files that require" 163 | echo "the 'autom4te' program to be rebuilt." 164 | program_details 'autom4te' 165 | ;; 166 | bison*|yacc*) 167 | echo "You should only need it if you modified a '.y' file." 168 | echo "You may want to install the GNU Bison package:" 169 | echo "<$gnu_software_URL/bison/>" 170 | ;; 171 | lex*|flex*) 172 | echo "You should only need it if you modified a '.l' file." 173 | echo "You may want to install the Fast Lexical Analyzer package:" 174 | echo "<$flex_URL>" 175 | ;; 176 | help2man*) 177 | echo "You should only need it if you modified a dependency" \ 178 | "of a man page." 179 | echo "You may want to install the GNU Help2man package:" 180 | echo "<$gnu_software_URL/help2man/>" 181 | ;; 182 | makeinfo*) 183 | echo "You should only need it if you modified a '.texi' file, or" 184 | echo "any other file indirectly affecting the aspect of the manual." 185 | echo "You might want to install the Texinfo package:" 186 | echo "<$gnu_software_URL/texinfo/>" 187 | echo "The spurious makeinfo call might also be the consequence of" 188 | echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189 | echo "want to install GNU make:" 190 | echo "<$gnu_software_URL/make/>" 191 | ;; 192 | *) 193 | echo "You might have modified some files without having the proper" 194 | echo "tools for further handling them. Check the 'README' file, it" 195 | echo "often tells you about the needed prerequisites for installing" 196 | echo "this package. You may also peek at any GNU archive site, in" 197 | echo "case some other package contains this missing '$1' program." 198 | ;; 199 | esac 200 | } 201 | 202 | give_advice "$1" | sed -e '1s/^/WARNING: /' \ 203 | -e '2,$s/^/ /' >&2 204 | 205 | # Propagate the correct exit status (expected to be 127 for a program 206 | # not found, 63 for a program that failed due to version mismatch). 207 | exit $st 208 | 209 | # Local variables: 210 | # eval: (add-hook 'write-file-hooks 'time-stamp) 211 | # time-stamp-start: "scriptversion=" 212 | # time-stamp-format: "%:y-%02m-%02d.%02H" 213 | # time-stamp-time-zone: "UTC" 214 | # time-stamp-end: "; # UTC" 215 | # End: 216 | -------------------------------------------------------------------------------- /support/cpp_interface/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # libics: Image Cytometry Standard file reading and writing. 4 | # 5 | # C++ interface 6 | # Copyright 2018 Cris Luengo 7 | # 8 | ############################################################################## 9 | 10 | # Compiler flags 11 | set(CMAKE_CXX_STANDARD 14) 12 | set(CMAKE_CXX_STANDARD_REQUIRED on) 13 | set(CMAKE_CXX_VISIBILITY_PRESET hidden) 14 | set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) 15 | 16 | if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # also matchs "AppleClang" 17 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wconversion -Wsign-conversion -pedantic") 18 | elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU") 19 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wconversion -Wsign-conversion -pedantic") 20 | elseif(CMAKE_C_COMPILER_ID STREQUAL "Intel") 21 | # TODO: compiler flags for Intel compiler 22 | elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") 23 | # TODO: compiler flags for MSVC compiler 24 | endif() 25 | 26 | set(SOURCES ${CMAKE_CURRENT_LIST_DIR}/libics.cpp) 27 | set(HEADERS ${CMAKE_CURRENT_LIST_DIR}/libics.hpp) 28 | 29 | add_library(libics_cpp ${SOURCES} ${HEADERS}) 30 | target_link_libraries(libics_cpp PRIVATE libics) 31 | 32 | if(BUILD_SHARED_LIBS) 33 | target_compile_definitions(libics_cpp PRIVATE BUILD_ICSCPP) # When compiling DLL/SO 34 | target_compile_definitions(libics_cpp INTERFACE USE_ICSCPP_DLL) # When linking against DLL/SO 35 | endif() 36 | 37 | target_include_directories(libics_cpp PUBLIC $) 38 | 39 | if(UNIX) 40 | set_target_properties(libics_cpp PROPERTIES OUTPUT_NAME "ics_cpp") 41 | endif(UNIX) 42 | 43 | # Install 44 | export(TARGETS libics_cpp FILE cmake/libics_cppTargets.cmake) 45 | 46 | include(CMakePackageConfigHelpers) 47 | write_basic_package_version_file( 48 | cmake/libics_cppConfigVersion.cmake 49 | VERSION ${PACKAGE_VERSION} 50 | COMPATIBILITY AnyNewerVersion) 51 | 52 | configure_package_config_file( 53 | ${CMAKE_CURRENT_SOURCE_DIR}/cmake/libicsConfig.cmake.in 54 | cmake/libics_cppConfig.cmake 55 | INSTALL_DESTINATION cmake/) 56 | 57 | install(TARGETS libics_cpp 58 | EXPORT libics_cppTargets 59 | ARCHIVE DESTINATION lib 60 | LIBRARY DESTINATION lib 61 | RUNTIME DESTINATION bin 62 | INCLUDES DESTINATION include) 63 | 64 | install(FILES ${HEADERS} DESTINATION include) 65 | 66 | install(FILES 67 | ${CMAKE_CURRENT_BINARY_DIR}/cmake/libics_cppConfig.cmake 68 | ${CMAKE_CURRENT_BINARY_DIR}/cmake/libics_cppConfigVersion.cmake 69 | DESTINATION cmake/) 70 | 71 | install(EXPORT libics_cppTargets DESTINATION cmake) 72 | 73 | 74 | # Unit tests 75 | add_executable(test_ics2a_cpp EXCLUDE_FROM_ALL ${CMAKE_CURRENT_LIST_DIR}/test_ics2a.cpp) 76 | target_link_libraries(test_ics2a_cpp libics_cpp) 77 | add_executable(test_ics2b_cpp EXCLUDE_FROM_ALL ${CMAKE_CURRENT_LIST_DIR}/test_ics2b.cpp) 78 | target_link_libraries(test_ics2b_cpp libics_cpp) 79 | add_executable(test_metadata_cpp EXCLUDE_FROM_ALL ${CMAKE_CURRENT_LIST_DIR}/test_metadata.cpp) 80 | target_link_libraries(test_metadata_cpp libics_cpp) 81 | add_executable(test_history_cpp EXCLUDE_FROM_ALL ${CMAKE_CURRENT_LIST_DIR}/test_history.cpp) 82 | target_link_libraries(test_history_cpp libics_cpp) 83 | 84 | set(TEST_PROGRAMS ${TEST_PROGRAMS} test_ics2a_cpp test_ics2b_cpp test_metadata_cpp test_history_cpp) 85 | add_dependencies(all_tests ${TEST_PROGRAMS}) 86 | 87 | add_test(NAME test_ics2a_cpp COMMAND test_ics2a_cpp "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_v2a_cpp.ics) 88 | set_tests_properties(test_ics2a_cpp PROPERTIES DEPENDS ctest_build_test_code) 89 | add_test(NAME test_ics2b_cpp COMMAND test_ics2b_cpp "${CMAKE_CURRENT_SOURCE_DIR}/test/testim.ics" result_v2b_cpp.ics) 90 | set_tests_properties(test_ics2b_cpp PROPERTIES DEPENDS ctest_build_test_code) 91 | add_test(NAME test_metadata1_cpp COMMAND test_metadata_cpp result_v1.ics) 92 | set_tests_properties(test_metadata1_cpp PROPERTIES DEPENDS test_ics1) 93 | add_test(NAME test_metadata2_cpp COMMAND test_metadata_cpp result_v2a.ics) 94 | set_tests_properties(test_metadata2_cpp PROPERTIES DEPENDS test_ics2a) 95 | add_test(NAME test_metadata3_cpp COMMAND test_metadata_cpp result_v2b.ics) 96 | set_tests_properties(test_metadata3_cpp PROPERTIES DEPENDS test_ics2b) 97 | if(LIBICS_USE_ZLIB) 98 | add_test(NAME test_metadata4_cpp COMMAND test_metadata_cpp result_v2z.ics) 99 | set_tests_properties(test_metadata4_cpp PROPERTIES DEPENDS test_gzip) 100 | endif() 101 | add_test(NAME test_history_cpp COMMAND test_history_cpp result_v1.ics) 102 | set_tests_properties(test_history_cpp PROPERTIES DEPENDS test_ics1) 103 | -------------------------------------------------------------------------------- /support/cpp_interface/test_history.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libics.hpp" 3 | 4 | int main(int argc, const char* argv[]) { 5 | 6 | constexpr char const* token1 = "sequence1cpp"; 7 | constexpr char const* token2 = "sequence2cpp"; 8 | constexpr char const* stuff1 = "this is some data"; 9 | constexpr char const* stuff2 = "this is some more data"; 10 | constexpr char const* stuff3 = "this is some other stuff"; 11 | 12 | if (argc != 2) { 13 | std::cerr << "One file names required\n"; 14 | exit(-1); 15 | } 16 | 17 | try { 18 | 19 | // Open image for update 20 | ics::ICS ip(argv[1], "rw"); 21 | 22 | // Remove history lines 23 | ip.DeleteHistory("testcpp"); // delete history line added by test_metadata.cpp 24 | 25 | // Add history lines 26 | ip.AddHistoryString(token1, stuff1); 27 | ip.AddHistoryString(token1, stuff2); 28 | ip.AddHistoryString(token2, stuff3); 29 | 30 | // Check 31 | if (ip.GetNumHistoryStrings() != 3) { 32 | std::cerr << "Number of history lines not correct.\n"; 33 | exit(-1); 34 | } 35 | 36 | // Read history lines and compare 37 | auto it = ip.NewHistoryIterator(); 38 | auto pair = it.KeyValue(); 39 | if (pair.key != token1 || pair.value != stuff1) { 40 | std::cerr << "1st history string does not match: \"" << pair.key << '/' << pair.value 41 | << "\" vs \"" << token1 << '/' << stuff1 << "\"\n"; 42 | exit(-1); 43 | } 44 | pair = it.KeyValue(); 45 | if (pair.key != token1 || pair.value != stuff2) { 46 | std::cerr << "2nd history string does not match: \"" << pair.key << '/' << pair.value 47 | << "\" vs \"" << token1 << '/' << stuff2 << "\"\n"; 48 | exit(-1); 49 | } 50 | pair = it.KeyValue(); 51 | if (pair.key != token2 || pair.value != stuff3) { 52 | std::cerr << "3rd history string does not match: \"" << pair.key << '/' << pair.value 53 | << "\" vs \"" << token2 << '/' << stuff3 << "\"\n"; 54 | exit(-1); 55 | } 56 | 57 | // Check earlier deleted line 58 | it = ip.NewHistoryIterator("testcpp"); 59 | if (!it.String().empty()) { 60 | std::cerr << "Did not properly delete original 'testcpp' line.\n"; 61 | exit(-1); 62 | } 63 | 64 | // Read token2 line 65 | it = ip.NewHistoryIterator(token2); 66 | pair = it.KeyValue(); 67 | if (pair.key != token2 || pair.value != stuff3) { 68 | std::cerr << "history string does not match.\n"; 69 | exit(-1); 70 | } 71 | 72 | // Commit changes 73 | ip.Close(); 74 | 75 | } catch (std::exception const& e) { 76 | std::cerr << "Exception thrown in libics: " << e.what() << '\n'; 77 | exit(-1); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /support/cpp_interface/test_ics2a.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "libics.hpp" 6 | 7 | int main(int argc, const char* argv[]) { 8 | if (argc != 3) { 9 | std::cerr << "Two file names required: in out\n"; 10 | exit(-1); 11 | } 12 | 13 | try { 14 | 15 | // Read image 16 | ics::ICS ip(argv[1], "r"); 17 | auto layout = ip.GetLayout(); 18 | std::size_t bufsize = ip.GetDataSize(); 19 | std::unique_ptr buf1{new std::uint8_t[bufsize]}; 20 | ip.GetData(buf1.get(), bufsize); 21 | ip.Close(); 22 | 23 | // Write image 24 | ip.Open(argv[2], "w2"); 25 | ip.SetLayout(layout.dataType, layout.dimensions); 26 | std::string datafile{argv[1]}; 27 | auto pos = datafile.rfind('.'); 28 | if (pos != std::string::npos) { 29 | datafile.erase(pos); 30 | } 31 | datafile += ".ids"; 32 | ip.SetSource(datafile, 0); 33 | ip.SetByteOrder(ics::ByteOrder::LittleEndian); 34 | ip.SetCompression(ics::Compression::Uncompressed, 0); 35 | ip.Close(); 36 | 37 | // Read image 38 | ip.Open(argv[2], "r"); 39 | if (bufsize != ip.GetDataSize()) { 40 | std::cerr << "Data in output file not same size as written.\n"; 41 | exit(-1); 42 | } 43 | std::unique_ptr buf2{new std::uint8_t[bufsize]}; 44 | ip.GetData(buf2.get(), bufsize); 45 | ip.Close(); 46 | if (memcmp(buf1.get(), buf2.get(), bufsize) != 0) { 47 | std::cerr << "Data in output file does not match data in input.\n"; 48 | exit(-1); 49 | } 50 | 51 | } catch (std::exception const& e) { 52 | std::cerr << "Exception thrown in libics: " << e.what() << '\n'; 53 | exit(-1); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /support/cpp_interface/test_ics2b.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "libics.hpp" 6 | 7 | int main(int argc, const char* argv[]) { 8 | 9 | if (argc != 3) { 10 | std::cerr << "Two file names required: in out\n"; 11 | exit(-1); 12 | } 13 | 14 | try { 15 | 16 | // Read image 17 | ics::ICS ip(argv[1], "r"); 18 | auto layout = ip.GetLayout(); 19 | std::size_t bufsize = ip.GetDataSize(); 20 | std::unique_ptr buf1{new std::uint8_t[bufsize]}; 21 | ip.GetData(buf1.get(), bufsize); 22 | ip.Close(); 23 | 24 | // Write image 25 | ip.Open(argv[2], "w2"); 26 | ip.SetLayout(layout.dataType, layout.dimensions); 27 | ip.SetData(buf1.get(), bufsize); 28 | ip.SetCompression(ics::Compression::Uncompressed, 0); 29 | ip.Close(); 30 | 31 | // Read image 32 | ip.Open(argv[2], "r"); 33 | if (bufsize != ip.GetDataSize()) { 34 | std::cerr << "Data in output file not same size as written.\n"; 35 | exit(-1); 36 | } 37 | std::unique_ptr buf2{new std::uint8_t[bufsize]}; 38 | ip.GetData(buf2.get(), bufsize); 39 | ip.Close(); 40 | if (memcmp(buf1.get(), buf2.get(), bufsize) != 0) { 41 | std::cerr << "Data in output file does not match data in input.\n"; 42 | exit(-1); 43 | } 44 | 45 | } catch (std::exception const& e) { 46 | std::cerr << "Exception thrown in libics: " << e.what() << '\n'; 47 | exit(-1); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /support/cpp_interface/test_metadata.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "libics.hpp" 6 | 7 | int main(int argc, const char* argv[]) { 8 | 9 | if (argc != 2) { 10 | std::cerr << "One file name required\n"; 11 | exit(-1); 12 | } 13 | 14 | try { 15 | 16 | // Open image for update 17 | ics::ICS ip(argv[1], "rw"); 18 | auto layout = ip.GetLayout(); 19 | std::size_t bufsize = ip.GetDataSize(); 20 | std::unique_ptr buf1{new std::uint8_t[bufsize]}; 21 | ip.GetData(buf1.get(), bufsize); 22 | 23 | // Add and change metadata 24 | ip.SetPosition(0, {5.7, 1.3, "m"}); 25 | ip.SetPosition(1, {-8.2, 1.2, "meter"}); 26 | ip.DeleteHistory(); 27 | ip.AddHistoryString("testcpp", "Adding history line."); 28 | 29 | // Commit changes 30 | ip.Close(); 31 | 32 | // Read image 33 | ip.Open(argv[1], "r"); 34 | 35 | // Check metadata 36 | auto units = ip.GetPosition(0); 37 | if (units.origin != 5.7 || units.scale != 1.3 || units.units != "m") { 38 | std::cerr << "Different position metadata read back\n"; 39 | exit(-1); 40 | } 41 | units = ip.GetPosition(1); 42 | if (units.origin != -8.2 || units.scale != 1.2 || units.units != "meter") { 43 | std::cerr << "Different position metadata read back\n"; 44 | exit(-1); 45 | } 46 | auto it = ip.NewHistoryIterator(); 47 | auto pair = it.KeyValue(); 48 | if (pair.key != "testcpp" || pair.value != "Adding history line.") { 49 | std::cerr << "Different history key/value pair read back\n"; 50 | exit(-1); 51 | } 52 | 53 | // Check pixel data 54 | if (bufsize != ip.GetDataSize()) { 55 | std::cerr << "Data in output file not same size as written.\n"; 56 | exit(-1); 57 | } 58 | std::unique_ptr buf2{new std::uint8_t[bufsize]}; 59 | ip.GetData(buf2.get(), bufsize); 60 | ip.Close(); 61 | if (memcmp(buf1.get(), buf2.get(), bufsize) != 0) { 62 | std::cerr << "Data in output file does not match data in input.\n"; 63 | exit(-1); 64 | } 65 | 66 | } catch (std::exception const& e) { 67 | std::cerr << "Exception thrown in libics: " << e.what() << '\n'; 68 | exit(-1); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /support/icsviewer/README: -------------------------------------------------------------------------------- 1 | 2 | Windows viewer example code 3 | =========================== 4 | 5 | This directory contains the sources for a very simple viewer 6 | utility. You'll need Visual C++ and Windows to run this. 7 | 8 | Basically, it's an example on how to use libics to read in 9 | a 2D preview of an ICS file. The file readics.c is the basis 10 | of the ICS plug-in for IrfanView (http://www.irfanview.com). 11 | 12 | The code in this directory falls under the same licence 13 | terms as libics itself. 14 | 15 | 16 | ------------------------------------------------------------- 17 | Copyright (C) 2001-2002 Cris L. Luengo Hendriks 18 | Frank de Jong 19 | 20 | Pattern Recognition Group 21 | Delft University of Technology 22 | The Netherlands 23 | ------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /support/icsviewer/icsviewer.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="icsviewer" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Application" 0x0101 6 | 7 | CFG=icsviewer - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "icsviewer.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "icsviewer.mak" CFG="icsviewer - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "icsviewer - Win32 Release" (based on "Win32 (x86) Application") 21 | !MESSAGE "icsviewer - Win32 Debug" (based on "Win32 (x86) Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "icsviewer - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 0 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release" 37 | # PROP BASE Intermediate_Dir "Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 0 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir "." 42 | # PROP Intermediate_Dir "." 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c 46 | # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c 47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 49 | # ADD BASE RSC /l 0x409 /d "NDEBUG" 50 | # ADD RSC /l 0x409 /d "NDEBUG" 51 | BSC32=bscmake.exe 52 | # ADD BASE BSC32 /nologo 53 | # ADD BSC32 /nologo 54 | LINK32=link.exe 55 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 56 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"msvcrtd" /nodefaultlib:"libcd" /nodefaultlib:"libc" 57 | 58 | !ELSEIF "$(CFG)" == "icsviewer - Win32 Debug" 59 | 60 | # PROP BASE Use_MFC 0 61 | # PROP BASE Use_Debug_Libraries 1 62 | # PROP BASE Output_Dir "Debug" 63 | # PROP BASE Intermediate_Dir "Debug" 64 | # PROP BASE Target_Dir "" 65 | # PROP Use_MFC 0 66 | # PROP Use_Debug_Libraries 1 67 | # PROP Output_Dir "." 68 | # PROP Intermediate_Dir "." 69 | # PROP Ignore_Export_Lib 0 70 | # PROP Target_Dir "" 71 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c 72 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c 73 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 74 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 75 | # ADD BASE RSC /l 0x409 /d "_DEBUG" 76 | # ADD RSC /l 0x409 /d "_DEBUG" 77 | BSC32=bscmake.exe 78 | # ADD BASE BSC32 /nologo 79 | # ADD BSC32 /nologo 80 | LINK32=link.exe 81 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 82 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /pdbtype:sept 83 | # SUBTRACT LINK32 /nodefaultlib 84 | 85 | !ENDIF 86 | 87 | # Begin Target 88 | 89 | # Name "icsviewer - Win32 Release" 90 | # Name "icsviewer - Win32 Debug" 91 | # Begin Group "Source Files" 92 | 93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" 94 | # Begin Source File 95 | 96 | SOURCE=.\readics.c 97 | # End Source File 98 | # Begin Source File 99 | 100 | SOURCE=.\viewer.c 101 | # End Source File 102 | # Begin Source File 103 | 104 | SOURCE=.\viewer.rc 105 | # End Source File 106 | # Begin Source File 107 | 108 | SOURCE=.\writedib.c 109 | # End Source File 110 | # End Group 111 | # Begin Group "Header Files" 112 | 113 | # PROP Default_Filter "h;hpp;hxx;hm;inl" 114 | # End Group 115 | # Begin Group "Resource Files" 116 | 117 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" 118 | # Begin Source File 119 | 120 | SOURCE=.\viewer.ico 121 | # End Source File 122 | # End Group 123 | # Begin Source File 124 | 125 | SOURCE=..\..\libics.lib 126 | # End Source File 127 | # Begin Source File 128 | 129 | SOURCE=..\..\..\zlib\zlib.lib 130 | # End Source File 131 | # End Target 132 | # End Project 133 | -------------------------------------------------------------------------------- /support/icsviewer/icsviewer.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "icsviewer"=.\icsviewer.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /support/icsviewer/readics.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "..\..\libics.h" 4 | 5 | int IsICS (char *filename) { 6 | if (IcsVersion (filename, 0) != 0) 7 | return 1; 8 | else 9 | return 0; 10 | } 11 | 12 | int NumberOfPlanesInICS (char *filename, char *errortext) { 13 | /* errortext must point to ERRORTEXT_LENGTH=300 bytes. */ 14 | ICS* ip; 15 | Ics_Error retval; 16 | int ii, numberofplanes = 0; 17 | int ndims; 18 | int dims[ICS_MAXDIM]; 19 | Ics_DataType dt; 20 | 21 | /* Read ICS header. */ 22 | for (ii=0; iibmiHeader.biSize = sizeof(BITMAPINFOHEADER); 114 | bi->bmiHeader.biWidth = dims[0]; 115 | bi->bmiHeader.biHeight = -dims[1]; 116 | bi->bmiHeader.biPlanes = 1; 117 | bi->bmiHeader.biBitCount = 8; 118 | bi->bmiHeader.biCompression = BI_RGB; 119 | bi->bmiHeader.biSizeImage = 0; 120 | bi->bmiHeader.biXPelsPerMeter = 0; 121 | bi->bmiHeader.biYPelsPerMeter = 0; 122 | bi->bmiHeader.biClrUsed = 0 /*256*/; 123 | bi->bmiHeader.biClrImportant = 0 /*256*/; 124 | cmap = bi->bmiColors; 125 | for (ii=0; ii<256; ii++) { 126 | cmap->rgbBlue = ii; 127 | cmap->rgbRed = ii; 128 | cmap->rgbGreen = ii; 129 | cmap++; 130 | } 131 | 132 | /* Read ICS data. */ 133 | buf = (char*)bi + sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD); 134 | retval = IcsGetPreviewData (ip, buf, dims[0]*dims[1], planenumber); 135 | IcsClose (ip); 136 | /* Move the data so that each line starts at a four-byte boundary */ 137 | if (padding != 0) { 138 | tmp = buf + dims[0]*dims[1] - 1; /* points to last byte read */ 139 | buf += (dims[0]+padding)*dims[1]-1-padding; /* points to where last byte needs to be */ 140 | for (ii=dims[1]-1; ii>=0; ii--) { 141 | for (jj=dims[0]-1; jj>=0; jj--) { 142 | *buf = *tmp; 143 | tmp--; 144 | buf--; 145 | } 146 | buf -= padding; 147 | } 148 | } 149 | GlobalUnlock (DIB); 150 | /* Error messages? */ 151 | switch (retval) { 152 | case IcsErr_FOpenIds: 153 | strcpy (errortext, "Failed to open the data file."); 154 | break; 155 | case IcsErr_FReadIds: 156 | case IcsErr_CorruptedStream: 157 | case IcsErr_DecompressionProblem: 158 | case IcsErr_EndOfStream: 159 | strcpy (errortext, "Failed reading the data file."); 160 | break; 161 | case IcsErr_IllegalROI: 162 | strcpy (errortext, "Requested plane is outside the image."); 163 | break; 164 | case IcsErr_UnknownDataType: 165 | strcpy (errortext, "Unsupported pixel data type."); 166 | break; 167 | case IcsErr_UnknownCompression: 168 | strcpy (errortext, "Unsupported compression method."); 169 | break; 170 | case IcsErr_Alloc: 171 | strcpy (errortext, "Couldn't allocate memory to read ICS file."); 172 | break; 173 | default: 174 | strcpy (errortext, "Unspecified error reading data."); 175 | case IcsErr_Ok: 176 | case IcsErr_OutputNotFilled: 177 | /* It's OK. */ 178 | return DIB; 179 | } 180 | /* There's an error */ 181 | GlobalFree (DIB); 182 | return 0; 183 | } 184 | -------------------------------------------------------------------------------- /support/icsviewer/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by viewer.rc 4 | // 5 | #define ID_FILE_SAVEASBMP 40001 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NO_MFC 1 12 | #define _APS_NEXT_RESOURCE_VALUE 101 13 | #define _APS_NEXT_COMMAND_VALUE 40002 14 | #define _APS_NEXT_CONTROL_VALUE 1000 15 | #define _APS_NEXT_SYMED_VALUE 101 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /support/icsviewer/viewer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svi-opensource/libics/996a49275150e7bedcc5f46b9dc39e168bb6b875/support/icsviewer/viewer.ico -------------------------------------------------------------------------------- /support/icsviewer/viewer.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | ///////////////////////////////////////////////////////////////////////////// 6 | // 7 | // Icon 8 | // 9 | 10 | // Icon with lowest ID value placed first to ensure application icon 11 | // remains consistent on all systems. 12 | ICSVIEWER ICON DISCARDABLE "viewer.ico" 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | // 16 | // Menu 17 | // 18 | 19 | ICSVIEWER MENU DISCARDABLE 20 | BEGIN 21 | POPUP "&File" 22 | BEGIN 23 | MENUITEM "&Open...", 200 24 | MENUITEM "Save &As BMP...", 300 25 | MENUITEM SEPARATOR 26 | MENUITEM "E&xit", 100 27 | END 28 | END 29 | 30 | 31 | #ifdef APSTUDIO_INVOKED 32 | ///////////////////////////////////////////////////////////////////////////// 33 | // 34 | // TEXTINCLUDE 35 | // 36 | 37 | 1 TEXTINCLUDE DISCARDABLE 38 | BEGIN 39 | "resource.h\0" 40 | END 41 | 42 | 2 TEXTINCLUDE DISCARDABLE 43 | BEGIN 44 | "\0" 45 | END 46 | 47 | 3 TEXTINCLUDE DISCARDABLE 48 | BEGIN 49 | "\r\n" 50 | "\0" 51 | END 52 | 53 | #endif // APSTUDIO_INVOKED 54 | 55 | #ifndef APSTUDIO_INVOKED 56 | ///////////////////////////////////////////////////////////////////////////// 57 | // 58 | // Generated from the TEXTINCLUDE 3 resource. 59 | // 60 | 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | #endif // not APSTUDIO_INVOKED 64 | 65 | -------------------------------------------------------------------------------- /support/icsviewer/writedib.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* WriteDIB - Writes a DIB to file 5 | * Returns - TRUE on success 6 | * szFile - Name of file to write to 7 | * hDIB - Handle of the DIB 8 | */ 9 | 10 | /* 20020912 - Patched by Frank de Jong from CodeGuru original */ 11 | 12 | BOOL WriteDIB( LPTSTR szFile, HANDLE hDIB, LPBITMAPINFO lpbi ) 13 | { 14 | BITMAPFILEHEADER hdr; 15 | LPBITMAPINFOHEADER lpbih; 16 | FILE *fp; 17 | int nColors; 18 | int bitSize; 19 | 20 | if (!hDIB) 21 | return FALSE; 22 | 23 | if( (fp = fopen( szFile, "wb" )) == 0 ) 24 | return FALSE; 25 | 26 | lpbih = (LPBITMAPINFOHEADER) lpbi; 27 | 28 | nColors = 1 << lpbih->biBitCount; 29 | 30 | // Fill in the fields of the file header 31 | hdr.bfType = ((WORD) ('M' << 8) | 'B'); // is always "BM" 32 | hdr.bfSize = GlobalSize (hDIB) + sizeof( hdr ); 33 | hdr.bfReserved1 = 0; 34 | hdr.bfReserved2 = 0; 35 | hdr.bfOffBits = (DWORD) (sizeof( hdr ) + lpbih->biSize + 36 | nColors * sizeof(RGBQUAD)); 37 | 38 | // Write the file header 39 | fwrite( &hdr, 1, sizeof(hdr), fp ); 40 | 41 | // Write the DIB header and the bits 42 | bitSize = GlobalSize(hDIB); 43 | fwrite( lpbih, 1, bitSize, fp ); 44 | 45 | fclose( fp ); 46 | 47 | return TRUE; 48 | } 49 | -------------------------------------------------------------------------------- /support/matlab/README: -------------------------------------------------------------------------------- 1 | 2 | libics MATLAB interface 3 | ======================= 4 | 5 | This directory contains the sources for MATLAB MEX-files 6 | that use libics to read and write ICS files. They serve 7 | as examples on how to use libics, but are also useful for 8 | people that use MATLAB and want to add ICS support. 9 | 10 | The code in this directory falls under the same licence 11 | terms as libics itself. 12 | 13 | This code is currently not supported by Scientific Volume Imaging. 14 | 15 | USAGE 16 | ===== 17 | 18 | The two MEX-files are used in this way: 19 | 20 | ------------------------------------------------------------- 21 | ICSREAD Reads a numeric array from an ICS file. 22 | A = ICSREAD(FILENAME) reads the numeric data in 23 | an ICS image file named FILENAME into A. 24 | 25 | Known limitations: 26 | - Complex data is not read. 27 | ------------------------------------------------------------- 28 | ICSWRITE Writes a numeric array to an ICS file. 29 | ICSWRITE(A,FILENAME,COMPRESS) writes the numeric data 30 | in A to an ICS image file named FILENAME. If COMPRESS 31 | is non-zero the data will be written compressed. 32 | 33 | Known limitations: 34 | - Complex data is not written. 35 | ------------------------------------------------------------- 36 | 37 | 38 | COMPILING 39 | ========= 40 | 41 | If your version of MATLAB is 7.2 or older, uncomment the line at 42 | the top of both source files that defines `mwSize`. 43 | 44 | - UNIX or macOS: 45 | Within MATLAB, type 46 | mex -I icsread.c /libics.a -lz 47 | mex -I icswrite.c /libics.a -lz 48 | from the directory containing both source files. If the Zlib library is not in a standard location, you will have 49 | to specify it explicitly, replace `-lz` with `/libz.a`. 50 | 51 | - Windows: 52 | Within MATLAB, type: 53 | mex -I -DWIN32 icsread.c \libics.lib \libz.lib 54 | mex -I -DWIN32 icswrite.c \libics.lib \libz.lib 55 | from the directory containing both source files. If you compiled 56 | the dynamic version of libics (DLL) you should type this instead: 57 | mex -I -DWIN32 -DUSE_ICSLIB_DLL icsread.c \libics.lib \libz.lib 58 | mex -I -DWIN32 -DUSE_ICSLIB_DLL icswrite.c \libics.lib \libz.lib 59 | Finally, if you used MinGW or Cygwin under Windows to compile libics, 60 | you can use Gnumex (http://gnumex.sourceforge.net/) to configure your 61 | MEX script correctly. 62 | 63 | Alternatively, use the makefile from the system's prompt. The 64 | provided makefile is written for both Borland BCC and Microsoft 65 | Visual C++ (under Windows), but should be easy to adapt to another 66 | system/compiler. Note that you need to configure MEX before running 67 | the makefile. 68 | 69 | 70 | ------------------------------------------------------------- 71 | Copyright (C) 2000-2010 Cris Luengo and others 72 | ------------------------------------------------------------- 73 | -------------------------------------------------------------------------------- /support/matlab/icsread.c: -------------------------------------------------------------------------------- 1 | /* ICSREAD Reads a numeric array from an ICS file. 2 | * A = ICSWRITE(FILENAME) reads the numeric data in 3 | * an ICS image file named FILENAME into A. 4 | * 5 | * Known limitations: 6 | * - Complex data is not read. 7 | * 8 | * Copyright (C) 2000-2007 Cris Luengo and others 9 | */ 10 | 11 | /* For MATLAB 7.2 and older, uncomment the following line: */ 12 | /* typedef int mwSize; */ 13 | 14 | #include "mex.h" 15 | #include 16 | #include "libics.h" 17 | #define ERROR_MESSAGE_LEN 2048 18 | 19 | void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { 20 | ICS* ip; 21 | Ics_DataType dt; 22 | mwSize mx_dims[ICS_MAXDIM]; 23 | int ndims; 24 | size_t dims[ICS_MAXDIM]; 25 | ptrdiff_t strides[ICS_MAXDIM]; 26 | size_t bufsize; 27 | void* buf; 28 | Ics_Error retval; 29 | mxClassID class; 30 | char filename[ICS_MAXPATHLEN]; 31 | int elemsize; 32 | int ii; 33 | size_t tmp; 34 | char errormessage[ERROR_MESSAGE_LEN]; 35 | 36 | if (strcmp (ICSLIB_VERSION, IcsGetLibVersion ())) 37 | mexErrMsgTxt ("Linking against the wrong version of the library."); 38 | 39 | /* There should be one output argument. */ 40 | if (nlhs > 1) 41 | mexErrMsgTxt ("Too many output arguments."); 42 | 43 | /* There should be one input argument. */ 44 | if (nrhs > 1) 45 | mexErrMsgTxt ("Too many input arguments."); 46 | if (nrhs < 1) 47 | mexErrMsgTxt ("Not enough input arguments."); 48 | 49 | /* First input argument. */ 50 | filename[0] = '\0'; 51 | if (mxGetString (prhs[0], filename, ICS_MAXPATHLEN)) { 52 | if (filename[0] == '\0') 53 | mexErrMsgTxt ("FILENAME should be a character array."); 54 | else 55 | mexErrMsgTxt ("The given filename is too long."); 56 | } 57 | 58 | /* Read ICS header. */ 59 | retval = IcsOpen (&ip, filename, "r"); 60 | switch (retval) { 61 | case IcsErr_Ok: 62 | break; 63 | case IcsErr_NotIcsFile: 64 | mexErrMsgTxt ("The file is not an ICS file."); 65 | break; 66 | case IcsErr_UnknownCompression: 67 | mexErrMsgTxt ("Unsupported compression method."); 68 | break; 69 | case IcsErr_FOpenIcs: 70 | mexErrMsgTxt ("Couldn't open the file for reading."); 71 | break; 72 | default: 73 | snprintf (errormessage, ERROR_MESSAGE_LEN, "Couldn't read the ICS header: %s", IcsGetErrorText (retval)); 74 | mexErrMsgTxt (errormessage); 75 | } 76 | IcsGetLayout (ip, &dt, &ndims, dims); 77 | switch (dt) { 78 | case Ics_real64: 79 | class = mxDOUBLE_CLASS; 80 | elemsize = 8; 81 | break; 82 | case Ics_real32: 83 | class = mxSINGLE_CLASS; 84 | elemsize = 4; 85 | break; 86 | case Ics_sint8: 87 | class = mxINT8_CLASS; 88 | elemsize = 1; 89 | break; 90 | case Ics_uint8: 91 | class = mxUINT8_CLASS; 92 | elemsize = 1; 93 | break; 94 | case Ics_sint16: 95 | class = mxINT16_CLASS; 96 | elemsize = 2; 97 | break; 98 | case Ics_uint16: 99 | class = mxUINT16_CLASS; 100 | elemsize = 2; 101 | break; 102 | case Ics_sint32: 103 | class = mxINT32_CLASS; 104 | elemsize = 4; 105 | break; 106 | case Ics_uint32: 107 | class = mxUINT32_CLASS; 108 | elemsize = 4; 109 | break; 110 | case Ics_complex64: 111 | case Ics_complex32: 112 | mexErrMsgTxt ("Cannot read complex data (I'm too lazy)."); 113 | break; 114 | default: 115 | mexErrMsgTxt ("Unknown data type in ICS file."); 116 | } 117 | strides[0] = 1; 118 | for (ii=1;ii1) { 121 | /* This is to swap the first two dimensions; MATLAB does y-x-z indexing. */ 122 | strides[0] = dims[1]; 123 | strides[1] = 1; 124 | tmp = dims[0]; 125 | dims[0] = dims[1]; 126 | dims[1] = tmp; 127 | } 128 | for (ii=0;ii 17 | #include "libics.h" 18 | #define ERROR_MESSAGE_LEN 2048 19 | 20 | void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { 21 | ICS* ip; 22 | Ics_DataType dt; 23 | int ndims; 24 | const mwSize* mx_dims; 25 | size_t dims[ICS_MAXDIM]; 26 | ptrdiff_t strides[ICS_MAXDIM]; 27 | size_t bufsize; 28 | void* buf; 29 | Ics_Error retval; 30 | mxClassID class; 31 | char filename[ICS_MAXPATHLEN]; 32 | int elemsize, compress = 0; 33 | int ii; 34 | size_t tmp; 35 | char errormessage[ERROR_MESSAGE_LEN]; 36 | 37 | if (strcmp (ICSLIB_VERSION, IcsGetLibVersion ())) 38 | mexErrMsgTxt ("Linking against the wrong version of the library."); 39 | 40 | /* There should be no output arguments. */ 41 | if (nlhs > 0) 42 | mexErrMsgTxt ("Too many output arguments."); 43 | 44 | /* There should be two or three input arguments. */ 45 | if (nrhs > 3) 46 | mexErrMsgTxt ("Too many input arguments."); 47 | if (nrhs < 2) 48 | mexErrMsgTxt ("Not enough input arguments."); 49 | 50 | /* First input argument. */ 51 | class = mxGetClassID (prhs[0]); 52 | switch (class) { 53 | case mxDOUBLE_CLASS: 54 | dt = Ics_real64; 55 | elemsize = 8; 56 | break; 57 | case mxSINGLE_CLASS: 58 | dt = Ics_real32; 59 | elemsize = 4; 60 | break; 61 | case mxINT8_CLASS: 62 | dt = Ics_sint8; 63 | elemsize = 1; 64 | break; 65 | case mxUINT8_CLASS: 66 | dt = Ics_uint8; 67 | elemsize = 1; 68 | break; 69 | case mxINT16_CLASS: 70 | dt = Ics_sint16; 71 | elemsize = 2; 72 | break; 73 | case mxUINT16_CLASS: 74 | dt = Ics_uint16; 75 | elemsize = 2; 76 | break; 77 | case mxINT32_CLASS: 78 | dt = Ics_sint32; 79 | elemsize = 4; 80 | break; 81 | case mxUINT32_CLASS: 82 | dt = Ics_uint32; 83 | elemsize = 4; 84 | break; 85 | default: 86 | mexErrMsgTxt ("Input array should be numeric."); 87 | } 88 | if (mxIsComplex (prhs[0])) 89 | mexErrMsgTxt ("Cannot write complex data (I'm too lazy)."); 90 | buf = mxGetData (prhs[0]); 91 | ndims = (int)mxGetNumberOfDimensions (prhs[0]); 92 | mx_dims = mxGetDimensions (prhs[0]); 93 | for (ii=0;ii1) { 99 | /* This is to swap the first two dimensions; MATLAB does y-x-z indexing. */ 100 | tmp = dims[0]; 101 | dims[0] = dims[1]; 102 | dims[1] = tmp; 103 | strides[0] = dims[1]; 104 | strides[1] = 1; 105 | } 106 | bufsize = mxGetNumberOfElements (prhs[0]) * elemsize; 107 | 108 | /* Second input argument. */ 109 | filename[0] = '\0'; 110 | if (mxGetString (prhs[1], filename, ICS_MAXPATHLEN)) { 111 | if (filename[0] == '\0') 112 | mexErrMsgTxt ("FILENAME should be a character array."); 113 | else 114 | mexErrMsgTxt ("The given filename is too long."); 115 | } 116 | 117 | /* Third input argument. */ 118 | if (nrhs > 2) { 119 | /* No checking whatsoever! */ 120 | compress = (mxGetScalar (prhs[2]) != 0); 121 | } 122 | 123 | /* Now we know everything we need to write the data. */ 124 | retval = IcsOpen (&ip, filename, "w1"); 125 | if (retval != IcsErr_Ok) { 126 | snprintf (errormessage, ERROR_MESSAGE_LEN, "Couldn't open the file for writing: %s", IcsGetErrorText (retval)); 127 | mexErrMsgTxt (errormessage); 128 | } 129 | IcsSetLayout (ip, dt, ndims, dims); 130 | retval = IcsGuessScilType (ip); 131 | if (retval == IcsErr_NoScilType) 132 | mexWarnMsgTxt ("Couldn't create a SCIL_TYPE string."); 133 | retval = IcsSetDataWithStrides (ip, buf, bufsize, strides, ndims); 134 | if (retval != IcsErr_Ok) { 135 | snprintf (errormessage, ERROR_MESSAGE_LEN, "Failed to set the data: %s", IcsGetErrorText (retval)); 136 | mexErrMsgTxt (errormessage); 137 | } 138 | if (compress) 139 | IcsSetCompression (ip, IcsCompr_gzip, 0); 140 | IcsAddHistory (ip, "software", "ICSWRITE under MATLAB with libics"); 141 | retval = IcsClose (ip); 142 | if (retval != IcsErr_Ok) { 143 | snprintf (errormessage, ERROR_MESSAGE_LEN, "Failed to create the ICS file: %s", IcsGetErrorText (retval)); 144 | mexErrMsgTxt (errormessage); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /support/matlab/makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2000-2010 Cris Luengo and others 3 | # 4 | # Makefile to compile matlab interface under Win32 5 | # 6 | 7 | MEXEXT = mexw32 8 | 9 | MATLAB_ROOT = C:\MATLAB701 10 | ZLIB_ROOT = C:\src\zlib 11 | ICS_ROOT = ..\.. 12 | LIBPATH = $(ICS_ROOT) 13 | INCLUDEPATH = $(ICS_ROOT) 14 | 15 | MEX = $(MATLAB_ROOT)\bin\win32\mex 16 | 17 | MEXFLAGS = -O -DWIN32 18 | # The next line is for the DLL version of libics. If you want to use 19 | # the static library, remove the next line. 20 | MEXFLAGS = $(MEXFLAGS) -DUSE_ICSLIB_DLL 21 | 22 | all : icswrite.$(MEXEXT) icsread.$(MEXEXT) 23 | @echo Done! 24 | 25 | icsread.$(MEXEXT): icsread.c 26 | $(MEX) $(MEXFLAGS) $^ -I$(INCLUDEPATH) $(LIBPATH)\libics.lib $(ZLIB_ROOT)\zlib.lib 27 | 28 | 29 | icswrite.$(MEXEXT): icswrite.c 30 | $(MEX) $(MEXFLAGS) $^ -I$(INCLUDEPATH) $(LIBPATH)\libics.lib $(ZLIB_ROOT)\zlib.lib 31 | 32 | clean: 33 | @-del /q *.$(MEXEXT) 34 | -------------------------------------------------------------------------------- /test-driver: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # test-driver - basic testsuite driver script. 3 | 4 | scriptversion=2013-07-13.22; # UTC 5 | 6 | # Copyright (C) 2011-2014 Free Software Foundation, Inc. 7 | # 8 | # This program is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2, or (at your option) 11 | # any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | 21 | # As a special exception to the GNU General Public License, if you 22 | # distribute this file as part of a program that contains a 23 | # configuration script generated by Autoconf, you may include it under 24 | # the same distribution terms that you use for the rest of that program. 25 | 26 | # This file is maintained in Automake, please report 27 | # bugs to or send patches to 28 | # . 29 | 30 | # Make unconditional expansion of undefined variables an error. This 31 | # helps a lot in preventing typo-related bugs. 32 | set -u 33 | 34 | usage_error () 35 | { 36 | echo "$0: $*" >&2 37 | print_usage >&2 38 | exit 2 39 | } 40 | 41 | print_usage () 42 | { 43 | cat <$log_file 2>&1 108 | estatus=$? 109 | 110 | if test $enable_hard_errors = no && test $estatus -eq 99; then 111 | tweaked_estatus=1 112 | else 113 | tweaked_estatus=$estatus 114 | fi 115 | 116 | case $tweaked_estatus:$expect_failure in 117 | 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 118 | 0:*) col=$grn res=PASS recheck=no gcopy=no;; 119 | 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 120 | 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; 121 | *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; 122 | *:*) col=$red res=FAIL recheck=yes gcopy=yes;; 123 | esac 124 | 125 | # Report the test outcome and exit status in the logs, so that one can 126 | # know whether the test passed or failed simply by looking at the '.log' 127 | # file, without the need of also peaking into the corresponding '.trs' 128 | # file (automake bug#11814). 129 | echo "$res $test_name (exit status: $estatus)" >>$log_file 130 | 131 | # Report outcome to console. 132 | echo "${col}${res}${std}: $test_name" 133 | 134 | # Register the test result, and other relevant metadata. 135 | echo ":test-result: $res" > $trs_file 136 | echo ":global-test-result: $res" >> $trs_file 137 | echo ":recheck: $recheck" >> $trs_file 138 | echo ":copy-in-global-log: $gcopy" >> $trs_file 139 | 140 | # Local Variables: 141 | # mode: shell-script 142 | # sh-indentation: 2 143 | # eval: (add-hook 'write-file-hooks 'time-stamp) 144 | # time-stamp-start: "scriptversion=" 145 | # time-stamp-format: "%:y-%02m-%02d.%02H" 146 | # time-stamp-time-zone: "UTC" 147 | # time-stamp-end: "; # UTC" 148 | # End: 149 | -------------------------------------------------------------------------------- /test/testim.ics: -------------------------------------------------------------------------------- 1 | 2 | ics_version 1.0 3 | filename testim 4 | layout parameters 4 5 | layout order bits x y z 6 | layout sizes 16 175 105 2 7 | layout coordinates video 8 | layout significant_bits 16 9 | representation format integer 10 | representation sign unsigned 11 | representation compression uncompressed 12 | representation byte_order 1 2 13 | parameter origin 0.000000 0.000000 0.000000 0.000000 14 | parameter scale 1.000000 1.000000 1.000000 1.000000 15 | parameter units relative undefined undefined undefined 16 | parameter labels intensity x-position y-position z-position 17 | -------------------------------------------------------------------------------- /test/testim.ids: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svi-opensource/libics/996a49275150e7bedcc5f46b9dc39e168bb6b875/test/testim.ids -------------------------------------------------------------------------------- /test/testim_c.ics: -------------------------------------------------------------------------------- 1 | 2 | ics_version 1.0 3 | filename testim_c 4 | layout parameters 4 5 | layout order bits x y z 6 | layout sizes 16 175 105 2 7 | layout coordinates video 8 | layout significant_bits 16 9 | representation format integer 10 | representation sign unsigned 11 | representation compression uncompressed 12 | representation byte_order 1 2 13 | parameter origin 0.000000 0.000000 0.000000 0.000000 14 | parameter scale 1.000000 1.000000 1.000000 1.000000 15 | parameter units relative undefined undefined undefined 16 | parameter labels intensity x-position y-position z-position 17 | -------------------------------------------------------------------------------- /test/testim_c.ids.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svi-opensource/libics/996a49275150e7bedcc5f46b9dc39e168bb6b875/test/testim_c.ids.Z -------------------------------------------------------------------------------- /test_compress.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "libics.h" 5 | 6 | int main (int argc, const char* argv[]) { 7 | ICS* ip; 8 | Ics_DataType dt1, dt2; 9 | int ndims; 10 | size_t dims[ICS_MAXDIM]; 11 | size_t bufsize; 12 | void* buf1; 13 | void* buf2; 14 | Ics_Error retval; 15 | 16 | 17 | if (argc != 3) { 18 | fprintf(stderr, "Two file names required: in1 in2\n"); 19 | exit(-1); 20 | } 21 | 22 | /* Read image 1 */ 23 | retval = IcsOpen(&ip, argv[1], "r"); 24 | if (retval != IcsErr_Ok) { 25 | fprintf(stderr, "Could not open input file: %s\n", 26 | IcsGetErrorText(retval)); 27 | exit(-1); 28 | } 29 | IcsGetLayout(ip, &dt1, &ndims, dims); 30 | bufsize = IcsGetDataSize(ip); 31 | buf1 = malloc(bufsize); 32 | if (buf1 == NULL) { 33 | fprintf(stderr, "Could not allocate memory.\n"); 34 | exit(-1); 35 | } 36 | retval = IcsGetData(ip, buf1, bufsize); 37 | if (retval != IcsErr_Ok) { 38 | fprintf(stderr, "Could not read input image data: %s\n", 39 | IcsGetErrorText(retval)); 40 | exit(-1); 41 | } 42 | retval = IcsClose(ip); 43 | if (retval != IcsErr_Ok) { 44 | fprintf(stderr, "Could not close input file: %s\n", 45 | IcsGetErrorText(retval)); 46 | exit(-1); 47 | } 48 | 49 | /* Read image 2 */ 50 | retval = IcsOpen(&ip, argv[2], "r"); 51 | if (retval != IcsErr_Ok) { 52 | fprintf(stderr, "Could not open compressed file for reading: %s\n", 53 | IcsGetErrorText(retval)); 54 | exit(-1); 55 | } 56 | IcsGetLayout(ip, &dt2, &ndims, dims); 57 | if (dt1 != dt2) { 58 | fprintf(stderr, "Data type in 2nd file does not match 1st.\n"); 59 | exit(-1); 60 | } 61 | if (bufsize != IcsGetDataSize(ip)) { 62 | fprintf(stderr, "Data in 2nd file not same size 1st.\n"); 63 | exit(-1); 64 | } 65 | buf2 = malloc(bufsize); 66 | if (buf2 == NULL) { 67 | fprintf(stderr, "Could not allocate memory.\n"); 68 | exit(-1); 69 | } 70 | retval = IcsGetData(ip, buf2, bufsize); 71 | if (retval != IcsErr_Ok) { 72 | fprintf(stderr, "Could not read compressed image data: %s\n", 73 | IcsGetErrorText(retval)); 74 | exit(-1); 75 | } 76 | retval = IcsClose(ip); 77 | if (retval != IcsErr_Ok) { 78 | fprintf(stderr, "Could not close output file: %s\n", 79 | IcsGetErrorText(retval)); 80 | exit(-1); 81 | } 82 | if (memcmp(buf1, buf2, bufsize) != 0) { 83 | fprintf(stderr, "Data in the two files is different.\n"); 84 | exit(-1); 85 | } 86 | 87 | free(buf1); 88 | free(buf2); 89 | exit(0); 90 | } 91 | -------------------------------------------------------------------------------- /test_compress.sh: -------------------------------------------------------------------------------- 1 | ./test_compress $srcdir/test/testim.ics $srcdir/test/testim_c.ics 2 | -------------------------------------------------------------------------------- /test_gzip.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "libics.h" 5 | 6 | int main(int argc, const char* argv[]) { 7 | ICS* ip; 8 | Ics_DataType dt; 9 | int ndims; 10 | size_t dims[ICS_MAXDIM]; 11 | size_t bufsize; 12 | void* buf1; 13 | void* buf2; 14 | Ics_Error retval; 15 | 16 | 17 | if(argc != 3) { 18 | fprintf(stderr, "Two file names required: in out\n"); 19 | exit(-1); 20 | } 21 | 22 | /* Read image */ 23 | retval = IcsOpen(&ip, argv[1], "r"); 24 | if(retval != IcsErr_Ok) { 25 | fprintf(stderr, "Could not open input file: %s\n", 26 | IcsGetErrorText(retval)); 27 | exit(-1); 28 | } 29 | IcsGetLayout(ip, &dt, &ndims, dims); 30 | bufsize = IcsGetDataSize(ip); 31 | buf1 = malloc(bufsize); 32 | if(buf1 == NULL) { 33 | fprintf(stderr, "Could not allocate memory.\n"); 34 | exit(-1); 35 | } 36 | retval = IcsGetData(ip, buf1, bufsize); 37 | if(retval != IcsErr_Ok) { 38 | fprintf(stderr, "Could not read input image data: %s\n", 39 | IcsGetErrorText(retval)); 40 | exit(-1); 41 | } 42 | retval = IcsClose(ip); 43 | if(retval != IcsErr_Ok) { 44 | fprintf(stderr, "Could not close input file: %s\n", 45 | IcsGetErrorText(retval)); 46 | exit(-1); 47 | } 48 | 49 | /* Write image */ 50 | retval = IcsOpen(&ip, argv[2], "w2"); 51 | if(retval != IcsErr_Ok) { 52 | fprintf(stderr, "Could not open output file: %s\n", 53 | IcsGetErrorText(retval)); 54 | exit(-1); 55 | } 56 | IcsSetLayout(ip, dt, ndims, dims); 57 | IcsSetData(ip, buf1, bufsize); 58 | IcsSetCompression(ip, IcsCompr_gzip, 6); 59 | retval = IcsClose(ip); 60 | if(retval != IcsErr_Ok) { 61 | fprintf(stderr, "Could not write output file: %s\n", 62 | IcsGetErrorText(retval)); 63 | exit(-1); 64 | } 65 | 66 | /* Read image */ 67 | retval = IcsOpen(&ip, argv[2], "r"); 68 | if(retval != IcsErr_Ok) { 69 | fprintf(stderr, "Could not open output file for reading: %s\n", 70 | IcsGetErrorText(retval)); 71 | exit(-1); 72 | } 73 | if(bufsize != IcsGetDataSize(ip)) { 74 | fprintf(stderr, "Data in output file not same size as written.\n"); 75 | exit(-1); 76 | } 77 | buf2 = malloc(bufsize); 78 | if(buf2 == NULL) { 79 | fprintf(stderr, "Could not allocate memory.\n"); 80 | exit(-1); 81 | } 82 | retval = IcsGetData(ip, buf2, bufsize); 83 | if(retval != IcsErr_Ok) { 84 | fprintf(stderr, "Could not read output image data: %s\n", 85 | IcsGetErrorText(retval)); 86 | exit(-1); 87 | } 88 | retval = IcsClose(ip); 89 | if(retval != IcsErr_Ok) { 90 | fprintf(stderr, "Could not close output file: %s\n", 91 | IcsGetErrorText(retval)); 92 | exit(-1); 93 | } 94 | if(memcmp(buf1, buf2, bufsize) != 0) { 95 | fprintf(stderr, "Data in output file does not match data in input.\n"); 96 | exit(-1); 97 | } 98 | 99 | free(buf1); 100 | free(buf2); 101 | exit(0); 102 | } 103 | -------------------------------------------------------------------------------- /test_gzip.sh: -------------------------------------------------------------------------------- 1 | ./test_gzip $srcdir/test/testim.ics result_v2z.ics 2 | -------------------------------------------------------------------------------- /test_history.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "libics.h" 5 | 6 | int main(int argc, const char* argv[]) { 7 | ICS* ip; 8 | Ics_Error retval; 9 | int nstr; 10 | char buffer[ICS_LINE_LENGTH]; 11 | char token[ICS_STRLEN_TOKEN]; 12 | Ics_HistoryIterator it; 13 | const char token1[] = "sequence1"; 14 | const char token2[] = "sequence2"; 15 | const char stuff1[] = "this is some data"; 16 | const char stuff2[] = "this is some more data"; 17 | const char stuff3[] = "this is some other stuff"; 18 | 19 | if (argc != 2) { 20 | fprintf(stderr, "One file name required\n"); 21 | exit(-1); 22 | } 23 | 24 | /* Open image for update */ 25 | retval = IcsOpen(&ip, argv[1], "rw"); 26 | if (retval != IcsErr_Ok) { 27 | fprintf(stderr, "Could not open file for update: %s\n", 28 | IcsGetErrorText(retval)); 29 | exit(-1); 30 | } 31 | 32 | /* Remove history lines */ 33 | retval = IcsDeleteHistory(ip, "test"); 34 | if (retval != IcsErr_Ok) { 35 | fprintf(stderr, "Could not delete history lines: %s\n", 36 | IcsGetErrorText(retval)); 37 | exit(-1); 38 | } 39 | 40 | /* Add history lines */ 41 | retval = IcsAddHistory(ip, token1, stuff1); 42 | if (retval != IcsErr_Ok) { 43 | fprintf(stderr, "Could not add history line: %s\n", 44 | IcsGetErrorText(retval)); 45 | exit(-1); 46 | } 47 | retval = IcsAddHistory(ip, token1, stuff2); 48 | if (retval != IcsErr_Ok) { 49 | fprintf(stderr, "Could not add history line: %s\n", 50 | IcsGetErrorText(retval)); 51 | exit(-1); 52 | } 53 | retval = IcsAddHistory(ip, token2, stuff3); 54 | if (retval != IcsErr_Ok) { 55 | fprintf(stderr, "Could not add history line: %s\n", 56 | IcsGetErrorText(retval)); 57 | exit(-1); 58 | } 59 | 60 | /* Check */ 61 | retval = IcsGetNumHistoryStrings(ip, &nstr); 62 | if (retval != IcsErr_Ok) { 63 | fprintf(stderr, "Could not get number of history lines: %s\n", 64 | IcsGetErrorText(retval)); 65 | exit(-1); 66 | } 67 | if (nstr != 3) { 68 | fprintf(stderr, "Number of history lines not correct.\n"); 69 | exit(-1); 70 | } 71 | 72 | /* Read history lines and compare */ 73 | retval = IcsNewHistoryIterator(ip, &it, ""); 74 | if (retval != IcsErr_Ok) { 75 | fprintf(stderr, "Could not make new history iterator: %s\n", 76 | IcsGetErrorText(retval)); 77 | exit(-1); 78 | } 79 | retval = IcsGetHistoryKeyValueI(ip, &it, token, buffer); 80 | if (retval != IcsErr_Ok) { 81 | fprintf(stderr, "Could not read 1st history string: %s\n", 82 | IcsGetErrorText(retval)); 83 | exit(-1); 84 | } 85 | if (strcmp(token,token1)!=0 || strcmp(buffer,stuff1)!=0) { 86 | fprintf(stderr, "1st history string does not match: \"%s\" vs \"%s\"\n", 87 | token, token1); 88 | exit(-1); 89 | } 90 | retval = IcsGetHistoryKeyValueI(ip, &it, token, buffer); 91 | if (retval != IcsErr_Ok) { 92 | fprintf(stderr, "Could not read 2nd history string: %s\n", 93 | IcsGetErrorText(retval)); 94 | exit(-1); 95 | } 96 | if (strcmp(token,token1)!=0 || strcmp(buffer,stuff2)!=0) { 97 | fprintf(stderr, "2nd history string does not match.\n"); 98 | exit(-1); 99 | } 100 | retval = IcsGetHistoryKeyValueI(ip, &it, token, buffer); 101 | if (retval != IcsErr_Ok) { 102 | fprintf(stderr, "Could not read 3rd history string: %s\n", 103 | IcsGetErrorText(retval)); 104 | exit(-1); 105 | } 106 | if (strcmp(token,token2)!=0 || strcmp(buffer,stuff3)!=0) { 107 | fprintf(stderr, "3rd history string does not match.\n"); 108 | exit(-1); 109 | } 110 | 111 | /* Check earlier deleted line */ 112 | retval = IcsNewHistoryIterator(ip, &it, "test"); 113 | if (retval != IcsErr_EndOfHistory) { 114 | fprintf(stderr, "Did not properly delete original 'test' line.\n"); 115 | exit(-1); 116 | } 117 | 118 | /* Read token2 line */ 119 | retval = IcsNewHistoryIterator(ip, &it, token2); 120 | if (retval != IcsErr_Ok) { 121 | fprintf(stderr, "Could not make new history iterator: %s\n", 122 | IcsGetErrorText(retval)); 123 | exit(-1); 124 | } 125 | retval = IcsGetHistoryKeyValueI(ip, &it, 0, buffer); 126 | if (retval != IcsErr_Ok) { 127 | fprintf(stderr, "Could not read history string: %s\n", 128 | IcsGetErrorText(retval)); 129 | exit(-1); 130 | } 131 | if (strcmp(buffer,stuff3)!=0) { 132 | fprintf(stderr, "history string does not match.\n"); 133 | exit(-1); 134 | } 135 | 136 | /* Commit changes */ 137 | retval = IcsClose(ip); 138 | if (retval != IcsErr_Ok) { 139 | fprintf(stderr, "Could not close file: %s\n", IcsGetErrorText(retval)); 140 | exit(-1); 141 | } 142 | 143 | exit(0); 144 | } 145 | -------------------------------------------------------------------------------- /test_history.sh: -------------------------------------------------------------------------------- 1 | ./test_history result_v1.ics 2 | -------------------------------------------------------------------------------- /test_ics1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "libics.h" 5 | 6 | int main(int argc, const char* argv[]) { 7 | ICS* ip; 8 | Ics_DataType dt; 9 | int ndims; 10 | size_t dims[ICS_MAXDIM]; 11 | size_t bufsize; 12 | void* buf1; 13 | void* buf2; 14 | Ics_Error retval; 15 | 16 | 17 | if (argc != 3) { 18 | fprintf(stderr, "Two file names required: in out\n"); 19 | exit(-1); 20 | } 21 | 22 | /* Read image */ 23 | retval = IcsOpen(&ip, argv[1], "r"); 24 | if (retval != IcsErr_Ok) { 25 | fprintf(stderr, "Could not open input file: %s\n", 26 | IcsGetErrorText(retval)); 27 | exit(-1); 28 | } 29 | IcsGetLayout(ip, &dt, &ndims, dims); 30 | bufsize = IcsGetDataSize(ip); 31 | buf1 = malloc(bufsize); 32 | if (buf1 == NULL) { 33 | fprintf(stderr, "Could not allocate memory.\n"); 34 | exit(-1); 35 | } 36 | retval = IcsGetData(ip, buf1, bufsize); 37 | if (retval != IcsErr_Ok) { 38 | fprintf(stderr, "Could not read input image data: %s\n", 39 | IcsGetErrorText(retval)); 40 | exit(-1); 41 | } 42 | retval = IcsClose(ip); 43 | if (retval != IcsErr_Ok) { 44 | fprintf(stderr, "Could not close input file: %s\n", 45 | IcsGetErrorText(retval)); 46 | exit(-1); 47 | } 48 | 49 | /* Write image */ 50 | retval = IcsOpen(&ip, argv[2], "w1"); 51 | if (retval != IcsErr_Ok) { 52 | fprintf(stderr, "Could not open output file: %s\n", 53 | IcsGetErrorText(retval)); 54 | exit(-1); 55 | } 56 | IcsSetLayout(ip, dt, ndims, dims); 57 | IcsSetData(ip, buf1, bufsize); 58 | IcsSetCompression(ip, IcsCompr_uncompressed, 0); 59 | retval = IcsClose(ip); 60 | if (retval != IcsErr_Ok) { 61 | fprintf(stderr, "Could not write output file: %s\n", 62 | IcsGetErrorText(retval)); 63 | exit(-1); 64 | } 65 | 66 | /* Read image */ 67 | retval = IcsOpen(&ip, argv[2], "r"); 68 | if (retval != IcsErr_Ok) { 69 | fprintf(stderr, "Could not open output file for reading: %s\n", 70 | IcsGetErrorText(retval)); 71 | exit(-1); 72 | } 73 | if (bufsize != IcsGetDataSize(ip)) { 74 | fprintf(stderr, "Data in output file not same size as written.\n"); 75 | exit(-1); 76 | } 77 | buf2 = malloc(bufsize); 78 | if (buf2 == NULL) { 79 | fprintf(stderr, "Could not allocate memory.\n"); 80 | exit(-1); 81 | } 82 | retval = IcsGetData(ip, buf2, bufsize); 83 | if (retval != IcsErr_Ok) { 84 | fprintf(stderr, "Could not read output image data: %s\n", 85 | IcsGetErrorText(retval)); 86 | exit(-1); 87 | } 88 | retval = IcsClose(ip); 89 | if (retval != IcsErr_Ok) { 90 | fprintf(stderr, "Could not close output file: %s\n", 91 | IcsGetErrorText(retval)); 92 | exit(-1); 93 | } 94 | if (memcmp(buf1, buf2, bufsize) != 0) { 95 | fprintf(stderr, "Data in output file does not match data in input.\n"); 96 | exit(-1); 97 | } 98 | 99 | free(buf1); 100 | free(buf2); 101 | exit(0); 102 | } 103 | -------------------------------------------------------------------------------- /test_ics1.sh: -------------------------------------------------------------------------------- 1 | ./test_ics1 $srcdir/test/testim.ics result_v1.ics 2 | -------------------------------------------------------------------------------- /test_ics2a.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "libics.h" 5 | #include "libics_ll.h" 6 | 7 | int main(int argc, const char* argv[]) { 8 | ICS* ip; 9 | Ics_DataType dt; 10 | int ndims; 11 | size_t dims[ICS_MAXDIM]; 12 | size_t bufsize; 13 | void* buf1; 14 | void* buf2; 15 | char datafile[ICS_MAXPATHLEN]; 16 | Ics_Error retval; 17 | 18 | 19 | if (argc != 3) { 20 | fprintf(stderr, "Two file names required: in out\n"); 21 | exit(-1); 22 | } 23 | 24 | /* Read image */ 25 | retval = IcsOpen(&ip, argv[1], "r"); 26 | if (retval != IcsErr_Ok) { 27 | fprintf(stderr, "Could not open input file: %s\n", 28 | IcsGetErrorText(retval)); 29 | exit(-1); 30 | } 31 | IcsGetLayout(ip, &dt, &ndims, dims); 32 | bufsize = IcsGetDataSize(ip); 33 | buf1 = malloc(bufsize); 34 | if (buf1 == NULL) { 35 | fprintf(stderr, "Could not allocate memory.\n"); 36 | exit(-1); 37 | } 38 | retval = IcsGetData(ip, buf1, bufsize); 39 | if (retval != IcsErr_Ok) { 40 | fprintf(stderr, "Could not read input image data: %s\n", 41 | IcsGetErrorText(retval)); 42 | exit(-1); 43 | } 44 | retval = IcsClose(ip); 45 | if (retval != IcsErr_Ok) { 46 | fprintf(stderr, "Could not close input file: %s\n", 47 | IcsGetErrorText(retval)); 48 | exit(-1); 49 | } 50 | 51 | /* Write image */ 52 | retval = IcsOpen(&ip, argv[2], "w2"); 53 | if (retval != IcsErr_Ok) { 54 | fprintf(stderr, "Could not open output file: %s\n", 55 | IcsGetErrorText(retval)); 56 | exit(-1); 57 | } 58 | IcsSetLayout(ip, dt, ndims, dims); 59 | IcsGetIdsName(datafile, argv[1]); 60 | IcsSetSource(ip, datafile, 0); 61 | IcsSetByteOrder(ip, IcsByteOrder_littleEndian); 62 | IcsSetCompression(ip, IcsCompr_uncompressed, 0); 63 | retval = IcsClose(ip); 64 | if (retval != IcsErr_Ok) { 65 | fprintf(stderr, "Could not write output file: %s\n", 66 | IcsGetErrorText(retval)); 67 | exit(-1); 68 | } 69 | 70 | /* Read image */ 71 | retval = IcsOpen(&ip, argv[2], "r"); 72 | if (retval != IcsErr_Ok) { 73 | fprintf(stderr, "Could not open output file for reading: %s\n", 74 | IcsGetErrorText(retval)); 75 | exit(-1); 76 | } 77 | if (bufsize != IcsGetDataSize(ip)) { 78 | fprintf(stderr, "Data in output file not same size as written.\n"); 79 | exit(-1); 80 | } 81 | buf2 = malloc(bufsize); 82 | if (buf2 == NULL) { 83 | fprintf(stderr, "Could not allocate memory.\n"); 84 | exit(-1); 85 | } 86 | retval = IcsGetData(ip, buf2, bufsize); 87 | if (retval != IcsErr_Ok) { 88 | fprintf(stderr, "Could not read output image data: %s\n", 89 | IcsGetErrorText(retval)); 90 | exit(-1); 91 | } 92 | retval = IcsClose(ip); 93 | if (retval != IcsErr_Ok) { 94 | fprintf(stderr, "Could not close output file: %s\n", 95 | IcsGetErrorText(retval)); 96 | exit(-1); 97 | } 98 | if (memcmp(buf1, buf2, bufsize) != 0) { 99 | fprintf(stderr, "Data in output file does not match data in input.\n"); 100 | exit(-1); 101 | } 102 | 103 | free(buf1); 104 | free(buf2); 105 | exit(0); 106 | } 107 | -------------------------------------------------------------------------------- /test_ics2a.sh: -------------------------------------------------------------------------------- 1 | ./test_ics2a $srcdir/test/testim.ics result_v2a.ics 2 | -------------------------------------------------------------------------------- /test_ics2b.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "libics.h" 5 | 6 | int main(int argc, const char* argv[]) { 7 | ICS* ip; 8 | Ics_DataType dt; 9 | int ndims; 10 | size_t dims[ICS_MAXDIM]; 11 | size_t bufsize; 12 | void* buf1; 13 | void* buf2; 14 | Ics_Error retval; 15 | 16 | 17 | if (argc != 3) { 18 | fprintf(stderr, "Two file names required: in out\n"); 19 | exit(-1); 20 | } 21 | 22 | /* Read image */ 23 | retval = IcsOpen(&ip, argv[1], "r"); 24 | if (retval != IcsErr_Ok) { 25 | fprintf(stderr, "Could not open input file: %s\n", 26 | IcsGetErrorText(retval)); 27 | exit(-1); 28 | } 29 | IcsGetLayout(ip, &dt, &ndims, dims); 30 | bufsize = IcsGetDataSize(ip); 31 | buf1 = malloc(bufsize); 32 | if (buf1 == NULL) { 33 | fprintf(stderr, "Could not allocate memory.\n"); 34 | exit(-1); 35 | } 36 | retval = IcsGetData(ip, buf1, bufsize); 37 | if (retval != IcsErr_Ok) { 38 | fprintf(stderr, "Could not read input image data: %s\n", 39 | IcsGetErrorText(retval)); 40 | exit(-1); 41 | } 42 | retval = IcsClose(ip); 43 | if (retval != IcsErr_Ok) { 44 | fprintf(stderr, "Could not close input file: %s\n", 45 | IcsGetErrorText(retval)); 46 | exit(-1); 47 | } 48 | 49 | /* Write image */ 50 | retval = IcsOpen(&ip, argv[2], "w2"); 51 | if (retval != IcsErr_Ok) { 52 | fprintf(stderr, "Could not open output file: %s\n", 53 | IcsGetErrorText(retval)); 54 | exit(-1); 55 | } 56 | IcsSetLayout(ip, dt, ndims, dims); 57 | IcsSetData(ip, buf1, bufsize); 58 | IcsSetCompression(ip, IcsCompr_uncompressed, 0); 59 | retval = IcsClose(ip); 60 | if (retval != IcsErr_Ok) { 61 | fprintf(stderr, "Could not write output file: %s\n", 62 | IcsGetErrorText(retval)); 63 | exit(-1); 64 | } 65 | 66 | /* Read image */ 67 | retval = IcsOpen(&ip, argv[2], "r"); 68 | if (retval != IcsErr_Ok) { 69 | fprintf(stderr, "Could not open output file for reading: %s\n", 70 | IcsGetErrorText(retval)); 71 | exit(-1); 72 | } 73 | if (bufsize != IcsGetDataSize(ip)) { 74 | fprintf(stderr, "Data in output file not same size as written.\n"); 75 | exit(-1); 76 | } 77 | buf2 = malloc(bufsize); 78 | if (buf2 == NULL) { 79 | fprintf(stderr, "Could not allocate memory.\n"); 80 | exit(-1); 81 | } 82 | retval = IcsGetData(ip, buf2, bufsize); 83 | if (retval != IcsErr_Ok) { 84 | fprintf(stderr, "Could not read output image data: %s\n", 85 | IcsGetErrorText(retval)); 86 | exit(-1); 87 | } 88 | retval = IcsClose(ip); 89 | if (retval != IcsErr_Ok) { 90 | fprintf(stderr, "Could not close output file: %s\n", 91 | IcsGetErrorText(retval)); 92 | exit(-1); 93 | } 94 | if (memcmp(buf1, buf2, bufsize) != 0) { 95 | fprintf(stderr, "Data in output file does not match data in input.\n"); 96 | exit(-1); 97 | } 98 | 99 | free(buf1); 100 | free(buf2); 101 | exit(0); 102 | } 103 | -------------------------------------------------------------------------------- /test_ics2b.sh: -------------------------------------------------------------------------------- 1 | ./test_ics2b $srcdir/test/testim.ics result_v2b.ics 2 | -------------------------------------------------------------------------------- /test_metadata.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "libics.h" 5 | 6 | int main(int argc, const char* argv[]) { 7 | ICS* ip; 8 | Ics_DataType dt; 9 | int ndims; 10 | size_t dims[ICS_MAXDIM]; 11 | size_t bufsize; 12 | void* buf1; 13 | void* buf2; 14 | Ics_Error retval; 15 | double origin; 16 | double scale; 17 | const char* units; 18 | char key[ICS_STRLEN_TOKEN]; 19 | char value[ICS_LINE_LENGTH]; 20 | 21 | if (argc != 2) { 22 | fprintf(stderr, "One file name required\n"); 23 | exit(-1); 24 | } 25 | 26 | /* Open image for update */ 27 | retval = IcsOpen(&ip, argv[1], "rw"); 28 | if (retval != IcsErr_Ok) { 29 | fprintf(stderr, "Could not open input file: %s\n", 30 | IcsGetErrorText(retval)); 31 | exit(-1); 32 | } 33 | IcsGetLayout(ip, &dt, &ndims, dims); 34 | bufsize = IcsGetDataSize(ip); 35 | buf1 = malloc(bufsize); 36 | if (buf1 == NULL) { 37 | fprintf(stderr, "Could not allocate memory.\n"); 38 | exit(-1); 39 | } 40 | retval = IcsGetData(ip, buf1, bufsize); 41 | if (retval != IcsErr_Ok) { 42 | fprintf(stderr, "Could not read input image data: %s\n", 43 | IcsGetErrorText(retval)); 44 | exit(-1); 45 | } 46 | 47 | /* Add and change metadata */ 48 | retval = IcsSetPosition(ip, 0, 1834, 0.02, "millimeter"); 49 | if (retval == IcsErr_Ok) 50 | retval = IcsSetPosition(ip, 1, -653, 0.014, "mm"); 51 | if (retval != IcsErr_Ok) { 52 | fprintf(stderr, "Could not set pixel position: %s\n", 53 | IcsGetErrorText(retval)); 54 | exit(-1); 55 | } 56 | retval = IcsAddHistory(ip, "test", "Adding history line."); 57 | if (retval != IcsErr_Ok) { 58 | fprintf(stderr, "Could not add history line: %s\n", 59 | IcsGetErrorText(retval)); 60 | exit(-1); 61 | } 62 | 63 | /* Commit changes */ 64 | retval = IcsClose(ip); 65 | if (retval != IcsErr_Ok) { 66 | fprintf(stderr, "Could not close input file: %s\n", 67 | IcsGetErrorText(retval)); 68 | exit(-1); 69 | } 70 | 71 | /* Read image */ 72 | retval = IcsOpen(&ip, argv[1], "r"); 73 | if (retval != IcsErr_Ok) { 74 | fprintf(stderr, "Could not open output file for reading: %s\n", 75 | IcsGetErrorText(retval)); 76 | exit(-1); 77 | } 78 | 79 | /* Check metadata */ 80 | retval = IcsGetPositionF(ip, 0, &origin, &scale, &units); 81 | if (retval == IcsErr_Ok) { 82 | if (origin != 1834 || scale != 0.02 || strcmp(units, "millimeter") != 0 ) { 83 | fprintf(stderr, "Different position metadata read back\n"); 84 | exit(-1); 85 | } 86 | retval = IcsGetPositionF(ip, 1, &origin, &scale, &units); 87 | if (retval == IcsErr_Ok) { 88 | if (origin != -653 || scale != 0.014 || strcmp(units, "mm") != 0) { 89 | fprintf(stderr, "Different position metadata read back\n"); 90 | exit(-1); 91 | } 92 | } 93 | } 94 | if (retval != IcsErr_Ok) { 95 | fprintf(stderr, "Could not get pixel position: %s\n", 96 | IcsGetErrorText(retval)); 97 | exit(-1); 98 | } 99 | retval = IcsGetHistoryKeyValue(ip, key, value, IcsWhich_First); 100 | if (retval != IcsErr_Ok) { 101 | fprintf(stderr, "Could not get history key/value pair: %s\n", 102 | IcsGetErrorText(retval)); 103 | exit(-1); 104 | } 105 | if (strcmp(key, "test") != 0 || strcmp(value, "Adding history line.") != 0) { 106 | fprintf(stderr, "Different history key/value pair read back\n"); 107 | exit(-1); 108 | } 109 | 110 | /* Check pixel data */ 111 | if (bufsize != IcsGetDataSize(ip)) { 112 | fprintf(stderr, "Data in output file not same size as input.\n"); 113 | exit(-1); 114 | } 115 | buf2 = malloc(bufsize); 116 | if (buf2 == NULL) { 117 | fprintf(stderr, "Could not allocate memory.\n"); 118 | exit(-1); 119 | } 120 | retval = IcsGetData(ip, buf2, bufsize); 121 | if (retval != IcsErr_Ok) { 122 | fprintf(stderr, "Could not read output image data: %s\n", 123 | IcsGetErrorText(retval)); 124 | exit(-1); 125 | } 126 | retval = IcsClose(ip); 127 | if (retval != IcsErr_Ok) { 128 | fprintf(stderr, "Could not close output file: %s\n", 129 | IcsGetErrorText(retval)); 130 | exit(-1); 131 | } 132 | if (memcmp(buf1, buf2, bufsize) != 0) { 133 | fprintf(stderr, "Data in output file does not match data in input.\n"); 134 | exit(-1); 135 | } 136 | 137 | free(buf1); 138 | free(buf2); 139 | exit(0); 140 | } 141 | -------------------------------------------------------------------------------- /test_metadata1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./test_metadata result_v1.ics && ./test_metadata result_v2a.ics && ./test_metadata result_v2b.ics 3 | -------------------------------------------------------------------------------- /test_metadata2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./test_metadata result_v2z.ics 3 | -------------------------------------------------------------------------------- /test_strides.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "libics.h" 5 | 6 | int main(int argc, const char* argv[]) { 7 | ICS* ip; 8 | Ics_DataType dt; 9 | int ndims; 10 | size_t dims[ICS_MAXDIM]; 11 | size_t bufsize; 12 | ptrdiff_t strides[3]; 13 | void* buf1; 14 | void* buf2; 15 | void* buf3; 16 | Ics_Error retval; 17 | 18 | 19 | if (argc != 3) { 20 | fprintf(stderr, "Two file names required: in out\n"); 21 | exit(-1); 22 | } 23 | 24 | /* Read image */ 25 | retval = IcsOpen(&ip, argv[1], "r"); 26 | if (retval != IcsErr_Ok) { 27 | fprintf(stderr, "Could not open input file: %s\n", 28 | IcsGetErrorText(retval)); 29 | exit(-1); 30 | } 31 | IcsGetLayout(ip, &dt, &ndims, dims); 32 | strides[0] = 1; 33 | strides[1] = (ptrdiff_t)(dims[0]*dims[2]); 34 | strides[2] = (ptrdiff_t)dims[0]; 35 | bufsize = IcsGetDataSize(ip); 36 | buf1 = malloc(bufsize); 37 | if (buf1 == NULL) { 38 | fprintf(stderr, "Could not allocate memory.\n"); 39 | exit(-1); 40 | } 41 | retval = IcsGetData(ip, buf1, bufsize); 42 | if (retval != IcsErr_Ok) { 43 | fprintf(stderr, "Could not read input image data: %s\n", 44 | IcsGetErrorText(retval)); 45 | exit(-1); 46 | } 47 | buf3 = malloc(bufsize); 48 | if (buf3 == NULL) { 49 | fprintf(stderr, "Could not allocate memory.\n"); 50 | exit(-1); 51 | } 52 | retval = IcsGetDataWithStrides(ip, buf3, bufsize, strides, 3); 53 | if (retval != IcsErr_Ok) { 54 | fprintf(stderr, "Could not read input image data using strides: %s\n", 55 | IcsGetErrorText(retval)); 56 | exit(-1); 57 | } 58 | retval = IcsClose(ip); 59 | if (retval != IcsErr_Ok) { 60 | fprintf(stderr, "Could not close input file: %s\n", 61 | IcsGetErrorText(retval)); 62 | exit(-1); 63 | } 64 | 65 | /* Write image */ 66 | retval = IcsOpen(&ip, argv[2], "w2"); 67 | if (retval != IcsErr_Ok) { 68 | fprintf(stderr, "Could not open output file: %s\n", 69 | IcsGetErrorText(retval)); 70 | exit(-1); 71 | } 72 | IcsSetLayout(ip, dt, ndims, dims); 73 | IcsSetDataWithStrides(ip, buf3, bufsize, strides, 3); 74 | #ifdef ICS_ZLIB 75 | IcsSetCompression(ip, IcsCompr_gzip, 6); 76 | #endif 77 | retval = IcsClose(ip); 78 | if (retval != IcsErr_Ok) { 79 | fprintf(stderr, "Could not write output file: %s\n", 80 | IcsGetErrorText(retval)); 81 | exit(-1); 82 | } 83 | 84 | /* Read image */ 85 | retval = IcsOpen(&ip, argv[2], "r"); 86 | if (retval != IcsErr_Ok) { 87 | fprintf(stderr, "Could not open output file for reading: %s\n", 88 | IcsGetErrorText(retval)); 89 | exit(-1); 90 | } 91 | if (bufsize != IcsGetDataSize(ip)) { 92 | fprintf(stderr, "Data in output file not same size as written.\n"); 93 | exit(-1); 94 | } 95 | buf2 = malloc(bufsize); 96 | if (buf2 == NULL) { 97 | fprintf(stderr, "Could not allocate memory.\n"); 98 | exit(-1); 99 | } 100 | retval = IcsGetData(ip, buf2, bufsize); 101 | if (retval != IcsErr_Ok) { 102 | fprintf(stderr, "Could not read output image data: %s\n", 103 | IcsGetErrorText(retval)); 104 | exit(-1); 105 | } 106 | retval = IcsClose(ip); 107 | if (retval != IcsErr_Ok) { 108 | fprintf(stderr, "Could not close output file: %s\n", 109 | IcsGetErrorText(retval)); 110 | exit(-1); 111 | } 112 | if (memcmp(buf1, buf2, bufsize) != 0) { 113 | fprintf(stderr, "Data in output file does not match data in input.\n"); 114 | exit(-1); 115 | } 116 | 117 | free(buf1); 118 | free(buf2); 119 | exit(0); 120 | } 121 | -------------------------------------------------------------------------------- /test_strides.sh: -------------------------------------------------------------------------------- 1 | ./test_strides $srcdir/test/testim.ics result_s.ics 2 | -------------------------------------------------------------------------------- /test_strides2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "libics.h" 5 | 6 | int main(int argc, const char* argv[]) { 7 | ICS* ip; 8 | Ics_DataType dt; 9 | int ndims; 10 | size_t dims[ICS_MAXDIM]; 11 | size_t bufsize; 12 | ptrdiff_t strides[3]; 13 | void* buf1; 14 | void* buf2; 15 | void* buf3; 16 | Ics_Error retval; 17 | 18 | 19 | if (argc != 3) { 20 | fprintf(stderr, "Two file names required: in out\n"); 21 | exit(-1); 22 | } 23 | 24 | /* Read image */ 25 | retval = IcsOpen(&ip, argv[1], "r"); 26 | if (retval != IcsErr_Ok) { 27 | fprintf(stderr, "Could not open input file: %s\n", 28 | IcsGetErrorText(retval)); 29 | exit(-1); 30 | } 31 | IcsGetLayout(ip, &dt, &ndims, dims); 32 | strides[0] = (ptrdiff_t)(dims[1]*2); 33 | strides[1] = 2; 34 | strides[2] = (ptrdiff_t)(dims[0]*dims[1]*2); 35 | bufsize = IcsGetDataSize(ip); 36 | buf1 = malloc(bufsize); 37 | if (buf1 == NULL) { 38 | fprintf(stderr, "Could not allocate memory.\n"); 39 | exit(-1); 40 | } 41 | retval = IcsGetData(ip, buf1, bufsize); 42 | if (retval != IcsErr_Ok) { 43 | fprintf(stderr, "Could not read input image data: %s\n", 44 | IcsGetErrorText(retval)); 45 | exit(-1); 46 | } 47 | buf3 = malloc(2*bufsize); 48 | if (buf3 == NULL) { 49 | fprintf(stderr, "Could not allocate memory.\n"); 50 | exit(-1); 51 | } 52 | retval = IcsGetDataWithStrides(ip, buf3, 2*bufsize, strides, 3); 53 | if (retval != IcsErr_Ok) { 54 | fprintf(stderr, "Could not read input image data using strides: %s\n", 55 | IcsGetErrorText(retval)); 56 | exit(-1); 57 | } 58 | retval = IcsClose(ip); 59 | if (retval != IcsErr_Ok) { 60 | fprintf(stderr, "Could not close input file: %s\n", 61 | IcsGetErrorText(retval)); 62 | exit(-1); 63 | } 64 | 65 | /* Write image */ 66 | retval = IcsOpen(&ip, argv[2], "w2"); 67 | if (retval != IcsErr_Ok) { 68 | fprintf(stderr, "Could not open output file: %s\n", 69 | IcsGetErrorText(retval)); 70 | exit(-1); 71 | } 72 | IcsSetLayout(ip, dt, ndims, dims); 73 | IcsSetDataWithStrides(ip, buf3, 2*bufsize, strides, 3); 74 | #ifdef ICS_ZLIB 75 | IcsSetCompression(ip, IcsCompr_gzip, 6); 76 | #endif 77 | retval = IcsClose(ip); 78 | if (retval != IcsErr_Ok) { 79 | fprintf(stderr, "Could not write output file: %s\n", 80 | IcsGetErrorText(retval)); 81 | exit(-1); 82 | } 83 | 84 | /* Read image */ 85 | retval = IcsOpen(&ip, argv[2], "r"); 86 | if (retval != IcsErr_Ok) { 87 | fprintf(stderr, "Could not open output file for reading: %s\n", 88 | IcsGetErrorText(retval)); 89 | exit(-1); 90 | } 91 | if (bufsize != IcsGetDataSize(ip)) { 92 | fprintf(stderr, "Data in output file not same size as written.\n"); 93 | exit(-1); 94 | } 95 | buf2 = malloc(bufsize); 96 | if (buf2 == NULL) { 97 | fprintf(stderr, "Could not allocate memory.\n"); 98 | exit(-1); 99 | } 100 | retval = IcsGetData(ip, buf2, bufsize); 101 | if (retval != IcsErr_Ok) { 102 | fprintf(stderr, "Could not read output image data: %s\n", 103 | IcsGetErrorText(retval)); 104 | exit(-1); 105 | } 106 | retval = IcsClose(ip); 107 | if (retval != IcsErr_Ok) { 108 | fprintf(stderr, "Could not close output file: %s\n", 109 | IcsGetErrorText(retval)); 110 | exit(-1); 111 | } 112 | if (memcmp(buf1, buf2, bufsize) != 0) { 113 | fprintf(stderr, "Data in output file does not match data in input.\n"); 114 | exit(-1); 115 | } 116 | 117 | free(buf1); 118 | free(buf2); 119 | exit(0); 120 | } 121 | -------------------------------------------------------------------------------- /test_strides2.sh: -------------------------------------------------------------------------------- 1 | ./test_strides2 $srcdir/test/testim.ics result_s2.ics 2 | -------------------------------------------------------------------------------- /test_strides3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "libics.h" 5 | 6 | int main(int argc, const char* argv[]) { 7 | ICS* ip; 8 | Ics_DataType dt; 9 | int ndims; 10 | size_t dims[ICS_MAXDIM]; 11 | size_t imelsize; 12 | size_t bufsize; 13 | ptrdiff_t strides[3]; 14 | void* buf1; 15 | void* buf2; 16 | void* buf3; 17 | Ics_Error retval; 18 | 19 | 20 | if (argc != 3) { 21 | fprintf(stderr, "Two file names required: in out\n"); 22 | exit(-1); 23 | } 24 | 25 | /* Read image */ 26 | retval = IcsOpen(&ip, argv[1], "r"); 27 | if (retval != IcsErr_Ok) { 28 | fprintf(stderr, "Could not open input file: %s\n", 29 | IcsGetErrorText(retval)); 30 | exit(-1); 31 | } 32 | IcsGetLayout(ip, &dt, &ndims, dims); 33 | strides[0] = -1; 34 | strides[1] = -(ptrdiff_t)(dims[0]*dims[2]); 35 | strides[2] = -(ptrdiff_t)(dims[0]); 36 | imelsize = IcsGetImelSize(ip); 37 | bufsize = IcsGetDataSize(ip); 38 | buf1 = malloc(bufsize); 39 | if (buf1 == NULL) { 40 | fprintf(stderr, "Could not allocate memory.\n"); 41 | exit(-1); 42 | } 43 | retval = IcsGetData(ip, buf1, bufsize); 44 | if (retval != IcsErr_Ok) { 45 | fprintf(stderr, "Could not read input image data: %s\n", 46 | IcsGetErrorText(retval)); 47 | exit(-1); 48 | } 49 | buf3 = malloc(bufsize); 50 | if (buf3 == NULL) { 51 | fprintf(stderr, "Could not allocate memory.\n"); 52 | exit(-1); 53 | } 54 | retval = IcsGetDataWithStrides(ip, (char*)buf3 + bufsize - imelsize, 0, strides, 3); 55 | if (retval != IcsErr_Ok) { 56 | fprintf(stderr, "Could not read input image data using strides: %s\n", 57 | IcsGetErrorText(retval)); 58 | exit(-1); 59 | } 60 | retval = IcsClose(ip); 61 | if (retval != IcsErr_Ok) { 62 | fprintf(stderr, "Could not close input file: %s\n", 63 | IcsGetErrorText(retval)); 64 | exit(-1); 65 | } 66 | 67 | /* Write image */ 68 | retval = IcsOpen(&ip, argv[2], "w2"); 69 | if (retval != IcsErr_Ok) { 70 | fprintf(stderr, "Could not open output file: %s\n", 71 | IcsGetErrorText(retval)); 72 | exit(-1); 73 | } 74 | IcsSetLayout(ip, dt, ndims, dims); 75 | IcsSetDataWithStrides(ip, (char*)buf3 + bufsize - imelsize, bufsize, strides, 3); 76 | #ifdef ICS_ZLIB 77 | IcsSetCompression(ip, IcsCompr_gzip, 6); 78 | #endif 79 | retval = IcsClose(ip); 80 | if (retval != IcsErr_Ok) { 81 | fprintf(stderr, "Could not write output file: %s\n", 82 | IcsGetErrorText(retval)); 83 | exit(-1); 84 | } 85 | 86 | /* Read image */ 87 | retval = IcsOpen(&ip, argv[2], "r"); 88 | if (retval != IcsErr_Ok) { 89 | fprintf(stderr, "Could not open output file for reading: %s\n", 90 | IcsGetErrorText(retval)); 91 | exit(-1); 92 | } 93 | if (bufsize != IcsGetDataSize(ip)) { 94 | fprintf(stderr, "Data in output file not same size as written.\n"); 95 | exit(-1); 96 | } 97 | buf2 = malloc(bufsize); 98 | if (buf2 == NULL) { 99 | fprintf(stderr, "Could not allocate memory.\n"); 100 | exit(-1); 101 | } 102 | retval = IcsGetData(ip, buf2, bufsize); 103 | if (retval != IcsErr_Ok) { 104 | fprintf(stderr, "Could not read output image data: %s\n", 105 | IcsGetErrorText(retval)); 106 | exit(-1); 107 | } 108 | retval = IcsClose(ip); 109 | if (retval != IcsErr_Ok) { 110 | fprintf(stderr, "Could not close output file: %s\n", 111 | IcsGetErrorText(retval)); 112 | exit(-1); 113 | } 114 | if (memcmp(buf1, buf2, bufsize) != 0) { 115 | fprintf(stderr, "Data in output file does not match data in input.\n"); 116 | exit(-1); 117 | } 118 | 119 | free(buf1); 120 | free(buf2); 121 | exit(0); 122 | } 123 | -------------------------------------------------------------------------------- /test_strides3.sh: -------------------------------------------------------------------------------- 1 | ./test_strides3 $srcdir/test/testim.ics result_s3.ics 2 | --------------------------------------------------------------------------------