Mercurial > hg > orthanc
annotate OrthancServer/ServerJobs/MergeStudyJob.cpp @ 3868:d5be23fc0106 transcoding
better negotiation of transfer syntaxes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 28 Apr 2020 08:43:48 +0200 |
parents | 023b2a9f3aa1 |
children | 3661e2a72482 |
rev | line source |
---|---|
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3507
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU General Public License as |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * published by the Free Software Foundation, either version 3 of the |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * License, or (at your option) any later version. |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * In addition, as a special exception, the copyright holders of this |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * program give permission to link the code of its release with the |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * that use the same license as the "OpenSSL" library), and distribute |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * the linked executables. You must obey the GNU General Public License |
52b017d22a4f
New URI: "/studies/.../merge" to merge 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 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * modify file(s) with this exception, you may extend this exception to |
52b017d22a4f
New URI: "/studies/.../merge" to merge 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 |
52b017d22a4f
New URI: "/studies/.../merge" to merge 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 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * version. If you delete this exception statement from all source files |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * in the program, then also delete it here. |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * |
52b017d22a4f
New URI: "/studies/.../merge" to merge 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 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * WITHOUT ANY WARRANTY; without even the implied warranty of |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * General Public License for more details. |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * You should have received a copy of the GNU General Public License |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 **/ |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 #include "MergeStudyJob.h" |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #include "../../Core/DicomParsing/FromDcmtkBridge.h" |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 #include "../../Core/Logging.h" |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 #include "../../Core/SerializationToolbox.h" |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
39 #include "../ServerContext.h" |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 namespace Orthanc |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 void MergeStudyJob::AddSourceSeriesInternal(const std::string& series) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 // Generate a target SeriesInstanceUID for this series |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 seriesUidMap_[series] = FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 // Add all the instances of the series as to be processed |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 std::list<std::string> instances; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 context_.GetIndex().GetChildren(instances, series); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 for (std::list<std::string>::const_iterator |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 it = instances.begin(); it != instances.end(); ++it) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 AddInstance(*it); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 void MergeStudyJob::AddSourceStudyInternal(const std::string& study) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 if (study == targetStudy_) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 { |
2955 | 65 throw OrthancException(ErrorCode_UnknownResource, |
66 "Cannot merge a study into the same study: " + study); | |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 else |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 std::list<std::string> series; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 context_.GetIndex().GetChildren(series, study); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 for (std::list<std::string>::const_iterator |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 it = series.begin(); it != series.end(); ++it) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 AddSourceSeriesInternal(*it); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 bool MergeStudyJob::HandleInstance(const std::string& instance) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 /** |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 * Retrieve the DICOM instance to be modified |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 **/ |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
88 std::unique_ptr<ParsedDicomFile> modified; |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 try |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 ServerContext::DicomCacheLocker locker(context_, instance); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 modified.reset(locker.GetDicom().Clone(true)); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 catch (OrthancException&) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 LOG(WARNING) << "An instance was removed after the job was issued: " << instance; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 return false; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 /** |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 * Chose the target UIDs |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 **/ |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 std::string series = modified->GetHasher().HashSeries(); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 SeriesUidMap::const_iterator targetSeriesUid = seriesUidMap_.find(series); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 if (targetSeriesUid == seriesUidMap_.end()) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 throw OrthancException(ErrorCode_BadFileFormat); // Should never happen |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 /** |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 * Copy the tags from the "Patient Module Attributes" and "General |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 * Study Module Attributes" modules of the target study |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 **/ |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 for (std::set<DicomTag>::const_iterator it = removals_.begin(); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 it != removals_.end(); ++it) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 modified->Remove(*it); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 for (Replacements::const_iterator it = replacements_.begin(); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 it != replacements_.end(); ++it) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 modified->ReplacePlainString(it->first, it->second); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 /** |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 * Store the new instance into Orthanc |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 **/ |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 modified->ReplacePlainString(DICOM_TAG_SERIES_INSTANCE_UID, targetSeriesUid->second); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 |
3507
69e49fc044f8
Fix generation of "SOP Instance UID" on split and merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
140 // Fix since Orthanc 1.5.8: Assign new "SOPInstanceUID", as the instance has been modified |
69e49fc044f8
Fix generation of "SOP Instance UID" on split and merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
141 modified->ReplacePlainString(DICOM_TAG_SOP_INSTANCE_UID, FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Instance)); |
69e49fc044f8
Fix generation of "SOP Instance UID" on split and merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
142 |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 DicomInstanceToStore toStore; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 toStore.SetOrigin(origin_); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 toStore.SetParsedDicomFile(*modified); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 std::string modifiedInstance; |
3814
023b2a9f3aa1
new enum: StoreInstanceMode
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
148 if (context_.Store(modifiedInstance, toStore, |
023b2a9f3aa1
new enum: StoreInstanceMode
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3712
diff
changeset
|
149 StoreInstanceMode_Default) != StoreStatus_Success) |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 LOG(ERROR) << "Error while storing a modified instance " << instance; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 return false; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 return true; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 bool MergeStudyJob::HandleTrailingStep() |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 if (!keepSource_) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 const size_t n = GetInstancesCount(); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 for (size_t i = 0; i < n; i++) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 Json::Value tmp; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 context_.DeleteResource(tmp, GetInstance(i), ResourceType_Instance); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 return true; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 MergeStudyJob::MergeStudyJob(ServerContext& context, |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 const std::string& targetStudy) : |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 context_(context), |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 keepSource_(false), |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 targetStudy_(targetStudy) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 /** |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 * Check the validity of the input ID |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 **/ |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 ResourceType type; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 if (!context_.GetIndex().LookupResourceType(type, targetStudy) || |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 type != ResourceType_Study) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
190 { |
2955 | 191 throw OrthancException(ErrorCode_UnknownResource, |
192 "Cannot merge into an unknown study: " + targetStudy); | |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 /** |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 * Detect the tags to be removed/replaced by parsing one child |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 * instance of the study |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 **/ |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 DicomTag::AddTagsForModule(removals_, DicomModule_Patient); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 DicomTag::AddTagsForModule(removals_, DicomModule_Study); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 std::list<std::string> instances; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 context_.GetIndex().GetChildInstances(instances, targetStudy); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 if (instances.empty()) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
209 throw OrthancException(ErrorCode_UnknownResource); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 DicomMap dicom; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 ServerContext::DicomCacheLocker locker(context_, instances.front()); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 locker.GetDicom().ExtractDicomSummary(dicom); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 const std::set<DicomTag> moduleTags = removals_; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 for (std::set<DicomTag>::const_iterator it = moduleTags.begin(); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 it != moduleTags.end(); ++it) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 const DicomValue* value = dicom.TestAndGetValue(*it); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 std::string str; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 if (value != NULL && |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 value->CopyToString(str, false)) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 removals_.erase(*it); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 replacements_.insert(std::make_pair(*it, str)); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 void MergeStudyJob::SetOrigin(const DicomInstanceOrigin& origin) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
237 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 if (IsStarted()) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
239 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 else |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 origin_ = origin; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
246 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 void MergeStudyJob::SetOrigin(const RestApiCall& call) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 SetOrigin(DicomInstanceOrigin::FromRest(call)); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 void MergeStudyJob::AddSource(const std::string& studyOrSeries) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 ResourceType level; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 if (IsStarted()) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
261 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 else if (!context_.GetIndex().LookupResourceType(level, studyOrSeries)) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 { |
2955 | 265 throw OrthancException(ErrorCode_UnknownResource, |
266 "Cannot find this resource: " + studyOrSeries); | |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
268 else |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 switch (level) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
271 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 case ResourceType_Study: |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 AddSourceStudyInternal(studyOrSeries); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 break; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 case ResourceType_Series: |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
277 AddSourceSeries(studyOrSeries); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
278 break; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 default: |
2955 | 281 throw OrthancException(ErrorCode_UnknownResource, |
282 "This resource is neither a study, nor a series: " + | |
283 studyOrSeries + " is a " + | |
284 std::string(EnumerationToString(level))); | |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
290 void MergeStudyJob::AddSourceSeries(const std::string& series) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 std::string parent; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 if (IsStarted()) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
296 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 else if (!context_.GetIndex().LookupParent(parent, series, ResourceType_Study)) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 { |
2955 | 300 throw OrthancException(ErrorCode_UnknownResource, |
301 "This resource is not a series: " + series); | |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 else if (parent == targetStudy_) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
304 { |
2955 | 305 throw OrthancException(ErrorCode_UnknownResource, |
306 "Cannot merge series " + series + | |
307 " into its parent study " + targetStudy_); | |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 else |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 AddSourceSeriesInternal(series); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 void MergeStudyJob::AddSourceStudy(const std::string& study) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 ResourceType actualLevel; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 if (IsStarted()) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 else if (!context_.GetIndex().LookupResourceType(actualLevel, study) || |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 actualLevel != ResourceType_Study) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 { |
2955 | 327 throw OrthancException(ErrorCode_UnknownResource, |
328 "This resource is not a study: " + study); | |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 else |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 AddSourceStudyInternal(study); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 void MergeStudyJob::SetKeepSource(bool keep) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 if (IsStarted()) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 keepSource_ = keep; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 void MergeStudyJob::GetPublicContent(Json::Value& value) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 SetOfInstancesJob::GetPublicContent(value); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 value["TargetStudy"] = targetStudy_; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 static const char* KEEP_SOURCE = "KeepSource"; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 static const char* TARGET_STUDY = "TargetStudy"; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 static const char* REPLACEMENTS = "Replacements"; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 static const char* REMOVALS = "Removals"; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 static const char* SERIES_UID_MAP = "SeriesUIDMap"; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 static const char* ORIGIN = "Origin"; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 MergeStudyJob::MergeStudyJob(ServerContext& context, |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 const Json::Value& serialized) : |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 SetOfInstancesJob(serialized), // (*) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 context_(context) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 if (!HasTrailingStep()) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 // Should have been set by (*) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 throw OrthancException(ErrorCode_InternalError); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 keepSource_ = SerializationToolbox::ReadBoolean(serialized, KEEP_SOURCE); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 targetStudy_ = SerializationToolbox::ReadString(serialized, TARGET_STUDY); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 SerializationToolbox::ReadMapOfTags(replacements_, serialized, REPLACEMENTS); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 SerializationToolbox::ReadSetOfTags(removals_, serialized, REMOVALS); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 SerializationToolbox::ReadMapOfStrings(seriesUidMap_, serialized, SERIES_UID_MAP); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
379 origin_ = DicomInstanceOrigin(serialized[ORIGIN]); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
383 bool MergeStudyJob::Serialize(Json::Value& target) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
384 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 if (!SetOfInstancesJob::Serialize(target)) |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 return false; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
389 else |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 { |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 target[KEEP_SOURCE] = keepSource_; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 target[TARGET_STUDY] = targetStudy_; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 SerializationToolbox::WriteMapOfTags(target, replacements_, REPLACEMENTS); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
394 SerializationToolbox::WriteSetOfTags(target, removals_, REMOVALS); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
395 SerializationToolbox::WriteMapOfStrings(target, seriesUidMap_, SERIES_UID_MAP); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 origin_.Serialize(target[ORIGIN]); |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
398 return true; |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
400 } |
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
401 } |