# HG changeset patch # User Sebastien Jodogne # Date 1376998782 -7200 # Node ID 1b2cdc855bd3121a302fc34498f09e43b795da4e # Parent b2b56b4e33b0b05d11080ad5a01b31e7ebe0fa83 Parameter for PACS manufacturer, support for ClearCanvas diff -r b2b56b4e33b0 -r 1b2cdc855bd3 OrthancServer/DicomProtocol/DicomUserConnection.cpp --- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp Mon Aug 19 14:47:03 2013 +0200 +++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp Tue Aug 20 13:39:42 2013 +0200 @@ -294,7 +294,20 @@ break; case FindRootModel_Instance: - DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "INSTANCE"); + if (manufacturer_ == ModalityManufacturer_ClearCanvas) + { + // This is a particular case for ClearCanvas, thanks to Peter Somlo . + // https://groups.google.com/d/msg/orthanc-users/j-6C3MAVwiw/iolB9hclom8J + // http://www.clearcanvas.ca/Home/Community/OldForums/tabid/526/aff/11/aft/14670/afv/topic/Default.aspx + printf("CLEAR CANVAS\n"); + DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "IMAGE"); + } + else + { + printf("GENERIC\n"); + DU_putStringDOElement(dataset.get(), DcmTagKey(0x0008, 0x0052), "INSTANCE"); + } + sopClass = UID_FINDStudyRootQueryRetrieveInformationModel; // Accession number @@ -453,6 +466,7 @@ distantAet_ = "ANY-SCP"; distantPort_ = 104; distantHost_ = "127.0.0.1"; + manufacturer_ = ModalityManufacturer_Generic; pimpl_->net_ = NULL; pimpl_->params_ = NULL; @@ -476,6 +490,12 @@ distantAet_ = aet; } + void DicomUserConnection::SetDistantManufacturer(ModalityManufacturer manufacturer) + { + Close(); + manufacturer_ = manufacturer; + } + void DicomUserConnection::SetDistantHost(const std::string& host) { diff -r b2b56b4e33b0 -r 1b2cdc855bd3 OrthancServer/DicomProtocol/DicomUserConnection.h --- a/OrthancServer/DicomProtocol/DicomUserConnection.h Mon Aug 19 14:47:03 2013 +0200 +++ b/OrthancServer/DicomProtocol/DicomUserConnection.h Tue Aug 20 13:39:42 2013 +0200 @@ -33,6 +33,7 @@ #pragma once #include "DicomFindAnswers.h" +#include "../ServerEnumerations.h" #include #include @@ -59,6 +60,7 @@ std::string distantAet_; std::string distantHost_; uint16_t distantPort_; + ModalityManufacturer manufacturer_; void CheckIsOpen() const; @@ -106,6 +108,13 @@ return distantPort_; } + void SetDistantManufacturer(ModalityManufacturer manufacturer); + + ModalityManufacturer GetDistantManufacturer() const + { + return manufacturer_; + } + void Open(); void Close(); diff -r b2b56b4e33b0 -r 1b2cdc855bd3 OrthancServer/OrthancInitialization.cpp --- a/OrthancServer/OrthancInitialization.cpp Mon Aug 19 14:47:03 2013 +0200 +++ b/OrthancServer/OrthancInitialization.cpp Tue Aug 20 13:39:42 2013 +0200 @@ -230,7 +230,8 @@ void GetDicomModality(const std::string& name, std::string& aet, std::string& address, - int& port) + int& port, + ModalityManufacturer& manufacturer) { boost::mutex::scoped_lock lock(globalMutex_); @@ -241,7 +242,8 @@ const Json::Value& modalities = (*configuration_) ["DicomModalities"]; if (modalities.type() != Json::objectValue || - !modalities.isMember(name)) + !modalities.isMember(name) || + (modalities[name].size() != 3 && modalities[name].size() != 4)) { throw OrthancException(""); } @@ -251,6 +253,15 @@ aet = modalities[name].get(0u, "").asString(); address = modalities[name].get(1u, "").asString(); port = modalities[name].get(2u, "").asInt(); + + if (modalities[name].size() == 4) + { + manufacturer = StringToModalityManufacturer(modalities[name].get(3u, "").asString()); + } + else + { + manufacturer = ModalityManufacturer_Generic; + } } catch (...) { diff -r b2b56b4e33b0 -r 1b2cdc855bd3 OrthancServer/OrthancInitialization.h --- a/OrthancServer/OrthancInitialization.h Mon Aug 19 14:47:03 2013 +0200 +++ b/OrthancServer/OrthancInitialization.h Tue Aug 20 13:39:42 2013 +0200 @@ -37,6 +37,7 @@ #include #include #include "../Core/HttpServer/MongooseServer.h" +#include "ServerEnumerations.h" namespace Orthanc { @@ -56,7 +57,8 @@ void GetDicomModality(const std::string& name, std::string& aet, std::string& address, - int& port); + int& port, + ModalityManufacturer& manufacturer); void GetOrthancPeer(const std::string& name, std::string& url, diff -r b2b56b4e33b0 -r 1b2cdc855bd3 OrthancServer/OrthancRestApi.cpp --- a/OrthancServer/OrthancRestApi.cpp Mon Aug 19 14:47:03 2013 +0200 +++ b/OrthancServer/OrthancRestApi.cpp Tue Aug 20 13:39:42 2013 +0200 @@ -76,11 +76,13 @@ { std::string aet, address; int port; - GetDicomModality(name, aet, address, port); + ModalityManufacturer manufacturer; + GetDicomModality(name, aet, address, port, manufacturer); connection.SetLocalApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "ORTHANC")); connection.SetDistantApplicationEntityTitle(aet); connection.SetDistantHost(address); connection.SetDistantPort(port); + connection.SetDistantManufacturer(manufacturer); connection.Open(); } diff -r b2b56b4e33b0 -r 1b2cdc855bd3 OrthancServer/ServerEnumerations.cpp --- a/OrthancServer/ServerEnumerations.cpp Mon Aug 19 14:47:03 2013 +0200 +++ b/OrthancServer/ServerEnumerations.cpp Tue Aug 20 13:39:42 2013 +0200 @@ -256,4 +256,39 @@ throw OrthancException(ErrorCode_ParameterOutOfRange); } } + + + const char* EnumerationToString(ModalityManufacturer manufacturer) + { + switch (manufacturer) + { + case ModalityManufacturer_Generic: + return "Generic"; + + case ModalityManufacturer_ClearCanvas: + return "ClearCanvas"; + + default: + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } + + + ModalityManufacturer StringToModalityManufacturer(const std::string& manufacturer) + { + if (manufacturer == "Generic") + { + return ModalityManufacturer_Generic; + } + else if (manufacturer == "ClearCanvas") + { + return ModalityManufacturer_ClearCanvas; + } + else + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + } + + } diff -r b2b56b4e33b0 -r 1b2cdc855bd3 OrthancServer/ServerEnumerations.h --- a/OrthancServer/ServerEnumerations.h Mon Aug 19 14:47:03 2013 +0200 +++ b/OrthancServer/ServerEnumerations.h Tue Aug 20 13:39:42 2013 +0200 @@ -51,6 +51,12 @@ StoreStatus_FilteredOut // Removed by NewInstanceFilter }; + enum ModalityManufacturer + { + ModalityManufacturer_Generic, + ModalityManufacturer_ClearCanvas + }; + /** * WARNING: Do not change the explicit values in the enumerations @@ -126,6 +132,10 @@ const char* EnumerationToString(ChangeType type); + const char* EnumerationToString(ModalityManufacturer manufacturer); + + ModalityManufacturer StringToModalityManufacturer(const std::string& manufacturer); + ResourceType GetParentResourceType(ResourceType type); ResourceType GetChildResourceType(ResourceType type); diff -r b2b56b4e33b0 -r 1b2cdc855bd3 Resources/Configuration.json --- a/Resources/Configuration.json Mon Aug 19 14:47:03 2013 +0200 +++ b/Resources/Configuration.json Tue Aug 20 13:39:42 2013 +0200 @@ -96,6 +96,14 @@ * command line "storescp 2000". **/ // "sample" : [ "STORESCP", "localhost", 2000 ] + + /** + * A fourth parameter is available to enable patches for a + * specific PACS manufacturer. The allowed values are currently + * "Generic" (default value) and "ClearCanvas". This parameter is + * case-sensitive. + **/ + // "clearcanvas" : [ "CLEARCANVAS", "192.168.1.1", 104, "ClearCanvas" ] }, // The list of the known Orthanc peers diff -r b2b56b4e33b0 -r 1b2cdc855bd3 THANKS --- a/THANKS Mon Aug 19 14:47:03 2013 +0200 +++ b/THANKS Tue Aug 20 13:39:42 2013 +0200 @@ -16,6 +16,7 @@ * Will Ryder (will.ryder@sydney.edu.au), for improvements with the handling of series with temporal positions (fMRI and dynamic PET). * Ryan Walklin (ryanwalklin@gmail.com), for Mac OS X build. +* Peter Somlo (peter.somlo@gmail.com), for ClearCanvas support. Artwork