Mercurial > hg > orthanc
comparison OrthancServer/Scheduler/ModifyInstanceCommand.cpp @ 1698:d78b87f93bcf
DicomModification use Json::Value
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 09 Oct 2015 12:29:21 +0200 |
parents | 0a2ad4a6858f |
children | b1291df2f780 |
comparison
equal
deleted
inserted
replaced
1697:21902c8ba95b | 1698:d78b87f93bcf |
---|---|
37 | 37 |
38 namespace Orthanc | 38 namespace Orthanc |
39 { | 39 { |
40 ModifyInstanceCommand::ModifyInstanceCommand(ServerContext& context, | 40 ModifyInstanceCommand::ModifyInstanceCommand(ServerContext& context, |
41 RequestOrigin origin, | 41 RequestOrigin origin, |
42 const DicomModification& modification) : | 42 DicomModification* modification) : |
43 context_(context), | 43 context_(context), |
44 origin_(origin), | 44 origin_(origin), |
45 modification_(modification) | 45 modification_(modification) |
46 { | 46 { |
47 modification_.SetAllowManualIdentifiers(true); | 47 modification_->SetAllowManualIdentifiers(true); |
48 | 48 |
49 if (modification_.IsReplaced(DICOM_TAG_PATIENT_ID)) | 49 if (modification_->IsReplaced(DICOM_TAG_PATIENT_ID)) |
50 { | 50 { |
51 modification_.SetLevel(ResourceType_Patient); | 51 modification_->SetLevel(ResourceType_Patient); |
52 } | 52 } |
53 else if (modification_.IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) | 53 else if (modification_->IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) |
54 { | 54 { |
55 modification_.SetLevel(ResourceType_Study); | 55 modification_->SetLevel(ResourceType_Study); |
56 } | 56 } |
57 else if (modification_.IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) | 57 else if (modification_->IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) |
58 { | 58 { |
59 modification_.SetLevel(ResourceType_Series); | 59 modification_->SetLevel(ResourceType_Series); |
60 } | 60 } |
61 else | 61 else |
62 { | 62 { |
63 modification_.SetLevel(ResourceType_Instance); | 63 modification_->SetLevel(ResourceType_Instance); |
64 } | 64 } |
65 | 65 |
66 if (origin_ != RequestOrigin_Lua) | 66 if (origin_ != RequestOrigin_Lua) |
67 { | 67 { |
68 // TODO If issued from HTTP, "remoteIp" and "username" must be provided | 68 // TODO If issued from HTTP, "remoteIp" and "username" must be provided |
69 throw OrthancException(ErrorCode_NotImplemented); | 69 throw OrthancException(ErrorCode_NotImplemented); |
70 } | |
71 } | |
72 | |
73 | |
74 ModifyInstanceCommand::~ModifyInstanceCommand() | |
75 { | |
76 if (modification_) | |
77 { | |
78 delete modification_; | |
70 } | 79 } |
71 } | 80 } |
72 | 81 |
73 | 82 |
74 bool ModifyInstanceCommand::Apply(ListOfStrings& outputs, | 83 bool ModifyInstanceCommand::Apply(ListOfStrings& outputs, |
86 { | 95 { |
87 ServerContext::DicomCacheLocker lock(context_, *it); | 96 ServerContext::DicomCacheLocker lock(context_, *it); |
88 modified.reset(lock.GetDicom().Clone()); | 97 modified.reset(lock.GetDicom().Clone()); |
89 } | 98 } |
90 | 99 |
91 modification_.Apply(*modified); | 100 modification_->Apply(*modified); |
92 | 101 |
93 DicomInstanceToStore toStore; | 102 DicomInstanceToStore toStore; |
94 assert(origin_ == RequestOrigin_Lua); | 103 assert(origin_ == RequestOrigin_Lua); |
95 toStore.SetLuaOrigin(); | 104 toStore.SetLuaOrigin(); |
96 toStore.SetParsedDicomFile(*modified); | 105 toStore.SetParsedDicomFile(*modified); |