annotate OrthancServer/ServerJobs/SplitStudyJob.cpp @ 2844:99863d6245b2

New URI: "/studies/.../split" to split a study
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Sep 2018 16:48:43 +0200
parents
children 218e2c864d1d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2844
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "SplitStudyJob.h"
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include "../../Core/Logging.h"
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "../../Core/DicomParsing/FromDcmtkBridge.h"
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 namespace Orthanc
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 void SplitStudyJob::CheckAllowedTag(const DicomTag& tag) const
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 if (allowedTags_.find(tag) == allowedTags_.end())
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 LOG(ERROR) << "Cannot modify the following tag while splitting a study "
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 << "(not in the patient/study modules): "
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 << FromDcmtkBridge::GetTagName(tag, "") << " (" << tag.Format() << ")";
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 throw OrthancException(ErrorCode_ParameterOutOfRange);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 void SplitStudyJob::Setup(const std::string& sourceStudy)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 SetPermissive(false);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 keepSource_ = false;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 sourceStudy_ = sourceStudy;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 targetStudyUid_ = FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Study);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 DicomTag::AddTagsForModule(allowedTags_, DicomModule_Patient);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 DicomTag::AddTagsForModule(allowedTags_, DicomModule_Study);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 allowedTags_.erase(DICOM_TAG_STUDY_INSTANCE_UID);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 allowedTags_.erase(DICOM_TAG_SERIES_INSTANCE_UID);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 ResourceType type;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 if (!context_.GetIndex().LookupResourceType(type, sourceStudy) ||
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 type != ResourceType_Study)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 LOG(ERROR) << "Cannot split unknown study: " << sourceStudy;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 throw OrthancException(ErrorCode_UnknownResource);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 std::list<std::string> children;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 context_.GetIndex().GetChildren(children, sourceStudy);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 for (std::list<std::string>::const_iterator
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 it = children.begin(); it != children.end(); ++it)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 sourceSeries_.insert(*it);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 bool SplitStudyJob::HandleInstance(const std::string& instance)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 /**
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 * Retrieve the DICOM instance to be modified
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 **/
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 std::auto_ptr<ParsedDicomFile> modified;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 try
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 ServerContext::DicomCacheLocker locker(context_, instance);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 modified.reset(locker.GetDicom().Clone(true));
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 catch (OrthancException&)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 LOG(WARNING) << "An instance was removed after the job was issued: " << instance;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 return false;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 /**
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 * Chose the target UIDs
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 **/
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 std::string series;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 if (!modified->GetTagValue(series, DICOM_TAG_SERIES_INSTANCE_UID))
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 throw OrthancException(ErrorCode_BadFileFormat); // Should never happen
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 std::string targetSeriesUid;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 SeriesUidMap::const_iterator found = targetSeries_.find(series);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 if (found == targetSeries_.end())
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 // Choose a random SeriesInstanceUID for this series
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 targetSeriesUid = FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 targetSeries_[series] = targetSeriesUid;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 else
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 targetSeriesUid = found->second;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 /**
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 * Apply user-specified modifications
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 **/
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 for (Removals::const_iterator it = removals_.begin();
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 it != removals_.end(); ++it)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 modified->Remove(*it);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 for (Replacements::const_iterator it = replacements_.begin();
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 it != replacements_.end(); ++it)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 modified->ReplacePlainString(it->first, it->second);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 /**
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 * Store the new instance into Orthanc
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 **/
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 modified->ReplacePlainString(DICOM_TAG_STUDY_INSTANCE_UID, targetStudyUid_);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 modified->ReplacePlainString(DICOM_TAG_SERIES_INSTANCE_UID, targetSeriesUid);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 if (targetStudy_.empty())
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 targetStudy_ = modified->GetHasher().HashStudy();
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 DicomInstanceToStore toStore;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 toStore.SetOrigin(origin_);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 toStore.SetParsedDicomFile(*modified);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 std::string modifiedInstance;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 if (context_.Store(modifiedInstance, toStore) != StoreStatus_Success)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 LOG(ERROR) << "Error while storing a modified instance " << instance;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 return false;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 return true;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 bool SplitStudyJob::HandleTrailingStep()
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 if (!keepSource_)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 const size_t n = GetInstancesCount();
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 for (size_t i = 0; i < n; i++)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 Json::Value tmp;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 context_.DeleteResource(tmp, GetInstance(i), ResourceType_Instance);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 return true;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 SplitStudyJob::SplitStudyJob(ServerContext& context,
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 const std::string& sourceStudy) :
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 SetOfInstancesJob(true /* with trailing step */),
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 context_(context)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 Setup(sourceStudy);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 SplitStudyJob::SplitStudyJob(ServerContext& context,
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 const Json::Value& serialized) :
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 SetOfInstancesJob(serialized),
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 context_(context)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 //assert(HasTrailingStep());
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 //Setup();
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 void SplitStudyJob::SetOrigin(const DicomInstanceOrigin& origin)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 if (IsStarted())
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 throw OrthancException(ErrorCode_BadSequenceOfCalls);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 else
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 origin_ = origin;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 void SplitStudyJob::SetOrigin(const RestApiCall& call)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 SetOrigin(DicomInstanceOrigin::FromRest(call));
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 void SplitStudyJob::AddSourceSeries(const std::string& series)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 if (IsStarted())
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 throw OrthancException(ErrorCode_BadSequenceOfCalls);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 else if (sourceSeries_.find(series) == sourceSeries_.end())
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 LOG(ERROR) << "This series does not belong to the study to be split: " << series;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 throw OrthancException(ErrorCode_UnknownResource);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 else
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 // Add all the instances of the series as to be processed
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 std::list<std::string> instances;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 context_.GetIndex().GetChildren(instances, series);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 for (std::list<std::string>::const_iterator
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 it = instances.begin(); it != instances.end(); ++it)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 AddInstance(*it);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 void SplitStudyJob::SetKeepSource(bool keep)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 if (IsStarted())
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 throw OrthancException(ErrorCode_BadSequenceOfCalls);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 keepSource_ = keep;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 void SplitStudyJob::Remove(const DicomTag& tag)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 if (IsStarted())
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 throw OrthancException(ErrorCode_BadSequenceOfCalls);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 CheckAllowedTag(tag);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 removals_.insert(tag);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 void SplitStudyJob::Replace(const DicomTag& tag,
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 const std::string& value)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 if (IsStarted())
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 throw OrthancException(ErrorCode_BadSequenceOfCalls);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 CheckAllowedTag(tag);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 replacements_[tag] = value;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 void SplitStudyJob::GetPublicContent(Json::Value& value)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 SetOfInstancesJob::GetPublicContent(value);
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 if (!targetStudy_.empty())
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 value["TargetStudy"] = targetStudy_;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 value["TargetStudyUID"] = targetStudyUid_;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 bool SplitStudyJob::Serialize(Json::Value& target)
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 {
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 return true;
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 }
99863d6245b2 New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 }