comparison OrthancServer/ServerJobs/SplitStudyJob.cpp @ 2955:bbfd95a0c429

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 03 Dec 2018 14:59:23 +0100
parents 8b00e4cb4a6b
children 4e43e67f8ecf
comparison
equal deleted inserted replaced
2954:d924f9bb61cc 2955:bbfd95a0c429
41 { 41 {
42 void SplitStudyJob::CheckAllowedTag(const DicomTag& tag) const 42 void SplitStudyJob::CheckAllowedTag(const DicomTag& tag) const
43 { 43 {
44 if (allowedTags_.find(tag) == allowedTags_.end()) 44 if (allowedTags_.find(tag) == allowedTags_.end())
45 { 45 {
46 LOG(ERROR) << "Cannot modify the following tag while splitting a study " 46 throw OrthancException(ErrorCode_ParameterOutOfRange,
47 << "(not in the patient/study modules): " 47 "Cannot modify the following tag while splitting a study "
48 << FromDcmtkBridge::GetTagName(tag, "") << " (" << tag.Format() << ")"; 48 "(not in the patient/study modules): " +
49 throw OrthancException(ErrorCode_ParameterOutOfRange); 49 FromDcmtkBridge::GetTagName(tag, "") +
50 " (" + tag.Format() + ")");
50 } 51 }
51 } 52 }
52 53
53 54
54 void SplitStudyJob::Setup() 55 void SplitStudyJob::Setup()
171 ResourceType type; 172 ResourceType type;
172 173
173 if (!context_.GetIndex().LookupResourceType(type, sourceStudy) || 174 if (!context_.GetIndex().LookupResourceType(type, sourceStudy) ||
174 type != ResourceType_Study) 175 type != ResourceType_Study)
175 { 176 {
176 LOG(ERROR) << "Cannot split unknown study: " << sourceStudy; 177 throw OrthancException(ErrorCode_UnknownResource,
177 throw OrthancException(ErrorCode_UnknownResource); 178 "Cannot split unknown study " + sourceStudy);
178 } 179 }
179 } 180 }
180 181
181 182
182 void SplitStudyJob::SetOrigin(const DicomInstanceOrigin& origin) 183 void SplitStudyJob::SetOrigin(const DicomInstanceOrigin& origin)
207 throw OrthancException(ErrorCode_BadSequenceOfCalls); 208 throw OrthancException(ErrorCode_BadSequenceOfCalls);
208 } 209 }
209 else if (!context_.GetIndex().LookupParent(parent, series, ResourceType_Study) || 210 else if (!context_.GetIndex().LookupParent(parent, series, ResourceType_Study) ||
210 parent != sourceStudy_) 211 parent != sourceStudy_)
211 { 212 {
212 LOG(ERROR) << "This series does not belong to the study to be split: " << series; 213 throw OrthancException(ErrorCode_UnknownResource,
213 throw OrthancException(ErrorCode_UnknownResource); 214 "This series does not belong to the study to be split: " + series);
214 } 215 }
215 else 216 else
216 { 217 {
217 // Generate a target SeriesInstanceUID for this series 218 // Generate a target SeriesInstanceUID for this series
218 seriesUidMap_[series] = FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series); 219 seriesUidMap_[series] = FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series);