# HG changeset patch # User Sebastien Jodogne # Date 1480094589 -3600 # Node ID 3252fbf149e3b5e8d62992ca408a3b554c894e57 # Parent f45cec2c32e25f48f0c325f7a8ffa0bbd2db0782 test diff -r f45cec2c32e2 -r 3252fbf149e3 Resources/Graveyard/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Graveyard/CMakeLists.txt Fri Nov 25 18:23:09 2016 +0100 @@ -0,0 +1,240 @@ +cmake_minimum_required(VERSION 2.8) +project(OrthancWSIApplications) + + +##################################################################### +## Parameters of the build +##################################################################### + +# Generic parameters +SET(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") +SET(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages") +SET(ENABLE_PROFILING OFF CACHE BOOL "Whether to enable the generation of profiling information with gprof") + +# Optional components +SET(ENABLE_SSL OFF CACHE BOOL "Include support for SSL") +SET(USE_DCMTK_361 OFF CACHE BOOL "Use forthcoming DCMTK version 3.6.1 in static builds (instead of 3.6.0)") + +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(TMP ON) +else() + set(TMP OFF) +endif() + + +# Advanced parameters to fine-tune linking against system libraries +SET(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost") +SET(USE_SYSTEM_CURL ON CACHE BOOL "Use the system version of LibCurl") +SET(USE_SYSTEM_DCMTK ON CACHE BOOL "Use the system version of DCMTK") +SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp") +SET(USE_SYSTEM_LIBJPEG ON CACHE BOOL "Use the system version of libjpeg") +SET(USE_SYSTEM_LIBPNG ON CACHE BOOL "Use the system version of libpng") +SET(USE_SYSTEM_LIBTIFF ON CACHE BOOL "Use the system version of libtiff") +SET(USE_SYSTEM_OPENJPEG ON CACHE BOOL "Use the system version of OpenJpeg") +SET(USE_SYSTEM_OPENSSL ON CACHE BOOL "Use the system version of OpenSSL") +SET(USE_SYSTEM_ZLIB ON CACHE BOOL "Use the system version of ZLib") + +SET(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)") + + +##################################################################### +## Configure mandatory third-party components +##################################################################### + +SET(ORTHANC_WSI_DIR ${CMAKE_CURRENT_LIST_DIR}/../..) +SET(ORTHANC_ROOT ${ORTHANC_WSI_DIR}/Resources/Orthanc) +SET(USE_OPENJPEG_JP2 ON) +SET(ENABLE_JPEG OFF) # Disable DCMTK's support for JPEG, that clashes with libtiff +SET(ENABLE_JPEG_LOSSLESS OFF) # Disable DCMTK's support for JPEG-LS +SET(ENABLE_DCMTK_NETWORK OFF) # Disable DCMTK's support for DICOM networking +SET(STANDALONE_BUILD ON) # Embed DCMTK's dictionaries for static builds +SET(USE_DCMTK_361_PRIVATE_DIC OFF) # No need for private tags + +include(CheckIncludeFiles) +include(CheckIncludeFileCXX) +include(CheckLibraryExists) +include(FindPythonInterp) +include(FindPkgConfig) +include(CheckSymbolExists) + +include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/VisualStudioPrecompiledHeaders.cmake) + +# Third-party components shipped with Orthanc +include(${ORTHANC_ROOT}/Resources/CMake/DcmtkConfiguration.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/LibCurlConfiguration.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/LibJpegConfiguration.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/LibPngConfiguration.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/ZlibConfiguration.cmake) + +# Include components specific to WSI +include(${ORTHANC_WSI_DIR}/Resources/CMake/Version.cmake) +include(${ORTHANC_WSI_DIR}/Resources/CMake/BoostExtendedConfiguration.cmake) +include(${ORTHANC_WSI_DIR}/Resources/CMake/OpenJpegConfiguration.cmake) +include(${ORTHANC_WSI_DIR}/Resources/CMake/LibTiffConfiguration.cmake) + +add_definitions( + -DORTHANC_ENABLE_BASE64=1 + -DORTHANC_ENABLE_CURL=1 + -DORTHANC_ENABLE_DCMTK=1 + -DORTHANC_ENABLE_LOGGING=1 + -DORTHANC_ENABLE_MD5=0 + -DORTHANC_ENABLE_JPEG=0 # Disable DCMTK's support for JPEG + -DORTHANC_ENABLE_PKCS11=0 + -DORTHANC_ENABLE_PLUGINS=1 # To enable class Orthanc::SharedLibrary + -DORTHANC_ENABLE_PUGIXML=0 + -DORTHANC_SANDBOXED=0 + ) + + +##################################################################### +## Configure optional third-party components +##################################################################### + +if (ENABLE_SSL) + set(ENABLE_PKCS11 OFF) + add_definitions(-DORTHANC_ENABLE_SSL=1) + include(${ORTHANC_ROOT}/Resources/CMake/OpenSslConfiguration.cmake) +else() + add_definitions(-DORTHANC_ENABLE_SSL=0) +endif() + + +##################################################################### +## Create the list of the source files that depend upon the +## precompiled headers +##################################################################### + +set(ORTHANC_WSI_SOURCES + ${ORTHANC_WSI_DIR}/Framework/Algorithms/PyramidReader.cpp + ${ORTHANC_WSI_DIR}/Framework/Algorithms/ReconstructPyramidCommand.cpp + ${ORTHANC_WSI_DIR}/Framework/Algorithms/TranscodeTileCommand.cpp + ${ORTHANC_WSI_DIR}/Framework/DicomToolbox.cpp + ${ORTHANC_WSI_DIR}/Framework/DicomizerParameters.cpp + ${ORTHANC_WSI_DIR}/Framework/Enumerations.cpp + ${ORTHANC_WSI_DIR}/Framework/ImageToolbox.cpp + ${ORTHANC_WSI_DIR}/Framework/ImagedVolumeParameters.cpp + ${ORTHANC_WSI_DIR}/Framework/Inputs/DecodedTiledPyramid.cpp + ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramid.cpp + ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramidInstance.cpp + ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramidLevel.cpp + ${ORTHANC_WSI_DIR}/Framework/Inputs/HierarchicalTiff.cpp + ${ORTHANC_WSI_DIR}/Framework/Inputs/OpenSlideLibrary.cpp + ${ORTHANC_WSI_DIR}/Framework/Inputs/OpenSlidePyramid.cpp + ${ORTHANC_WSI_DIR}/Framework/Inputs/PyramidWithRawTiles.cpp + ${ORTHANC_WSI_DIR}/Framework/Inputs/SingleLevelDecodedPyramid.cpp + ${ORTHANC_WSI_DIR}/Framework/Inputs/TiledPyramidStatistics.cpp + ${ORTHANC_WSI_DIR}/Framework/Jpeg2000Reader.cpp + ${ORTHANC_WSI_DIR}/Framework/Jpeg2000Writer.cpp + ${ORTHANC_WSI_DIR}/Framework/Targets/FolderTarget.cpp + ${ORTHANC_WSI_DIR}/Framework/Targets/OrthancTarget.cpp + ${ORTHANC_WSI_DIR}/Framework/Outputs/DicomPyramidWriter.cpp + ${ORTHANC_WSI_DIR}/Framework/Outputs/HierarchicalTiffWriter.cpp + ${ORTHANC_WSI_DIR}/Framework/Outputs/InMemoryTiledImage.cpp + ${ORTHANC_WSI_DIR}/Framework/Outputs/MultiframeDicomWriter.cpp + ${ORTHANC_WSI_DIR}/Framework/Outputs/PyramidWriterBase.cpp + ${ORTHANC_WSI_DIR}/Framework/Outputs/TruncatedPyramidWriter.cpp + ) + +set(ORTHANC_CORE_SOURCES + ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp + ${ORTHANC_ROOT}/Core/DicomFormat/DicomArray.cpp + ${ORTHANC_ROOT}/Core/DicomFormat/DicomMap.cpp + ${ORTHANC_ROOT}/Core/DicomFormat/DicomTag.cpp + ${ORTHANC_ROOT}/Core/DicomFormat/DicomValue.cpp + ${ORTHANC_ROOT}/Core/Enumerations.cpp + ${ORTHANC_ROOT}/Core/HttpClient.cpp + ${ORTHANC_ROOT}/Core/Images/IImageWriter.cpp + ${ORTHANC_ROOT}/Core/Images/Image.cpp + ${ORTHANC_ROOT}/Core/Images/ImageAccessor.cpp + ${ORTHANC_ROOT}/Core/Images/ImageBuffer.cpp + ${ORTHANC_ROOT}/Core/Images/ImageProcessing.cpp + ${ORTHANC_ROOT}/Core/Images/JpegErrorManager.cpp + ${ORTHANC_ROOT}/Core/Images/JpegReader.cpp + ${ORTHANC_ROOT}/Core/Images/JpegWriter.cpp + ${ORTHANC_ROOT}/Core/Images/PngReader.cpp + ${ORTHANC_ROOT}/Core/Images/PngWriter.cpp + ${ORTHANC_ROOT}/Core/Logging.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/BagOfTasksProcessor.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp + ${ORTHANC_ROOT}/Core/SystemToolbox.cpp + ${ORTHANC_ROOT}/Core/TemporaryFile.cpp + ${ORTHANC_ROOT}/Core/Toolbox.cpp + ${ORTHANC_ROOT}/Core/WebServiceParameters.cpp + ${ORTHANC_ROOT}/OrthancServer/FromDcmtkBridge.cpp + ${ORTHANC_ROOT}/OrthancServer/ServerEnumerations.cpp + ${ORTHANC_ROOT}/OrthancServer/ToDcmtkBridge.cpp + ${ORTHANC_ROOT}/Plugins/Engine/SharedLibrary.cpp + ${ORTHANC_ROOT}/Resources/ThirdParty/base64/base64.cpp + ) + +EmbedResources( + ${DCMTK_DICTIONARIES} + BRIGHTFIELD_OPTICAL_PATH ${ORTHANC_WSI_DIR}/Resources/BrightfieldOpticalPath.json + SAMPLE_DATASET ${ORTHANC_WSI_DIR}/Resources/SampleDataset.json + SRGB_ICC_PROFILE ${ORTHANC_WSI_DIR}/Resources/sRGB.icc + ) + + +##################################################################### +## Setup precompiled headers for Microsoft Visual Studio +##################################################################### + +if (MSVC) + add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1) + + ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( + "PrecompiledHeaders.h" "${ORTHANC_WSI_DIR}/Framework/Orthanc/Core/PrecompiledHeaders.cpp" ORTHANC_CORE_SOURCES) + + ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( + "PrecompiledHeadersWSI.h" "${ORTHANC_WSI_DIR}/Framework/PrecompiledHeadersWSI.cpp" ORTHANC_WSI_SOURCES) + + source_group(ThirdParty\\OrthancCore FILES ${ORTHANC_CORE_SOURCES}) +endif() + + +##################################################################### +## Build a hello world +##################################################################### + +add_executable(Hello + ${ORTHANC_CORE_SOURCES} + ${ORTHANC_WSI_SOURCES} + ${AUTOGENERATED_SOURCES} + + # Mandatory components + ${BOOST_SOURCES} + ${CURL_SOURCES} + ${DCMTK_SOURCES} + ${JSONCPP_SOURCES} + ${LIBJPEG_SOURCES} + ${LIBPNG_SOURCES} + ${LIBTIFF_SOURCES} + ${OPENJPEG_SOURCES} + ${ZLIB_SOURCES} + + # Optional components + ${OPENSSL_SOURCES} + + ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp + ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomDatasetReader.cpp + ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomPath.cpp + ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomTag.cpp + ${ORTHANC_ROOT}/Plugins/Samples/Common/FullOrthancDataset.cpp + ${ORTHANC_ROOT}/Plugins/Samples/Common/IOrthancConnection.cpp + ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancHttpConnection.cpp + ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginConnection.cpp + ${ORTHANC_ROOT}/Plugins/Samples/Common/SimplifiedOrthancDataset.cpp + + Hello.cpp + ${ORTHANC_WSI_DIR}/Applications/ApplicationToolbox.cpp + + ${DICOMIZER_RESOURCES} + ) + +add_definitions(-DHAS_ORTHANC_EXCEPTION=1) + +target_link_libraries(Hello ${DCMTK_LIBRARIES}) diff -r f45cec2c32e2 -r 3252fbf149e3 Resources/Graveyard/Hello.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/Graveyard/Hello.cpp Fri Nov 25 18:23:09 2016 +0100 @@ -0,0 +1,85 @@ + +#include +#include +#include +#include +#include +#include +#include + +#include "../../Framework/Inputs/DicomPyramid.h" +#include "../../Applications/ApplicationToolbox.h" +#include "../../Resources/Orthanc/Plugins/Samples/Common/OrthancHttpConnection.h" +#include "../../Resources/Orthanc/Plugins/Samples/Common/DicomDatasetReader.h" +#include "../../Resources/Orthanc/Plugins/Samples/Common/FullOrthancDataset.h" +#include "../../Resources/Orthanc/Plugins/Samples/Common/SimplifiedOrthancDataset.h" + +#include + +namespace OrthancPlugins +{ + void Run() + { + OrthancHttpConnection orthanc; + +#if 0 + //DicomDatasetReader reader(new SimplifiedOrthancDataset(orthanc, "/instances/2791b060-6ff103b3-8078bed0-5abbd75a-a5c675f7/tags?simplify")); + DicomDatasetReader reader(new FullOrthancDataset(orthanc, "/instances/2791b060-6ff103b3-8078bed0-5abbd75a-a5c675f7/tags")); + + std::cout << reader.GetIntegerValue(DICOM_TAG_TOTAL_PIXEL_MATRIX_COLUMNS) << "x" + << reader.GetIntegerValue(DICOM_TAG_TOTAL_PIXEL_MATRIX_ROWS) << std::endl; + + std::string s; + printf("%d ", reader.GetDataset().GetStringValue(s, DICOM_TAG_SOP_CLASS_UID)); + printf("[%s]\n", s.c_str()); + + size_t c; + + { + DicomPath p(DICOM_TAG_PER_FRAME_FUNCTIONAL_GROUPS_SEQUENCE); + printf("%d ", reader.GetDataset().GetSequenceSize(c, p)); + printf("%d\n", c); + } + + for (size_t i = 0; i < c; i++) + { + /*DicomPath p(DICOM_TAG_COLUMN_POSITION_IN_TOTAL_IMAGE_PIXEL_MATRIX); + p.AddToPrefix(DICOM_TAG_PER_FRAME_FUNCTIONAL_GROUPS_SEQUENCE, i); + p.AddToPrefix(DICOM_TAG_PLANE_POSITION_SLIDE_SEQUENCE, 0); + + std::string x, y; + printf("%d %d ", i, reader.GetDataset().GetStringValue(x, p)); + p.SetFinalTag(DICOM_TAG_ROW_POSITION_IN_TOTAL_IMAGE_PIXEL_MATRIX); + printf("%d ", reader.GetDataset().GetStringValue(y, p)); + printf("[%s,%s]\n", x.c_str(), y.c_str());*/ + + std::cout << i << ": [" + << reader.GetMandatoryStringValue( + DicomPath(DICOM_TAG_PER_FRAME_FUNCTIONAL_GROUPS_SEQUENCE, i, + DICOM_TAG_PLANE_POSITION_SLIDE_SEQUENCE, 0, + DICOM_TAG_COLUMN_POSITION_IN_TOTAL_IMAGE_PIXEL_MATRIX)) << "," + << reader.GetMandatoryStringValue( + DicomPath(DICOM_TAG_PER_FRAME_FUNCTIONAL_GROUPS_SEQUENCE, i, + DICOM_TAG_PLANE_POSITION_SLIDE_SEQUENCE, 0, + DICOM_TAG_ROW_POSITION_IN_TOTAL_IMAGE_PIXEL_MATRIX)) + << "]" << std::endl; + } + +#else + OrthancWSI::DicomPyramid pyramid(orthanc, "68bc53a6-8bd5b470-05072b43-af144cf8-665c54fd"); + //OrthancWSI::DicomPyramid pyramid(orthanc, "4fdff9b9-8b81bc8f-04a3f903-4d44bd57-cc3bf42c"); +#endif + } + +} + + + + +int main() +{ + OrthancWSI::ApplicationToolbox::GlobalInitialize(); + OrthancPlugins::Run(); + OrthancWSI::ApplicationToolbox::GlobalFinalize(); + return 0; +}