Mercurial > hg > orthanc
comparison OrthancServer/main.cpp @ 392:7035f4a5b07b lua-scripting
installing lua scripts
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 Apr 2013 15:41:07 +0200 |
parents | 466c992a9a42 |
children | 9784f19f7e1b |
comparison
equal
deleted
inserted
replaced
390:3be5837ceb80 | 392:7035f4a5b07b |
---|---|
54 | 54 |
55 public: | 55 public: |
56 MyDicomStore(ServerContext& context) : | 56 MyDicomStore(ServerContext& context) : |
57 server_(context) | 57 server_(context) |
58 { | 58 { |
59 LuaContext& lua = server_.GetLuaContext(); | |
60 lua.Execute(Orthanc::EmbeddedResources::LUA_TOOLBOX); | |
61 lua.Execute("function NewInstanceFilter(dicom, aet) print(dicom['0010,0020'].Value); return true end"); | |
62 } | 59 } |
63 | 60 |
64 virtual void Handle(const std::string& dicomFile, | 61 virtual void Handle(const std::string& dicomFile, |
65 const DicomMap& dicomSummary, | 62 const DicomMap& dicomSummary, |
66 const Json::Value& dicomJson, | 63 const Json::Value& dicomJson, |
232 LOG(WARNING) << "Storage directory: " << storageDirectory; | 229 LOG(WARNING) << "Storage directory: " << storageDirectory; |
233 LOG(WARNING) << "Index directory: " << indexDirectory; | 230 LOG(WARNING) << "Index directory: " << indexDirectory; |
234 | 231 |
235 context.SetCompressionEnabled(GetGlobalBoolParameter("StorageCompression", false)); | 232 context.SetCompressionEnabled(GetGlobalBoolParameter("StorageCompression", false)); |
236 | 233 |
234 { | |
235 std::string path = GetGlobalStringParameter("Scripting", ""); | |
236 if (path.size() > 0) | |
237 { | |
238 LOG(WARNING) << "Installing the Lua scripts from: " << path; | |
239 std::string lua; | |
240 Toolbox::ReadFile(lua, path); | |
241 context.GetLuaContext().Execute(Orthanc::EmbeddedResources::LUA_TOOLBOX); | |
242 context.GetLuaContext().Execute(lua); | |
243 } | |
244 } | |
245 | |
246 | |
237 try | 247 try |
238 { | 248 { |
239 context.GetIndex().SetMaximumPatientCount(GetGlobalIntegerParameter("MaximumPatientCount", 0)); | 249 context.GetIndex().SetMaximumPatientCount(GetGlobalIntegerParameter("MaximumPatientCount", 0)); |
240 } | 250 } |
241 catch (...) | 251 catch (...) |