From 31dba0b4e9be32a5d8e0052e2bf16e7eb4e02534 Mon Sep 17 00:00:00 2001 From: Antonin Descampe Date: Thu, 14 Apr 2011 18:37:47 +0000 Subject: [PATCH] initial commit of OpenJPIP 1.0, a JPIP client-server architecture based on OpenJPEG (see README file in jpip directory for more details) --- CHANGES | 1 + CMakeLists.txt | 1 - INSTALL | 1 - README | 2 +- applications/CMakeLists.txt | 4 - applications/indexer_JPIP/CMakeLists.txt | 9 - applications/jpip/Makefile | 19 + applications/jpip/README | 141 ++ applications/jpip/doc/Doxyfile | 1514 +++++++++++++++++ applications/jpip/doc/jpip_protocol.png | Bin 0 -> 6305 bytes applications/jpip/libopenjpip/Makefile | 10 + applications/jpip/libopenjpip/box_manager.c | 421 +++++ applications/jpip/libopenjpip/box_manager.h | 265 +++ .../jpip/libopenjpip/boxheader_manager.c | 81 + .../jpip/libopenjpip/boxheader_manager.h | 71 + applications/jpip/libopenjpip/byte_manager.c | 146 ++ applications/jpip/libopenjpip/byte_manager.h | 122 ++ .../jpip/libopenjpip/codestream_manager.c | 80 + .../jpip/libopenjpip/codestream_manager.h | 102 ++ applications/jpip/libopenjpip/comMakefile.mk | 17 + .../jpip/libopenjpip/faixbox_manager.c | 189 ++ .../jpip/libopenjpip/faixbox_manager.h | 146 ++ .../jpip/libopenjpip/ihdrbox_manager.c | 74 + .../jpip/libopenjpip/ihdrbox_manager.h | 48 + .../jpip/libopenjpip/imgreg_manager.c | 133 ++ .../jpip/libopenjpip/imgreg_manager.h | 89 + applications/jpip/libopenjpip/index_manager.c | 524 ++++++ applications/jpip/libopenjpip/index_manager.h | 139 ++ .../jpip/libopenjpip/manfbox_manager.c | 115 ++ .../jpip/libopenjpip/manfbox_manager.h | 81 + .../jpip/libopenjpip/marker_manager.c | 68 + .../jpip/libopenjpip/marker_manager.h | 87 + .../jpip/libopenjpip/metadata_manager.c | 253 +++ .../jpip/libopenjpip/metadata_manager.h | 150 ++ .../jpip/libopenjpip/mhixbox_manager.c | 140 ++ .../jpip/libopenjpip/mhixbox_manager.h | 102 ++ .../jpip/libopenjpip/msgqueue_manager.c | 947 +++++++++++ .../jpip/libopenjpip/msgqueue_manager.h | 167 ++ .../jpip/libopenjpip/placeholder_manager.c | 138 ++ .../jpip/libopenjpip/placeholder_manager.h | 115 ++ .../jpip/libopenjpip/target_manager.c | 210 +++ .../jpip/libopenjpip/target_manager.h | 116 ++ applications/jpip/mainpage.h | 80 + .../jpip/opj_client/opj_dec_server/Makefile | 14 + .../opj_client/opj_dec_server/cache_manager.c | 239 +++ .../opj_client/opj_dec_server/cache_manager.h | 158 ++ .../opj_dec_server/imgsock_manager.c | 260 +++ .../opj_dec_server/imgsock_manager.h | 159 ++ .../opj_client/opj_dec_server/jp2k_decoder.c | 202 +++ .../opj_client/opj_dec_server/jp2k_decoder.h | 39 + .../opj_dec_server/jptstream_manager.c | 91 + .../opj_dec_server/jptstream_manager.h | 39 + .../opj_dec_server/opj_dec_server.c | 319 ++++ .../jpip/opj_client/opj_viewer/build.xml | 35 + .../opj_client/opj_viewer/dist/manifest.txt | 5 + .../opj_viewer/dist/opj_viewer-20110218.jar | Bin 0 -> 19360 bytes .../opj_client/opj_viewer/dist/opj_viewer.jar | 1 + .../opj_viewer/src/ImageManager.java | 99 ++ .../opj_viewer/src/ImageViewer.java | 267 +++ .../opj_viewer/src/ImageWindow.java | 93 + .../opj_viewer/src/ImgdecClient.java | 268 +++ .../opj_viewer/src/JP2XMLparser.java | 122 ++ .../opj_viewer/src/JPIPHttpClient.java | 301 ++++ .../jpip/opj_client/opj_viewer/src/MML.java | 116 ++ .../opj_viewer/src/OptionPanel.java | 98 ++ .../opj_client/opj_viewer/src/PnmImage.java | 141 ++ .../opj_viewer/src/RegimViewer.java | 115 ++ .../opj_viewer/src/ResizeListener.java | 59 + applications/jpip/opj_server/Makefile | 14 + .../jpip/opj_server/channel_manager.c | 166 ++ .../jpip/opj_server/channel_manager.h | 115 ++ applications/jpip/opj_server/opj_server.c | 430 +++++ applications/jpip/opj_server/query_parser.c | 250 +++ applications/jpip/opj_server/query_parser.h | 84 + .../jpip/opj_server/session_manager.c | 190 +++ .../jpip/opj_server/session_manager.h | 116 ++ applications/jpip/tools/Makefile | 24 + applications/jpip/tools/addXMLinJP2.c | 181 ++ .../tools/indexer}/Makefile | 2 +- .../tools/indexer}/bio.c | 0 .../tools/indexer}/bio.h | 0 .../tools/indexer}/cio.c | 0 .../tools/indexer}/cio.h | 0 .../tools/indexer}/fix.c | 6 +- .../tools/indexer}/fix.h | 0 .../tools/indexer}/index_create.c | 64 +- .../tools/indexer}/int.c | 0 .../tools/indexer}/int.h | 0 .../tools/indexer}/j2k.h | 4 +- .../tools/indexer}/jp2.c | 3 +- .../tools/indexer}/jp2.h | 0 .../tools/indexer}/jpip.c | 18 +- .../tools/indexer}/jpip.h | 0 applications/jpip/tools/indexer/jpt.c | 140 ++ .../{indexer_JPIP => jpip/tools/indexer}/pi.c | 0 .../{indexer_JPIP => jpip/tools/indexer}/pi.h | 0 .../{indexer_JPIP => jpip/tools/indexer}/t2.c | 0 .../{indexer_JPIP => jpip/tools/indexer}/t2.h | 0 .../tools/indexer}/tcd.c | 0 .../tools/indexer}/tcd.h | 0 .../tools/indexer}/tgt.c | 0 .../tools/indexer}/tgt.h | 0 applications/jpip/tools/jpt_to_j2k.c | 108 ++ applications/jpip/tools/jpt_to_jp2.c | 123 ++ applications/jpip/tools/test_index.c | 128 ++ 105 files changed, 12467 insertions(+), 57 deletions(-) delete mode 100644 applications/indexer_JPIP/CMakeLists.txt create mode 100644 applications/jpip/Makefile create mode 100644 applications/jpip/README create mode 100644 applications/jpip/doc/Doxyfile create mode 100644 applications/jpip/doc/jpip_protocol.png create mode 100644 applications/jpip/libopenjpip/Makefile create mode 100644 applications/jpip/libopenjpip/box_manager.c create mode 100644 applications/jpip/libopenjpip/box_manager.h create mode 100644 applications/jpip/libopenjpip/boxheader_manager.c create mode 100644 applications/jpip/libopenjpip/boxheader_manager.h create mode 100644 applications/jpip/libopenjpip/byte_manager.c create mode 100644 applications/jpip/libopenjpip/byte_manager.h create mode 100644 applications/jpip/libopenjpip/codestream_manager.c create mode 100644 applications/jpip/libopenjpip/codestream_manager.h create mode 100644 applications/jpip/libopenjpip/comMakefile.mk create mode 100644 applications/jpip/libopenjpip/faixbox_manager.c create mode 100644 applications/jpip/libopenjpip/faixbox_manager.h create mode 100644 applications/jpip/libopenjpip/ihdrbox_manager.c create mode 100644 applications/jpip/libopenjpip/ihdrbox_manager.h create mode 100644 applications/jpip/libopenjpip/imgreg_manager.c create mode 100644 applications/jpip/libopenjpip/imgreg_manager.h create mode 100644 applications/jpip/libopenjpip/index_manager.c create mode 100644 applications/jpip/libopenjpip/index_manager.h create mode 100644 applications/jpip/libopenjpip/manfbox_manager.c create mode 100644 applications/jpip/libopenjpip/manfbox_manager.h create mode 100644 applications/jpip/libopenjpip/marker_manager.c create mode 100644 applications/jpip/libopenjpip/marker_manager.h create mode 100644 applications/jpip/libopenjpip/metadata_manager.c create mode 100644 applications/jpip/libopenjpip/metadata_manager.h create mode 100644 applications/jpip/libopenjpip/mhixbox_manager.c create mode 100644 applications/jpip/libopenjpip/mhixbox_manager.h create mode 100644 applications/jpip/libopenjpip/msgqueue_manager.c create mode 100644 applications/jpip/libopenjpip/msgqueue_manager.h create mode 100644 applications/jpip/libopenjpip/placeholder_manager.c create mode 100644 applications/jpip/libopenjpip/placeholder_manager.h create mode 100644 applications/jpip/libopenjpip/target_manager.c create mode 100644 applications/jpip/libopenjpip/target_manager.h create mode 100644 applications/jpip/mainpage.h create mode 100644 applications/jpip/opj_client/opj_dec_server/Makefile create mode 100644 applications/jpip/opj_client/opj_dec_server/cache_manager.c create mode 100644 applications/jpip/opj_client/opj_dec_server/cache_manager.h create mode 100644 applications/jpip/opj_client/opj_dec_server/imgsock_manager.c create mode 100644 applications/jpip/opj_client/opj_dec_server/imgsock_manager.h create mode 100644 applications/jpip/opj_client/opj_dec_server/jp2k_decoder.c create mode 100644 applications/jpip/opj_client/opj_dec_server/jp2k_decoder.h create mode 100644 applications/jpip/opj_client/opj_dec_server/jptstream_manager.c create mode 100644 applications/jpip/opj_client/opj_dec_server/jptstream_manager.h create mode 100644 applications/jpip/opj_client/opj_dec_server/opj_dec_server.c create mode 100644 applications/jpip/opj_client/opj_viewer/build.xml create mode 100644 applications/jpip/opj_client/opj_viewer/dist/manifest.txt create mode 100755 applications/jpip/opj_client/opj_viewer/dist/opj_viewer-20110218.jar create mode 120000 applications/jpip/opj_client/opj_viewer/dist/opj_viewer.jar create mode 100644 applications/jpip/opj_client/opj_viewer/src/ImageManager.java create mode 100644 applications/jpip/opj_client/opj_viewer/src/ImageViewer.java create mode 100644 applications/jpip/opj_client/opj_viewer/src/ImageWindow.java create mode 100644 applications/jpip/opj_client/opj_viewer/src/ImgdecClient.java create mode 100644 applications/jpip/opj_client/opj_viewer/src/JP2XMLparser.java create mode 100644 applications/jpip/opj_client/opj_viewer/src/JPIPHttpClient.java create mode 100644 applications/jpip/opj_client/opj_viewer/src/MML.java create mode 100644 applications/jpip/opj_client/opj_viewer/src/OptionPanel.java create mode 100644 applications/jpip/opj_client/opj_viewer/src/PnmImage.java create mode 100644 applications/jpip/opj_client/opj_viewer/src/RegimViewer.java create mode 100644 applications/jpip/opj_client/opj_viewer/src/ResizeListener.java create mode 100644 applications/jpip/opj_server/Makefile create mode 100644 applications/jpip/opj_server/channel_manager.c create mode 100644 applications/jpip/opj_server/channel_manager.h create mode 100644 applications/jpip/opj_server/opj_server.c create mode 100644 applications/jpip/opj_server/query_parser.c create mode 100644 applications/jpip/opj_server/query_parser.h create mode 100644 applications/jpip/opj_server/session_manager.c create mode 100644 applications/jpip/opj_server/session_manager.h create mode 100644 applications/jpip/tools/Makefile create mode 100644 applications/jpip/tools/addXMLinJP2.c rename applications/{indexer_JPIP => jpip/tools/indexer}/Makefile (92%) rename applications/{indexer_JPIP => jpip/tools/indexer}/bio.c (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/bio.h (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/cio.c (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/cio.h (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/fix.c (96%) rename applications/{indexer_JPIP => jpip/tools/indexer}/fix.h (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/index_create.c (95%) rename applications/{indexer_JPIP => jpip/tools/indexer}/int.c (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/int.h (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/j2k.h (99%) rename applications/{indexer_JPIP => jpip/tools/indexer}/jp2.c (99%) rename applications/{indexer_JPIP => jpip/tools/indexer}/jp2.h (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/jpip.c (98%) rename applications/{indexer_JPIP => jpip/tools/indexer}/jpip.h (100%) create mode 100644 applications/jpip/tools/indexer/jpt.c rename applications/{indexer_JPIP => jpip/tools/indexer}/pi.c (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/pi.h (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/t2.c (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/t2.h (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/tcd.c (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/tcd.h (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/tgt.c (100%) rename applications/{indexer_JPIP => jpip/tools/indexer}/tgt.h (100%) create mode 100644 applications/jpip/tools/jpt_to_j2k.c create mode 100644 applications/jpip/tools/jpt_to_jp2.c create mode 100644 applications/jpip/tools/test_index.c diff --git a/CHANGES b/CHANGES index d5e3dfd1..aaced315 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ What's New for OpenJPEG + : added April 14, 2011 ++ [antonin] initial commit of OpenJPIP 1.0, a JPIP client-server architecture based on OpenJPEG (see README file in jpip directory for more details) * [antonin] fixed applications/codec/CMakeLists.txt that prevented JPWL executables to be built with JPWL functionalities. ! [antonin] changed make all behaviour : DOC target removed from ALL. diff --git a/CMakeLists.txt b/CMakeLists.txt index c4297e70..bd73a34d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,7 +210,6 @@ ADD_SUBDIRECTORY(libopenjpeg) # Build Applications OPTION(BUILD_CODEC "Build the CODEC executables" ON) OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF) -OPTION(BUILD_INDEXER_JPIP "Build the INDEXER_JPIP executables" OFF) ADD_SUBDIRECTORY(applications) #----------------------------------------------------------------------------- diff --git a/INSTALL b/INSTALL index a3d97475..61cf4cfa 100644 --- a/INSTALL +++ b/INSTALL @@ -67,7 +67,6 @@ Main available cmake flags: * To build the CODEC executables: '-DBUILD_CODEC:bool=on' (default: 'ON') * To build the MJ2 executables: '-DBUILD_MJ2:bool=on' (default: 'OFF') * To build the JPWL executables and JPWL library: '-DBUILD_JPWL:bool=on' (default: 'OFF') -* [WIN32 ONLY] To build the INDEXER_JPIP executable: '-DBUILD_INDEXER_JPIP:bool=on' (default: 'OFF') * To enable testing (and automatic result upload to http://my.cdash.org/index.php?project=OPENJPEG): cmake . -DBUILD_TESTING:BOOL=ON -DJPEG2000_CONFORMANCE_DATA_ROOT:PATH=/path/to/your/JPEG2000/test/files make diff --git a/README b/README index 2ee2b541..895b644d 100644 --- a/README +++ b/README @@ -11,7 +11,7 @@ Details on folders hierarchy: * codec: a basic codec * mj2: motion jpeg 2000 executables * JavaOpenJPEG: java jni to use openjpeg in a java program - * indexer_JPIP: obsolete. Will be replaced by a complete JPIP implementation soon. + * jpip: complete client-server architecture for remote browsing of jpeg 2000 images. See corresponding README for more details. * OPJViewer: gui for displaying j2k files (based on wxWidget) * thirdparty: thirdparty libraries used by some applications. These libraries will be build only if there are not found on the system. Note that libopenjpeg itself does not have any dependency. * doc: doxygen documentation setup file and man pages diff --git a/applications/CMakeLists.txt b/applications/CMakeLists.txt index f4f16e4b..43081e8f 100644 --- a/applications/CMakeLists.txt +++ b/applications/CMakeLists.txt @@ -127,8 +127,4 @@ ENDIF(BUILD_CODEC) IF(BUILD_MJ2) ADD_SUBDIRECTORY(mj2) ENDIF(BUILD_MJ2) -# -IF(BUILD_INDEXER_JPIP) - ADD_SUBDIRECTORY(indexer_JPIP) -ENDIF(BUILD_INDEXER_JPIP) # \ No newline at end of file diff --git a/applications/indexer_JPIP/CMakeLists.txt b/applications/indexer_JPIP/CMakeLists.txt deleted file mode 100644 index c8e378d1..00000000 --- a/applications/indexer_JPIP/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# index_create - -ADD_EXECUTABLE(index_create -bio.c cio.c int.c pi.c t2.c tgt.c tcd.c index_create.c jpip.c jp2.c -) -INSTALL(TARGETS index_create - EXPORT OpenJPEGTargets - DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications -) diff --git a/applications/jpip/Makefile b/applications/jpip/Makefile new file mode 100644 index 00000000..29b3ce76 --- /dev/null +++ b/applications/jpip/Makefile @@ -0,0 +1,19 @@ +default: t_libopenjpip t_opj_server t_opj_dec_server t_tools + +t_libopenjpip: + make -C libopenjpip + +t_opj_server: + make -C opj_server + +t_opj_dec_server: + make -C opj_client/opj_dec_server + +t_tools: + make -C tools + +clean: + make clean -C libopenjpip + make clean -C opj_server + make clean -C opj_client/opj_dec_server + make clean -C tools diff --git a/applications/jpip/README b/applications/jpip/README new file mode 100644 index 00000000..90cc956e --- /dev/null +++ b/applications/jpip/README @@ -0,0 +1,141 @@ +======================================================================== + OpenJPIP software 1.0 ReadMe + +OpenJPEG: +http://www.openjpeg.org + +Written by: +Kaori Hagihara +UCL/SST/ICTM/ELEN +February 18 2011 +======================================================================== + +Contents: +1. Introduction +2. License +3. System requirements +4. Implementing instructions +5. JP2 encoding instructions + + +---------- +1. Introduction +---------- + +OpenJPIP software is an implementation of JPEG 2000 Part9: Interactivity tools, APIs and protocols (JPIP). +( For more info about JPIP, check the website: http://www.jpeg.org/jpeg2000/j2kpart9.html) +The current implementation uses some results from the 2KAN project (http://www.2kan.org). + +First Version 1.0 covers: + - JPT-stream (Tile based) media types + - Session, channels, cache model managements + - JPIP over HTTP + - Indexing JPEG 2000 files + - Embedding XML formatted metadata + - Region Of Interest (ROI) requests + +---------- +2. License +---------- + +This software is released under the BSD license, anybody can use or modify the library, even for commercial applications. +The only restriction is to retain the copyright in the sources or the binaries documentation. +Neither the author, nor the university accept any responsibility for any kind of error or data loss which may occur during usage. + +---------- +3. System requirements +---------- + + - OpenJPEG library (currently assumes it is installed on the system => will not use the one built higher in the directory structure) + - FastCGI development kit (C libraries) at server (http://www.fastcgi.com) + - Java application launcher at client + - Kakadu software ( http://www.kakadusoftware.com). Currently required to encode jpeg 2000 images with tile-parts. This will be implemented soon in openjpeg, making this requirement obsolete. + + - Xerces2 java XML parser on the client for accessing embedded image metadata (http://xerces.apache.org/xerces2-j) + +We tested this software with a virtual server running on the same Linux machine as the clients. Currently, it works only on linux or macosx platforms, windows version should come later. + +---------- +4. Building instructions +---------- + +A Makefile is available in the same directory as this README file. Simply type 'make' and it will build all the required C-executables. +Concerning the java-based opj_viewer, simply type 'ant' in the corresponding directory (requires 'ant' utility of course) + +CMake files ar planned to be included ASAP. + +The documentation can be build this way (requires doxygen utility): + cd doc + doxygen Doxyfile + +---------- +5. Usage +---------- + +Preliminary notes : + * HTML documentation is available at http://www.openjpeg.org/jpip/doc/html + * Example image is available at http://www.openjpeg.org/jpip/data/copenhague1.zip (20 Mb !) + +Webserver: + You need a webserver running with the fastcgi module enabled and correctly configured. + For Apache, add the following line to your /etc/apache2/mods-available/fastcgi.conf configuration file: + + FastCGIExternalServer /var/www/myFCGI -host localhost:3000 + + where /var/www is your DocumentRoot. + Please refer to 'http://www.openjpeg.org/jpip/doc/ApacheFastCGITutorial.pdf' for more details. + +Server: + 1. Store JP2 files in the same directory as opj_server + + 2. Launch opj_server from the server terminal: + % spawn-fcgi -f ./opj_server -p 3000 -n + +Client: + 1. Launch image decoding server, and keep it alive as long as image viewers are open + % ./opj_dec_server + + You might prefer to implement this program from another directory since cache files are saved in the working directory. + % mkdir cache + % cd cache + % ../opj_dec_server + + 2. Open image viewers (as many as needed) + % java -jar opj_viewer.jar http://hostname/myFCGI JP2_filename.jp2 + ( The arguments + - http://hostname/myFCGI is the HTTP server URI (myFCGI refers to opj_server by the server setting) + - JP2_filename.jp2 is the name of a JP2 file available on the server.) + Image viewer GUI instructions: + Scale up request: Enlarge the window + ROI request: Select a region by mouse click and drag, then click inside the red frame of the selected region + + Annotate image with ROI information in XML metadata: Click button "Region Of Interest" + Open a new window presenting an aligned image with a locally stored image: Click button "Image Registration" (Under Construction) + + 3. Quit the image decoding server through the telnet, be sure all image viewers are closed + % telnet localhost 5000 + quit + +---------- +5. JP2 encoding instructions +---------- + +An example to encode a TIF image "copenhague1.tif" at resolution 4780x4050, 8bit/pixel, grayscale. + + 1. J2K encoding using Kakadu with an option which introduces the tile-part flag at each resolution level + % ./kdu_compress -i copenhague1.tif -o copenhague1.j2k Corder=RPCL ORGtparts=R Stiles={256,256} + + 2. JP2 encoding with embedding indexing data + % ./index_create copenhague1.j2k copenhague1.jp2 2 + +