Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomFormat/DicomMap.cpp @ 5236:5e0db9eac1f8 db-protobuf
integration mainline->db-protobuf
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Apr 2023 21:43:37 +0200 |
parents | 0ea402b4d901 |
children | 138e9d0c08c1 |
rev | line source |
---|---|
0 | 1 /** |
59 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 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 |
5185
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5180
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
0ea402b4d901
upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5180
diff
changeset
|
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
0 | 7 * |
8 * 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
|
9 * 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
|
10 * 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
|
11 * the License, or (at your option) any later version. |
136 | 12 * |
0 | 13 * This program is distributed in the hope that it will be useful, but |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * 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
|
16 * Lesser General Public License for more details. |
0 | 17 * |
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
|
18 * 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
|
19 * 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
|
20 * <http://www.gnu.org/licenses/>. |
0 | 21 **/ |
22 | |
23 | |
824
a811bdf8b8eb
precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
24 #include "../PrecompiledHeaders.h" |
0 | 25 #include "DicomMap.h" |
26 | |
27 #include <stdio.h> | |
28 #include <memory> | |
4933 | 29 #include <boost/algorithm/string/join.hpp> |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
30 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3690
diff
changeset
|
31 #include "../Compatibility.h" |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
32 #include "../Endianness.h" |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
33 #include "../Logging.h" |
59 | 34 #include "../OrthancException.h" |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
35 #include "../Toolbox.h" |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
36 #include "DicomArray.h" |
5038
f8bea9c1c0fc
reduce dependencies to DCMTK (e.g. for plugins)
Alain Mazy <am@osimis.io>
parents:
5036
diff
changeset
|
37 |
f8bea9c1c0fc
reduce dependencies to DCMTK (e.g. for plugins)
Alain Mazy <am@osimis.io>
parents:
5036
diff
changeset
|
38 #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
|
39 #include "../DicomParsing/FromDcmtkBridge.h" |
5038
f8bea9c1c0fc
reduce dependencies to DCMTK (e.g. for plugins)
Alain Mazy <am@osimis.io>
parents:
5036
diff
changeset
|
40 #endif |
0 | 41 |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
42 #if !defined(__EMSCRIPTEN__) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
43 // 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
|
44 # 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
|
45 #endif |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
46 |
59 | 47 namespace Orthanc |
0 | 48 { |
4933 | 49 // WARNING: the DEFAULT list of main dicom tags below are the list as they |
50 // were in Orthanc 1.10 before we introduced the dynamic main dicom tags. | |
51 // This list has not changed since Orthanc 1.4.2 and had a single change since | |
52 // Orthanc 0.9.5. | |
53 // These lists have a specific signature. When a resource does not have | |
54 // the metadata "MainDicomTagsSignature", we'll assume that they were stored | |
55 // with an Orthanc prior to 1.11. It is therefore very important that you never | |
56 // change these lists ! | |
57 | |
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
|
58 static const DicomTag DEFAULT_PATIENT_MAIN_DICOM_TAGS[] = |
0 | 59 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
60 // { DicomTag(0x0010, 0x1010), "PatientAge" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
61 // { 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
|
62 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
|
63 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
|
64 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
|
65 DICOM_TAG_OTHER_PATIENT_IDS, |
5177 | 66 DICOM_TAG_PATIENT_ID |
0 | 67 }; |
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
|
68 |
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
|
69 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
|
70 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
71 // { DicomTag(0x0010, 0x1020), "PatientSize" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
72 // { 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 DICOM_TAG_STUDY_INSTANCE_UID, |
5179
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5178
diff
changeset
|
79 |
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5178
diff
changeset
|
80 // 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
|
81 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
|
82 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
|
83 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
|
84 DICOM_TAG_REFERRING_PHYSICIAN_NAME |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
85 }; |
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
|
86 |
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
|
87 static const DicomTag DEFAULT_SERIES_MAIN_DICOM_TAGS[] = |
0 | 88 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
89 // { 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 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
|
106 |
5179
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5178
diff
changeset
|
107 // 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
|
108 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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 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
|
114 }; |
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 |
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 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
|
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 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
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 DICOM_TAG_SOP_INSTANCE_UID, |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
126 |
5179
1e406c23b352
added unit test DicomMap.SetupFindTemplates
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5178
diff
changeset
|
127 // 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
|
128 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
|
129 DICOM_TAG_IMAGE_COMMENTS, |
2804
d88970f1ffbf
fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
130 |
d88970f1ffbf
fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
131 /** |
d88970f1ffbf
fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
132 * 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
|
133 * 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
|
134 * 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
|
135 * 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
|
136 * 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
|
137 **/ |
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
|
138 DICOM_TAG_IMAGE_ORIENTATION_PATIENT // New in Orthanc 1.4.2 |
0 | 139 }; |
140 | |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
141 class DicomMap::MainDicomTagsConfiguration : public boost::noncopyable |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
142 { |
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
|
143 private: |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
144 #if !defined(__EMSCRIPTEN__) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
145 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
|
146 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
|
147 |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
148 boost::shared_mutex mutex_; |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
149 #endif |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
150 |
5177 | 151 std::set<DicomTag> patientsMainDicomTagsByLevel_; |
152 std::set<DicomTag> studiesMainDicomTagsByLevel_; | |
153 std::set<DicomTag> seriesMainDicomTagsByLevel_; | |
154 std::set<DicomTag> instancesMainDicomTagsByLevel_; | |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
155 |
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
|
156 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
|
157 |
4933 | 158 std::map<ResourceType, std::string> signatures_; |
159 std::map<ResourceType, std::string> defaultSignatures_; | |
160 | |
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
|
161 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
|
162 { |
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 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
|
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 |
4933 | 166 std::string ComputeSignature(const std::set<DicomTag>& tags) |
167 { | |
168 // std::set are sorted by default (which is important for us !) | |
169 std::set<std::string> tagsIds; | |
4981 | 170 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it) |
4933 | 171 { |
172 tagsIds.insert(it->Format()); | |
173 } | |
174 | |
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
|
175 std::string signatureText = boost::algorithm::join(tagsIds, ";"); |
4933 | 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 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
|
178 } |
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
|
179 |
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 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
|
181 { |
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
|
182 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
|
183 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
|
184 |
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 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
|
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 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
|
188 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
|
189 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
|
190 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
|
191 |
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 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
|
193 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
|
194 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
|
195 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
|
196 |
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 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
|
198 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
|
199 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
|
200 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
|
201 |
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 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
|
203 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
|
204 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
|
205 break; |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
206 |
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 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
|
208 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
|
209 } |
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 |
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 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
|
212 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
|
213 |
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 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
|
215 { |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
216 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
|
217 } |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
218 } |
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
219 |
5177 | 220 std::set<DicomTag>& GetMainDicomTagsByLevelInternal(ResourceType level) |
221 { | |
222 switch (level) | |
223 { | |
224 case ResourceType_Patient: | |
225 return patientsMainDicomTagsByLevel_; | |
226 | |
227 case ResourceType_Study: | |
228 return studiesMainDicomTagsByLevel_; | |
229 | |
230 case ResourceType_Series: | |
231 return seriesMainDicomTagsByLevel_; | |
232 | |
233 case ResourceType_Instance: | |
234 return instancesMainDicomTagsByLevel_; | |
235 | |
236 default: | |
237 throw OrthancException(ErrorCode_InternalError); | |
238 } | |
239 } | |
240 | |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
241 void AddMainDicomTagInternal(const DicomTag& tag, |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
242 ResourceType level) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
243 { |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
244 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
|
245 |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
246 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
|
247 { |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
248 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
|
249 } |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
250 |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
251 existingLevelTags.insert(tag); |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
252 allMainDicomTags_.insert(tag); |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
253 |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
254 signatures_[level] = ComputeSignature(GetMainDicomTagsByLevelInternal(level)); |
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 |
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
|
257 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
|
258 // 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
|
259 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
|
260 { |
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 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
|
262 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
|
263 } |
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 |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
265 void ResetDefaultMainDicomTags() |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
266 { |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
267 #if !defined(__EMSCRIPTEN__) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
268 WriterLock lock(mutex_); |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
269 #endif |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
270 |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
271 patientsMainDicomTagsByLevel_.clear(); |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
272 studiesMainDicomTagsByLevel_.clear(); |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
273 seriesMainDicomTagsByLevel_.clear(); |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
274 instancesMainDicomTagsByLevel_.clear(); |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
275 |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
276 allMainDicomTags_.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 // 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
|
279 LoadDefaultMainDicomTags(ResourceType_Patient); |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
280 LoadDefaultMainDicomTags(ResourceType_Study); |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
281 LoadDefaultMainDicomTags(ResourceType_Series); |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
282 LoadDefaultMainDicomTags(ResourceType_Instance); |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
283 |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
284 defaultSignatures_[ResourceType_Patient] = signatures_[ResourceType_Patient]; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
285 defaultSignatures_[ResourceType_Study] = signatures_[ResourceType_Study]; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
286 defaultSignatures_[ResourceType_Series] = signatures_[ResourceType_Series]; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
287 defaultSignatures_[ResourceType_Instance] = signatures_[ResourceType_Instance]; |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
288 } |
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
289 |
5177 | 290 void AddMainDicomTag(const DicomTag& tag, |
291 ResourceType level) | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
292 { |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
293 #if !defined(__EMSCRIPTEN__) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
294 WriterLock lock(mutex_); |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
295 #endif |
4982
40fd2a485a84
fix build for older compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4981
diff
changeset
|
296 |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
297 AddMainDicomTagInternal(tag, level); |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
298 } |
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
|
299 |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
300 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
|
301 { |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
302 #if !defined(__EMSCRIPTEN__) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
303 ReaderLock lock(mutex_); |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
304 #endif |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
305 |
5177 | 306 target = allMainDicomTags_; |
307 } | |
308 | |
309 void GetMainDicomTagsByLevel(std::set<DicomTag>& target, | |
310 ResourceType level) | |
311 { | |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
312 #if !defined(__EMSCRIPTEN__) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
313 ReaderLock lock(mutex_); |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
314 #endif |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
315 |
5177 | 316 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
|
317 } |
4933 | 318 |
5176 | 319 std::string GetMainDicomTagsSignature(ResourceType level) |
4933 | 320 { |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
321 #if !defined(__EMSCRIPTEN__) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
322 ReaderLock lock(mutex_); |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
323 #endif |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
324 |
4933 | 325 assert(signatures_.find(level) != signatures_.end()); |
326 return signatures_[level]; | |
327 } | |
328 | |
5176 | 329 std::string GetDefaultMainDicomTagsSignature(ResourceType level) |
4933 | 330 { |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
331 #if !defined(__EMSCRIPTEN__) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
332 ReaderLock lock(mutex_); |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
333 #endif |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
334 |
4933 | 335 assert(defaultSignatures_.find(level) != defaultSignatures_.end()); |
336 return defaultSignatures_[level]; | |
337 } | |
338 | |
5177 | 339 bool IsMainDicomTag(const DicomTag& tag) |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
340 { |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
341 #if !defined(__EMSCRIPTEN__) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
342 ReaderLock lock(mutex_); |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
343 #endif |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
344 |
5177 | 345 return allMainDicomTags_.find(tag) != allMainDicomTags_.end(); |
346 } | |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
347 |
5177 | 348 bool IsMainDicomTag(const DicomTag& tag, |
349 ResourceType level) | |
350 { | |
5178
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
351 #if !defined(__EMSCRIPTEN__) |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
352 ReaderLock lock(mutex_); |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
353 #endif |
02c7e4aa7946
internal class DicomMap::MainDicomTagsConfiguration is now thread-safe
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5177
diff
changeset
|
354 |
5177 | 355 const std::set<DicomTag>& mainDicomTags = GetMainDicomTagsByLevelInternal(level); |
356 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
|
357 } |
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
|
358 }; |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
359 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
360 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
361 void DicomMap::SetValueInternal(uint16_t group, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
362 uint16_t element, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
363 DicomValue* value) |
0 | 364 { |
365 DicomTag tag(group, element); | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
366 Content::iterator it = content_.find(tag); |
0 | 367 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
368 if (it != content_.end()) |
0 | 369 { |
370 delete it->second; | |
371 it->second = value; | |
372 } | |
373 else | |
374 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
375 content_.insert(std::make_pair(tag, value)); |
0 | 376 } |
377 } | |
378 | |
379 | |
380 void DicomMap::Clear() | |
381 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
382 for (Content::iterator it = content_.begin(); it != content_.end(); ++it) |
0 | 383 { |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
384 assert(it->second != NULL); |
0 | 385 delete it->second; |
386 } | |
387 | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
388 content_.clear(); |
0 | 389 } |
390 | |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
391 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
|
392 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
393 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
|
394 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
395 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
396 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
|
397 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
398 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
|
399 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
400 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
401 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
|
402 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
403 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
|
404 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
405 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
406 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
|
407 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
408 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
|
409 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
410 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
411 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
|
412 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
413 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
|
414 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
415 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
416 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
|
417 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
418 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
|
419 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
420 |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
421 void DicomMap::SetValue(const DicomTag& tag, const Json::Value& value) |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
422 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
423 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
|
424 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
425 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
426 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
|
427 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
428 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
|
429 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
430 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
431 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
|
432 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
433 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
|
434 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
435 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
436 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
|
437 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
438 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
|
439 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
440 |
0 | 441 |
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
|
442 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
|
443 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
|
444 const std::set<DicomTag>& mainDicomTags) |
0 | 445 { |
446 result.Clear(); | |
447 | |
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
|
448 for (std::set<DicomTag>::const_iterator itmt = mainDicomTags.begin(); |
4981 | 449 itmt != mainDicomTags.end(); ++itmt) |
0 | 450 { |
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
|
451 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
|
452 if (it != source.end()) |
0 | 453 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
454 result.SetValue(it->first, *it->second /* value will be cloned */); |
0 | 455 } |
456 } | |
457 } | |
458 | |
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
|
459 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
|
460 { |
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 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
|
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 for (std::set<DicomTag>::const_iterator itmt = tags.begin(); |
4981 | 464 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
|
465 { |
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
|
466 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
|
467 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
|
468 { |
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 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
|
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 } |
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 |
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
|
474 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
|
475 { |
5177 | 476 std::set<DicomTag> mainDicomTags; |
477 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
|
478 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
|
479 } |
0 | 480 |
481 void DicomMap::ExtractPatientInformation(DicomMap& result) const | |
482 { | |
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
|
483 ExtractResourceInformation(result, ResourceType_Patient); |
0 | 484 } |
485 | |
486 void DicomMap::ExtractStudyInformation(DicomMap& result) const | |
487 { | |
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
|
488 ExtractResourceInformation(result, ResourceType_Study); |
0 | 489 } |
490 | |
491 void DicomMap::ExtractSeriesInformation(DicomMap& result) const | |
492 { | |
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
|
493 ExtractResourceInformation(result, ResourceType_Series); |
0 | 494 } |
495 | |
496 void DicomMap::ExtractInstanceInformation(DicomMap& result) const | |
497 { | |
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
|
498 ExtractResourceInformation(result, ResourceType_Instance); |
0 | 499 } |
500 | |
501 | |
4297 | 502 DicomMap::~DicomMap() |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
503 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
504 Clear(); |
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 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
507 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
|
508 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
509 return content_.size(); |
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 |
80 | 512 |
0 | 513 DicomMap* DicomMap::Clone() const |
514 { | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3690
diff
changeset
|
515 std::unique_ptr<DicomMap> result(new DicomMap); |
0 | 516 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
517 for (Content::const_iterator it = content_.begin(); it != content_.end(); ++it) |
0 | 518 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
519 result->content_.insert(std::make_pair(it->first, it->second->Clone())); |
0 | 520 } |
521 | |
522 return result.release(); | |
523 } | |
524 | |
525 | |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
526 void DicomMap::Assign(const DicomMap& other) |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
527 { |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
528 Clear(); |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
529 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
530 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
|
531 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
532 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
|
533 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
534 } |
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 |
0 | 537 const DicomValue& DicomMap::GetValue(const DicomTag& tag) const |
538 { | |
80 | 539 const DicomValue* value = TestAndGetValue(tag); |
540 | |
541 if (value) | |
542 { | |
543 return *value; | |
544 } | |
545 else | |
546 { | |
730
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
547 throw OrthancException(ErrorCode_InexistentTag); |
80 | 548 } |
549 } | |
550 | |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
551 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
|
552 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
553 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
|
554 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
555 |
80 | 556 |
557 const DicomValue* DicomMap::TestAndGetValue(const DicomTag& tag) const | |
558 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
559 Content::const_iterator it = content_.find(tag); |
0 | 560 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
561 if (it == content_.end()) |
0 | 562 { |
80 | 563 return NULL; |
0 | 564 } |
565 else | |
566 { | |
80 | 567 return it->second; |
0 | 568 } |
569 } | |
570 | |
571 | |
572 void DicomMap::Remove(const DicomTag& tag) | |
573 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
574 Content::iterator it = content_.find(tag); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
575 if (it != content_.end()) |
0 | 576 { |
577 delete it->second; | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
578 content_.erase(it); |
0 | 579 } |
580 } | |
581 | |
5036
877bc3b96476
Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
582 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
|
583 { |
877bc3b96476
Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
584 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
|
585 { |
877bc3b96476
Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
586 Remove(*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 } |
0 | 589 |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
590 void DicomMap::SetupFindPatientTemplate(DicomMap& result) |
0 | 591 { |
592 result.Clear(); | |
593 | |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
594 // Identifying tags |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
595 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); |
0 | 596 |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
597 // Other tags in the "Patient" module |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
598 result.SetValue(DICOM_TAG_OTHER_PATIENT_IDS, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
599 result.SetValue(DICOM_TAG_PATIENT_BIRTH_DATE, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
600 result.SetValue(DICOM_TAG_PATIENT_NAME, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
601 result.SetValue(DICOM_TAG_PATIENT_SEX, "", false); |
0 | 602 } |
603 | |
604 void DicomMap::SetupFindStudyTemplate(DicomMap& result) | |
605 { | |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
606 result.Clear(); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
607 |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
608 // Identifying tags |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
609 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
610 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
611 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1841
diff
changeset
|
612 |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
613 // Other tags in the "General Study" module |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
614 result.SetValue(DICOM_TAG_REFERRING_PHYSICIAN_NAME, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
615 result.SetValue(DICOM_TAG_STUDY_DATE, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
616 result.SetValue(DICOM_TAG_STUDY_DESCRIPTION, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
617 result.SetValue(DICOM_TAG_STUDY_ID, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
618 result.SetValue(DICOM_TAG_STUDY_TIME, "", false); |
0 | 619 } |
620 | |
621 void DicomMap::SetupFindSeriesTemplate(DicomMap& result) | |
622 { | |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
623 result.Clear(); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
624 |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
625 // Identifying tags |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
626 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
627 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
628 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
629 result.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "", false); |
1372 | 630 |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
631 // Other tags in the "General Series" module |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
632 result.SetValue(DICOM_TAG_BODY_PART_EXAMINED, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
633 result.SetValue(DICOM_TAG_MODALITY, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
634 result.SetValue(DICOM_TAG_OPERATOR_NAME, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
635 result.SetValue(DICOM_TAG_PERFORMED_PROCEDURE_STEP_DESCRIPTION, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
636 result.SetValue(DICOM_TAG_PROTOCOL_NAME, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
637 result.SetValue(DICOM_TAG_SERIES_DATE, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
638 result.SetValue(DICOM_TAG_SERIES_DESCRIPTION, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
639 result.SetValue(DICOM_TAG_SERIES_NUMBER, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
640 result.SetValue(DICOM_TAG_SERIES_TIME, "", false); |
0 | 641 } |
642 | |
643 void DicomMap::SetupFindInstanceTemplate(DicomMap& result) | |
644 { | |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
645 result.Clear(); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
646 |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
647 // Identifying tags |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
648 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
649 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
650 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
651 result.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "", false); |
5180
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
652 result.SetValue(DICOM_TAG_SOP_INSTANCE_UID, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
653 |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
654 // Other tags in the "SOP Common" module |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
655 result.SetValue(DICOM_TAG_ACQUISITION_NUMBER, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
656 result.SetValue(DICOM_TAG_IMAGE_COMMENTS, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
657 result.SetValue(DICOM_TAG_IMAGE_INDEX, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
658 result.SetValue(DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
659 result.SetValue(DICOM_TAG_IMAGE_POSITION_PATIENT, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
660 result.SetValue(DICOM_TAG_INSTANCE_CREATION_DATE, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
661 result.SetValue(DICOM_TAG_INSTANCE_CREATION_TIME, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
662 result.SetValue(DICOM_TAG_INSTANCE_NUMBER, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
663 result.SetValue(DICOM_TAG_NUMBER_OF_FRAMES, "", false); |
d2626a062809
fix DicomMap::SetupFindXXXTemplate() methods
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5179
diff
changeset
|
664 result.SetValue(DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER, "", false); |
0 | 665 } |
666 | |
667 | |
668 void DicomMap::CopyTagIfExists(const DicomMap& source, | |
669 const DicomTag& tag) | |
670 { | |
671 if (source.HasTag(tag)) | |
672 { | |
673 SetValue(tag, source.GetValue(tag)); | |
674 } | |
675 } | |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
676 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
677 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
678 bool DicomMap::IsMainDicomTag(const DicomTag& tag, ResourceType level) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
679 { |
5177 | 680 return DicomMap::MainDicomTagsConfiguration::GetInstance().IsMainDicomTag(tag, level); |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
681 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
682 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
683 bool DicomMap::IsMainDicomTag(const DicomTag& tag) |
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 return (IsMainDicomTag(tag, ResourceType_Patient) || |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
686 IsMainDicomTag(tag, ResourceType_Study) || |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
687 IsMainDicomTag(tag, ResourceType_Series) || |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
688 IsMainDicomTag(tag, ResourceType_Instance)); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
689 } |
567 | 690 |
4944
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
691 static bool IsGenericComputedTag(const DicomTag& tag) |
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
692 { |
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
693 return tag == DICOM_TAG_RETRIEVE_URL || |
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
694 tag == DICOM_TAG_RETRIEVE_AE_TITLE; |
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
695 } |
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
696 |
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
|
697 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
|
698 { |
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 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
|
700 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
|
701 IsComputedTag(tag, ResourceType_Series) || |
4944
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
702 IsComputedTag(tag, ResourceType_Instance) || |
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
703 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
|
704 } |
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
|
705 |
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 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
|
707 { |
4944
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
708 |
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
|
709 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
|
710 { |
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 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
|
712 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
|
713 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
|
714 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
|
715 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
|
716 ); |
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 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
|
718 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
|
719 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
|
720 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
|
721 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
|
722 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
|
723 ); |
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 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
|
725 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
|
726 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
|
727 ); |
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 case ResourceType_Instance: |
4944
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
729 return ( |
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
730 tag == DICOM_TAG_INSTANCE_AVAILABILITY |
f377d5643538
new Warnings configuration + InstanceAvailability tag
Alain Mazy <am@osimis.io>
parents:
4940
diff
changeset
|
731 ); |
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
|
732 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
|
733 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
|
734 } |
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 } |
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 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
|
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 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
|
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 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
|
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 |
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 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
|
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 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
|
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 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
|
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 } |
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 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
|
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 |
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 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
|
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 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
|
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 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
|
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 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
|
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 } |
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 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
|
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 |
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 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
|
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 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
|
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 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
|
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 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
|
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 } |
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 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
|
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 |
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 |
5175
48005e522bd6
start fixing thread safety issues with DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5050
diff
changeset
|
780 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
|
781 ResourceType level) |
567 | 782 { |
5177 | 783 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
|
784 } |
567 | 785 |
5176 | 786 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
|
787 { |
5177 | 788 DicomMap::MainDicomTagsConfiguration::GetInstance().GetAllMainDicomTags(target); |
567 | 789 } |
790 | |
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
|
791 void DicomMap::AddMainDicomTag(const DicomTag& tag, ResourceType level) |
567 | 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 DicomMap::MainDicomTagsConfiguration::GetInstance().AddMainDicomTag(tag, level); |
567 | 794 } |
795 | |
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
|
796 void DicomMap::ResetDefaultMainDicomTags() |
567 | 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 DicomMap::MainDicomTagsConfiguration::GetInstance().ResetDefaultMainDicomTags(); |
567 | 799 } |
1206
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
800 |
5176 | 801 std::string DicomMap::GetMainDicomTagsSignature(ResourceType level) |
4933 | 802 { |
803 return DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsSignature(level); | |
804 } | |
805 | |
5176 | 806 std::string DicomMap::GetDefaultMainDicomTagsSignature(ResourceType level) |
4933 | 807 { |
808 return DicomMap::MainDicomTagsConfiguration::GetInstance().GetDefaultMainDicomTagsSignature(level); | |
809 } | |
810 | |
1360 | 811 void DicomMap::GetTags(std::set<DicomTag>& tags) const |
812 { | |
813 tags.clear(); | |
814 | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
815 for (Content::const_iterator it = content_.begin(); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
816 it != content_.end(); ++it) |
1360 | 817 { |
818 tags.insert(it->first); | |
819 } | |
820 } | |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
821 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
822 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
823 static uint16_t ReadLittleEndianUint16(const char* dicom) |
2007
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 const uint8_t* p = reinterpret_cast<const uint8_t*>(dicom); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
826 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
827 return (static_cast<uint16_t>(p[0]) | |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
828 (static_cast<uint16_t>(p[1]) << 8)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
829 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
830 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
831 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
832 static uint32_t ReadLittleEndianUint32(const char* dicom) |
2007
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 const uint8_t* p = reinterpret_cast<const uint8_t*>(dicom); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
835 |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
836 return (static_cast<uint32_t>(p[0]) | |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
837 (static_cast<uint32_t>(p[1]) << 8) | |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
838 (static_cast<uint32_t>(p[2]) << 16) | |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
839 (static_cast<uint32_t>(p[3]) << 24)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
840 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
841 |
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 static bool ValidateTag(const ValueRepresentation& vr, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
844 const std::string& value) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
845 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
846 switch (vr) |
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 case ValueRepresentation_ApplicationEntity: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
849 return value.size() <= 16; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
850 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
851 case ValueRepresentation_AgeString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
852 return (value.size() == 4 && |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
853 isdigit(value[0]) && |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
854 isdigit(value[1]) && |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
855 isdigit(value[2]) && |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
856 (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
|
857 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
858 case ValueRepresentation_AttributeTag: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
859 return value.size() == 4; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
860 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
861 case ValueRepresentation_CodeString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
862 return value.size() <= 16; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
863 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
864 case ValueRepresentation_Date: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
865 return value.size() <= 18; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
866 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
867 case ValueRepresentation_DecimalString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
868 return value.size() <= 16; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
869 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
870 case ValueRepresentation_DateTime: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
871 return value.size() <= 54; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
872 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
873 case ValueRepresentation_FloatingPointSingle: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
874 return value.size() == 4; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
875 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
876 case ValueRepresentation_FloatingPointDouble: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
877 return value.size() == 8; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
878 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
879 case ValueRepresentation_IntegerString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
880 return value.size() <= 12; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
881 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
882 case ValueRepresentation_LongString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
883 return value.size() <= 64; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
884 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
885 case ValueRepresentation_LongText: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
886 return value.size() <= 10240; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
887 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
888 case ValueRepresentation_OtherByte: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
889 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
890 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
891 case ValueRepresentation_OtherDouble: |
2013 | 892 return value.size() <= (static_cast<uint64_t>(1) << 32) - 8; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
893 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
894 case ValueRepresentation_OtherFloat: |
2013 | 895 return value.size() <= (static_cast<uint64_t>(1) << 32) - 4; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
896 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
897 case ValueRepresentation_OtherLong: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
898 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
899 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
900 case ValueRepresentation_OtherWord: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
901 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
902 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
903 case ValueRepresentation_PersonName: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
904 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
905 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
906 case ValueRepresentation_ShortString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
907 return value.size() <= 16; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
908 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
909 case ValueRepresentation_SignedLong: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
910 return value.size() == 4; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
911 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
912 case ValueRepresentation_Sequence: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
913 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
914 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
915 case ValueRepresentation_SignedShort: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
916 return value.size() == 2; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
917 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
918 case ValueRepresentation_ShortText: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
919 return value.size() <= 1024; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
920 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
921 case ValueRepresentation_Time: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
922 return value.size() <= 28; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
923 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
924 case ValueRepresentation_UnlimitedCharacters: |
2013 | 925 return value.size() <= (static_cast<uint64_t>(1) << 32) - 2; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
926 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
927 case ValueRepresentation_UniqueIdentifier: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
928 return value.size() <= 64; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
929 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
930 case ValueRepresentation_UnsignedLong: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
931 return value.size() == 4; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
932 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
933 case ValueRepresentation_Unknown: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
934 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
935 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
936 case ValueRepresentation_UniversalResource: |
2013 | 937 return value.size() <= (static_cast<uint64_t>(1) << 32) - 2; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
938 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
939 case ValueRepresentation_UnsignedShort: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
940 return value.size() == 2; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
941 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
942 case ValueRepresentation_UnlimitedText: |
2013 | 943 return value.size() <= (static_cast<uint64_t>(1) << 32) - 2; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
944 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
945 default: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
946 // Assume unsupported tags are OK |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
947 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
948 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
949 } |
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 static void RemoveTagPadding(std::string& value, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
953 const ValueRepresentation& vr) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
954 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
955 /** |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
956 * Remove padding from character strings, if need be. For the time |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
957 * being, only the UI VR is supported. |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
958 * 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
|
959 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
960 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
961 switch (vr) |
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 case ValueRepresentation_UniqueIdentifier: |
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 /** |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
966 * "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
|
967 * trailing NULL (00H) character when necessary to achieve even |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
968 * length." |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
969 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
970 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
971 if (!value.empty() && |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
972 value[value.size() - 1] == '\0') |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
973 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
974 value.resize(value.size() - 1); |
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 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
977 break; |
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 |
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 * TODO implement other VR |
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 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
984 default: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
985 // No padding is applicable to this VR |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
986 break; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
987 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
988 } |
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 static bool ReadNextTag(DicomTag& tag, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
992 ValueRepresentation& vr, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
993 std::string& value, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
994 const char* dicom, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
995 size_t size, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
996 size_t& position) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
997 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
998 /** |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
999 * 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
|
1000 * 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
|
1001 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1002 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1003 if (position + 6 > size) |
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 return false; |
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 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1008 tag = DicomTag(ReadLittleEndianUint16(dicom + position), |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1009 ReadLittleEndianUint16(dicom + position + 2)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1010 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1011 vr = StringToValueRepresentation(std::string(dicom + position + 4, 2), true); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1012 if (vr == ValueRepresentation_NotSupported) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1013 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1014 return false; |
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 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1017 // 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
|
1018 if (vr == ValueRepresentation_ApplicationEntity /* AE */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1019 vr == ValueRepresentation_AgeString /* AS */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1020 vr == ValueRepresentation_AttributeTag /* AT */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1021 vr == ValueRepresentation_CodeString /* CS */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1022 vr == ValueRepresentation_Date /* DA */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1023 vr == ValueRepresentation_DecimalString /* DS */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1024 vr == ValueRepresentation_DateTime /* DT */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1025 vr == ValueRepresentation_FloatingPointSingle /* FL */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1026 vr == ValueRepresentation_FloatingPointDouble /* FD */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1027 vr == ValueRepresentation_IntegerString /* IS */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1028 vr == ValueRepresentation_LongString /* LO */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1029 vr == ValueRepresentation_LongText /* LT */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1030 vr == ValueRepresentation_PersonName /* PN */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1031 vr == ValueRepresentation_ShortString /* SH */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1032 vr == ValueRepresentation_SignedLong /* SL */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1033 vr == ValueRepresentation_SignedShort /* SS */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1034 vr == ValueRepresentation_ShortText /* ST */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1035 vr == ValueRepresentation_Time /* TM */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1036 vr == ValueRepresentation_UniqueIdentifier /* UI */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1037 vr == ValueRepresentation_UnsignedLong /* UL */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1038 vr == ValueRepresentation_UnsignedShort /* US */) |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1039 { |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1040 /** |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1041 * 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
|
1042 * 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
|
1043 * ST, TM, UI, UL and US" |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1044 **/ |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1045 if (position + 8 > size) |
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 return false; |
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 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1050 uint16_t length = ReadLittleEndianUint16(dicom + position + 6); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1051 if (position + 8 + length > size) |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1052 { |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1053 return false; |
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 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1056 value.assign(dicom + position + 8, length); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1057 position += (8 + length); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1058 } |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1059 else |
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 /** |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1062 * 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
|
1063 * than as shown in Table 7.1-2" |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1064 **/ |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1065 if (position + 12 > size) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1066 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1067 return false; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1068 } |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1069 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1070 uint16_t reserved = ReadLittleEndianUint16(dicom + position + 6); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1071 if (reserved != 0) |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1072 { |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1073 return false; |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1074 } |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1075 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1076 uint32_t length = ReadLittleEndianUint32(dicom + position + 8); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1077 if (position + 12 + length > size) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1078 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1079 return false; |
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 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1082 value.assign(dicom + position + 12, length); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1083 position += (12 + length); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1084 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1085 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1086 if (!ValidateTag(vr, value)) |
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 return false; |
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 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1091 RemoveTagPadding(value, vr); |
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 return true; |
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 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1096 |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
1097 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
|
1098 size_t size) |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1099 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1100 /** |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1101 * 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
|
1102 * 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
|
1103 * 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
|
1104 * 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
|
1105 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1106 |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
1107 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
|
1108 |
3771
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1109 return (size >= 132 && |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
1110 p[128] == 'D' && |
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
1111 p[129] == 'I' && |
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
1112 p[130] == 'C' && |
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
1113 p[131] == 'M'); |
3771
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1114 } |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1115 |
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 bool DicomMap::ParseDicomMetaInformation(DicomMap& result, |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
1118 const void* dicom, |
3771
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1119 size_t size) |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1120 { |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1121 if (!IsDicomFile(dicom, size)) |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1122 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1123 return false; |
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 |
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 * The DICOM File Meta Information must be encoded using the |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1129 * Explicit VR Little Endian Transfer Syntax |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1130 * (UID=1.2.840.10008.1.2.1). |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1131 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1132 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1133 result.Clear(); |
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 // First, we read the "File Meta Information Group Length" tag |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1136 // (0002,0000) to know where to stop reading the meta header |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1137 size_t position = 132; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1138 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1139 DicomTag tag(0x0000, 0x0000); // Dummy initialization |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1140 ValueRepresentation vr; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1141 std::string value; |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
1142 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
|
1143 tag.GetGroup() != 0x0002 || |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1144 tag.GetElement() != 0x0000 || |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1145 vr != ValueRepresentation_UnsignedLong || |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1146 value.size() != 4) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1147 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1148 return false; |
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 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
1151 size_t stopPosition = position + ReadLittleEndianUint32(value.c_str()); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1152 if (stopPosition > size) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1153 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1154 return false; |
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 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1157 while (position < stopPosition) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1158 { |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
1159 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
|
1160 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1161 result.SetValue(tag, value, IsBinaryValueRepresentation(vr)); |
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 else |
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 return false; |
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 } |
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 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
1170 } |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1171 |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1172 |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1173 static std::string ValueAsString(const DicomMap& summary, |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1174 const DicomTag& tag) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1175 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1176 const DicomValue& value = summary.GetValue(tag); |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1177 if (value.IsNull()) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1178 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1179 return "(null)"; |
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 else |
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 return value.GetContent(); |
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 } |
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 void DicomMap::LogMissingTagsForStore() const |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1189 { |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1190 std::string patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid; |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1191 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1192 if (HasTag(DICOM_TAG_PATIENT_ID)) |
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 patientId = ValueAsString(*this, 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 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1197 if (HasTag(DICOM_TAG_STUDY_INSTANCE_UID)) |
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 studyInstanceUid = ValueAsString(*this, 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 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1202 if (HasTag(DICOM_TAG_SERIES_INSTANCE_UID)) |
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 seriesInstanceUid = ValueAsString(*this, 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 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1207 if (HasTag(DICOM_TAG_SOP_INSTANCE_UID)) |
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 sopInstanceUid = ValueAsString(*this, 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 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1212 LogMissingTagsForStore(patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid); |
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 |
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 void DicomMap::LogMissingTagsForStore(const std::string& patientId, |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1217 const std::string& studyInstanceUid, |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1218 const std::string& seriesInstanceUid, |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1219 const std::string& sopInstanceUid) |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1220 { |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1221 std::string s, t; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1222 |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1223 if (!patientId.empty()) |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1224 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1225 if (t.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1226 t += ", "; |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1227 t += "PatientID=" + patientId; |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1228 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1229 else |
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 if (s.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1232 s += ", "; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1233 s += "PatientID"; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1234 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1235 |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1236 if (!studyInstanceUid.empty()) |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1237 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1238 if (t.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1239 t += ", "; |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1240 t += "StudyInstanceUID=" + studyInstanceUid; |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1241 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1242 else |
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 if (s.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1245 s += ", "; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1246 s += "StudyInstanceUID"; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1247 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1248 |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1249 if (!seriesInstanceUid.empty()) |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1250 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1251 if (t.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1252 t += ", "; |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1253 t += "SeriesInstanceUID=" + seriesInstanceUid; |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1254 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1255 else |
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 if (s.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1258 s += ", "; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1259 s += "SeriesInstanceUID"; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1260 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1261 |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1262 if (!sopInstanceUid.empty()) |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1263 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1264 if (t.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1265 t += ", "; |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1266 t += "SOPInstanceUID=" + sopInstanceUid; |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1267 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1268 else |
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 if (s.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1271 s += ", "; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1272 s += "SOPInstanceUID"; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1273 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1274 |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1275 if (t.size() == 0) |
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 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
|
1278 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1279 else |
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 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
|
1282 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1283 } |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1284 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1285 |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1286 bool DicomMap::LookupStringValue(std::string& result, |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1287 const DicomTag& tag, |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1288 bool allowBinary) const |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1289 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1290 const DicomValue* value = TestAndGetValue(tag); |
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 if (value == NULL) |
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 return false; |
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 else |
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 return value->CopyToString(result, allowBinary); |
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 } |
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 bool DicomMap::ParseInteger32(int32_t& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1303 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1304 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1305 const DicomValue* value = TestAndGetValue(tag); |
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 if (value == NULL) |
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 return false; |
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 else |
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 return value->ParseInteger32(result); |
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 } |
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 bool DicomMap::ParseInteger64(int64_t& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1318 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1319 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1320 const DicomValue* value = TestAndGetValue(tag); |
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 if (value == NULL) |
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 return false; |
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 else |
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 return value->ParseInteger64(result); |
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 } |
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 bool DicomMap::ParseUnsignedInteger32(uint32_t& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1333 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1334 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1335 const DicomValue* value = TestAndGetValue(tag); |
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 if (value == NULL) |
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 return false; |
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 else |
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 return value->ParseUnsignedInteger32(result); |
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 } |
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 bool DicomMap::ParseUnsignedInteger64(uint64_t& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1348 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1349 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1350 const DicomValue* value = TestAndGetValue(tag); |
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 if (value == NULL) |
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 return false; |
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 else |
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 return value->ParseUnsignedInteger64(result); |
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 } |
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 bool DicomMap::ParseFloat(float& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1363 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1364 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1365 const DicomValue* value = TestAndGetValue(tag); |
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 if (value == NULL) |
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 return false; |
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 else |
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 return value->ParseFloat(result); |
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 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1376 |
3690
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1377 bool DicomMap::ParseFirstFloat(float& result, |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1378 const DicomTag& tag) const |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1379 { |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1380 const DicomValue* value = TestAndGetValue(tag); |
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 if (value == NULL) |
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 return false; |
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 else |
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 return value->ParseFirstFloat(result); |
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 } |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1391 |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1392 bool DicomMap::ParseDouble(double& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1393 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1394 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1395 const DicomValue* value = TestAndGetValue(tag); |
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 if (value == NULL) |
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 return false; |
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 else |
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 return value->ParseDouble(result); |
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 } |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1406 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1407 |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1408 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
|
1409 { |
3498 | 1410 if (dicomAsJson.type() != Json::objectValue) |
1411 { | |
1412 throw OrthancException(ErrorCode_BadFileFormat); | |
1413 } | |
1414 | |
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
|
1415 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
|
1416 { |
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 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
|
1418 } |
3005
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1419 |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1420 Json::Value::Members tags = dicomAsJson.getMemberNames(); |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1421 for (Json::Value::Members::const_iterator |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1422 it = tags.begin(); it != tags.end(); ++it) |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1423 { |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1424 DicomTag tag(0, 0); |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1425 if (!DicomTag::ParseHexadecimal(tag, it->c_str())) |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1426 { |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1427 throw OrthancException(ErrorCode_CorruptedFile); |
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 |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1430 const Json::Value& value = dicomAsJson[*it]; |
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 if (value.type() != Json::objectValue || |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1433 !value.isMember("Type") || |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1434 !value.isMember("Value") || |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1435 value["Type"].type() != Json::stringValue) |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1436 { |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1437 throw OrthancException(ErrorCode_CorruptedFile); |
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 |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1440 if (value["Type"] == "String") |
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["Value"].type() != Json::stringValue) |
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 throw OrthancException(ErrorCode_CorruptedFile); |
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 else |
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 SetValue(tag, value["Value"].asString(), false /* not binary */); |
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 } |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1451 else if (value["Type"] == "Sequence" && parseSequences) |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1452 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1453 if (value["Value"].type() != Json::arrayValue) |
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 throw OrthancException(ErrorCode_CorruptedFile); |
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 else |
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 SetValue(tag, value["Value"]); |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1460 } |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1461 } |
3005
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1462 } |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1463 } |
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 |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1466 void DicomMap::Merge(const DicomMap& other) |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1467 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1468 for (Content::const_iterator it = other.content_.begin(); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1469 it != other.content_.end(); ++it) |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1470 { |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1471 assert(it->second != NULL); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1472 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1473 if (content_.find(it->first) == content_.end()) |
3006
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 content_[it->first] = it->second->Clone(); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1476 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1477 } |
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 |
3678
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1481 void DicomMap::MergeMainDicomTags(const DicomMap& other, |
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1482 ResourceType level) |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1483 { |
5177 | 1484 std::set<DicomTag> mainDicomTags; |
1485 DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(mainDicomTags, level); | |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1486 |
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
|
1487 for (std::set<DicomTag>::const_iterator itmt = mainDicomTags.begin(); |
4981 | 1488 itmt != mainDicomTags.end(); ++itmt) |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1489 { |
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
|
1490 Content::const_iterator found = other.content_.find(*itmt); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1491 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1492 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
|
1493 content_.find(*itmt) == content_.end()) |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1494 { |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1495 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
|
1496 content_[*itmt] = found->second->Clone(); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1497 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1498 } |
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 void DicomMap::ExtractMainDicomTags(const DicomMap& other) |
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 Clear(); |
3678
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1505 MergeMainDicomTags(other, ResourceType_Patient); |
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1506 MergeMainDicomTags(other, ResourceType_Study); |
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1507 MergeMainDicomTags(other, ResourceType_Series); |
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1508 MergeMainDicomTags(other, ResourceType_Instance); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1509 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1510 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1511 |
3015
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1512 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
|
1513 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1514 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
|
1515 { |
5177 | 1516 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
|
1517 { |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1518 return false; |
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 } |
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 return true; |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1523 } |
5036
877bc3b96476
Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
1524 |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1525 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
|
1526 { |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1527 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
|
1528 |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1529 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
|
1530 { |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1531 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
|
1532 { |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1533 result.SetValue(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
|
1534 } |
877bc3b96476
Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
1535 } |
877bc3b96476
Handle Dicom sequences in ExtraMainDicomTags and save them in the 'MainDicomSequences' metadata
Alain Mazy <am@osimis.io>
parents:
4982
diff
changeset
|
1536 } |
3015
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1537 |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1538 void DicomMap::Serialize(Json::Value& target) const |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1539 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1540 target = Json::objectValue; |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1541 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1542 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
|
1543 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1544 assert(it->second != NULL); |
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 std::string tag = it->first.Format(); |
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 Json::Value value; |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1549 it->second->Serialize(value); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1550 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1551 target[tag] = 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 } |
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 void DicomMap::Unserialize(const Json::Value& source) |
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 Clear(); |
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 if (source.type() != Json::objectValue) |
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 throw OrthancException(ErrorCode_BadFileFormat); |
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 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1565 Json::Value::Members tags = source.getMemberNames(); |
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 for (size_t i = 0; i < tags.size(); i++) |
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 DicomTag tag(0, 0); |
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 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
|
1572 content_.find(tag) != content_.end()) |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1573 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1574 throw OrthancException(ErrorCode_BadFileFormat); |
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 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3690
diff
changeset
|
1577 std::unique_ptr<DicomValue> value(new DicomValue); |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1578 value->Unserialize(source[tags[i]]); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1579 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1580 content_[tag] = value.release(); |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1581 } |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1582 } |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1583 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1584 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1585 void DicomMap::FromDicomWeb(const Json::Value& source) |
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 static const char* const ALPHABETIC = "Alphabetic"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1588 static const char* const IDEOGRAPHIC = "Ideographic"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1589 static const char* const INLINE_BINARY = "InlineBinary"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1590 static const char* const PHONETIC = "Phonetic"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1591 static const char* const VALUE = "Value"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1592 static const char* const VR = "vr"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1593 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1594 Clear(); |
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 if (source.type() != Json::objectValue) |
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 throw OrthancException(ErrorCode_BadFileFormat); |
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 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1601 Json::Value::Members tags = source.getMemberNames(); |
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 for (size_t i = 0; i < tags.size(); i++) |
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 const Json::Value& item = source[tags[i]]; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1606 DicomTag tag(0, 0); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1607 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1608 if (item.type() != Json::objectValue || |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1609 !item.isMember(VR) || |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1610 item[VR].type() != Json::stringValue || |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1611 !DicomTag::ParseHexadecimal(tag, tags[i].c_str())) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1612 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1613 throw OrthancException(ErrorCode_BadFileFormat); |
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 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1616 ValueRepresentation vr = StringToValueRepresentation(item[VR].asString(), false); |
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 if (item.isMember(INLINE_BINARY)) |
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 const Json::Value& value = item[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 if (value.type() == Json::stringValue) |
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 std::string decoded; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1625 Toolbox::DecodeBase64(decoded, value.asString()); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1626 SetValue(tag, decoded, true /* binary data */); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1627 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1628 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1629 else if (!item.isMember(VALUE)) |
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 // Tag is present, but it has a null value |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1632 SetValue(tag, "", false /* not binary */); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1633 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1634 else |
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 const Json::Value& value = item[VALUE]; |
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 if (value.type() == Json::arrayValue) |
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 bool supported = true; |
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 std::string s; |
4199 | 1643 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
|
1644 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1645 if (!s.empty()) |
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 s += '\\'; |
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 |
4199 | 1650 switch (value[j].type()) |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1651 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1652 case Json::objectValue: |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1653 if (vr == ValueRepresentation_PersonName && |
4199 | 1654 value[j].type() == Json::objectValue) |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1655 { |
4199 | 1656 if (value[j].isMember(ALPHABETIC) && |
1657 value[j][ALPHABETIC].type() == Json::stringValue) | |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1658 { |
4199 | 1659 s += value[j][ALPHABETIC].asString(); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1660 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1661 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1662 bool hasIdeographic = false; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1663 |
4199 | 1664 if (value[j].isMember(IDEOGRAPHIC) && |
1665 value[j][IDEOGRAPHIC].type() == Json::stringValue) | |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1666 { |
4199 | 1667 s += '=' + value[j][IDEOGRAPHIC].asString(); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1668 hasIdeographic = true; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1669 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1670 |
4199 | 1671 if (value[j].isMember(PHONETIC) && |
1672 value[j][PHONETIC].type() == Json::stringValue) | |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1673 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1674 if (!hasIdeographic) |
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 s += '='; |
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 |
4199 | 1679 s += '=' + value[j][PHONETIC].asString(); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1680 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1681 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1682 else |
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 // This is the case of sequences |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1685 supported = false; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1686 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1687 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1688 break; |
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 case Json::stringValue: |
4199 | 1691 s += value[j].asString(); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1692 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1693 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1694 case Json::intValue: |
4788
b47ee86a0d10
support 64 bit integers in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4501
diff
changeset
|
1695 s += boost::lexical_cast<std::string>(value[j].asInt64()); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1696 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1697 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1698 case Json::uintValue: |
4788
b47ee86a0d10
support 64 bit integers in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4501
diff
changeset
|
1699 s += boost::lexical_cast<std::string>(value[j].asUInt64()); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1700 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1701 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1702 case Json::realValue: |
4199 | 1703 s += boost::lexical_cast<std::string>(value[j].asDouble()); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1704 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1705 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1706 default: |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1707 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1708 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1709 } |
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 if (supported) |
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 SetValue(tag, s, false /* not binary */); |
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 } |
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 } |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1719 |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1720 |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1721 std::string DicomMap::GetStringValue(const DicomTag& tag, |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1722 const std::string& defaultValue, |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1723 bool allowBinary) const |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1724 { |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1725 std::string s; |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1726 if (LookupStringValue(s, tag, allowBinary)) |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1727 { |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1728 return s; |
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 else |
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 return defaultValue; |
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 } |
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 |
3551
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1737 void DicomMap::RemoveBinaryTags() |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1738 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1739 Content kept; |
3551
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 for (Content::iterator it = content_.begin(); it != content_.end(); ++it) |
3551
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1742 { |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1743 assert(it->second != NULL); |
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 if (!it->second->IsBinary() && |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1746 !it->second->IsNull()) |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1747 { |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1748 kept[it->first] = it->second; |
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 else |
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 delete it->second; |
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 } |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1755 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1756 content_ = kept; |
3551
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1757 } |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1758 |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1759 |
5044
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1760 void DicomMap::RemoveSequences() |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1761 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1762 Content kept; |
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 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
|
1765 { |
6fed78e13233
Refactored DicomMap to handle sequences when needed
Alain Mazy <am@osimis.io>
parents:
5040
diff
changeset
|
1766 assert(it->second != NULL); |
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 if (!it->second->IsSequence()) |
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 kept[it->first] = it->second; |
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 else |
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 delete it->second; |
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 } |
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 content_ = kept; |
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 |
3650
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1781 void DicomMap::DumpMainDicomTags(Json::Value& target, |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1782 ResourceType level) const |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1783 { |
5177 | 1784 std::set<DicomTag> mainDicomTags; |
1785 DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(mainDicomTags, level); | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1786 |
3650
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1787 target = Json::objectValue; |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1788 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1789 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
|
1790 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1791 assert(it->second != NULL); |
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 if (!it->second->IsBinary() && |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1794 !it->second->IsNull()) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1795 { |
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
|
1796 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
|
1797 |
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
|
1798 if (found != mainDicomTags.end()) |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1799 { |
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
|
1800 #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
|
1801 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
|
1802 #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
|
1803 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
|
1804 #endif |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1805 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1806 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1807 } |
3650
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1808 } |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1809 |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1810 |
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
|
1811 |
3650
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1812 |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1813 void DicomMap::Print(FILE* fp) const |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1814 { |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1815 DicomArray a(*this); |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1816 a.Print(fp); |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1817 } |
0 | 1818 } |