Mercurial > hg > orthanc
changeset 387:ff647eedfbe1
enabling of Find/Move commands
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 22 Apr 2013 15:59:33 +0200 |
parents | dfbd3989a3f9 |
children | 9aa8ecbeeeb9 |
files | OrthancServer/main.cpp Resources/Configuration.json |
diffstat | 2 files changed, 69 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/main.cpp Fri Apr 19 09:46:14 2013 +0200 +++ b/OrthancServer/main.cpp Mon Apr 22 15:59:33 2013 +0200 @@ -39,6 +39,7 @@ #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h" #include "../Core/HttpServer/FilesystemHttpHandler.h" #include "../Core/HttpServer/MongooseServer.h" +#include "../Core/DicomFormat/DicomArray.h" #include "DicomProtocol/DicomServer.h" #include "OrthancInitialization.h" #include "ServerContext.h" @@ -47,13 +48,13 @@ -class MyDicomStore : public IStoreRequestHandler +class MyStoreRequestHandler : public IStoreRequestHandler { private: ServerContext& context_; public: - MyDicomStore(ServerContext& context) : + MyStoreRequestHandler(ServerContext& context) : context_(context) { } @@ -71,24 +72,78 @@ }; -class MyDicomStoreFactory : public IStoreRequestHandlerFactory +class MyFindRequestHandler : public IFindRequestHandler +{ +private: + ServerContext& context_; + +public: + MyFindRequestHandler(ServerContext& context) : + context_(context) + { + } + + virtual void Handle(const DicomMap& input, + DicomFindAnswers& answers) + { + printf("FindRequest\n"); + DicomArray a(input); + a.Print(stdout); + } +}; + + +class MyMoveRequestHandler : public IMoveRequestHandler { private: ServerContext& context_; public: - MyDicomStoreFactory(ServerContext& context) : context_(context) + MyMoveRequestHandler(ServerContext& context) : + context_(context) + { + } + +public: + virtual IMoveRequestIterator* Handle(const std::string& target, + const DicomMap& input) + { + printf("MoveRequest\n"); + return NULL; + } +}; + + +class MyDicomServerFactory : + public IStoreRequestHandlerFactory, + public IFindRequestHandlerFactory, + public IMoveRequestHandlerFactory +{ +private: + ServerContext& context_; + +public: + MyDicomServerFactory(ServerContext& context) : context_(context) { } virtual IStoreRequestHandler* ConstructStoreRequestHandler() { - return new MyDicomStore(context_); + return new MyStoreRequestHandler(context_); + } + + virtual IFindRequestHandler* ConstructFindRequestHandler() + { + return new MyFindRequestHandler(context_); + } + + virtual IMoveRequestHandler* ConstructMoveRequestHandler() + { + return new MyMoveRequestHandler(context_); } void Done() { - //index_.db().Execute("DELETE FROM Studies"); } }; @@ -237,13 +292,16 @@ context.GetIndex().SetMaximumStorageSize(0); } - MyDicomStoreFactory storeScp(context); + MyDicomServerFactory serverFactory(context); + { // DICOM server DicomServer dicomServer; dicomServer.SetCalledApplicationEntityTitleCheck(GetGlobalBoolParameter("DicomCheckCalledAet", false)); - dicomServer.SetStoreRequestHandlerFactory(storeScp); + dicomServer.SetStoreRequestHandlerFactory(serverFactory); + dicomServer.SetMoveRequestHandlerFactory(serverFactory); + dicomServer.SetFindRequestHandlerFactory(serverFactory); dicomServer.SetPortNumber(GetGlobalIntegerParameter("DicomPort", 4242)); dicomServer.SetApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "ORTHANC")); @@ -288,7 +346,7 @@ LOG(WARNING) << "Orthanc is stopping"; } - storeScp.Done(); + serverFactory.Done(); } catch (OrthancException& e) {
--- a/Resources/Configuration.json Fri Apr 19 09:46:14 2013 +0200 +++ b/Resources/Configuration.json Mon Apr 22 15:59:33 2013 +0200 @@ -54,7 +54,7 @@ /** - * Security-related options + * Security-related options for the HTTP server **/ // Whether remote hosts can connect to the HTTP server @@ -63,7 +63,7 @@ // Whether or not SSL is enabled "SslEnabled" : false, - // Path to the SSL certificate + // Path to the SSL certificate (meaningful only if SSL is enabled) "SslCertificate" : "certificate.pem", // Whether or not the password protection is enabled