annotate OrthancFramework/Sources/DicomFormat/DicomMap.cpp @ 5853:4d932683049d get-scu tip

very first implementation of C-Get SCU
author Alain Mazy <am@orthanc.team>
date Tue, 29 Oct 2024 17:25:49 +0100
parents f7adfb22e20e
children 61c9e5df64d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
59
c996319e90bc renaming in Core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 53
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1850
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1206
diff changeset
4 * Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5323
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
10 * modify it under the terms of the GNU Lesser General Public License
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
11 * as published by the Free Software Foundation, either version 3 of
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
12 * the License, or (at your option) any later version.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 84
diff changeset
13 *
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
17 * Lesser General Public License for more details.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
20 * License along with this program. If not, see
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
21 * <http://www.gnu.org/licenses/>.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
824
a811bdf8b8eb precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 730
diff changeset
25 #include "../PrecompiledHeaders.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "DicomMap.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include <stdio.h>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include <memory>
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
30 #include <boost/algorithm/string/join.hpp>
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
31
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3690
diff changeset
32 #include "../Compatibility.h"
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
33 #include "../Endianness.h"
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
34 #include "../Logging.h"
59
c996319e90bc renaming in Core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 53
diff changeset
35 #include "../OrthancException.h"
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
36 #include "../Toolbox.h"
3518
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
37 #include "DicomArray.h"
5323
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
38 #include "DicomImageInformation.h"
5038
f8bea9c1c0fc reduce dependencies to DCMTK (e.g. for plugins)
Alain Mazy <am@osimis.io>
parents: 5036
diff changeset
39
f8bea9c1c0fc reduce dependencies to DCMTK (e.g. for plugins)
Alain Mazy <am@osimis.io>
parents: 5036
diff changeset
40 #if ORTHANC_ENABLE_DCMTK == 1
5036
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
41 #include "../DicomParsing/FromDcmtkBridge.h"
5038
f8bea9c1c0fc reduce dependencies to DCMTK (e.g. for plugins)
Alain Mazy <am@osimis.io>
parents: 5036
diff changeset
42 #endif
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
44 #if !defined(__EMSCRIPTEN__)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
45 // Multithreading is not supported in WebAssembly
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
46 # include <boost/thread/shared_mutex.hpp>
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
47 #endif
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
48
59
c996319e90bc renaming in Core
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 53
diff changeset
49 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 {
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
51 // WARNING: the DEFAULT list of main dicom tags below are the list as they
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
52 // were in Orthanc 1.10 before we introduced the dynamic main dicom tags.
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
53 // This list has not changed since Orthanc 1.4.2 and had a single change since
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
54 // Orthanc 0.9.5.
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
55 // These lists have a specific signature. When a resource does not have
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
56 // the metadata "MainDicomTagsSignature", we'll assume that they were stored
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
57 // with an Orthanc prior to 1.11. It is therefore very important that you never
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
58 // change these lists !
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
59
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
60 static const DicomTag DEFAULT_PATIENT_MAIN_DICOM_TAGS[] =
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
62 // { DicomTag(0x0010, 0x1010), "PatientAge" },
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
63 // { DicomTag(0x0010, 0x1040), "PatientAddress" },
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
64 DICOM_TAG_PATIENT_NAME,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
65 DICOM_TAG_PATIENT_BIRTH_DATE,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
66 DICOM_TAG_PATIENT_SEX,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
67 DICOM_TAG_OTHER_PATIENT_IDS,
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
68 DICOM_TAG_PATIENT_ID
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 };
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
70
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
71 static const DicomTag DEFAULT_STUDY_MAIN_DICOM_TAGS[] =
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
72 {
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
73 // { DicomTag(0x0010, 0x1020), "PatientSize" },
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
74 // { DicomTag(0x0010, 0x1030), "PatientWeight" },
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
75 DICOM_TAG_STUDY_DATE,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
76 DICOM_TAG_STUDY_TIME,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
77 DICOM_TAG_STUDY_ID,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
78 DICOM_TAG_STUDY_DESCRIPTION,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
79 DICOM_TAG_ACCESSION_NUMBER,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
80 DICOM_TAG_STUDY_INSTANCE_UID,
5179
1e406c23b352 added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5178
diff changeset
81
1e406c23b352 added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5178
diff changeset
82 // New in db v6 (Orthanc 0.9.5)
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
83 DICOM_TAG_REQUESTED_PROCEDURE_DESCRIPTION,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
84 DICOM_TAG_INSTITUTION_NAME,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
85 DICOM_TAG_REQUESTING_PHYSICIAN,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
86 DICOM_TAG_REFERRING_PHYSICIAN_NAME
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
87 };
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
88
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
89 static const DicomTag DEFAULT_SERIES_MAIN_DICOM_TAGS[] =
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
91 // { DicomTag(0x0010, 0x1080), "MilitaryRank" },
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
92 DICOM_TAG_SERIES_DATE,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
93 DICOM_TAG_SERIES_TIME,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
94 DICOM_TAG_MODALITY,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
95 DICOM_TAG_MANUFACTURER,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
96 DICOM_TAG_STATION_NAME,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
97 DICOM_TAG_SERIES_DESCRIPTION,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
98 DICOM_TAG_BODY_PART_EXAMINED,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
99 DICOM_TAG_SEQUENCE_NAME,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
100 DICOM_TAG_PROTOCOL_NAME,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
101 DICOM_TAG_SERIES_NUMBER,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
102 DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
103 DICOM_TAG_IMAGES_IN_ACQUISITION,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
104 DICOM_TAG_NUMBER_OF_TEMPORAL_POSITIONS,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
105 DICOM_TAG_NUMBER_OF_SLICES,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
106 DICOM_TAG_NUMBER_OF_TIME_SLICES,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
107 DICOM_TAG_SERIES_INSTANCE_UID,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
108
5179
1e406c23b352 added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5178
diff changeset
109 // New in db v6 (Orthanc 0.9.5)
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
110 DICOM_TAG_IMAGE_ORIENTATION_PATIENT,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
111 DICOM_TAG_SERIES_TYPE,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
112 DICOM_TAG_OPERATOR_NAME,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
113 DICOM_TAG_PERFORMED_PROCEDURE_STEP_DESCRIPTION,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
114 DICOM_TAG_ACQUISITION_DEVICE_PROCESSING_DESCRIPTION,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
115 DICOM_TAG_CONTRAST_BOLUS_AGENT
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
116 };
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
117
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
118 static const DicomTag DEFAULT_INSTANCE_MAIN_DICOM_TAGS[] =
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
119 {
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
120 DICOM_TAG_INSTANCE_CREATION_DATE,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
121 DICOM_TAG_INSTANCE_CREATION_TIME,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
122 DICOM_TAG_ACQUISITION_NUMBER,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
123 DICOM_TAG_IMAGE_INDEX,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
124 DICOM_TAG_INSTANCE_NUMBER,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
125 DICOM_TAG_NUMBER_OF_FRAMES,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
126 DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
127 DICOM_TAG_SOP_INSTANCE_UID,
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
128
5179
1e406c23b352 added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5178
diff changeset
129 // New in db v6 (Orthanc 0.9.5)
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
130 DICOM_TAG_IMAGE_POSITION_PATIENT,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
131 DICOM_TAG_IMAGE_COMMENTS,
2804
d88970f1ffbf fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
132
d88970f1ffbf fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
133 /**
d88970f1ffbf fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
134 * Main DICOM tags that are not part of any release of the
d88970f1ffbf fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
135 * database schema yet, and that will be part of future db v7. In
d88970f1ffbf fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
136 * the meantime, the user must call "/tools/reconstruct" once to
d88970f1ffbf fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
137 * access these tags if the corresponding DICOM files where
d88970f1ffbf fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
138 * indexed in the database by an older version of Orthanc.
d88970f1ffbf fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
139 **/
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
140 DICOM_TAG_IMAGE_ORIENTATION_PATIENT // New in Orthanc 1.4.2
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
143 class DicomMap::MainDicomTagsConfiguration : public boost::noncopyable
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
144 {
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
145 private:
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
146 #if !defined(__EMSCRIPTEN__)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
147 typedef boost::unique_lock<boost::shared_mutex> WriterLock;
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
148 typedef boost::shared_lock<boost::shared_mutex> ReaderLock;
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
149
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
150 boost::shared_mutex mutex_;
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
151 #endif
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
152
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
153 std::set<DicomTag> patientsMainDicomTagsByLevel_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
154 std::set<DicomTag> studiesMainDicomTagsByLevel_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
155 std::set<DicomTag> seriesMainDicomTagsByLevel_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
156 std::set<DicomTag> instancesMainDicomTagsByLevel_;
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
157
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
158 std::set<DicomTag> allMainDicomTags_;
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
159
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
160 std::map<ResourceType, std::string> signatures_;
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
161 std::map<ResourceType, std::string> defaultSignatures_;
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
162
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
163 MainDicomTagsConfiguration()
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
164 {
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
165 ResetDefaultMainDicomTags();
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
166 }
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
167
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
168 std::string ComputeSignature(const std::set<DicomTag>& tags)
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
169 {
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
170 // std::set are sorted by default (which is important for us !)
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
171 std::set<std::string> tagsIds;
4981
d0c34145320c cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4960
diff changeset
172 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
173 {
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
174 tagsIds.insert(it->Format());
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
175 }
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
176
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4933
diff changeset
177 std::string signatureText = boost::algorithm::join(tagsIds, ";");
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
178
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4933
diff changeset
179 return signatureText;
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
180 }
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
181
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
182 void LoadDefaultMainDicomTags(ResourceType level)
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
183 {
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
184 const DicomTag* tags = NULL;
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
185 size_t size;
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
186
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
187 switch (level)
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
188 {
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
189 case ResourceType_Patient:
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
190 tags = DEFAULT_PATIENT_MAIN_DICOM_TAGS;
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
191 size = sizeof(DEFAULT_PATIENT_MAIN_DICOM_TAGS) / sizeof(DicomTag);
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
192 break;
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
193
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
194 case ResourceType_Study:
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
195 tags = DEFAULT_STUDY_MAIN_DICOM_TAGS;
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
196 size = sizeof(DEFAULT_STUDY_MAIN_DICOM_TAGS) / sizeof(DicomTag);
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
197 break;
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
198
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
199 case ResourceType_Series:
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
200 tags = DEFAULT_SERIES_MAIN_DICOM_TAGS;
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
201 size = sizeof(DEFAULT_SERIES_MAIN_DICOM_TAGS) / sizeof(DicomTag);
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
202 break;
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
203
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
204 case ResourceType_Instance:
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
205 tags = DEFAULT_INSTANCE_MAIN_DICOM_TAGS;
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
206 size = sizeof(DEFAULT_INSTANCE_MAIN_DICOM_TAGS) / sizeof(DicomTag);
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
207 break;
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
208
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
209 default:
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
210 throw OrthancException(ErrorCode_ParameterOutOfRange);
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
211 }
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
212
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
213 assert(tags != NULL &&
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
214 size != 0);
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
215
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
216 for (size_t i = 0; i < size; i++)
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
217 {
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
218 AddMainDicomTagInternal(tags[i], level);
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
219 }
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
220 }
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
221
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
222 std::set<DicomTag>& GetMainDicomTagsByLevelInternal(ResourceType level)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
223 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
224 switch (level)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
225 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
226 case ResourceType_Patient:
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
227 return patientsMainDicomTagsByLevel_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
228
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
229 case ResourceType_Study:
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
230 return studiesMainDicomTagsByLevel_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
231
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
232 case ResourceType_Series:
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
233 return seriesMainDicomTagsByLevel_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
234
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
235 case ResourceType_Instance:
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
236 return instancesMainDicomTagsByLevel_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
237
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
238 default:
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
239 throw OrthancException(ErrorCode_InternalError);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
240 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
241 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
242
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
243 void AddMainDicomTagInternal(const DicomTag& tag,
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
244 ResourceType level)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
245 {
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
246 std::set<DicomTag>& existingLevelTags = GetMainDicomTagsByLevelInternal(level);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
247
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
248 if (existingLevelTags.find(tag) != existingLevelTags.end())
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
249 {
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
250 throw OrthancException(ErrorCode_MainDicomTagsMultiplyDefined, tag.Format() + " is already defined");
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
251 }
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
252
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
253 existingLevelTags.insert(tag);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
254 allMainDicomTags_.insert(tag);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
255
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
256 signatures_[level] = ComputeSignature(GetMainDicomTagsByLevelInternal(level));
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
257 }
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
258
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
259 public:
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
260 // Singleton pattern
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
261 static MainDicomTagsConfiguration& GetInstance()
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
262 {
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
263 static MainDicomTagsConfiguration parameters;
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
264 return parameters;
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
265 }
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
266
5175
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
267 void ResetDefaultMainDicomTags()
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
268 {
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
269 #if !defined(__EMSCRIPTEN__)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
270 WriterLock lock(mutex_);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
271 #endif
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
272
5175
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
273 patientsMainDicomTagsByLevel_.clear();
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
274 studiesMainDicomTagsByLevel_.clear();
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
275 seriesMainDicomTagsByLevel_.clear();
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
276 instancesMainDicomTagsByLevel_.clear();
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
277
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
278 allMainDicomTags_.clear();
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
279
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
280 // by default, initialize with the previous static list (up to 1.10.0)
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
281 LoadDefaultMainDicomTags(ResourceType_Patient);
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
282 LoadDefaultMainDicomTags(ResourceType_Study);
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
283 LoadDefaultMainDicomTags(ResourceType_Series);
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
284 LoadDefaultMainDicomTags(ResourceType_Instance);
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
285
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
286 defaultSignatures_[ResourceType_Patient] = signatures_[ResourceType_Patient];
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
287 defaultSignatures_[ResourceType_Study] = signatures_[ResourceType_Study];
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
288 defaultSignatures_[ResourceType_Series] = signatures_[ResourceType_Series];
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
289 defaultSignatures_[ResourceType_Instance] = signatures_[ResourceType_Instance];
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
290 }
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
291
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
292 void AddMainDicomTag(const DicomTag& tag,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
293 ResourceType level)
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
294 {
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
295 #if !defined(__EMSCRIPTEN__)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
296 WriterLock lock(mutex_);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
297 #endif
4982
40fd2a485a84 fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4981
diff changeset
298
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
299 AddMainDicomTagInternal(tag, level);
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
300 }
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
301
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
302 void GetAllMainDicomTags(std::set<DicomTag>& target)
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
303 {
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
304 #if !defined(__EMSCRIPTEN__)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
305 ReaderLock lock(mutex_);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
306 #endif
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
307
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
308 target = allMainDicomTags_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
309 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
310
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
311 void GetMainDicomTagsByLevel(std::set<DicomTag>& target,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
312 ResourceType level)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
313 {
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
314 #if !defined(__EMSCRIPTEN__)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
315 ReaderLock lock(mutex_);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
316 #endif
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
317
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
318 target = GetMainDicomTagsByLevelInternal(level);
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
319 }
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
320
5176
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5175
diff changeset
321 std::string GetMainDicomTagsSignature(ResourceType level)
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
322 {
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
323 #if !defined(__EMSCRIPTEN__)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
324 ReaderLock lock(mutex_);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
325 #endif
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
326
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
327 assert(signatures_.find(level) != signatures_.end());
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
328 return signatures_[level];
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
329 }
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
330
5176
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5175
diff changeset
331 std::string GetDefaultMainDicomTagsSignature(ResourceType level)
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
332 {
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
333 #if !defined(__EMSCRIPTEN__)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
334 ReaderLock lock(mutex_);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
335 #endif
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
336
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
337 assert(defaultSignatures_.find(level) != defaultSignatures_.end());
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
338 return defaultSignatures_[level];
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
339 }
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
340
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
341 bool IsMainDicomTag(const DicomTag& tag)
5175
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
342 {
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
343 #if !defined(__EMSCRIPTEN__)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
344 ReaderLock lock(mutex_);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
345 #endif
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
346
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
347 return allMainDicomTags_.find(tag) != allMainDicomTags_.end();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
348 }
5175
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
349
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
350 bool IsMainDicomTag(const DicomTag& tag,
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
351 ResourceType level)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
352 {
5178
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
353 #if !defined(__EMSCRIPTEN__)
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
354 ReaderLock lock(mutex_);
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
355 #endif
02c7e4aa7946 internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5177
diff changeset
356
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
357 const std::set<DicomTag>& mainDicomTags = GetMainDicomTagsByLevelInternal(level);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
358 return mainDicomTags.find(tag) != mainDicomTags.end();
5175
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
359 }
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
360 };
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
361
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
362
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
363 void DicomMap::SetValueInternal(uint16_t group,
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
364 uint16_t element,
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
365 DicomValue* value)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 DicomTag tag(group, element);
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
368 Content::iterator it = content_.find(tag);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
370 if (it != content_.end())
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 delete it->second;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 it->second = value;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
377 content_.insert(std::make_pair(tag, value));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 void DicomMap::Clear()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
384 for (Content::iterator it = content_.begin(); it != content_.end(); ++it)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 {
2863
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
386 assert(it->second != NULL);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 delete it->second;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
390 content_.clear();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
393 void DicomMap::SetNullValue(uint16_t group, uint16_t element)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
394 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
395 SetValueInternal(group, element, new DicomValue);
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
396 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
397
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
398 void DicomMap::SetNullValue(const DicomTag &tag)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
399 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
400 SetValueInternal(tag.GetGroup(), tag.GetElement(), new DicomValue);
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
401 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
402
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
403 void DicomMap::SetValue(uint16_t group, uint16_t element, const DicomValue &value)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
404 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
405 SetValueInternal(group, element, value.Clone());
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
406 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
407
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
408 void DicomMap::SetValue(const DicomTag &tag, const DicomValue &value)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
409 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
410 SetValueInternal(tag.GetGroup(), tag.GetElement(), value.Clone());
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
411 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
412
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
413 void DicomMap::SetValue(const DicomTag &tag, const std::string &str, bool isBinary)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
414 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
415 SetValueInternal(tag.GetGroup(), tag.GetElement(), new DicomValue(str, isBinary));
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
416 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
417
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
418 void DicomMap::SetValue(uint16_t group, uint16_t element, const std::string &str, bool isBinary)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
419 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
420 SetValueInternal(group, element, new DicomValue(str, isBinary));
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
421 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
422
5323
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
423 void DicomMap::SetSequenceValue(const DicomTag& tag, const Json::Value& value)
5044
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
424 {
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
425 SetValueInternal(tag.GetGroup(), tag.GetElement(), new DicomValue(value));
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
426 }
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
427
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
428 bool DicomMap::HasTag(uint16_t group, uint16_t element) const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
429 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
430 return HasTag(DicomTag(group, element));
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
431 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
432
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
433 bool DicomMap::HasTag(const DicomTag &tag) const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
434 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
435 return content_.find(tag) != content_.end();
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
436 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
437
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
438 const DicomValue &DicomMap::GetValue(uint16_t group, uint16_t element) const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
439 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
440 return GetValue(DicomTag(group, element));
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
441 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
442
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443
4936
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
444 static void ExtractTagsInternal(DicomMap& result,
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
445 const DicomMap::Content& source,
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
446 const std::set<DicomTag>& mainDicomTags)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 result.Clear();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
450 for (std::set<DicomTag>::const_iterator itmt = mainDicomTags.begin();
4981
d0c34145320c cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4960
diff changeset
451 itmt != mainDicomTags.end(); ++itmt)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 {
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
453 DicomMap::Content::const_iterator it = source.find(*itmt);
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
454 if (it != source.end())
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
456 result.SetValue(it->first, *it->second /* value will be cloned */);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460
4936
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
461 void DicomMap::ExtractTags(DicomMap& result, const std::set<DicomTag>& tags) const
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
462 {
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
463 result.Clear();
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
464
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
465 for (std::set<DicomTag>::const_iterator itmt = tags.begin();
4981
d0c34145320c cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4960
diff changeset
466 itmt != tags.end(); ++itmt)
4936
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
467 {
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
468 DicomMap::Content::const_iterator it = content_.find(*itmt);
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
469 if (it != content_.end())
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
470 {
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
471 result.SetValue(it->first, *it->second /* value will be cloned */);
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
472 }
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
473 }
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
474 }
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
475
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4933
diff changeset
476 void DicomMap::ExtractResourceInformation(DicomMap& result, ResourceType level) const
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4933
diff changeset
477 {
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
478 std::set<DicomTag> mainDicomTags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
479 DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(mainDicomTags, level);
4936
8422e4f99a18 Handling RequestedTags in ExpandResource -> read parent main dicom tags if required. Not yet getting missing tags from file. Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4935
diff changeset
480 ExtractTagsInternal(result, content_, mainDicomTags);
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4933
diff changeset
481 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483 void DicomMap::ExtractPatientInformation(DicomMap& result) const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 {
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4933
diff changeset
485 ExtractResourceInformation(result, ResourceType_Patient);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 void DicomMap::ExtractStudyInformation(DicomMap& result) const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 {
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4933
diff changeset
490 ExtractResourceInformation(result, ResourceType_Study);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 void DicomMap::ExtractSeriesInformation(DicomMap& result) const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494 {
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4933
diff changeset
495 ExtractResourceInformation(result, ResourceType_Series);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498 void DicomMap::ExtractInstanceInformation(DicomMap& result) const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 {
4935
acd3f72e2a21 split ExpandResource in 2: read from DB and serialize to json. This will allow us to merge requested tags from both the DB and the file system
Alain Mazy <am@osimis.io>
parents: 4933
diff changeset
500 ExtractResourceInformation(result, ResourceType_Instance);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503
4297
785a2713323e abi continued
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4296
diff changeset
504 DicomMap::~DicomMap()
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
505 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
506 Clear();
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
507 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
508
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
509 size_t DicomMap::GetSize() const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
510 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
511 return content_.size();
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
512 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
513
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
514
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 DicomMap* DicomMap::Clone() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516 {
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3690
diff changeset
517 std::unique_ptr<DicomMap> result(new DicomMap);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
519 for (Content::const_iterator it = content_.begin(); it != content_.end(); ++it)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
521 result->content_.insert(std::make_pair(it->first, it->second->Clone()));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524 return result.release();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527
1310
61ce8147f30d custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
528 void DicomMap::Assign(const DicomMap& other)
61ce8147f30d custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
529 {
61ce8147f30d custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
530 Clear();
61ce8147f30d custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
531
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
532 for (Content::const_iterator it = other.content_.begin(); it != other.content_.end(); ++it)
1310
61ce8147f30d custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
533 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
534 content_.insert(std::make_pair(it->first, it->second->Clone()));
1310
61ce8147f30d custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
535 }
61ce8147f30d custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
536 }
61ce8147f30d custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
537
61ce8147f30d custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
538
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 const DicomValue& DicomMap::GetValue(const DicomTag& tag) const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 {
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
541 const DicomValue* value = TestAndGetValue(tag);
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
542
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
543 if (value)
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
544 {
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
545 return *value;
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
546 }
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
547 else
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
548 {
730
309e686b41e7 better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
549 throw OrthancException(ErrorCode_InexistentTag);
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
550 }
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
551 }
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
552
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
553 const DicomValue *DicomMap::TestAndGetValue(uint16_t group, uint16_t element) const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
554 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
555 return TestAndGetValue(DicomTag(group, element));
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
556 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4214
diff changeset
557
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
558
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
559 const DicomValue* DicomMap::TestAndGetValue(const DicomTag& tag) const
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
560 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
561 Content::const_iterator it = content_.find(tag);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
563 if (it == content_.end())
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 {
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
565 return NULL;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568 {
80
6212bf978584 status of series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 77
diff changeset
569 return it->second;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 void DicomMap::Remove(const DicomTag& tag)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
576 Content::iterator it = content_.find(tag);
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
577 if (it != content_.end())
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 delete it->second;
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
580 content_.erase(it);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583
5036
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
584 void DicomMap::RemoveTags(const std::set<DicomTag>& tags)
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
585 {
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
586 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
587 {
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
588 Remove(*it);
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
589 }
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
590 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
592 void DicomMap::SetupFindPatientTemplate(DicomMap& result)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 result.Clear();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
596 // Identifying tags
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
597 result.SetValue(DICOM_TAG_PATIENT_ID, "", false);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
599 // Other tags in the "Patient" module
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
600 result.SetValue(DICOM_TAG_OTHER_PATIENT_IDS, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
601 result.SetValue(DICOM_TAG_PATIENT_BIRTH_DATE, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
602 result.SetValue(DICOM_TAG_PATIENT_NAME, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
603 result.SetValue(DICOM_TAG_PATIENT_SEX, "", false);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606 void DicomMap::SetupFindStudyTemplate(DicomMap& result)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 {
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
608 result.Clear();
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
609
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
610 // Identifying tags
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
611 result.SetValue(DICOM_TAG_PATIENT_ID, "", false);
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
612 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false);
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
613 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false);
1848
e39716f71d67 new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1841
diff changeset
614
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
615 // Other tags in the "General Study" module
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
616 result.SetValue(DICOM_TAG_REFERRING_PHYSICIAN_NAME, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
617 result.SetValue(DICOM_TAG_STUDY_DATE, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
618 result.SetValue(DICOM_TAG_STUDY_DESCRIPTION, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
619 result.SetValue(DICOM_TAG_STUDY_ID, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
620 result.SetValue(DICOM_TAG_STUDY_TIME, "", false);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 void DicomMap::SetupFindSeriesTemplate(DicomMap& result)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624 {
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
625 result.Clear();
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
626
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
627 // Identifying tags
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
628 result.SetValue(DICOM_TAG_PATIENT_ID, "", false);
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
629 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
630 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false);
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
631 result.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "", false);
1372
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1364
diff changeset
632
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
633 // Other tags in the "General Series" module
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
634 result.SetValue(DICOM_TAG_BODY_PART_EXAMINED, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
635 result.SetValue(DICOM_TAG_MODALITY, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
636 result.SetValue(DICOM_TAG_OPERATOR_NAME, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
637 result.SetValue(DICOM_TAG_PERFORMED_PROCEDURE_STEP_DESCRIPTION, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
638 result.SetValue(DICOM_TAG_PROTOCOL_NAME, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
639 result.SetValue(DICOM_TAG_SERIES_DATE, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
640 result.SetValue(DICOM_TAG_SERIES_DESCRIPTION, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
641 result.SetValue(DICOM_TAG_SERIES_NUMBER, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
642 result.SetValue(DICOM_TAG_SERIES_TIME, "", false);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645 void DicomMap::SetupFindInstanceTemplate(DicomMap& result)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 {
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
647 result.Clear();
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
648
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
649 // Identifying tags
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
650 result.SetValue(DICOM_TAG_PATIENT_ID, "", false);
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
651 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
652 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
653 result.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "", false);
5180
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
654 result.SetValue(DICOM_TAG_SOP_INSTANCE_UID, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
655
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
656 // Other tags in the "SOP Common" module
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
657 result.SetValue(DICOM_TAG_ACQUISITION_NUMBER, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
658 result.SetValue(DICOM_TAG_IMAGE_COMMENTS, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
659 result.SetValue(DICOM_TAG_IMAGE_INDEX, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
660 result.SetValue(DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
661 result.SetValue(DICOM_TAG_IMAGE_POSITION_PATIENT, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
662 result.SetValue(DICOM_TAG_INSTANCE_CREATION_DATE, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
663 result.SetValue(DICOM_TAG_INSTANCE_CREATION_TIME, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
664 result.SetValue(DICOM_TAG_INSTANCE_NUMBER, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
665 result.SetValue(DICOM_TAG_NUMBER_OF_FRAMES, "", false);
d2626a062809 fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5179
diff changeset
666 result.SetValue(DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER, "", false);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 void DicomMap::CopyTagIfExists(const DicomMap& source,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 const DicomTag& tag)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 if (source.HasTag(tag))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 SetValue(tag, source.GetValue(tag));
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 }
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
678
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
679
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
680 bool DicomMap::IsMainDicomTag(const DicomTag& tag, ResourceType level)
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
681 {
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
682 return DicomMap::MainDicomTagsConfiguration::GetInstance().IsMainDicomTag(tag, level);
562
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
683 }
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
684
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
685 bool DicomMap::IsMainDicomTag(const DicomTag& tag)
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
686 {
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
687 return (IsMainDicomTag(tag, ResourceType_Patient) ||
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
688 IsMainDicomTag(tag, ResourceType_Study) ||
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
689 IsMainDicomTag(tag, ResourceType_Series) ||
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
690 IsMainDicomTag(tag, ResourceType_Instance));
f64e3838d6e1 refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 433
diff changeset
691 }
567
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
692
4944
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
693 static bool IsGenericComputedTag(const DicomTag& tag)
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
694 {
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
695 return tag == DICOM_TAG_RETRIEVE_URL ||
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
696 tag == DICOM_TAG_RETRIEVE_AE_TITLE;
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
697 }
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
698
4940
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
699 bool DicomMap::IsComputedTag(const DicomTag& tag)
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
700 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
701 return (IsComputedTag(tag, ResourceType_Patient) ||
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
702 IsComputedTag(tag, ResourceType_Study) ||
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
703 IsComputedTag(tag, ResourceType_Series) ||
4944
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
704 IsComputedTag(tag, ResourceType_Instance) ||
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
705 IsGenericComputedTag(tag));
4940
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
706 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
707
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
708 bool DicomMap::IsComputedTag(const DicomTag& tag, ResourceType level)
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
709 {
4944
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
710
4940
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
711 switch (level)
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
712 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
713 case ResourceType_Patient:
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
714 return (
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
715 tag == DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES ||
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
716 tag == DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES ||
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
717 tag == DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
718 );
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
719 case ResourceType_Study:
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
720 return (
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
721 tag == DICOM_TAG_MODALITIES_IN_STUDY ||
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
722 tag == DICOM_TAG_SOP_CLASSES_IN_STUDY ||
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
723 tag == DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES ||
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
724 tag == DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
725 );
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
726 case ResourceType_Series:
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
727 return (
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
728 tag == DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
729 );
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
730 case ResourceType_Instance:
4944
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
731 return (
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
732 tag == DICOM_TAG_INSTANCE_AVAILABILITY
f377d5643538 new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents: 4940
diff changeset
733 );
4940
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
734 default:
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
735 throw OrthancException(ErrorCode_ParameterOutOfRange);
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
736 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
737 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
738
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
739 bool DicomMap::HasOnlyComputedTags(const std::set<DicomTag>& tags)
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
740 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
741 if (tags.size() == 0)
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
742 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
743 return false;
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
744 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
745
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
746 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
747 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
748 if (!IsComputedTag(*it))
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
749 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
750 return false;
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
751 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
752 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
753 return true;
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
754 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
755
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
756 bool DicomMap::HasComputedTags(const std::set<DicomTag>& tags)
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
757 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
758 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
759 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
760 if (IsComputedTag(*it))
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
761 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
762 return true;
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
763 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
764 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
765
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
766 return false;
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
767 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
768
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
769 bool DicomMap::HasComputedTags(const std::set<DicomTag>& tags, ResourceType level)
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
770 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
771 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it)
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
772 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
773 if (IsComputedTag(*it, level))
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
774 {
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
775 return true;
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
776 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
777 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
778 return false;
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
779 }
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
780
304514ce84ee tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents: 4936
diff changeset
781
5175
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
782 void DicomMap::GetMainDicomTags(std::set<DicomTag>& target,
48005e522bd6 start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5050
diff changeset
783 ResourceType level)
567
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
784 {
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
785 DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(target, level);
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
786 }
567
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
787
5176
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5175
diff changeset
788 void DicomMap::GetAllMainDicomTags(std::set<DicomTag>& target)
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
789 {
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
790 DicomMap::MainDicomTagsConfiguration::GetInstance().GetAllMainDicomTags(target);
567
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
791 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
792
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
793 void DicomMap::AddMainDicomTag(const DicomTag& tag, ResourceType level)
567
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
794 {
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
795 DicomMap::MainDicomTagsConfiguration::GetInstance().AddMainDicomTag(tag, level);
567
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
796 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
797
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
798 void DicomMap::ResetDefaultMainDicomTags()
567
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
799 {
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
800 DicomMap::MainDicomTagsConfiguration::GetInstance().ResetDefaultMainDicomTags();
567
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 562
diff changeset
801 }
1206
f5b0207967bc Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
802
5176
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5175
diff changeset
803 std::string DicomMap::GetMainDicomTagsSignature(ResourceType level)
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
804 {
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
805 return DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsSignature(level);
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
806 }
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
807
5176
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5175
diff changeset
808 std::string DicomMap::GetDefaultMainDicomTagsSignature(ResourceType level)
4933
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
809 {
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
810 return DicomMap::MainDicomTagsConfiguration::GetInstance().GetDefaultMainDicomTagsSignature(level);
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
811 }
312c6f4da888 adding MainDicomTags signatures
Alain Mazy <am@osimis.io>
parents: 4932
diff changeset
812
1360
0649c5aef34a DicomFindQuery
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1310
diff changeset
813 void DicomMap::GetTags(std::set<DicomTag>& tags) const
0649c5aef34a DicomFindQuery
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1310
diff changeset
814 {
0649c5aef34a DicomFindQuery
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1310
diff changeset
815 tags.clear();
0649c5aef34a DicomFindQuery
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1310
diff changeset
816
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
817 for (Content::const_iterator it = content_.begin();
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
818 it != content_.end(); ++it)
1360
0649c5aef34a DicomFindQuery
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1310
diff changeset
819 {
0649c5aef34a DicomFindQuery
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1310
diff changeset
820 tags.insert(it->first);
0649c5aef34a DicomFindQuery
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1310
diff changeset
821 }
0649c5aef34a DicomFindQuery
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1310
diff changeset
822 }
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
823
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
824
4213
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
825 static uint16_t ReadLittleEndianUint16(const char* dicom)
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
826 {
4213
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
827 const uint8_t* p = reinterpret_cast<const uint8_t*>(dicom);
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
828
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
829 return (static_cast<uint16_t>(p[0]) |
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
830 (static_cast<uint16_t>(p[1]) << 8));
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
831 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
832
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
833
4213
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
834 static uint32_t ReadLittleEndianUint32(const char* dicom)
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
835 {
4213
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
836 const uint8_t* p = reinterpret_cast<const uint8_t*>(dicom);
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
837
4214
7b011cfda135 working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4213
diff changeset
838 return (static_cast<uint32_t>(p[0]) |
7b011cfda135 working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4213
diff changeset
839 (static_cast<uint32_t>(p[1]) << 8) |
7b011cfda135 working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4213
diff changeset
840 (static_cast<uint32_t>(p[2]) << 16) |
7b011cfda135 working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4213
diff changeset
841 (static_cast<uint32_t>(p[3]) << 24));
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
842 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
843
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
844
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
845 static bool ValidateTag(const ValueRepresentation& vr,
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
846 const std::string& value)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
847 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
848 switch (vr)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
849 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
850 case ValueRepresentation_ApplicationEntity:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
851 return value.size() <= 16;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
852
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
853 case ValueRepresentation_AgeString:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
854 return (value.size() == 4 &&
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
855 isdigit(value[0]) &&
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
856 isdigit(value[1]) &&
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
857 isdigit(value[2]) &&
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
858 (value[3] == 'D' || value[3] == 'W' || value[3] == 'M' || value[3] == 'Y'));
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
859
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
860 case ValueRepresentation_AttributeTag:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
861 return value.size() == 4;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
862
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
863 case ValueRepresentation_CodeString:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
864 return value.size() <= 16;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
865
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
866 case ValueRepresentation_Date:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
867 return value.size() <= 18;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
868
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
869 case ValueRepresentation_DecimalString:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
870 return value.size() <= 16;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
871
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
872 case ValueRepresentation_DateTime:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
873 return value.size() <= 54;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
874
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
875 case ValueRepresentation_FloatingPointSingle:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
876 return value.size() == 4;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
877
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
878 case ValueRepresentation_FloatingPointDouble:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
879 return value.size() == 8;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
880
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
881 case ValueRepresentation_IntegerString:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
882 return value.size() <= 12;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
883
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
884 case ValueRepresentation_LongString:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
885 return value.size() <= 64;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
886
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
887 case ValueRepresentation_LongText:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
888 return value.size() <= 10240;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
889
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
890 case ValueRepresentation_OtherByte:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
891 return true;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
892
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
893 case ValueRepresentation_OtherDouble:
2013
f6e68c0c2737 fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2008
diff changeset
894 return value.size() <= (static_cast<uint64_t>(1) << 32) - 8;
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
895
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
896 case ValueRepresentation_OtherFloat:
2013
f6e68c0c2737 fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2008
diff changeset
897 return value.size() <= (static_cast<uint64_t>(1) << 32) - 4;
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
898
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
899 case ValueRepresentation_OtherLong:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
900 return true;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
901
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
902 case ValueRepresentation_OtherWord:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
903 return true;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
904
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
905 case ValueRepresentation_PersonName:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
906 return true;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
907
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
908 case ValueRepresentation_ShortString:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
909 return value.size() <= 16;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
910
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
911 case ValueRepresentation_SignedLong:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
912 return value.size() == 4;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
913
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
914 case ValueRepresentation_Sequence:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
915 return true;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
916
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
917 case ValueRepresentation_SignedShort:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
918 return value.size() == 2;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
919
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
920 case ValueRepresentation_ShortText:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
921 return value.size() <= 1024;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
922
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
923 case ValueRepresentation_Time:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
924 return value.size() <= 28;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
925
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
926 case ValueRepresentation_UnlimitedCharacters:
2013
f6e68c0c2737 fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2008
diff changeset
927 return value.size() <= (static_cast<uint64_t>(1) << 32) - 2;
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
928
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
929 case ValueRepresentation_UniqueIdentifier:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
930 return value.size() <= 64;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
931
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
932 case ValueRepresentation_UnsignedLong:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
933 return value.size() == 4;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
934
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
935 case ValueRepresentation_Unknown:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
936 return true;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
937
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
938 case ValueRepresentation_UniversalResource:
2013
f6e68c0c2737 fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2008
diff changeset
939 return value.size() <= (static_cast<uint64_t>(1) << 32) - 2;
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
940
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
941 case ValueRepresentation_UnsignedShort:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
942 return value.size() == 2;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
943
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
944 case ValueRepresentation_UnlimitedText:
2013
f6e68c0c2737 fix for msvc
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2008
diff changeset
945 return value.size() <= (static_cast<uint64_t>(1) << 32) - 2;
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
946
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
947 default:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
948 // Assume unsupported tags are OK
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
949 return true;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
950 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
951 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
952
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
953
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
954 static void RemoveTagPadding(std::string& value,
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
955 const ValueRepresentation& vr)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
956 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
957 /**
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
958 * Remove padding from character strings, if need be. For the time
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
959 * being, only the UI VR is supported.
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
960 * http://dicom.nema.org/medical/dicom/current/output/chtml/part05/sect_6.2.html
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
961 **/
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
962
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
963 switch (vr)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
964 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
965 case ValueRepresentation_UniqueIdentifier:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
966 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
967 /**
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
968 * "Values with a VR of UI shall be padded with a single
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
969 * trailing NULL (00H) character when necessary to achieve even
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
970 * length."
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
971 **/
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
972
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
973 if (!value.empty() &&
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
974 value[value.size() - 1] == '\0')
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
975 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
976 value.resize(value.size() - 1);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
977 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
978
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
979 break;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
980 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
981
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
982 /**
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
983 * TODO implement other VR
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
984 **/
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
985
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
986 default:
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
987 // No padding is applicable to this VR
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
988 break;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
989 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
990 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
991
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
992
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
993 static bool ReadNextTag(DicomTag& tag,
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
994 ValueRepresentation& vr,
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
995 std::string& value,
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
996 const char* dicom,
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
997 size_t size,
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
998 size_t& position)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
999 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1000 /**
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1001 * http://dicom.nema.org/medical/dicom/current/output/chtml/part05/chapter_7.html#sect_7.1.2
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1002 * This function reads a data element with Explicit VR encoded using Little-Endian.
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1003 **/
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1004
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1005 if (position + 6 > size)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1006 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1007 return false;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1008 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1009
4213
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1010 tag = DicomTag(ReadLittleEndianUint16(dicom + position),
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1011 ReadLittleEndianUint16(dicom + position + 2));
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1012
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1013 vr = StringToValueRepresentation(std::string(dicom + position + 4, 2), true);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1014 if (vr == ValueRepresentation_NotSupported)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1015 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1016 return false;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1017 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1018
4213
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1019 // http://dicom.nema.org/medical/dicom/current/output/chtml/part05/chapter_7.html#sect_7.1.2
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1020 if (vr == ValueRepresentation_ApplicationEntity /* AE */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1021 vr == ValueRepresentation_AgeString /* AS */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1022 vr == ValueRepresentation_AttributeTag /* AT */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1023 vr == ValueRepresentation_CodeString /* CS */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1024 vr == ValueRepresentation_Date /* DA */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1025 vr == ValueRepresentation_DecimalString /* DS */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1026 vr == ValueRepresentation_DateTime /* DT */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1027 vr == ValueRepresentation_FloatingPointSingle /* FL */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1028 vr == ValueRepresentation_FloatingPointDouble /* FD */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1029 vr == ValueRepresentation_IntegerString /* IS */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1030 vr == ValueRepresentation_LongString /* LO */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1031 vr == ValueRepresentation_LongText /* LT */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1032 vr == ValueRepresentation_PersonName /* PN */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1033 vr == ValueRepresentation_ShortString /* SH */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1034 vr == ValueRepresentation_SignedLong /* SL */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1035 vr == ValueRepresentation_SignedShort /* SS */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1036 vr == ValueRepresentation_ShortText /* ST */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1037 vr == ValueRepresentation_Time /* TM */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1038 vr == ValueRepresentation_UniqueIdentifier /* UI */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1039 vr == ValueRepresentation_UnsignedLong /* UL */ ||
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1040 vr == ValueRepresentation_UnsignedShort /* US */)
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1041 {
4213
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1042 /**
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1043 * This is Table 7.1-2. "Data Element with Explicit VR of AE,
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1044 * AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, PN, SH, SL, SS,
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1045 * ST, TM, UI, UL and US"
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1046 **/
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1047 if (position + 8 > size)
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1048 {
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1049 return false;
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1050 }
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1051
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1052 uint16_t length = ReadLittleEndianUint16(dicom + position + 6);
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1053 if (position + 8 + length > size)
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1054 {
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1055 return false;
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1056 }
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1057
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1058 value.assign(dicom + position + 8, length);
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1059 position += (8 + length);
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1060 }
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1061 else
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1062 {
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1063 /**
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1064 * This is Table 7.1-1. "Data Element with Explicit VR other
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1065 * than as shown in Table 7.1-2"
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1066 **/
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1067 if (position + 12 > size)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1068 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1069 return false;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1070 }
4213
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1071
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1072 uint16_t reserved = ReadLittleEndianUint16(dicom + position + 6);
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1073 if (reserved != 0)
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1074 {
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1075 return false;
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1076 }
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1077
4213
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1078 uint32_t length = ReadLittleEndianUint32(dicom + position + 8);
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1079 if (position + 12 + length > size)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1080 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1081 return false;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1082 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1083
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1084 value.assign(dicom + position + 12, length);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1085 position += (12 + length);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1086 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1087
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1088 if (!ValidateTag(vr, value))
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1089 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1090 return false;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1091 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1092
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1093 RemoveTagPadding(value, vr);
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1094
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1095 return true;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1096 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1097
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1098
3840
e7003b2203a7 fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3771
diff changeset
1099 bool DicomMap::IsDicomFile(const void* dicom,
3771
74889e6f6d68 fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1100 size_t size)
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1101 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1102 /**
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1103 * http://dicom.nema.org/medical/dicom/current/output/chtml/part10/chapter_7.html
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1104 * According to Table 7.1-1, besides the "DICM" DICOM prefix, the
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1105 * file preamble (i.e. dicom[0..127]) should not be taken into
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1106 * account to determine whether the file is or is not a DICOM file.
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1107 **/
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1108
3840
e7003b2203a7 fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3771
diff changeset
1109 const uint8_t* p = reinterpret_cast<const uint8_t*>(dicom);
e7003b2203a7 fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3771
diff changeset
1110
3771
74889e6f6d68 fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1111 return (size >= 132 &&
3840
e7003b2203a7 fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3771
diff changeset
1112 p[128] == 'D' &&
e7003b2203a7 fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3771
diff changeset
1113 p[129] == 'I' &&
e7003b2203a7 fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3771
diff changeset
1114 p[130] == 'C' &&
e7003b2203a7 fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3771
diff changeset
1115 p[131] == 'M');
3771
74889e6f6d68 fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1116 }
74889e6f6d68 fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1117
74889e6f6d68 fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1118
74889e6f6d68 fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1119 bool DicomMap::ParseDicomMetaInformation(DicomMap& result,
3840
e7003b2203a7 fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3771
diff changeset
1120 const void* dicom,
3771
74889e6f6d68 fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1121 size_t size)
74889e6f6d68 fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1122 {
74889e6f6d68 fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1123 if (!IsDicomFile(dicom, size))
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1124 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1125 return false;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1126 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1127
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1128
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1129 /**
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1130 * The DICOM File Meta Information must be encoded using the
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1131 * Explicit VR Little Endian Transfer Syntax
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1132 * (UID=1.2.840.10008.1.2.1).
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1133 **/
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1134
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1135 result.Clear();
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1136
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1137 // First, we read the "File Meta Information Group Length" tag
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1138 // (0002,0000) to know where to stop reading the meta header
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1139 size_t position = 132;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1140
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1141 DicomTag tag(0x0000, 0x0000); // Dummy initialization
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1142 ValueRepresentation vr;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1143 std::string value;
3840
e7003b2203a7 fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3771
diff changeset
1144 if (!ReadNextTag(tag, vr, value, reinterpret_cast<const char*>(dicom), size, position) ||
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1145 tag.GetGroup() != 0x0002 ||
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1146 tag.GetElement() != 0x0000 ||
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1147 vr != ValueRepresentation_UnsignedLong ||
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1148 value.size() != 4)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1149 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1150 return false;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1151 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1152
4213
be2eca8b02e1 testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4199
diff changeset
1153 size_t stopPosition = position + ReadLittleEndianUint32(value.c_str());
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1154 if (stopPosition > size)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1155 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1156 return false;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1157 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1158
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1159 while (position < stopPosition)
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1160 {
3840
e7003b2203a7 fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3771
diff changeset
1161 if (ReadNextTag(tag, vr, value, reinterpret_cast<const char*>(dicom), size, position))
2007
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1162 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1163 result.SetValue(tag, value, IsBinaryValueRepresentation(vr));
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1164 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1165 else
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1166 {
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1167 return false;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1168 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1169 }
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1170
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1171 return true;
655489d9165d DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
1172 }
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1173
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1174
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1175 static std::string ValueAsString(const DicomMap& summary,
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1176 const DicomTag& tag)
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1177 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1178 const DicomValue& value = summary.GetValue(tag);
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1179 if (value.IsNull())
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1180 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1181 return "(null)";
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1182 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1183 else
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1184 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1185 return value.GetContent();
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1186 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1187 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1188
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1189
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1190 void DicomMap::LogMissingTagsForStore() const
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1191 {
4501
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1192 std::string patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid;
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1193
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1194 if (HasTag(DICOM_TAG_PATIENT_ID))
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1195 {
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1196 patientId = ValueAsString(*this, DICOM_TAG_PATIENT_ID);
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1197 }
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1198
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1199 if (HasTag(DICOM_TAG_STUDY_INSTANCE_UID))
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1200 {
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1201 studyInstanceUid = ValueAsString(*this, DICOM_TAG_STUDY_INSTANCE_UID);
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1202 }
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1203
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1204 if (HasTag(DICOM_TAG_SERIES_INSTANCE_UID))
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1205 {
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1206 seriesInstanceUid = ValueAsString(*this, DICOM_TAG_SERIES_INSTANCE_UID);
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1207 }
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1208
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1209 if (HasTag(DICOM_TAG_SOP_INSTANCE_UID))
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1210 {
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1211 sopInstanceUid = ValueAsString(*this, DICOM_TAG_SOP_INSTANCE_UID);
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1212 }
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1213
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1214 LogMissingTagsForStore(patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid);
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1215 }
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1216
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1217
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1218 void DicomMap::LogMissingTagsForStore(const std::string& patientId,
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1219 const std::string& studyInstanceUid,
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1220 const std::string& seriesInstanceUid,
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1221 const std::string& sopInstanceUid)
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1222 {
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1223 std::string s, t;
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1224
4501
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1225 if (!patientId.empty())
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1226 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1227 if (t.size() > 0)
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1228 t += ", ";
4501
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1229 t += "PatientID=" + patientId;
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1230 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1231 else
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1232 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1233 if (s.size() > 0)
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1234 s += ", ";
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1235 s += "PatientID";
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1236 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1237
4501
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1238 if (!studyInstanceUid.empty())
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1239 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1240 if (t.size() > 0)
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1241 t += ", ";
4501
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1242 t += "StudyInstanceUID=" + studyInstanceUid;
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1243 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1244 else
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1245 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1246 if (s.size() > 0)
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1247 s += ", ";
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1248 s += "StudyInstanceUID";
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1249 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1250
4501
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1251 if (!seriesInstanceUid.empty())
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1252 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1253 if (t.size() > 0)
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1254 t += ", ";
4501
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1255 t += "SeriesInstanceUID=" + seriesInstanceUid;
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1256 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1257 else
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1258 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1259 if (s.size() > 0)
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1260 s += ", ";
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1261 s += "SeriesInstanceUID";
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1262 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1263
4501
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1264 if (!sopInstanceUid.empty())
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1265 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1266 if (t.size() > 0)
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1267 t += ", ";
4501
11c2ddb4e2ca FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
1268 t += "SOPInstanceUID=" + sopInstanceUid;
2380
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1269 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1270 else
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1271 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1272 if (s.size() > 0)
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1273 s += ", ";
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1274 s += "SOPInstanceUID";
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1275 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1276
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1277 if (t.size() == 0)
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1278 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1279 LOG(ERROR) << "Store has failed because all the required tags (" << s << ") are missing (is it a DICOMDIR file?)";
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1280 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1281 else
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1282 {
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1283 LOG(ERROR) << "Store has failed because required tags (" << s << ") are missing for the following instance: " << t;
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1284 }
96b3ec054b69 reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
1285 }
2412
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1286
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1287
3518
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1288 bool DicomMap::LookupStringValue(std::string& result,
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1289 const DicomTag& tag,
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1290 bool allowBinary) const
2412
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1291 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1292 const DicomValue* value = TestAndGetValue(tag);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1293
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1294 if (value == NULL)
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1295 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1296 return false;
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1297 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1298 else
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1299 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1300 return value->CopyToString(result, allowBinary);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1301 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1302 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1303
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1304 bool DicomMap::ParseInteger32(int32_t& result,
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1305 const DicomTag& tag) const
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1306 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1307 const DicomValue* value = TestAndGetValue(tag);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1308
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1309 if (value == NULL)
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1310 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1311 return false;
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1312 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1313 else
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1314 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1315 return value->ParseInteger32(result);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1316 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1317 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1318
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1319 bool DicomMap::ParseInteger64(int64_t& result,
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1320 const DicomTag& tag) const
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1321 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1322 const DicomValue* value = TestAndGetValue(tag);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1323
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1324 if (value == NULL)
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1325 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1326 return false;
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1327 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1328 else
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1329 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1330 return value->ParseInteger64(result);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1331 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1332 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1333
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1334 bool DicomMap::ParseUnsignedInteger32(uint32_t& result,
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1335 const DicomTag& tag) const
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1336 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1337 const DicomValue* value = TestAndGetValue(tag);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1338
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1339 if (value == NULL)
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1340 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1341 return false;
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1342 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1343 else
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1344 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1345 return value->ParseUnsignedInteger32(result);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1346 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1347 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1348
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1349 bool DicomMap::ParseUnsignedInteger64(uint64_t& result,
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1350 const DicomTag& tag) const
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1351 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1352 const DicomValue* value = TestAndGetValue(tag);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1353
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1354 if (value == NULL)
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1355 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1356 return false;
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1357 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1358 else
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1359 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1360 return value->ParseUnsignedInteger64(result);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1361 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1362 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1363
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1364 bool DicomMap::ParseFloat(float& result,
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1365 const DicomTag& tag) const
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1366 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1367 const DicomValue* value = TestAndGetValue(tag);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1368
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1369 if (value == NULL)
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1370 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1371 return false;
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1372 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1373 else
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1374 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1375 return value->ParseFloat(result);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1376 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1377 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1378
3690
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1379 bool DicomMap::ParseFirstFloat(float& result,
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1380 const DicomTag& tag) const
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1381 {
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1382 const DicomValue* value = TestAndGetValue(tag);
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1383
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1384 if (value == NULL)
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1385 {
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1386 return false;
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1387 }
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1388 else
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1389 {
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1390 return value->ParseFirstFloat(result);
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1391 }
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1392 }
a9ce35d67c3c implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3678
diff changeset
1393
2412
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1394 bool DicomMap::ParseDouble(double& result,
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1395 const DicomTag& tag) const
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1396 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1397 const DicomValue* value = TestAndGetValue(tag);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1398
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1399 if (value == NULL)
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1400 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1401 return false;
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1402 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1403 else
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1404 {
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1405 return value->ParseDouble(result);
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1406 }
cad393b41bc3 handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
1407 }
2863
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1408
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1409
5044
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1410 void DicomMap::FromDicomAsJson(const Json::Value& dicomAsJson, bool append, bool parseSequences)
3005
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1411 {
3498
957e06cbe76a additional check
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3496
diff changeset
1412 if (dicomAsJson.type() != Json::objectValue)
957e06cbe76a additional check
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3496
diff changeset
1413 {
957e06cbe76a additional check
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3496
diff changeset
1414 throw OrthancException(ErrorCode_BadFileFormat);
957e06cbe76a additional check
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3496
diff changeset
1415 }
957e06cbe76a additional check
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3496
diff changeset
1416
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1417 if (!append)
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1418 {
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1419 Clear();
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1420 }
3005
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1421
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1422 Json::Value::Members tags = dicomAsJson.getMemberNames();
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1423 for (Json::Value::Members::const_iterator
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1424 it = tags.begin(); it != tags.end(); ++it)
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1425 {
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1426 DicomTag tag(0, 0);
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1427 if (!DicomTag::ParseHexadecimal(tag, it->c_str()))
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1428 {
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1429 throw OrthancException(ErrorCode_CorruptedFile);
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1430 }
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1431
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1432 const Json::Value& value = dicomAsJson[*it];
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1433
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1434 if (value.type() != Json::objectValue ||
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1435 !value.isMember("Type") ||
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1436 !value.isMember("Value") ||
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1437 value["Type"].type() != Json::stringValue)
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1438 {
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1439 throw OrthancException(ErrorCode_CorruptedFile);
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1440 }
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1441
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1442 if (value["Type"] == "String")
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1443 {
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1444 if (value["Value"].type() != Json::stringValue)
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1445 {
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1446 throw OrthancException(ErrorCode_CorruptedFile);
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1447 }
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1448 else
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1449 {
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1450 SetValue(tag, value["Value"].asString(), false /* not binary */);
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1451 }
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1452 }
5044
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1453 else if (value["Type"] == "Sequence" && parseSequences)
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1454 {
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1455 if (value["Value"].type() != Json::arrayValue)
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1456 {
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1457 throw OrthancException(ErrorCode_CorruptedFile);
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1458 }
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1459 else
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1460 {
5323
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1461 SetSequenceValue(tag, value["Value"]);
5044
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1462 }
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1463 }
3005
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1464 }
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1465 }
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1466
8265a6b56100 DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2863
diff changeset
1467
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1468 void DicomMap::Merge(const DicomMap& other)
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1469 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1470 for (Content::const_iterator it = other.content_.begin();
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1471 it != other.content_.end(); ++it)
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1472 {
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1473 assert(it->second != NULL);
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1474
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1475 if (content_.find(it->first) == content_.end())
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1476 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1477 content_[it->first] = it->second->Clone();
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1478 }
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1479 }
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1480 }
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1481
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1482
3678
26c6d47467a9 DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3653
diff changeset
1483 void DicomMap::MergeMainDicomTags(const DicomMap& other,
26c6d47467a9 DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3653
diff changeset
1484 ResourceType level)
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1485 {
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
1486 std::set<DicomTag> mainDicomTags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
1487 DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(mainDicomTags, level);
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1488
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1489 for (std::set<DicomTag>::const_iterator itmt = mainDicomTags.begin();
4981
d0c34145320c cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4960
diff changeset
1490 itmt != mainDicomTags.end(); ++itmt)
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1491 {
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1492 Content::const_iterator found = other.content_.find(*itmt);
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1493
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1494 if (found != other.content_.end() &&
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1495 content_.find(*itmt) == content_.end())
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1496 {
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1497 assert(found->second != NULL);
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1498 content_[*itmt] = found->second->Clone();
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1499 }
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1500 }
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1501 }
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1502
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1503
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1504 void DicomMap::ExtractMainDicomTags(const DicomMap& other)
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1505 {
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1506 Clear();
3678
26c6d47467a9 DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3653
diff changeset
1507 MergeMainDicomTags(other, ResourceType_Patient);
26c6d47467a9 DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3653
diff changeset
1508 MergeMainDicomTags(other, ResourceType_Study);
26c6d47467a9 DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3653
diff changeset
1509 MergeMainDicomTags(other, ResourceType_Series);
26c6d47467a9 DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3653
diff changeset
1510 MergeMainDicomTags(other, ResourceType_Instance);
3006
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1511 }
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1512
0e1755e5efd0 DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3005
diff changeset
1513
3015
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1514 bool DicomMap::HasOnlyMainDicomTags() const
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1515 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1516 for (Content::const_iterator it = content_.begin(); it != content_.end(); ++it)
3015
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1517 {
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
1518 if (!DicomMap::MainDicomTagsConfiguration::GetInstance().IsMainDicomTag(it->first))
3015
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1519 {
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1520 return false;
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1521 }
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1522 }
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1523
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1524 return true;
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1525 }
5036
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
1526
5044
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1527 void DicomMap::ExtractSequences(DicomMap& result) const
5036
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
1528 {
5044
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1529 result.Clear();
5036
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
1530
5044
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1531 for (Content::const_iterator it = content_.begin(); it != content_.end(); ++it)
5036
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
1532 {
5044
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1533 if (it->second->IsSequence())
5036
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
1534 {
5323
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1535 result.SetSequenceValue(it->first, it->second->GetSequenceContent());
5036
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
1536 }
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
1537 }
877bc3b96476 Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents: 4982
diff changeset
1538 }
3015
abe49ca61cd5 On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3006
diff changeset
1539
2863
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1540 void DicomMap::Serialize(Json::Value& target) const
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1541 {
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1542 target = Json::objectValue;
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1543
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1544 for (Content::const_iterator it = content_.begin(); it != content_.end(); ++it)
2863
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1545 {
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1546 assert(it->second != NULL);
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1547
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1548 std::string tag = it->first.Format();
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1549
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1550 Json::Value value;
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1551 it->second->Serialize(value);
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1552
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1553 target[tag] = value;
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1554 }
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1555 }
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1556
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1557
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1558 void DicomMap::Unserialize(const Json::Value& source)
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1559 {
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1560 Clear();
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1561
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1562 if (source.type() != Json::objectValue)
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1563 {
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1564 throw OrthancException(ErrorCode_BadFileFormat);
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1565 }
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1566
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1567 Json::Value::Members tags = source.getMemberNames();
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1568
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1569 for (size_t i = 0; i < tags.size(); i++)
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1570 {
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1571 DicomTag tag(0, 0);
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1572
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1573 if (!DicomTag::ParseHexadecimal(tag, tags[i].c_str()) ||
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1574 content_.find(tag) != content_.end())
2863
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1575 {
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1576 throw OrthancException(ErrorCode_BadFileFormat);
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1577 }
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1578
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3690
diff changeset
1579 std::unique_ptr<DicomValue> value(new DicomValue);
2863
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1580 value->Unserialize(source[tags[i]]);
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1581
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1582 content_[tag] = value.release();
2863
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1583 }
da12ba232119 serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2804
diff changeset
1584 }
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1585
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1586
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1587 void DicomMap::FromDicomWeb(const Json::Value& source)
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1588 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1589 static const char* const ALPHABETIC = "Alphabetic";
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1590 static const char* const IDEOGRAPHIC = "Ideographic";
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1591 static const char* const INLINE_BINARY = "InlineBinary";
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1592 static const char* const PHONETIC = "Phonetic";
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1593 static const char* const VALUE = "Value";
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1594 static const char* const VR = "vr";
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1595
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1596 Clear();
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1597
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1598 if (source.type() != Json::objectValue)
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1599 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1600 throw OrthancException(ErrorCode_BadFileFormat);
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1601 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1602
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1603 Json::Value::Members tags = source.getMemberNames();
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1604
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1605 for (size_t i = 0; i < tags.size(); i++)
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1606 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1607 const Json::Value& item = source[tags[i]];
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1608 DicomTag tag(0, 0);
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1609
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1610 if (item.type() != Json::objectValue ||
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1611 !item.isMember(VR) ||
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1612 item[VR].type() != Json::stringValue ||
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1613 !DicomTag::ParseHexadecimal(tag, tags[i].c_str()))
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1614 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1615 throw OrthancException(ErrorCode_BadFileFormat);
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1616 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1617
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1618 ValueRepresentation vr = StringToValueRepresentation(item[VR].asString(), false);
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1619
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1620 if (item.isMember(INLINE_BINARY))
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1621 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1622 const Json::Value& value = item[INLINE_BINARY];
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1623
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1624 if (value.type() == Json::stringValue)
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1625 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1626 std::string decoded;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1627 Toolbox::DecodeBase64(decoded, value.asString());
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1628 SetValue(tag, decoded, true /* binary data */);
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1629 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1630 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1631 else if (!item.isMember(VALUE))
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1632 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1633 // Tag is present, but it has a null value
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1634 SetValue(tag, "", false /* not binary */);
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1635 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1636 else
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1637 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1638 const Json::Value& value = item[VALUE];
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1639
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1640 if (value.type() == Json::arrayValue)
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1641 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1642 bool supported = true;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1643
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1644 std::string s;
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1645 for (Json::Value::ArrayIndex j = 0; j < value.size() && supported; j++)
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1646 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1647 if (!s.empty())
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1648 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1649 s += '\\';
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1650 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1651
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1652 switch (value[j].type())
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1653 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1654 case Json::objectValue:
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1655 if (vr == ValueRepresentation_PersonName &&
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1656 value[j].type() == Json::objectValue)
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1657 {
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1658 if (value[j].isMember(ALPHABETIC) &&
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1659 value[j][ALPHABETIC].type() == Json::stringValue)
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1660 {
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1661 s += value[j][ALPHABETIC].asString();
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1662 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1663
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1664 bool hasIdeographic = false;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1665
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1666 if (value[j].isMember(IDEOGRAPHIC) &&
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1667 value[j][IDEOGRAPHIC].type() == Json::stringValue)
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1668 {
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1669 s += '=' + value[j][IDEOGRAPHIC].asString();
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1670 hasIdeographic = true;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1671 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1672
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1673 if (value[j].isMember(PHONETIC) &&
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1674 value[j][PHONETIC].type() == Json::stringValue)
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1675 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1676 if (!hasIdeographic)
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1677 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1678 s += '=';
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1679 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1680
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1681 s += '=' + value[j][PHONETIC].asString();
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1682 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1683 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1684 else
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1685 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1686 // This is the case of sequences
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1687 supported = false;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1688 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1689
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1690 break;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1691
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1692 case Json::stringValue:
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1693 s += value[j].asString();
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1694 break;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1695
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1696 case Json::intValue:
4788
b47ee86a0d10 support 64 bit integers in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4501
diff changeset
1697 s += boost::lexical_cast<std::string>(value[j].asInt64());
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1698 break;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1699
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1700 case Json::uintValue:
4788
b47ee86a0d10 support 64 bit integers in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4501
diff changeset
1701 s += boost::lexical_cast<std::string>(value[j].asUInt64());
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1702 break;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1703
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1704 case Json::realValue:
4199
fbc49a65340a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
1705 s += boost::lexical_cast<std::string>(value[j].asDouble());
3496
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1706 break;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1707
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1708 default:
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1709 break;
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1710 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1711 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1712
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1713 if (supported)
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1714 {
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1715 SetValue(tag, s, false /* not binary */);
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1716 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1717 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1718 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1719 }
109631ed3564 DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
1720 }
3518
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1721
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1722
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1723 std::string DicomMap::GetStringValue(const DicomTag& tag,
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1724 const std::string& defaultValue,
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1725 bool allowBinary) const
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1726 {
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1727 std::string s;
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1728 if (LookupStringValue(s, tag, allowBinary))
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1729 {
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1730 return s;
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1731 }
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1732 else
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1733 {
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1734 return defaultValue;
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1735 }
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1736 }
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1737
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1738
3551
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1739 void DicomMap::RemoveBinaryTags()
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1740 {
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1741 Content kept;
3551
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1742
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1743 for (Content::iterator it = content_.begin(); it != content_.end(); ++it)
3551
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1744 {
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1745 assert(it->second != NULL);
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1746
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1747 if (!it->second->IsBinary() &&
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1748 !it->second->IsNull())
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1749 {
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1750 kept[it->first] = it->second;
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1751 }
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1752 else
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1753 {
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1754 delete it->second;
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1755 }
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1756 }
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1757
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1758 content_ = kept;
3551
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1759 }
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1760
173c7f363d8f DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3518
diff changeset
1761
5044
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1762 void DicomMap::RemoveSequences()
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1763 {
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1764 Content kept;
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1765
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1766 for (Content::iterator it = content_.begin(); it != content_.end(); ++it)
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1767 {
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1768 assert(it->second != NULL);
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1769
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1770 if (!it->second->IsSequence())
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1771 {
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1772 kept[it->first] = it->second;
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1773 }
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1774 else
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1775 {
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1776 delete it->second;
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1777 }
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1778 }
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1779
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1780 content_ = kept;
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1781 }
6fed78e13233 Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents: 5040
diff changeset
1782
3650
e5811a9f8df0 removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1783 void DicomMap::DumpMainDicomTags(Json::Value& target,
e5811a9f8df0 removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1784 ResourceType level) const
e5811a9f8df0 removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1785 {
5177
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
1786 std::set<DicomTag> mainDicomTags;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5176
diff changeset
1787 DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(mainDicomTags, level);
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1788
3650
e5811a9f8df0 removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1789 target = Json::objectValue;
e5811a9f8df0 removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1790
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1791 for (Content::const_iterator it = content_.begin(); it != content_.end(); ++it)
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1792 {
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1793 assert(it->second != NULL);
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1794
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1795 if (!it->second->IsBinary() &&
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1796 !it->second->IsNull())
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1797 {
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1798 std::set<DicomTag>::const_iterator found = mainDicomTags.find(it->first);
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1799
4932
b7ce2bb6b881 refactored the list of MainDicomTags to be able to change it dynamicaly. Unit tests and Integration tests ok
Alain Mazy <am@osimis.io>
parents: 4870
diff changeset
1800 if (found != mainDicomTags.end())
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1801 {
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1802 #if ORTHANC_ENABLE_DCMTK == 1
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1803 target[FromDcmtkBridge::GetTagName(*found, "")] = it->second->GetContent();
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1804 #else
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1805 target[found->Format()] = it->second->GetContent();
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1806 #endif
3651
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1807 }
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1808 }
46cb00e4adbb DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3650
diff changeset
1809 }
3650
e5811a9f8df0 removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1810 }
e5811a9f8df0 removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1811
e5811a9f8df0 removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1812
5323
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1813 ValueRepresentation DicomMap::GuessPixelDataValueRepresentation(DicomTransferSyntax transferSyntax) const
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1814 {
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1815 const DicomValue* value = TestAndGetValue(DICOM_TAG_BITS_ALLOCATED);
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1816
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1817 uint32_t bitsAllocated;
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1818 if (value == NULL ||
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1819 !value->ParseUnsignedInteger32(bitsAllocated))
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1820 {
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1821 bitsAllocated = 8;
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1822 }
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1823
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1824 return DicomImageInformation::GuessPixelDataValueRepresentation(transferSyntax, bitsAllocated);
138e9d0c08c1 added DicomMap::GuessPixelDataValueRepresentation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
1825 }
5040
1c08cd68250a removed the 'name' of MainDicomTags to simplify code -> DicomMap::ParseMainDicomTags has been deprecated and one should use DicomMap::FromDicomAsJson on 'full' formatted tags
Alain Mazy <am@osimis.io>
parents: 5038
diff changeset
1826
3650
e5811a9f8df0 removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
1827
3518
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1828 void DicomMap::Print(FILE* fp) const
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1829 {
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1830 DicomArray a(*this);
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1831 a.Print(fp);
a57c8163d9ae DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3498
diff changeset
1832 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1833 }