Mercurial > hg > orthanc
comparison PalanthirServer/main.cpp @ 50:a15e90e5d6fc
rename in code
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 05 Sep 2012 15:50:12 +0200 |
parents | 33d67e1ab173 |
children | 601ee9b7f2c7 |
comparison
equal
deleted
inserted
replaced
49:e1a3ae0dadf3 | 50:a15e90e5d6fc |
---|---|
1 /** | 1 /** |
2 * Palantir - A Lightweight, RESTful DICOM Store | 2 * Palanthir - 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 "PalantirRestApi.h" | 21 #include "PalanthirRestApi.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 "PalantirInitialization.h" | 29 #include "PalanthirInitialization.h" |
30 | 30 |
31 | 31 |
32 using namespace Palantir; | 32 using namespace Palanthir; |
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 PalantirInitialize(argv[1]); | 102 PalanthirInitialize(argv[1]); |
103 } | 103 } |
104 else | 104 else |
105 { | 105 { |
106 PalantirInitialize(); | 106 PalanthirInitialize(); |
107 } | 107 } |
108 | 108 |
109 std::string storageDirectory = GetGlobalStringParameter("StorageDirectory", "PalantirStorage"); | 109 std::string storageDirectory = GetGlobalStringParameter("StorageDirectory", "PalanthirStorage"); |
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(true); | 116 dicomServer.SetCalledApplicationEntityTitleCheck(true); |
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", "PALANTIR")); | 119 dicomServer.SetApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "PALANTHIR")); |
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 PALANTIR_STANDALONE == 1 | 140 #if PALANTHIR_STANDALONE == 1 |
141 httpServer.RegisterHandler(new EmbeddedResourceHttpHandler("/app", EmbeddedResources::PALANTIR_EXPLORER)); | 141 httpServer.RegisterHandler(new EmbeddedResourceHttpHandler("/app", EmbeddedResources::PALANTHIR_EXPLORER)); |
142 #else | 142 #else |
143 httpServer.RegisterHandler(new FilesystemHttpHandler("/app", PALANTIR_PATH "/PalantirExplorer")); | 143 httpServer.RegisterHandler(new FilesystemHttpHandler("/app", PALANTHIR_PATH "/PalanthirExplorer")); |
144 #endif | 144 #endif |
145 | 145 |
146 httpServer.RegisterHandler(new PalantirRestApi(index, storageDirectory)); | 146 httpServer.RegisterHandler(new PalanthirRestApi(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 (PalantirException& e) | 161 catch (PalanthirException& e) |
162 { | 162 { |
163 std::cout << "EXCEPT [" << e.What() << "]" << std::endl; | 163 std::cout << "EXCEPT [" << e.What() << "]" << std::endl; |
164 } | 164 } |
165 | 165 |
166 PalantirFinalize(); | 166 PalanthirFinalize(); |
167 | 167 |
168 return 0; | 168 return 0; |
169 } | 169 } |