# HG changeset patch # User Sebastien Jodogne # Date 1433233369 -7200 # Node ID c584c25a74fdfe2abfcf680f91a5358affcf394c # Parent 798076adf9e9f7a98fd42866a0cfea99570644b7 cont diff -r 798076adf9e9 -r c584c25a74fd CMakeLists.txt --- a/CMakeLists.txt Tue Jun 02 10:11:34 2015 +0200 +++ b/CMakeLists.txt Tue Jun 02 10:22:49 2015 +0200 @@ -42,7 +42,7 @@ ## Create the standalone DLL containing the Orthanc Client API ##################################################################### -include_directories(OrthancCppClient/SharedLibrary/Laaw) +include_directories(Resources/Laaw) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") if (CMAKE_CROSSCOMPILING) @@ -50,9 +50,9 @@ set(CMAKE_SHARED_LIBRARY_PREFIX "") if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) - set(ORTHANC_CPP_CLIENT_AUX OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows32.def) + set(ORTHANC_CPP_CLIENT_AUX CppClient/SharedLibrary/AUTOGENERATED/Windows32.def) elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8) - set(ORTHANC_CPP_CLIENT_AUX OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows64.def) + set(ORTHANC_CPP_CLIENT_AUX CppClient/SharedLibrary/AUTOGENERATED/Windows64.def) else() message(FATAL_ERROR "Support your platform here") endif() @@ -62,10 +62,10 @@ if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) set(CMAKE_SHARED_LIBRARY_SUFFIX "_Windows32.dll") - list(APPEND ORTHANC_CPP_CLIENT_AUX OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows32.rc) + list(APPEND ORTHANC_CPP_CLIENT_AUX CppClient/SharedLibrary/AUTOGENERATED/Windows32.rc) elseif (${CMAKE_SIZEOF_VOID_P} EQUAL 8) set(CMAKE_SHARED_LIBRARY_SUFFIX "_Windows64.dll") - list(APPEND ORTHANC_CPP_CLIENT_AUX OrthancCppClient/SharedLibrary/AUTOGENERATED/Windows64.rc) + list(APPEND ORTHANC_CPP_CLIENT_AUX CppClient/SharedLibrary/AUTOGENERATED/Windows64.rc) else() message(FATAL_ERROR "Support your platform here") endif() @@ -88,14 +88,15 @@ Orthanc/Resources/ThirdParty/base64/base64.cpp Orthanc/Resources/ThirdParty/md5/md5.c - OrthancCppClient/Instance.cpp - OrthancCppClient/OrthancConnection.cpp - OrthancCppClient/Patient.cpp - OrthancCppClient/Series.cpp - OrthancCppClient/SharedLibrary/SharedLibrary.cpp - OrthancCppClient/Study.cpp - OrthancCppClient/ArrayFilledByThreads.cpp - OrthancCppClient/ThreadedCommandProcessor.cpp + CppClient/Instance.cpp + CppClient/OrthancConnection.cpp + CppClient/Patient.cpp + CppClient/Series.cpp + CppClient/Study.cpp + CppClient/ArrayFilledByThreads.cpp + CppClient/ThreadedCommandProcessor.cpp + + SharedLibrary/SharedLibrary.cpp ${ORTHANC_CPP_CLIENT_AUX} ${THIRD_PARTY_SOURCES} @@ -114,7 +115,7 @@ ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") set_target_properties(OrthancClient - PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed -Wl,--version-script=${CMAKE_SOURCE_DIR}/OrthancCppClient/SharedLibrary/Laaw/VersionScript.map" + PROPERTIES LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed -Wl,--version-script=${CMAKE_SOURCE_DIR}/Resources/Laaw/VersionScript.map" ) target_link_libraries(OrthancClient pthread) @@ -138,7 +139,7 @@ # Set the version of the "Orthanc Client" shared library file(STRINGS - ${CMAKE_SOURCE_DIR}/OrthancCppClient/SharedLibrary/Product.json + ${CMAKE_SOURCE_DIR}/SharedLibrary/Product.json ORTHANC_CLIENT_VERSION_TMP REGEX "^[ \t]*\"Version\"[ \t]*") @@ -160,7 +161,7 @@ install( FILES - OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h + CppClient/SharedLibrary/AUTOGENERATED/CppClient.h DESTINATION include/orthanc ) diff -r 798076adf9e9 -r c584c25a74fd CppClient/ArrayFilledByThreads.cpp --- a/CppClient/ArrayFilledByThreads.cpp Tue Jun 02 10:11:34 2015 +0200 +++ b/CppClient/ArrayFilledByThreads.cpp Tue Jun 02 10:22:49 2015 +0200 @@ -35,9 +35,9 @@ #include "ThreadedCommandProcessor.h" #include "../Orthanc/Core/OrthancException.h" -namespace Orthanc +namespace OrthancClient { - class ArrayFilledByThreads::Command : public ICommand + class ArrayFilledByThreads::Command : public Orthanc::ICommand { private: ArrayFilledByThreads& that_; @@ -85,7 +85,7 @@ { array_.resize(filler_.GetFillerSize()); - Orthanc::ThreadedCommandProcessor processor(threadCount_); + ThreadedCommandProcessor processor(threadCount_); for (size_t i = 0; i < array_.size(); i++) { processor.Post(new Command(*this, i)); @@ -127,7 +127,7 @@ { if (t < 1) { - throw OrthancException(ErrorCode_ParameterOutOfRange); + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } threadCount_ = t; @@ -141,7 +141,7 @@ } - IDynamicObject& ArrayFilledByThreads::GetItem(size_t index) + Orthanc::IDynamicObject& ArrayFilledByThreads::GetItem(size_t index) { if (index >= GetSize()) { diff -r 798076adf9e9 -r c584c25a74fd CppClient/ArrayFilledByThreads.h --- a/CppClient/ArrayFilledByThreads.h Tue Jun 02 10:11:34 2015 +0200 +++ b/CppClient/ArrayFilledByThreads.h Tue Jun 02 10:22:49 2015 +0200 @@ -46,13 +46,13 @@ public: virtual size_t GetFillerSize() = 0; - virtual IDynamicObject* GetFillerItem(size_t index) = 0; + virtual Orthanc::IDynamicObject* GetFillerItem(size_t index) = 0; }; private: IFiller& filler_; boost::mutex mutex_; - std::vector array_; + std::vector array_; bool filled_; unsigned int threadCount_; @@ -80,7 +80,7 @@ size_t GetSize(); - IDynamicObject& GetItem(size_t index); + Orthanc::IDynamicObject& GetItem(size_t index); }; } diff -r 798076adf9e9 -r c584c25a74fd CppClient/OrthancConnection.h --- a/CppClient/OrthancConnection.h Tue Jun 02 10:11:34 2015 +0200 +++ b/CppClient/OrthancConnection.h Tue Jun 02 10:22:49 2015 +0200 @@ -45,12 +45,12 @@ **/ class LAAW_API OrthancConnection : public boost::noncopyable, - private Orthanc::ArrayFilledByThreads::IFiller + private ArrayFilledByThreads::IFiller { private: Orthanc::HttpClient client_; std::string orthancUrl_; - Orthanc::ArrayFilledByThreads patients_; + ArrayFilledByThreads patients_; Json::Value content_; void ReadPatients(); diff -r 798076adf9e9 -r c584c25a74fd CppClient/Patient.h --- a/CppClient/Patient.h Tue Jun 02 10:11:34 2015 +0200 +++ b/CppClient/Patient.h Tue Jun 02 10:22:49 2015 +0200 @@ -43,13 +43,13 @@ **/ class LAAW_API Patient : public Orthanc::IDynamicObject, - private Orthanc::ArrayFilledByThreads::IFiller + private ArrayFilledByThreads::IFiller { private: const OrthancConnection& connection_; std::string id_; Json::Value patient_; - Orthanc::ArrayFilledByThreads studies_; + ArrayFilledByThreads studies_; void ReadPatient(); diff -r 798076adf9e9 -r c584c25a74fd CppClient/PublicEnumerations.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CppClient/PublicEnumerations.h Tue Jun 02 10:22:49 2015 +0200 @@ -0,0 +1,106 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * In addition, as a special exception, the copyright holders of this + * program give permission to link the code of its release with the + * OpenSSL project's "OpenSSL" library (or with modified versions of it + * that use the same license as the "OpenSSL" library), and distribute + * the linked executables. You must obey the GNU General Public License + * in all respects for all of the code used other than "OpenSSL". If you + * modify file(s) with this exception, you may extend this exception to + * your version of the file(s), but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source files + * in the program, then also delete it here. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + **/ + + +#pragma once + +#include + +namespace Orthanc +{ + /** + * {summary}{The memory layout of the pixels (resp. voxels) of a 2D (resp. 3D) image.} + **/ + enum LAAW_API PixelFormat + { + /** + * {summary}{Color image in RGB24 format.} + * {description}{This format describes a color image. The pixels are stored in 3 + * consecutive bytes. The memory layout is RGB.} + **/ + PixelFormat_RGB24 = 1, + + /** + * {summary}{Color image in RGBA32 format.} + * {description}{This format describes a color image. The pixels are stored in 4 + * consecutive bytes. The memory layout is RGBA.} + **/ + PixelFormat_RGBA32 = 2, + + /** + * {summary}{Graylevel 8bpp image.} + * {description}{The image is graylevel. Each pixel is unsigned and stored in one byte.} + **/ + PixelFormat_Grayscale8 = 3, + + /** + * {summary}{Graylevel, unsigned 16bpp image.} + * {description}{The image is graylevel. Each pixel is unsigned and stored in two bytes.} + **/ + PixelFormat_Grayscale16 = 4, + + /** + * {summary}{Graylevel, signed 16bpp image.} + * {description}{The image is graylevel. Each pixel is signed and stored in two bytes.} + **/ + PixelFormat_SignedGrayscale16 = 5 + }; + + + /** + * {summary}{The extraction mode specifies the way the values of the pixels are scaled when downloading a 2D image.} + **/ + enum LAAW_API ImageExtractionMode + { + /** + * {summary}{Rescaled to 8bpp.} + * {description}{The minimum value of the image is set to 0, and its maximum value is set to 255.} + **/ + ImageExtractionMode_Preview = 1, + + /** + * {summary}{Truncation to the [0, 255] range.} + **/ + ImageExtractionMode_UInt8 = 2, + + /** + * {summary}{Truncation to the [0, 65535] range.} + **/ + ImageExtractionMode_UInt16 = 3, + + /** + * {summary}{Truncation to the [-32768, 32767] range.} + **/ + ImageExtractionMode_Int16 = 4 + }; + + +} diff -r 798076adf9e9 -r c584c25a74fd CppClient/Series.cpp --- a/CppClient/Series.cpp Tue Jun 02 10:11:34 2015 +0200 +++ b/CppClient/Series.cpp Tue Jun 02 10:22:49 2015 +0200 @@ -156,7 +156,7 @@ }; - class ProgressToFloatListener : public Orthanc::ThreadedCommandProcessor::IListener + class ProgressToFloatListener : public ThreadedCommandProcessor::IListener { private: float* target_; @@ -387,7 +387,7 @@ Orthanc::PixelFormat format, size_t lineStride, size_t stackStride, - Orthanc::ThreadedCommandProcessor::IListener* listener) + ThreadedCommandProcessor::IListener* listener) { using namespace Orthanc; diff -r 798076adf9e9 -r c584c25a74fd CppClient/Series.h --- a/CppClient/Series.h Tue Jun 02 10:11:34 2015 +0200 +++ b/CppClient/Series.h Tue Jun 02 10:22:49 2015 +0200 @@ -46,7 +46,7 @@ **/ class LAAW_API Series : public Orthanc::IDynamicObject, - private Orthanc::ArrayFilledByThreads::IFiller + private ArrayFilledByThreads::IFiller { private: enum Status3DImage @@ -59,7 +59,7 @@ const OrthancConnection& connection_; std::string id_, url_; Json::Value series_; - Orthanc::ArrayFilledByThreads instances_; + ArrayFilledByThreads instances_; Status3DImage status_; float voxelSizeX_; @@ -84,7 +84,7 @@ Orthanc::PixelFormat format, size_t lineStride, size_t stackStride, - Orthanc::ThreadedCommandProcessor::IListener* listener); + ThreadedCommandProcessor::IListener* listener); public: /** @@ -198,7 +198,7 @@ Orthanc::PixelFormat format, int64_t lineStride, int64_t stackStride, - Orthanc::ThreadedCommandProcessor::IListener& listener) + ThreadedCommandProcessor::IListener& listener) { Load3DImageInternal(target, format, static_cast(lineStride), static_cast(stackStride), &listener); diff -r 798076adf9e9 -r c584c25a74fd CppClient/Study.h --- a/CppClient/Study.h Tue Jun 02 10:11:34 2015 +0200 +++ b/CppClient/Study.h Tue Jun 02 10:22:49 2015 +0200 @@ -43,13 +43,13 @@ **/ class LAAW_API Study : public Orthanc::IDynamicObject, - private Orthanc::ArrayFilledByThreads::IFiller + private ArrayFilledByThreads::IFiller { private: const OrthancConnection& connection_; std::string id_; Json::Value study_; - Orthanc::ArrayFilledByThreads series_; + ArrayFilledByThreads series_; void ReadStudy(); diff -r 798076adf9e9 -r c584c25a74fd CppClient/ThreadedCommandProcessor.cpp --- a/CppClient/ThreadedCommandProcessor.cpp Tue Jun 02 10:11:34 2015 +0200 +++ b/CppClient/ThreadedCommandProcessor.cpp Tue Jun 02 10:22:49 2015 +0200 @@ -34,7 +34,7 @@ #include "../Orthanc/Core/OrthancException.h" -namespace Orthanc +namespace OrthancClient { static const int32_t TIMEOUT = 10; @@ -43,7 +43,7 @@ { while (!that->done_) { - std::auto_ptr command(that->queue_.Dequeue(TIMEOUT)); + std::auto_ptr command(that->queue_.Dequeue(TIMEOUT)); if (command.get() != NULL) { @@ -63,7 +63,7 @@ } else { - success = dynamic_cast(*command).Execute(); + success = dynamic_cast(*command).Execute(); } } else @@ -71,7 +71,7 @@ // A command has already failed. Skip the execution of this command. } } - catch (OrthancException) + catch (Orthanc::OrthancException&) { } @@ -117,7 +117,7 @@ { if (numThreads < 1) { - throw OrthancException(ErrorCode_ParameterOutOfRange); + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } listener_ = NULL; @@ -156,11 +156,11 @@ } - void ThreadedCommandProcessor::Post(ICommand* command) + void ThreadedCommandProcessor::Post(Orthanc::ICommand* command) { if (command == NULL) { - throw OrthancException(ErrorCode_ParameterOutOfRange); + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } boost::mutex::scoped_lock lock(mutex_); diff -r 798076adf9e9 -r c584c25a74fd CppClient/ThreadedCommandProcessor.h --- a/CppClient/ThreadedCommandProcessor.h Tue Jun 02 10:11:34 2015 +0200 +++ b/CppClient/ThreadedCommandProcessor.h Tue Jun 02 10:22:49 2015 +0200 @@ -59,7 +59,7 @@ }; private: - SharedMessageQueue queue_; + Orthanc::SharedMessageQueue queue_; bool done_; bool cancel_; std::vector threads_; @@ -78,7 +78,7 @@ ~ThreadedCommandProcessor(); // This takes the ownership of the command - void Post(ICommand* command); + void Post(Orthanc::ICommand* command); bool Join(); diff -r 798076adf9e9 -r c584c25a74fd Graveyard/Enumerations.h --- a/Graveyard/Enumerations.h Tue Jun 02 10:11:34 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/** - * Orthanc - A Lightweight, RESTful DICOM Store - * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * In addition, as a special exception, the copyright holders of this - * program give permission to link the code of its release with the - * OpenSSL project's "OpenSSL" library (or with modified versions of it - * that use the same license as the "OpenSSL" library), and distribute - * the linked executables. You must obey the GNU General Public License - * in all respects for all of the code used other than "OpenSSL". If you - * modify file(s) with this exception, you may extend this exception to - * your version of the file(s), but you are not obligated to do so. If - * you do not wish to do so, delete this exception statement from your - * version. If you delete this exception statement from all source files - * in the program, then also delete it here. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - **/ - - -#pragma once - -#include - -namespace Orthanc -{ - /** - * {summary}{The memory layout of the pixels (resp. voxels) of a 2D (resp. 3D) image.} - **/ - enum LAAW_API PixelFormat - { - /** - * {summary}{Color image in RGB24 format.} - * {description}{This format describes a color image. The pixels are stored in 3 - * consecutive bytes. The memory layout is RGB.} - **/ - PixelFormat_RGB24 = 1, - - /** - * {summary}{Color image in RGBA32 format.} - * {description}{This format describes a color image. The pixels are stored in 4 - * consecutive bytes. The memory layout is RGBA.} - **/ - PixelFormat_RGBA32 = 2, - - /** - * {summary}{Graylevel 8bpp image.} - * {description}{The image is graylevel. Each pixel is unsigned and stored in one byte.} - **/ - PixelFormat_Grayscale8 = 3, - - /** - * {summary}{Graylevel, unsigned 16bpp image.} - * {description}{The image is graylevel. Each pixel is unsigned and stored in two bytes.} - **/ - PixelFormat_Grayscale16 = 4, - - /** - * {summary}{Graylevel, signed 16bpp image.} - * {description}{The image is graylevel. Each pixel is signed and stored in two bytes.} - **/ - PixelFormat_SignedGrayscale16 = 5 - }; - - - /** - * {summary}{The extraction mode specifies the way the values of the pixels are scaled when downloading a 2D image.} - **/ - enum LAAW_API ImageExtractionMode - { - /** - * {summary}{Rescaled to 8bpp.} - * {description}{The minimum value of the image is set to 0, and its maximum value is set to 255.} - **/ - ImageExtractionMode_Preview = 1, - - /** - * {summary}{Truncation to the [0, 255] range.} - **/ - ImageExtractionMode_UInt8 = 2, - - /** - * {summary}{Truncation to the [0, 65535] range.} - **/ - ImageExtractionMode_UInt16 = 3, - - /** - * {summary}{Truncation to the [-32768, 32767] range.} - **/ - ImageExtractionMode_Int16 = 4 - }; - - -} diff -r 798076adf9e9 -r c584c25a74fd SharedLibrary/SharedLibrary.cpp --- a/SharedLibrary/SharedLibrary.cpp Tue Jun 02 10:11:34 2015 +0200 +++ b/SharedLibrary/SharedLibrary.cpp Tue Jun 02 10:22:49 2015 +0200 @@ -31,8 +31,8 @@ -#include "../../Orthanc/Core/HttpClient.h" -#include "../OrthancConnection.h" +#include "../Orthanc/Core/HttpClient.h" +#include "../CppClient/OrthancConnection.h" class SharedLibrarySingleton