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