annotate OrthancServer/Sources/ServerJobs/MergeStudyJob.h @ 5485:48b8dae6dc77

upgrade to year 2024
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Jan 2024 15:10:42 +0100
parents 0ea402b4d901
children f7adfb22e20e
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
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
6 * Copyright (C) 2021-2024 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 #pragma once
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/DicomFormat/DicomMap.h"
3095
beeeb6096f27 removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
26 #include "../DicomInstanceOrigin.h"
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
27 #include "CleaningInstancesJob.h"
2853
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 namespace Orthanc
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
3095
beeeb6096f27 removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
31 class ServerContext;
beeeb6096f27 removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
32
3941
771dbd9eb3bd class CleaningInstancesJob to share cleaning code by merge/split jobs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
33 class MergeStudyJob : public CleaningInstancesJob
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 private:
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 typedef std::map<std::string, std::string> SeriesUidMap;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 typedef std::map<DicomTag, std::string> Replacements;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 std::string targetStudy_;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 Replacements replacements_;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 std::set<DicomTag> removals_;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 SeriesUidMap seriesUidMap_;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 DicomInstanceOrigin origin_;
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
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 void AddSourceSeriesInternal(const std::string& 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 void AddSourceStudyInternal(const std::string& study);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
4712
bad8935cd5f2 "/studies/{id}/split" accepts "Instances" parameter to split instances instead of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
51 // Make setter methods private to prevent incorrect calls
bad8935cd5f2 "/studies/{id}/split" accepts "Instances" parameter to split instances instead of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
52 using SetOfInstancesJob::AddParentResource;
bad8935cd5f2 "/studies/{id}/split" accepts "Instances" parameter to split instances instead of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
53 using SetOfInstancesJob::AddInstance;
bad8935cd5f2 "/studies/{id}/split" accepts "Instances" parameter to split instances instead of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
54
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 protected:
4205
d962a2996637 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
56 virtual bool HandleInstance(const std::string& instance) ORTHANC_OVERRIDE;
2853
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 public:
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 MergeStudyJob(ServerContext& context,
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 const std::string& targetStudy);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 MergeStudyJob(ServerContext& context,
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 const Json::Value& serialized);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 const std::string& GetTargetStudy() const
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 {
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 return targetStudy_;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4712
diff changeset
70 void AddSource(const std::string& publicId);
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 void AddSourceStudy(const std::string& study);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 void AddSourceSeries(const std::string& series);
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
4715
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4712
diff changeset
76 void AddSourceInstance(const std::string& instance); // New in Orthanc 1.9.4
fb98db281d1d "/studies/{id}/merge" accepts instances inside its "Resources" parameter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4712
diff changeset
77
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 void SetOrigin(const DicomInstanceOrigin& origin);
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 void SetOrigin(const RestApiCall& call);
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 const DicomInstanceOrigin& GetOrigin() const
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 return origin_;
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 }
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
4205
d962a2996637 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
87 virtual void Stop(JobStopReason reason) ORTHANC_OVERRIDE
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 {
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
4205
d962a2996637 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
91 virtual void GetJobType(std::string& target) ORTHANC_OVERRIDE
2853
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 target = "MergeStudy";
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
4205
d962a2996637 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
96 virtual void GetPublicContent(Json::Value& value) ORTHANC_OVERRIDE;
2853
52b017d22a4f New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
4205
d962a2996637 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
98 virtual bool Serialize(Json::Value& target) ORTHANC_OVERRIDE;
2853
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 }