annotate OrthancServer/Sources/ServerJobs/MergeStudyJob.cpp @ 5453:b750777c36a2

fix
author Alain Mazy <am@osimis.io>
date Wed, 06 Dec 2023 14:19:59 +0100
parents 0ea402b4d901
children 48b8dae6dc77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
5185
0ea402b4d901 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4892
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
0ea402b4d901 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4892
diff changeset
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * 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
9 * 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
10 * 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
11 * 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
12 *
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * 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
14 * 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
15 * 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
16 * General Public License for more details.
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * 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
19 * 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
20 **/
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #include "MergeStudyJob.h"
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
25 #include "../../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h"
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
26 #include "../../../OrthancFramework/Sources/Logging.h"
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
27 #include "../../../OrthancFramework/Sources/SerializationToolbox.h"
4140
0ddc5297a8ab centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4139
diff changeset
28 #include "../OrthancConfiguration.h"
3095
beeeb6096f27 removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
29 #include "../ServerContext.h"
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
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 namespace Orthanc
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
34 static void RegisterSeries(std::map<std::string, std::string>& target,
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
35 const std::string& series)
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
36 {
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
37 // Generate a target SeriesInstanceUID for this series
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
38 if (target.find(series) == target.end())
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
39 {
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
40 target[series] = FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series);
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
41 }
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
42 }
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
43
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
44
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 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
46 {
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
47 RegisterSeries(seriesUidMap_, series);
2853
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;
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
51 GetContext().GetIndex().GetChildren(instances, series);
2853
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
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
65 throw OrthancException(ErrorCode_UnknownResource,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
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;
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
71 GetContext().GetIndex().GetChildren(series, study);
2853
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 {
3940
3661e2a72482 safeguard in merge/split job
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3814
diff changeset
84 if (!HasTrailingStep())
3661e2a72482 safeguard in merge/split job
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3814
diff changeset
85 {
3661e2a72482 safeguard in merge/split job
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3814
diff changeset
86 throw OrthancException(ErrorCode_BadSequenceOfCalls,
3661e2a72482 safeguard in merge/split job
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3814
diff changeset
87 "AddTrailingStep() should have been called after AddSourceXXX()");
3661e2a72482 safeguard in merge/split job
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3814
diff changeset
88 }
3661e2a72482 safeguard in merge/split job
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3814
diff changeset
89
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 /**
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 * 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
92 **/
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
94 std::unique_ptr<ParsedDicomFile> modified;
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 try
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 {
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
98 ServerContext::DicomCacheLocker locker(GetContext(), instance);
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 modified.reset(locker.GetDicom().Clone(true));
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 catch (OrthancException&)
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 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
104 return false;
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
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 /**
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 * Chose the target UIDs
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 **/
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 std::string series = modified->GetHasher().HashSeries();
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 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
115
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 if (targetSeriesUid == seriesUidMap_.end())
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 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
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
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 /**
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 * 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
124 * 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
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 (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
128 it != removals_.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->Remove(*it);
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 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
134 it != replacements_.end(); ++it)
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 modified->ReplacePlainString(it->first, it->second);
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
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 /**
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 * Store the new instance into Orthanc
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 **/
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 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
145
3507
69e49fc044f8 Fix generation of "SOP Instance UID" on split and merge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3095
diff changeset
146 // 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
147 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
148
4508
8f9090b137f1 Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
149 std::unique_ptr<DicomInstanceToStore> toStore(DicomInstanceToStore::CreateFromParsedDicomFile(*modified));
8f9090b137f1 Optimization in C-STORE SCP by avoiding an unnecessary DICOM parsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
150 toStore->SetOrigin(origin_);
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 std::string modifiedInstance;
4796
94616af363ec added ReceivedCStoreInstanceFilter lua callback + OrthancPluginRegisterIncomingCStoreInstanceFilter in sdk
Alain Mazy <am@osimis.io>
parents: 4715
diff changeset
153 ServerContext::StoreResult result = GetContext().Store(modifiedInstance, *toStore, StoreInstanceMode_Default);
94616af363ec added ReceivedCStoreInstanceFilter lua callback + OrthancPluginRegisterIncomingCStoreInstanceFilter in sdk
Alain Mazy <am@osimis.io>
parents: 4715
diff changeset
154 if (result.GetStatus() != StoreStatus_Success)
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 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
157 return false;
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
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 return true;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 }
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
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 MergeStudyJob::MergeStudyJob(ServerContext& context,
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 const std::string& targetStudy) :
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
166 CleaningInstancesJob(context, false /* by default, remove source instances */),
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 targetStudy_(targetStudy)
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 {
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 * 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
171 **/
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 ResourceType type;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
175 if (!GetContext().GetIndex().LookupResourceType(type, targetStudy) ||
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 type != ResourceType_Study)
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 {
2955
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
178 throw OrthancException(ErrorCode_UnknownResource,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
179 "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
180 }
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 /**
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 * 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
185 * instance of the study
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 **/
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 DicomTag::AddTagsForModule(removals_, DicomModule_Patient);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 DicomTag::AddTagsForModule(removals_, DicomModule_Study);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 std::list<std::string> instances;
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
192 GetContext().GetIndex().GetChildInstances(instances, 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 if (instances.empty())
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 throw OrthancException(ErrorCode_UnknownResource);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 DicomMap dicom;
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 {
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
202 ServerContext::DicomCacheLocker locker(GetContext(), instances.front());
4140
0ddc5297a8ab centralization of default parameters for JSON/DicomMap conversions from DCMTK
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4139
diff changeset
203 OrthancConfiguration::DefaultExtractDicomSummary(dicom, locker.GetDicom());
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 const std::set<DicomTag> moduleTags = removals_;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 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
208 it != moduleTags.end(); ++it)
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 const DicomValue* value = dicom.TestAndGetValue(*it);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 std::string str;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 if (value != NULL &&
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 value->CopyToString(str, false))
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 removals_.erase(*it);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 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
218 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221
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 void MergeStudyJob::SetOrigin(const DicomInstanceOrigin& origin)
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 if (IsStarted())
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 throw OrthancException(ErrorCode_BadSequenceOfCalls);
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 else
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 origin_ = origin;
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 RestApiCall& call)
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 SetOrigin(DicomInstanceOrigin::FromRest(call));
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
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
242 void MergeStudyJob::AddSource(const std::string& publicId)
2853
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 ResourceType level;
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 if (IsStarted())
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 throw OrthancException(ErrorCode_BadSequenceOfCalls);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 }
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
250 else if (!GetContext().GetIndex().LookupResourceType(level, publicId))
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 {
2955
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
252 throw OrthancException(ErrorCode_UnknownResource,
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
253 "Cannot find this resource: " + publicId);
2853
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 else
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 switch (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 case ResourceType_Study:
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
260 AddSourceStudyInternal(publicId);
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 break;
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 case ResourceType_Series:
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
264 AddSourceSeries(publicId);
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
265 break;
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
266
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
267 case ResourceType_Instance:
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
268 AddSourceInstance(publicId);
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 break;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 default:
2955
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
272 throw OrthancException(ErrorCode_UnknownResource,
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
273 "This resource is neither a study, nor a series, nor an instance: " +
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
274 publicId + " is a " + std::string(EnumerationToString(level)));
2853
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 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278
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 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
281 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 std::string parent;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 if (IsStarted())
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 throw OrthancException(ErrorCode_BadSequenceOfCalls);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 }
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
288 else if (!GetContext().GetIndex().LookupParent(parent, series, ResourceType_Study))
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 {
2955
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
290 throw OrthancException(ErrorCode_UnknownResource,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
291 "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
292 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 else if (parent == targetStudy_)
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 {
2955
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
295 throw OrthancException(ErrorCode_UnknownResource,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
296 "Cannot merge series " + series +
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
297 " into its parent study " + targetStudy_);
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 else
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 AddSourceSeriesInternal(series);
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 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 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
307 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 ResourceType actualLevel;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 if (IsStarted())
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 throw OrthancException(ErrorCode_BadSequenceOfCalls);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 }
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
314 else if (!GetContext().GetIndex().LookupResourceType(actualLevel, study) ||
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 actualLevel != ResourceType_Study)
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 {
2955
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
317 throw OrthancException(ErrorCode_UnknownResource,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2860
diff changeset
318 "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
319 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 else
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 AddSourceStudyInternal(study);
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 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
327 void MergeStudyJob::AddSourceInstance(const std::string& instance)
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
328 {
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
329 std::string parentStudy, parentSeries;
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
330
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
331 if (IsStarted())
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
332 {
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
333 throw OrthancException(ErrorCode_BadSequenceOfCalls);
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
334 }
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
335 else if (!GetContext().GetIndex().LookupParent(parentSeries, instance, ResourceType_Series) ||
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
336 !GetContext().GetIndex().LookupParent(parentStudy, parentSeries, ResourceType_Study))
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
337 {
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
338 throw OrthancException(ErrorCode_UnknownResource,
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
339 "This resource is not an instance: " + instance);
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
340 }
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
341 else if (parentStudy == targetStudy_)
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
342 {
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
343 throw OrthancException(ErrorCode_UnknownResource,
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
344 "Cannot merge instance " + instance +
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
345 " into its parent study " + targetStudy_);
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
346 }
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
347 else
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
348 {
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
349 RegisterSeries(seriesUidMap_, parentSeries);
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
350 AddInstance(instance);
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
351 }
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
352 }
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
353
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4508
diff changeset
354
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 void MergeStudyJob::GetPublicContent(Json::Value& value)
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 {
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
357 CleaningInstancesJob::GetPublicContent(value);
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 value["TargetStudy"] = targetStudy_;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360
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 static const char* TARGET_STUDY = "TargetStudy";
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 static const char* REPLACEMENTS = "Replacements";
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 static const char* REMOVALS = "Removals";
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 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
366 static const char* ORIGIN = "Origin";
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
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 MergeStudyJob::MergeStudyJob(ServerContext& context,
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 const Json::Value& serialized) :
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
371 CleaningInstancesJob(context, serialized,
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
372 false /* by default, remove source instances */) // (*)
2853
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 if (!HasTrailingStep())
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 // Should have been set by (*)
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 throw OrthancException(ErrorCode_InternalError);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 targetStudy_ = SerializationToolbox::ReadString(serialized, TARGET_STUDY);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 SerializationToolbox::ReadMapOfTags(replacements_, serialized, REPLACEMENTS);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 SerializationToolbox::ReadSetOfTags(removals_, serialized, REMOVALS);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 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
384 origin_ = DicomInstanceOrigin(serialized[ORIGIN]);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 }
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
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 bool MergeStudyJob::Serialize(Json::Value& target)
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 {
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3940
diff changeset
390 if (!CleaningInstancesJob::Serialize(target))
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 return false;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 else
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 target[TARGET_STUDY] = targetStudy_;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 SerializationToolbox::WriteMapOfTags(target, replacements_, REPLACEMENTS);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 SerializationToolbox::WriteSetOfTags(target, removals_, REMOVALS);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 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
400 origin_.Serialize(target[ORIGIN]);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 return true;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 }