Mercurial > hg > orthanc
comparison OrthancServer/DicomProtocol/DicomFindAnswers.cpp @ 2059:8e67325eaa3f
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 30 Jun 2016 20:02:21 +0200 |
parents | f0acfa753973 |
children | 9329ba17a069 |
comparison
equal
deleted
inserted
replaced
2058:43cd2ab060c7 | 2059:8e67325eaa3f |
---|---|
48 { | 48 { |
49 private: | 49 private: |
50 ParsedDicomFile* dicom_; | 50 ParsedDicomFile* dicom_; |
51 DicomMap* map_; | 51 DicomMap* map_; |
52 | 52 |
53 void CleanupDicom() | 53 void CleanupDicom(bool isWorklist) |
54 { | 54 { |
55 if (dicom_ != NULL) | 55 if (isWorklist && |
56 { | 56 dicom_ != NULL) |
57 { | |
58 // These lines are necessary when serving worklists, otherwise | |
59 // Orthanc does not behave as "wlmscpfs" | |
57 dicom_->Remove(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID); | 60 dicom_->Remove(DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID); |
58 dicom_->Remove(DICOM_TAG_SOP_INSTANCE_UID); | 61 dicom_->Remove(DICOM_TAG_SOP_INSTANCE_UID); |
59 } | 62 } |
60 } | 63 } |
61 | 64 |
62 public: | 65 public: |
63 Answer(ParsedDicomFile& dicom) : | 66 Answer(bool isWorklist, |
67 ParsedDicomFile& dicom) : | |
64 dicom_(dicom.Clone()), | 68 dicom_(dicom.Clone()), |
65 map_(NULL) | 69 map_(NULL) |
66 { | 70 { |
67 CleanupDicom(); | 71 CleanupDicom(isWorklist); |
68 } | 72 } |
69 | 73 |
70 Answer(const void* dicom, | 74 Answer(bool isWorklist, |
75 const void* dicom, | |
71 size_t size) : | 76 size_t size) : |
72 dicom_(new ParsedDicomFile(dicom, size)), | 77 dicom_(new ParsedDicomFile(dicom, size)), |
73 map_(NULL) | 78 map_(NULL) |
74 { | 79 { |
75 CleanupDicom(); | 80 CleanupDicom(isWorklist); |
76 } | 81 } |
77 | 82 |
78 Answer(const DicomMap& map) : | 83 Answer(const DicomMap& map) : |
79 dicom_(NULL), | 84 dicom_(NULL), |
80 map_(map.Clone()) | 85 map_(map.Clone()) |
118 } | 123 } |
119 } | 124 } |
120 }; | 125 }; |
121 | 126 |
122 | 127 |
128 void DicomFindAnswers::SetWorklist(bool isWorklist) | |
129 { | |
130 if (answers_.empty()) | |
131 { | |
132 isWorklist_ = isWorklist; | |
133 } | |
134 else | |
135 { | |
136 // This set of answers is not empty anymore, cannot change its type | |
137 throw OrthancException(ErrorCode_BadSequenceOfCalls); | |
138 } | |
139 } | |
140 | |
141 | |
123 void DicomFindAnswers::Clear() | 142 void DicomFindAnswers::Clear() |
124 { | 143 { |
125 for (size_t i = 0; i < answers_.size(); i++) | 144 for (size_t i = 0; i < answers_.size(); i++) |
126 { | 145 { |
127 assert(answers_[i] != NULL); | 146 assert(answers_[i] != NULL); |
147 } | 166 } |
148 | 167 |
149 | 168 |
150 void DicomFindAnswers::Add(ParsedDicomFile& dicom) | 169 void DicomFindAnswers::Add(ParsedDicomFile& dicom) |
151 { | 170 { |
152 answers_.push_back(new Answer(dicom)); | 171 answers_.push_back(new Answer(isWorklist_, dicom)); |
153 } | 172 } |
154 | 173 |
155 | 174 |
156 void DicomFindAnswers::Add(const void* dicom, | 175 void DicomFindAnswers::Add(const void* dicom, |
157 size_t size) | 176 size_t size) |
158 { | 177 { |
159 answers_.push_back(new Answer(dicom, size)); | 178 answers_.push_back(new Answer(isWorklist_, dicom, size)); |
160 } | 179 } |
161 | 180 |
162 | 181 |
163 DicomFindAnswers::Answer& DicomFindAnswers::GetAnswerInternal(size_t index) const | 182 DicomFindAnswers::Answer& DicomFindAnswers::GetAnswerInternal(size_t index) const |
164 { | 183 { |