annotate OrthancServer/Sources/ServerToolbox.h @ 5137:15109c3f0f7d

added sanity checks in DicomModificationJob + automatically reconstruct resources at the end of a DicomModificationJob
author Alain Mazy <am@osimis.io>
date Wed, 18 Jan 2023 17:58:51 +0100
parents 8fba26292a9f
children 0ea402b4d901
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
213
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1859
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 730
diff changeset
4 * Department, University Hospital of Liege, Belgium
4870
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
213
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * License, or (at your option) any later version.
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * General Public License for more details.
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
25 #include "Database/IDatabaseWrapper.h"
3083
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
26 #include "ServerEnumerations.h"
730
309e686b41e7 better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
27
3083
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
28 #include <boost/noncopyable.hpp>
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
29 #include <list>
213
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 namespace Orthanc
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
3083
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
33 class ServerContext;
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
34 class IStorageArea;
683d572424b6 IDatabaseWrapper::SetResourcesContent
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
35
2120
4b02ec79728a refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
36 namespace ServerToolbox
1668
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
37 {
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
38 bool FindOneChildInstance(int64_t& result,
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
39 IDatabaseWrapper::ITransaction& transaction,
1668
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
40 int64_t resource,
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
41 ResourceType type);
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
42
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
43 void ReconstructMainDicomTags(IDatabaseWrapper::ITransaction& transaction,
1668
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
44 IStorageArea& storageArea,
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
45 ResourceType level);
2121
7e8889bc95c6 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2120
diff changeset
46
7e8889bc95c6 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2120
diff changeset
47 void LoadIdentifiers(const DicomTag*& tags,
7e8889bc95c6 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2120
diff changeset
48 size_t& size,
7e8889bc95c6 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2120
diff changeset
49 ResourceType level);
7e8889bc95c6 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2120
diff changeset
50
7e8889bc95c6 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2120
diff changeset
51 bool IsIdentifier(const DicomTag& tag,
7e8889bc95c6 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2120
diff changeset
52 ResourceType level);
7e8889bc95c6 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2120
diff changeset
53
7e8889bc95c6 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2120
diff changeset
54 std::string NormalizeIdentifier(const std::string& value);
2209
e3fd5bc429a2 URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2123
diff changeset
55
e3fd5bc429a2 URI to reconstruct the main DICOM tags, the JSON summary and the metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2123
diff changeset
56 void ReconstructResource(ServerContext& context,
4988
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
57 const std::string& resource,
8fba26292a9f Housekeeper plugin: finalizing + integration tests ok
Alain Mazy <am@osimis.io>
parents: 4892
diff changeset
58 bool reconstructFiles);
1668
de1413733c97 reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
59 }
213
4ce7fdcc8879 access to tags, simplified-tags and file of an instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }