Mercurial > hg > orthanc
comparison OrthancServer/main.cpp @ 62:a70bb32802ae orthanc-renaming
renaming Server
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 16 Sep 2012 09:33:19 +0200 |
parents | 4bc019d2f969 |
children | 7593b57dc1bf |
comparison
equal
deleted
inserted
replaced
61:d1c511efd6b1 | 62:a70bb32802ae |
---|---|
1 /** | 1 /** |
2 * Palanthir - A Lightweight, RESTful DICOM Store | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege, | 3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege, |
4 * Belgium | 4 * Belgium |
5 * | 5 * |
6 * This program is free software: you can redistribute it and/or | 6 * This program is free software: you can redistribute it and/or |
7 * modify it under the terms of the GNU General Public License as | 7 * modify it under the terms of the GNU General Public License as |
16 * You should have received a copy of the GNU General Public License | 16 * You should have received a copy of the GNU General Public License |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 **/ | 18 **/ |
19 | 19 |
20 | 20 |
21 #include "PalanthirRestApi.h" | 21 #include "OrthancRestApi.h" |
22 | 22 |
23 #include <stdio.h> | 23 #include <stdio.h> |
24 | 24 |
25 #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h" | 25 #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h" |
26 #include "../Core/HttpServer/FilesystemHttpHandler.h" | 26 #include "../Core/HttpServer/FilesystemHttpHandler.h" |
27 #include "../Core/HttpServer/MongooseServer.h" | 27 #include "../Core/HttpServer/MongooseServer.h" |
28 #include "DicomProtocol/DicomServer.h" | 28 #include "DicomProtocol/DicomServer.h" |
29 #include "PalanthirInitialization.h" | 29 #include "OrthancInitialization.h" |
30 | 30 |
31 | 31 |
32 using namespace Palanthir; | 32 using namespace Orthanc; |
33 | 33 |
34 | 34 |
35 class MyDicomStore : public IStoreRequestHandler | 35 class MyDicomStore : public IStoreRequestHandler |
36 { | 36 { |
37 private: | 37 private: |
97 { | 97 { |
98 try | 98 try |
99 { | 99 { |
100 if (argc >= 2) | 100 if (argc >= 2) |
101 { | 101 { |
102 PalanthirInitialize(argv[1]); | 102 OrthancInitialize(argv[1]); |
103 } | 103 } |
104 else | 104 else |
105 { | 105 { |
106 PalanthirInitialize(); | 106 OrthancInitialize(); |
107 } | 107 } |
108 | 108 |
109 std::string storageDirectory = GetGlobalStringParameter("StorageDirectory", "PalanthirStorage"); | 109 std::string storageDirectory = GetGlobalStringParameter("StorageDirectory", "OrthancStorage"); |
110 ServerIndex index(storageDirectory); | 110 ServerIndex index(storageDirectory); |
111 MyDicomStoreFactory storeScp(index, storageDirectory); | 111 MyDicomStoreFactory storeScp(index, storageDirectory); |
112 | 112 |
113 { | 113 { |
114 // DICOM server | 114 // DICOM server |
115 DicomServer dicomServer; | 115 DicomServer dicomServer; |
116 dicomServer.SetCalledApplicationEntityTitleCheck(GetGlobalBoolParameter("DicomCheckCalledAet", false)); | 116 dicomServer.SetCalledApplicationEntityTitleCheck(GetGlobalBoolParameter("DicomCheckCalledAet", false)); |
117 dicomServer.SetStoreRequestHandlerFactory(storeScp); | 117 dicomServer.SetStoreRequestHandlerFactory(storeScp); |
118 dicomServer.SetPortNumber(GetGlobalIntegerParameter("DicomPort", 4242)); | 118 dicomServer.SetPortNumber(GetGlobalIntegerParameter("DicomPort", 4242)); |
119 dicomServer.SetApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "PALANTHIR")); | 119 dicomServer.SetApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "ORTHANC")); |
120 | 120 |
121 // HTTP server | 121 // HTTP server |
122 MongooseServer httpServer; | 122 MongooseServer httpServer; |
123 httpServer.SetPort(GetGlobalIntegerParameter("HttpPort", 8000)); | 123 httpServer.SetPort(GetGlobalIntegerParameter("HttpPort", 8000)); |
124 httpServer.SetRemoteAccessAllowed(GetGlobalBoolParameter("RemoteAccessAllowed", false)); | 124 httpServer.SetRemoteAccessAllowed(GetGlobalBoolParameter("RemoteAccessAllowed", false)); |
135 else | 135 else |
136 { | 136 { |
137 httpServer.SetSslEnabled(false); | 137 httpServer.SetSslEnabled(false); |
138 } | 138 } |
139 | 139 |
140 #if PALANTHIR_STANDALONE == 1 | 140 #if ORTHANC_STANDALONE == 1 |
141 httpServer.RegisterHandler(new EmbeddedResourceHttpHandler("/app", EmbeddedResources::PALANTHIR_EXPLORER)); | 141 httpServer.RegisterHandler(new EmbeddedResourceHttpHandler("/app", EmbeddedResources::ORTHANC_EXPLORER)); |
142 #else | 142 #else |
143 httpServer.RegisterHandler(new FilesystemHttpHandler("/app", PALANTHIR_PATH "/PalanthirExplorer")); | 143 httpServer.RegisterHandler(new FilesystemHttpHandler("/app", ORTHANC_PATH "/OrthancExplorer")); |
144 #endif | 144 #endif |
145 | 145 |
146 httpServer.RegisterHandler(new PalanthirRestApi(index, storageDirectory)); | 146 httpServer.RegisterHandler(new OrthancRestApi(index, storageDirectory)); |
147 | 147 |
148 // GO !!! | 148 // GO !!! |
149 httpServer.Start(); | 149 httpServer.Start(); |
150 dicomServer.Start(); | 150 dicomServer.Start(); |
151 | 151 |
156 printf("Finishing\n"); | 156 printf("Finishing\n"); |
157 } | 157 } |
158 | 158 |
159 storeScp.Done(); | 159 storeScp.Done(); |
160 } | 160 } |
161 catch (PalanthirException& e) | 161 catch (OrthancException& e) |
162 { | 162 { |
163 std::cout << "EXCEPT [" << e.What() << "]" << std::endl; | 163 std::cout << "EXCEPT [" << e.What() << "]" << std::endl; |
164 } | 164 } |
165 | 165 |
166 PalanthirFinalize(); | 166 OrthancFinalize(); |
167 | 167 |
168 return 0; | 168 return 0; |
169 } | 169 } |