Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomFormat/DicomMap.cpp @ 4917:95378de340d4
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Feb 2022 06:36:29 +0100 |
parents | 43e613a7756b |
children | b7ce2bb6b881 |
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 |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
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> | |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
29 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3690
diff
changeset
|
30 #include "../Compatibility.h" |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
31 #include "../Endianness.h" |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
32 #include "../Logging.h" |
59 | 33 #include "../OrthancException.h" |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
34 #include "../Toolbox.h" |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
35 #include "DicomArray.h" |
0 | 36 |
37 | |
59 | 38 namespace Orthanc |
0 | 39 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
40 namespace |
0 | 41 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
42 struct MainDicomTag |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
43 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
44 const DicomTag tag_; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
45 const char* name_; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
46 }; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
47 } |
0 | 48 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
49 static const MainDicomTag PATIENT_MAIN_DICOM_TAGS[] = |
0 | 50 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
51 // { DicomTag(0x0010, 0x1010), "PatientAge" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
52 // { DicomTag(0x0010, 0x1040), "PatientAddress" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
53 { DicomTag(0x0010, 0x0010), "PatientName" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
54 { DicomTag(0x0010, 0x0030), "PatientBirthDate" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
55 { DicomTag(0x0010, 0x0040), "PatientSex" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
56 { DicomTag(0x0010, 0x1000), "OtherPatientIDs" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
57 { DICOM_TAG_PATIENT_ID, "PatientID" } |
0 | 58 }; |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
59 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
60 static const MainDicomTag STUDY_MAIN_DICOM_TAGS[] = |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
61 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
62 // { DicomTag(0x0010, 0x1020), "PatientSize" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
63 // { DicomTag(0x0010, 0x1030), "PatientWeight" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
64 { DICOM_TAG_STUDY_DATE, "StudyDate" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
65 { DicomTag(0x0008, 0x0030), "StudyTime" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
66 { DicomTag(0x0020, 0x0010), "StudyID" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
67 { DICOM_TAG_STUDY_DESCRIPTION, "StudyDescription" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
68 { DICOM_TAG_ACCESSION_NUMBER, "AccessionNumber" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
69 { DICOM_TAG_STUDY_INSTANCE_UID, "StudyInstanceUID" }, |
0 | 70 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
71 // New in db v6 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
72 { DICOM_TAG_REQUESTED_PROCEDURE_DESCRIPTION, "RequestedProcedureDescription" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
73 { DICOM_TAG_INSTITUTION_NAME, "InstitutionName" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
74 { DICOM_TAG_REQUESTING_PHYSICIAN, "RequestingPhysician" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
75 { DICOM_TAG_REFERRING_PHYSICIAN_NAME, "ReferringPhysicianName" } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
76 }; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
77 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
78 static const MainDicomTag SERIES_MAIN_DICOM_TAGS[] = |
0 | 79 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
80 // { DicomTag(0x0010, 0x1080), "MilitaryRank" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
81 { DicomTag(0x0008, 0x0021), "SeriesDate" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
82 { DicomTag(0x0008, 0x0031), "SeriesTime" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
83 { DICOM_TAG_MODALITY, "Modality" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
84 { DicomTag(0x0008, 0x0070), "Manufacturer" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
85 { DicomTag(0x0008, 0x1010), "StationName" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
86 { DICOM_TAG_SERIES_DESCRIPTION, "SeriesDescription" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
87 { DicomTag(0x0018, 0x0015), "BodyPartExamined" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
88 { DicomTag(0x0018, 0x0024), "SequenceName" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
89 { DicomTag(0x0018, 0x1030), "ProtocolName" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
90 { DicomTag(0x0020, 0x0011), "SeriesNumber" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
91 { DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES, "CardiacNumberOfImages" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
92 { DICOM_TAG_IMAGES_IN_ACQUISITION, "ImagesInAcquisition" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
93 { DICOM_TAG_NUMBER_OF_TEMPORAL_POSITIONS, "NumberOfTemporalPositions" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
94 { DICOM_TAG_NUMBER_OF_SLICES, "NumberOfSlices" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
95 { DICOM_TAG_NUMBER_OF_TIME_SLICES, "NumberOfTimeSlices" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
96 { DICOM_TAG_SERIES_INSTANCE_UID, "SeriesInstanceUID" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
97 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
98 // New in db v6 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
99 { DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "ImageOrientationPatient" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
100 { DICOM_TAG_SERIES_TYPE, "SeriesType" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
101 { DICOM_TAG_OPERATOR_NAME, "OperatorsName" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
102 { DICOM_TAG_PERFORMED_PROCEDURE_STEP_DESCRIPTION, "PerformedProcedureStepDescription" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
103 { DICOM_TAG_ACQUISITION_DEVICE_PROCESSING_DESCRIPTION, "AcquisitionDeviceProcessingDescription" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
104 { DICOM_TAG_CONTRAST_BOLUS_AGENT, "ContrastBolusAgent" } |
0 | 105 }; |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
106 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
107 static const MainDicomTag INSTANCE_MAIN_DICOM_TAGS[] = |
0 | 108 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
109 { DicomTag(0x0008, 0x0012), "InstanceCreationDate" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
110 { DicomTag(0x0008, 0x0013), "InstanceCreationTime" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
111 { DicomTag(0x0020, 0x0012), "AcquisitionNumber" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
112 { DICOM_TAG_IMAGE_INDEX, "ImageIndex" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
113 { DICOM_TAG_INSTANCE_NUMBER, "InstanceNumber" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
114 { DICOM_TAG_NUMBER_OF_FRAMES, "NumberOfFrames" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
115 { DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER, "TemporalPositionIdentifier" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
116 { DICOM_TAG_SOP_INSTANCE_UID, "SOPInstanceUID" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
117 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
118 // New in db v6 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
119 { DICOM_TAG_IMAGE_POSITION_PATIENT, "ImagePositionPatient" }, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
120 { DICOM_TAG_IMAGE_COMMENTS, "ImageComments" }, |
2804
d88970f1ffbf
fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
121 |
d88970f1ffbf
fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
122 /** |
d88970f1ffbf
fix ordering of non-parallel slices + /tools/reconstruct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
123 * 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
|
124 * 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
|
125 * 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
|
126 * 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
|
127 * 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
|
128 **/ |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
129 { DICOM_TAG_IMAGE_ORIENTATION_PATIENT, "ImageOrientationPatient" } // New in Orthanc 1.4.2 |
0 | 130 }; |
131 | |
132 | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
133 static void LoadMainDicomTags(const MainDicomTag*& tags, |
3650
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
134 size_t& size, |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
135 ResourceType level) |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
136 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
137 switch (level) |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
138 { |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
139 case ResourceType_Patient: |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
140 tags = PATIENT_MAIN_DICOM_TAGS; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
141 size = sizeof(PATIENT_MAIN_DICOM_TAGS) / sizeof(MainDicomTag); |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
142 break; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
143 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
144 case ResourceType_Study: |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
145 tags = STUDY_MAIN_DICOM_TAGS; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
146 size = sizeof(STUDY_MAIN_DICOM_TAGS) / sizeof(MainDicomTag); |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
147 break; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
148 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
149 case ResourceType_Series: |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
150 tags = SERIES_MAIN_DICOM_TAGS; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
151 size = sizeof(SERIES_MAIN_DICOM_TAGS) / sizeof(MainDicomTag); |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
152 break; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
153 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
154 case ResourceType_Instance: |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
155 tags = INSTANCE_MAIN_DICOM_TAGS; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
156 size = sizeof(INSTANCE_MAIN_DICOM_TAGS) / sizeof(MainDicomTag); |
1749
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
157 break; |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
158 |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
159 default: |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
160 throw OrthancException(ErrorCode_ParameterOutOfRange); |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
161 } |
99f4a05f39fa
various types of constraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1737
diff
changeset
|
162 } |
0 | 163 |
164 | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
165 static void LoadMainDicomTags(std::map<DicomTag, std::string>& target, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
166 ResourceType level) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
167 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
168 const MainDicomTag* tags = NULL; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
169 size_t size; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
170 LoadMainDicomTags(tags, size, level); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
171 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
172 assert(tags != NULL && |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
173 size != 0); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
174 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
175 for (size_t i = 0; i < size; i++) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
176 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
177 assert(target.find(tags[i].tag_) == target.end()); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
178 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
179 target[tags[i].tag_] = tags[i].name_; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
180 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
181 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
182 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
183 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
184 namespace |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
185 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
186 class DicomTag2 : public DicomTag |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
187 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
188 public: |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
189 DicomTag2() : |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
190 DicomTag(0, 0) // To make std::map<> happy |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
191 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
192 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
193 |
4199 | 194 explicit DicomTag2(const DicomTag& tag) : |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
195 DicomTag(tag) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
196 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
197 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
198 }; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
199 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
200 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
201 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
202 static void LoadMainDicomTags(std::map<std::string, DicomTag2>& target, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
203 ResourceType level) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
204 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
205 const MainDicomTag* tags = NULL; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
206 size_t size; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
207 LoadMainDicomTags(tags, size, level); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
208 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
209 assert(tags != NULL && |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
210 size != 0); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
211 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
212 for (size_t i = 0; i < size; i++) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
213 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
214 assert(target.find(tags[i].name_) == target.end()); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
215 |
4199 | 216 target[tags[i].name_] = DicomTag2(tags[i].tag_); |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
217 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
218 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
219 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
220 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
221 void DicomMap::SetValueInternal(uint16_t group, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
222 uint16_t element, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
223 DicomValue* value) |
0 | 224 { |
225 DicomTag tag(group, element); | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
226 Content::iterator it = content_.find(tag); |
0 | 227 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
228 if (it != content_.end()) |
0 | 229 { |
230 delete it->second; | |
231 it->second = value; | |
232 } | |
233 else | |
234 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
235 content_.insert(std::make_pair(tag, value)); |
0 | 236 } |
237 } | |
238 | |
239 | |
240 void DicomMap::Clear() | |
241 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
242 for (Content::iterator it = content_.begin(); it != content_.end(); ++it) |
0 | 243 { |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
244 assert(it->second != NULL); |
0 | 245 delete it->second; |
246 } | |
247 | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
248 content_.clear(); |
0 | 249 } |
250 | |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
251 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
|
252 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
253 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
|
254 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
255 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
256 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
|
257 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
258 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
|
259 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
260 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
261 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
|
262 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
263 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
|
264 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
265 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
266 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
|
267 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
268 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
|
269 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
270 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
271 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
|
272 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
273 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
|
274 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
275 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
276 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
|
277 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
278 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
|
279 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
280 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
281 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
|
282 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
283 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
|
284 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
285 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
286 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
|
287 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
288 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
|
289 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
290 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
291 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
|
292 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
293 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
|
294 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
295 |
0 | 296 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
297 static void ExtractTags(DicomMap& result, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
298 const DicomMap::Content& source, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
299 const MainDicomTag* tags, |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
300 size_t count) |
0 | 301 { |
302 result.Clear(); | |
303 | |
304 for (unsigned int i = 0; i < count; i++) | |
305 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
306 DicomMap::Content::const_iterator it = source.find(tags[i].tag_); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
307 if (it != source.end()) |
0 | 308 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
309 result.SetValue(it->first, *it->second /* value will be cloned */); |
0 | 310 } |
311 } | |
312 } | |
313 | |
314 | |
315 void DicomMap::ExtractPatientInformation(DicomMap& result) const | |
316 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
317 ExtractTags(result, content_, PATIENT_MAIN_DICOM_TAGS, sizeof(PATIENT_MAIN_DICOM_TAGS) / sizeof(MainDicomTag)); |
0 | 318 } |
319 | |
320 void DicomMap::ExtractStudyInformation(DicomMap& result) const | |
321 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
322 ExtractTags(result, content_, STUDY_MAIN_DICOM_TAGS, sizeof(STUDY_MAIN_DICOM_TAGS) / sizeof(MainDicomTag)); |
0 | 323 } |
324 | |
325 void DicomMap::ExtractSeriesInformation(DicomMap& result) const | |
326 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
327 ExtractTags(result, content_, SERIES_MAIN_DICOM_TAGS, sizeof(SERIES_MAIN_DICOM_TAGS) / sizeof(MainDicomTag)); |
0 | 328 } |
329 | |
330 void DicomMap::ExtractInstanceInformation(DicomMap& result) const | |
331 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
332 ExtractTags(result, content_, INSTANCE_MAIN_DICOM_TAGS, sizeof(INSTANCE_MAIN_DICOM_TAGS) / sizeof(MainDicomTag)); |
0 | 333 } |
334 | |
335 | |
4297 | 336 DicomMap::~DicomMap() |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
337 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
338 Clear(); |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
339 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
340 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
341 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
|
342 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
343 return content_.size(); |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
344 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
345 |
80 | 346 |
0 | 347 DicomMap* DicomMap::Clone() const |
348 { | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3690
diff
changeset
|
349 std::unique_ptr<DicomMap> result(new DicomMap); |
0 | 350 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
351 for (Content::const_iterator it = content_.begin(); it != content_.end(); ++it) |
0 | 352 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
353 result->content_.insert(std::make_pair(it->first, it->second->Clone())); |
0 | 354 } |
355 | |
356 return result.release(); | |
357 } | |
358 | |
359 | |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
360 void DicomMap::Assign(const DicomMap& other) |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
361 { |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
362 Clear(); |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
363 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
364 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
|
365 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
366 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
|
367 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
368 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
369 |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
370 |
0 | 371 const DicomValue& DicomMap::GetValue(const DicomTag& tag) const |
372 { | |
80 | 373 const DicomValue* value = TestAndGetValue(tag); |
374 | |
375 if (value) | |
376 { | |
377 return *value; | |
378 } | |
379 else | |
380 { | |
730
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
381 throw OrthancException(ErrorCode_InexistentTag); |
80 | 382 } |
383 } | |
384 | |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
385 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
|
386 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
387 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
|
388 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4214
diff
changeset
|
389 |
80 | 390 |
391 const DicomValue* DicomMap::TestAndGetValue(const DicomTag& tag) const | |
392 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
393 Content::const_iterator it = content_.find(tag); |
0 | 394 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
395 if (it == content_.end()) |
0 | 396 { |
80 | 397 return NULL; |
0 | 398 } |
399 else | |
400 { | |
80 | 401 return it->second; |
0 | 402 } |
403 } | |
404 | |
405 | |
406 void DicomMap::Remove(const DicomTag& tag) | |
407 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
408 Content::iterator it = content_.find(tag); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
409 if (it != content_.end()) |
0 | 410 { |
411 delete it->second; | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
412 content_.erase(it); |
0 | 413 } |
414 } | |
415 | |
416 | |
417 static void SetupFindTemplate(DicomMap& result, | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
418 const MainDicomTag* tags, |
0 | 419 size_t count) |
420 { | |
421 result.Clear(); | |
422 | |
423 for (size_t i = 0; i < count; i++) | |
424 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
425 result.SetValue(tags[i].tag_, "", false); |
0 | 426 } |
427 } | |
428 | |
429 void DicomMap::SetupFindPatientTemplate(DicomMap& result) | |
430 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
431 SetupFindTemplate(result, PATIENT_MAIN_DICOM_TAGS, sizeof(PATIENT_MAIN_DICOM_TAGS) / sizeof(MainDicomTag)); |
0 | 432 } |
433 | |
434 void DicomMap::SetupFindStudyTemplate(DicomMap& result) | |
435 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
436 SetupFindTemplate(result, STUDY_MAIN_DICOM_TAGS, sizeof(STUDY_MAIN_DICOM_TAGS) / sizeof(MainDicomTag)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
437 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
438 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1841
diff
changeset
|
439 |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1841
diff
changeset
|
440 // These main DICOM tags are only indirectly related to the |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1841
diff
changeset
|
441 // General Study Module, remove them |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1841
diff
changeset
|
442 result.Remove(DICOM_TAG_INSTITUTION_NAME); |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1841
diff
changeset
|
443 result.Remove(DICOM_TAG_REQUESTING_PHYSICIAN); |
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1841
diff
changeset
|
444 result.Remove(DICOM_TAG_REQUESTED_PROCEDURE_DESCRIPTION); |
0 | 445 } |
446 | |
447 void DicomMap::SetupFindSeriesTemplate(DicomMap& result) | |
448 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
449 SetupFindTemplate(result, SERIES_MAIN_DICOM_TAGS, sizeof(SERIES_MAIN_DICOM_TAGS) / sizeof(MainDicomTag)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
450 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
451 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
452 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); |
1372 | 453 |
454 // These tags are considered as "main" by Orthanc, but are not in the Series module | |
455 result.Remove(DicomTag(0x0008, 0x0070)); // Manufacturer | |
456 result.Remove(DicomTag(0x0008, 0x1010)); // Station name | |
457 result.Remove(DicomTag(0x0018, 0x0024)); // Sequence name | |
458 result.Remove(DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES); | |
459 result.Remove(DICOM_TAG_IMAGES_IN_ACQUISITION); | |
460 result.Remove(DICOM_TAG_NUMBER_OF_SLICES); | |
461 result.Remove(DICOM_TAG_NUMBER_OF_TEMPORAL_POSITIONS); | |
462 result.Remove(DICOM_TAG_NUMBER_OF_TIME_SLICES); | |
1706 | 463 result.Remove(DICOM_TAG_IMAGE_ORIENTATION_PATIENT); |
1848
e39716f71d67
new main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1841
diff
changeset
|
464 result.Remove(DICOM_TAG_SERIES_TYPE); |
1850
68854412c7bc
new main dicomtags: AcquisitionDeviceProcessingDescription and ContrastBolusAgent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
465 result.Remove(DICOM_TAG_ACQUISITION_DEVICE_PROCESSING_DESCRIPTION); |
68854412c7bc
new main dicomtags: AcquisitionDeviceProcessingDescription and ContrastBolusAgent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1848
diff
changeset
|
466 result.Remove(DICOM_TAG_CONTRAST_BOLUS_AGENT); |
0 | 467 } |
468 | |
469 void DicomMap::SetupFindInstanceTemplate(DicomMap& result) | |
470 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
471 SetupFindTemplate(result, INSTANCE_MAIN_DICOM_TAGS, sizeof(INSTANCE_MAIN_DICOM_TAGS) / sizeof(MainDicomTag)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
472 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
473 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
474 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
475 result.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "", false); |
0 | 476 } |
477 | |
478 | |
479 void DicomMap::CopyTagIfExists(const DicomMap& source, | |
480 const DicomTag& tag) | |
481 { | |
482 if (source.HasTag(tag)) | |
483 { | |
484 SetValue(tag, source.GetValue(tag)); | |
485 } | |
486 } | |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
487 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
488 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
489 bool DicomMap::IsMainDicomTag(const DicomTag& tag, ResourceType level) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
490 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
491 const MainDicomTag *tags = NULL; |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
492 size_t size; |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
493 LoadMainDicomTags(tags, size, level); |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
494 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
495 for (size_t i = 0; i < size; i++) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
496 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
497 if (tags[i].tag_ == tag) |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
498 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
499 return true; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
500 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
501 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
502 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
503 return false; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
504 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
505 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
506 bool DicomMap::IsMainDicomTag(const DicomTag& tag) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
507 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
508 return (IsMainDicomTag(tag, ResourceType_Patient) || |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
509 IsMainDicomTag(tag, ResourceType_Study) || |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
510 IsMainDicomTag(tag, ResourceType_Series) || |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
511 IsMainDicomTag(tag, ResourceType_Instance)); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
512 } |
567 | 513 |
514 | |
515 void DicomMap::GetMainDicomTagsInternal(std::set<DicomTag>& result, ResourceType level) | |
516 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
517 const MainDicomTag *tags = NULL; |
567 | 518 size_t size; |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
519 LoadMainDicomTags(tags, size, level); |
567 | 520 |
521 for (size_t i = 0; i < size; i++) | |
522 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
523 result.insert(tags[i].tag_); |
567 | 524 } |
525 } | |
526 | |
527 | |
528 void DicomMap::GetMainDicomTags(std::set<DicomTag>& result, ResourceType level) | |
529 { | |
530 result.clear(); | |
531 GetMainDicomTagsInternal(result, level); | |
532 } | |
533 | |
534 | |
535 void DicomMap::GetMainDicomTags(std::set<DicomTag>& result) | |
536 { | |
537 result.clear(); | |
538 GetMainDicomTagsInternal(result, ResourceType_Patient); | |
539 GetMainDicomTagsInternal(result, ResourceType_Study); | |
540 GetMainDicomTagsInternal(result, ResourceType_Series); | |
541 GetMainDicomTagsInternal(result, ResourceType_Instance); | |
542 } | |
1206
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
543 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
544 |
1360 | 545 void DicomMap::GetTags(std::set<DicomTag>& tags) const |
546 { | |
547 tags.clear(); | |
548 | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
549 for (Content::const_iterator it = content_.begin(); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
550 it != content_.end(); ++it) |
1360 | 551 { |
552 tags.insert(it->first); | |
553 } | |
554 } | |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
555 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
556 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
557 static uint16_t ReadLittleEndianUint16(const char* dicom) |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
558 { |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
559 const uint8_t* p = reinterpret_cast<const uint8_t*>(dicom); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
560 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
561 return (static_cast<uint16_t>(p[0]) | |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
562 (static_cast<uint16_t>(p[1]) << 8)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
563 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
564 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
565 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
566 static uint32_t ReadLittleEndianUint32(const char* dicom) |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
567 { |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
568 const uint8_t* p = reinterpret_cast<const uint8_t*>(dicom); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
569 |
4214
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
570 return (static_cast<uint32_t>(p[0]) | |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
571 (static_cast<uint32_t>(p[1]) << 8) | |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
572 (static_cast<uint32_t>(p[2]) << 16) | |
7b011cfda135
working on DicomStreamReader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4213
diff
changeset
|
573 (static_cast<uint32_t>(p[3]) << 24)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
574 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
575 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
576 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
577 static bool ValidateTag(const ValueRepresentation& vr, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
578 const std::string& value) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
579 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
580 switch (vr) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
581 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
582 case ValueRepresentation_ApplicationEntity: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
583 return value.size() <= 16; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
584 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
585 case ValueRepresentation_AgeString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
586 return (value.size() == 4 && |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
587 isdigit(value[0]) && |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
588 isdigit(value[1]) && |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
589 isdigit(value[2]) && |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
590 (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
|
591 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
592 case ValueRepresentation_AttributeTag: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
593 return value.size() == 4; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
594 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
595 case ValueRepresentation_CodeString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
596 return value.size() <= 16; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
597 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
598 case ValueRepresentation_Date: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
599 return value.size() <= 18; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
600 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
601 case ValueRepresentation_DecimalString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
602 return value.size() <= 16; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
603 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
604 case ValueRepresentation_DateTime: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
605 return value.size() <= 54; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
606 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
607 case ValueRepresentation_FloatingPointSingle: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
608 return value.size() == 4; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
609 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
610 case ValueRepresentation_FloatingPointDouble: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
611 return value.size() == 8; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
612 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
613 case ValueRepresentation_IntegerString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
614 return value.size() <= 12; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
615 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
616 case ValueRepresentation_LongString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
617 return value.size() <= 64; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
618 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
619 case ValueRepresentation_LongText: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
620 return value.size() <= 10240; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
621 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
622 case ValueRepresentation_OtherByte: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
623 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
624 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
625 case ValueRepresentation_OtherDouble: |
2013 | 626 return value.size() <= (static_cast<uint64_t>(1) << 32) - 8; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
627 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
628 case ValueRepresentation_OtherFloat: |
2013 | 629 return value.size() <= (static_cast<uint64_t>(1) << 32) - 4; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
630 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
631 case ValueRepresentation_OtherLong: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
632 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
633 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
634 case ValueRepresentation_OtherWord: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
635 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
636 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
637 case ValueRepresentation_PersonName: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
638 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
639 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
640 case ValueRepresentation_ShortString: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
641 return value.size() <= 16; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
642 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
643 case ValueRepresentation_SignedLong: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
644 return value.size() == 4; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
645 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
646 case ValueRepresentation_Sequence: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
647 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
648 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
649 case ValueRepresentation_SignedShort: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
650 return value.size() == 2; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
651 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
652 case ValueRepresentation_ShortText: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
653 return value.size() <= 1024; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
654 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
655 case ValueRepresentation_Time: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
656 return value.size() <= 28; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
657 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
658 case ValueRepresentation_UnlimitedCharacters: |
2013 | 659 return value.size() <= (static_cast<uint64_t>(1) << 32) - 2; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
660 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
661 case ValueRepresentation_UniqueIdentifier: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
662 return value.size() <= 64; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
663 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
664 case ValueRepresentation_UnsignedLong: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
665 return value.size() == 4; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
666 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
667 case ValueRepresentation_Unknown: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
668 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
669 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
670 case ValueRepresentation_UniversalResource: |
2013 | 671 return value.size() <= (static_cast<uint64_t>(1) << 32) - 2; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
672 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
673 case ValueRepresentation_UnsignedShort: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
674 return value.size() == 2; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
675 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
676 case ValueRepresentation_UnlimitedText: |
2013 | 677 return value.size() <= (static_cast<uint64_t>(1) << 32) - 2; |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
678 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
679 default: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
680 // Assume unsupported tags are OK |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
681 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
682 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
683 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
684 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
685 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
686 static void RemoveTagPadding(std::string& value, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
687 const ValueRepresentation& vr) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
688 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
689 /** |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
690 * Remove padding from character strings, if need be. For the time |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
691 * being, only the UI VR is supported. |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
692 * 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
|
693 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
694 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
695 switch (vr) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
696 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
697 case ValueRepresentation_UniqueIdentifier: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
698 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
699 /** |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
700 * "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
|
701 * trailing NULL (00H) character when necessary to achieve even |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
702 * length." |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
703 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
704 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
705 if (!value.empty() && |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
706 value[value.size() - 1] == '\0') |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
707 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
708 value.resize(value.size() - 1); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
709 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
710 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
711 break; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
712 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
713 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
714 /** |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
715 * TODO implement other VR |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
716 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
717 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
718 default: |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
719 // No padding is applicable to this VR |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
720 break; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
721 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
722 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
723 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
724 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
725 static bool ReadNextTag(DicomTag& tag, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
726 ValueRepresentation& vr, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
727 std::string& value, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
728 const char* dicom, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
729 size_t size, |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
730 size_t& position) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
731 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
732 /** |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
733 * 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
|
734 * 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
|
735 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
736 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
737 if (position + 6 > size) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
738 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
739 return false; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
740 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
741 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
742 tag = DicomTag(ReadLittleEndianUint16(dicom + position), |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
743 ReadLittleEndianUint16(dicom + position + 2)); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
744 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
745 vr = StringToValueRepresentation(std::string(dicom + position + 4, 2), true); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
746 if (vr == ValueRepresentation_NotSupported) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
747 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
748 return false; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
749 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
750 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
751 // 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
|
752 if (vr == ValueRepresentation_ApplicationEntity /* AE */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
753 vr == ValueRepresentation_AgeString /* AS */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
754 vr == ValueRepresentation_AttributeTag /* AT */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
755 vr == ValueRepresentation_CodeString /* CS */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
756 vr == ValueRepresentation_Date /* DA */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
757 vr == ValueRepresentation_DecimalString /* DS */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
758 vr == ValueRepresentation_DateTime /* DT */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
759 vr == ValueRepresentation_FloatingPointSingle /* FL */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
760 vr == ValueRepresentation_FloatingPointDouble /* FD */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
761 vr == ValueRepresentation_IntegerString /* IS */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
762 vr == ValueRepresentation_LongString /* LO */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
763 vr == ValueRepresentation_LongText /* LT */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
764 vr == ValueRepresentation_PersonName /* PN */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
765 vr == ValueRepresentation_ShortString /* SH */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
766 vr == ValueRepresentation_SignedLong /* SL */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
767 vr == ValueRepresentation_SignedShort /* SS */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
768 vr == ValueRepresentation_ShortText /* ST */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
769 vr == ValueRepresentation_Time /* TM */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
770 vr == ValueRepresentation_UniqueIdentifier /* UI */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
771 vr == ValueRepresentation_UnsignedLong /* UL */ || |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
772 vr == ValueRepresentation_UnsignedShort /* US */) |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
773 { |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
774 /** |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
775 * 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
|
776 * 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
|
777 * ST, TM, UI, UL and US" |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
778 **/ |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
779 if (position + 8 > size) |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
780 { |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
781 return false; |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
782 } |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
783 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
784 uint16_t length = ReadLittleEndianUint16(dicom + position + 6); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
785 if (position + 8 + length > size) |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
786 { |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
787 return false; |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
788 } |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
789 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
790 value.assign(dicom + position + 8, length); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
791 position += (8 + length); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
792 } |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
793 else |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
794 { |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
795 /** |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
796 * 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
|
797 * than as shown in Table 7.1-2" |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
798 **/ |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
799 if (position + 12 > size) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
800 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
801 return false; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
802 } |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
803 |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
804 uint16_t reserved = ReadLittleEndianUint16(dicom + position + 6); |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
805 if (reserved != 0) |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
806 { |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
807 return false; |
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
808 } |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
809 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
810 uint32_t length = ReadLittleEndianUint32(dicom + position + 8); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
811 if (position + 12 + length > size) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
812 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
813 return false; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
814 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
815 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
816 value.assign(dicom + position + 12, length); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
817 position += (12 + length); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
818 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
819 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
820 if (!ValidateTag(vr, value)) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
821 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
822 return false; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
823 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
824 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
825 RemoveTagPadding(value, vr); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
826 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
827 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
828 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
829 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
830 |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
831 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
|
832 size_t size) |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
833 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
834 /** |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
835 * 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
|
836 * 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
|
837 * 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
|
838 * 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
|
839 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
840 |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
841 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
|
842 |
3771
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
843 return (size >= 132 && |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
844 p[128] == 'D' && |
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
845 p[129] == 'I' && |
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
846 p[130] == 'C' && |
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
847 p[131] == 'M'); |
3771
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
848 } |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
849 |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
850 |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
851 bool DicomMap::ParseDicomMetaInformation(DicomMap& result, |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
852 const void* dicom, |
3771
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
853 size_t size) |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
854 { |
74889e6f6d68
fix memory issues if parsing invalid DICOM file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
855 if (!IsDicomFile(dicom, size)) |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
856 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
857 return false; |
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 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
860 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
861 /** |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
862 * The DICOM File Meta Information must be encoded using the |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
863 * Explicit VR Little Endian Transfer Syntax |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
864 * (UID=1.2.840.10008.1.2.1). |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
865 **/ |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
866 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
867 result.Clear(); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
868 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
869 // First, we read the "File Meta Information Group Length" tag |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
870 // (0002,0000) to know where to stop reading the meta header |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
871 size_t position = 132; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
872 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
873 DicomTag tag(0x0000, 0x0000); // Dummy initialization |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
874 ValueRepresentation vr; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
875 std::string value; |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
876 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
|
877 tag.GetGroup() != 0x0002 || |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
878 tag.GetElement() != 0x0000 || |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
879 vr != ValueRepresentation_UnsignedLong || |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
880 value.size() != 4) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
881 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
882 return false; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
883 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
884 |
4213
be2eca8b02e1
testing DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
885 size_t stopPosition = position + ReadLittleEndianUint32(value.c_str()); |
2007
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
886 if (stopPosition > size) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
887 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
888 return false; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
889 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
890 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
891 while (position < stopPosition) |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
892 { |
3840
e7003b2203a7
fixing signature of DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3771
diff
changeset
|
893 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
|
894 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
895 result.SetValue(tag, value, IsBinaryValueRepresentation(vr)); |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
896 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
897 else |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
898 { |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
899 return false; |
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 } |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
902 |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
903 return true; |
655489d9165d
DicomMap::ParseDicomMetaInformation()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
904 } |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
905 |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
906 |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
907 static std::string ValueAsString(const DicomMap& summary, |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
908 const DicomTag& tag) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
909 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
910 const DicomValue& value = summary.GetValue(tag); |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
911 if (value.IsNull()) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
912 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
913 return "(null)"; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
914 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
915 else |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
916 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
917 return value.GetContent(); |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
918 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
919 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
920 |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
921 |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
922 void DicomMap::LogMissingTagsForStore() const |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
923 { |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
924 std::string patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid; |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
925 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
926 if (HasTag(DICOM_TAG_PATIENT_ID)) |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
927 { |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
928 patientId = ValueAsString(*this, DICOM_TAG_PATIENT_ID); |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
929 } |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
930 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
931 if (HasTag(DICOM_TAG_STUDY_INSTANCE_UID)) |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
932 { |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
933 studyInstanceUid = ValueAsString(*this, DICOM_TAG_STUDY_INSTANCE_UID); |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
934 } |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
935 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
936 if (HasTag(DICOM_TAG_SERIES_INSTANCE_UID)) |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
937 { |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
938 seriesInstanceUid = ValueAsString(*this, DICOM_TAG_SERIES_INSTANCE_UID); |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
939 } |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
940 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
941 if (HasTag(DICOM_TAG_SOP_INSTANCE_UID)) |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
942 { |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
943 sopInstanceUid = ValueAsString(*this, DICOM_TAG_SOP_INSTANCE_UID); |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
944 } |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
945 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
946 LogMissingTagsForStore(patientId, studyInstanceUid, seriesInstanceUid, sopInstanceUid); |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
947 } |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
948 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
949 |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
950 void DicomMap::LogMissingTagsForStore(const std::string& patientId, |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
951 const std::string& studyInstanceUid, |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
952 const std::string& seriesInstanceUid, |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
953 const std::string& sopInstanceUid) |
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
954 { |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
955 std::string s, t; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
956 |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
957 if (!patientId.empty()) |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
958 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
959 if (t.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
960 t += ", "; |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
961 t += "PatientID=" + patientId; |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
962 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
963 else |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
964 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
965 if (s.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
966 s += ", "; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
967 s += "PatientID"; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
968 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
969 |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
970 if (!studyInstanceUid.empty()) |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
971 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
972 if (t.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
973 t += ", "; |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
974 t += "StudyInstanceUID=" + studyInstanceUid; |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
975 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
976 else |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
977 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
978 if (s.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
979 s += ", "; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
980 s += "StudyInstanceUID"; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
981 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
982 |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
983 if (!seriesInstanceUid.empty()) |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
984 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
985 if (t.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
986 t += ", "; |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
987 t += "SeriesInstanceUID=" + seriesInstanceUid; |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
988 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
989 else |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
990 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
991 if (s.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
992 s += ", "; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
993 s += "SeriesInstanceUID"; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
994 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
995 |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
996 if (!sopInstanceUid.empty()) |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
997 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
998 if (t.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
999 t += ", "; |
4501
11c2ddb4e2ca
FromDcmtkBridge::LogMissingTagsForStore()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
1000 t += "SOPInstanceUID=" + sopInstanceUid; |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1001 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1002 else |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1003 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1004 if (s.size() > 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1005 s += ", "; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1006 s += "SOPInstanceUID"; |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1007 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1008 |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1009 if (t.size() == 0) |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1010 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1011 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
|
1012 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1013 else |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1014 { |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1015 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
|
1016 } |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
1017 } |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1018 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1019 |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1020 bool DicomMap::LookupStringValue(std::string& result, |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1021 const DicomTag& tag, |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1022 bool allowBinary) const |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1023 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1024 const DicomValue* value = TestAndGetValue(tag); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1025 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1026 if (value == NULL) |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1027 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1028 return false; |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1029 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1030 else |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1031 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1032 return value->CopyToString(result, allowBinary); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1033 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1034 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1035 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1036 bool DicomMap::ParseInteger32(int32_t& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1037 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1038 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1039 const DicomValue* value = TestAndGetValue(tag); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1040 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1041 if (value == NULL) |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1042 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1043 return false; |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1044 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1045 else |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1046 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1047 return value->ParseInteger32(result); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1048 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1049 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1050 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1051 bool DicomMap::ParseInteger64(int64_t& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1052 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1053 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1054 const DicomValue* value = TestAndGetValue(tag); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1055 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1056 if (value == NULL) |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1057 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1058 return false; |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1059 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1060 else |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1061 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1062 return value->ParseInteger64(result); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1063 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1064 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1065 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1066 bool DicomMap::ParseUnsignedInteger32(uint32_t& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1067 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1068 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1069 const DicomValue* value = TestAndGetValue(tag); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1070 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1071 if (value == NULL) |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1072 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1073 return false; |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1074 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1075 else |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1076 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1077 return value->ParseUnsignedInteger32(result); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1078 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1079 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1080 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1081 bool DicomMap::ParseUnsignedInteger64(uint64_t& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1082 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1083 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1084 const DicomValue* value = TestAndGetValue(tag); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1085 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1086 if (value == NULL) |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1087 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1088 return false; |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1089 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1090 else |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1091 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1092 return value->ParseUnsignedInteger64(result); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1093 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1094 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1095 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1096 bool DicomMap::ParseFloat(float& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1097 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1098 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1099 const DicomValue* value = TestAndGetValue(tag); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1100 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1101 if (value == NULL) |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1102 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1103 return false; |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1104 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1105 else |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1106 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1107 return value->ParseFloat(result); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1108 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1109 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1110 |
3690
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1111 bool DicomMap::ParseFirstFloat(float& result, |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1112 const DicomTag& tag) const |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1113 { |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1114 const DicomValue* value = TestAndGetValue(tag); |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1115 |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1116 if (value == NULL) |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1117 { |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1118 return false; |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1119 } |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1120 else |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1121 { |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1122 return value->ParseFirstFloat(result); |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1123 } |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1124 } |
a9ce35d67c3c
implementation of "/instances/.../rendered" for grayscale images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3678
diff
changeset
|
1125 |
2412
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1126 bool DicomMap::ParseDouble(double& result, |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1127 const DicomTag& tag) const |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1128 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1129 const DicomValue* value = TestAndGetValue(tag); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1130 |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1131 if (value == NULL) |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1132 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1133 return false; |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1134 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1135 else |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1136 { |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1137 return value->ParseDouble(result); |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1138 } |
cad393b41bc3
handy shortcuts in DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
1139 } |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1140 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1141 |
3005
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1142 void DicomMap::FromDicomAsJson(const Json::Value& dicomAsJson) |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1143 { |
3498 | 1144 if (dicomAsJson.type() != Json::objectValue) |
1145 { | |
1146 throw OrthancException(ErrorCode_BadFileFormat); | |
1147 } | |
1148 | |
3005
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1149 Clear(); |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1150 |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1151 Json::Value::Members tags = dicomAsJson.getMemberNames(); |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1152 for (Json::Value::Members::const_iterator |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1153 it = tags.begin(); it != tags.end(); ++it) |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1154 { |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1155 DicomTag tag(0, 0); |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1156 if (!DicomTag::ParseHexadecimal(tag, it->c_str())) |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1157 { |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1158 throw OrthancException(ErrorCode_CorruptedFile); |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1159 } |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1160 |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1161 const Json::Value& value = dicomAsJson[*it]; |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1162 |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1163 if (value.type() != Json::objectValue || |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1164 !value.isMember("Type") || |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1165 !value.isMember("Value") || |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1166 value["Type"].type() != Json::stringValue) |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1167 { |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1168 throw OrthancException(ErrorCode_CorruptedFile); |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1169 } |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1170 |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1171 if (value["Type"] == "String") |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1172 { |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1173 if (value["Value"].type() != Json::stringValue) |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1174 { |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1175 throw OrthancException(ErrorCode_CorruptedFile); |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1176 } |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1177 else |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1178 { |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1179 SetValue(tag, value["Value"].asString(), false /* not binary */); |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1180 } |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1181 } |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1182 } |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1183 } |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1184 |
8265a6b56100
DicomMap::FromDicomAsJson
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2863
diff
changeset
|
1185 |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1186 void DicomMap::Merge(const DicomMap& other) |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1187 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1188 for (Content::const_iterator it = other.content_.begin(); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1189 it != other.content_.end(); ++it) |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1190 { |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1191 assert(it->second != NULL); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1192 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1193 if (content_.find(it->first) == content_.end()) |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1194 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1195 content_[it->first] = it->second->Clone(); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1196 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1197 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1198 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1199 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1200 |
3678
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1201 void DicomMap::MergeMainDicomTags(const DicomMap& other, |
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1202 ResourceType level) |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1203 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1204 const MainDicomTag* tags = NULL; |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1205 size_t size = 0; |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1206 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1207 LoadMainDicomTags(tags, size, level); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1208 assert(tags != NULL && size > 0); |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1209 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1210 for (size_t i = 0; i < size; i++) |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1211 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1212 Content::const_iterator found = other.content_.find(tags[i].tag_); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1213 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1214 if (found != other.content_.end() && |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1215 content_.find(tags[i].tag_) == content_.end()) |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1216 { |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1217 assert(found->second != NULL); |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1218 content_[tags[i].tag_] = found->second->Clone(); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1219 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1220 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1221 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1222 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1223 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1224 void DicomMap::ExtractMainDicomTags(const DicomMap& other) |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1225 { |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1226 Clear(); |
3678
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1227 MergeMainDicomTags(other, ResourceType_Patient); |
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1228 MergeMainDicomTags(other, ResourceType_Study); |
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1229 MergeMainDicomTags(other, ResourceType_Series); |
26c6d47467a9
DicomMap::MergeMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3653
diff
changeset
|
1230 MergeMainDicomTags(other, ResourceType_Instance); |
3006
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1231 } |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1232 |
0e1755e5efd0
DicomMap::ExtractMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3005
diff
changeset
|
1233 |
3015
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1234 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
|
1235 { |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1236 // TODO - Speed up possible by making this std::set a global variable |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1237 |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1238 std::set<DicomTag> mainDicomTags; |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1239 GetMainDicomTags(mainDicomTags); |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1240 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1241 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
|
1242 { |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1243 if (mainDicomTags.find(it->first) == mainDicomTags.end()) |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1244 { |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1245 return false; |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1246 } |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1247 } |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1248 |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1249 return true; |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1250 } |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1251 |
abe49ca61cd5
On C-FIND, avoid accessing the storage area whenever possible
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3006
diff
changeset
|
1252 |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1253 void DicomMap::Serialize(Json::Value& target) const |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1254 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1255 target = Json::objectValue; |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1256 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1257 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
|
1258 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1259 assert(it->second != NULL); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1260 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1261 std::string tag = it->first.Format(); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1262 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1263 Json::Value value; |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1264 it->second->Serialize(value); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1265 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1266 target[tag] = value; |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1267 } |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1268 } |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1269 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1270 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1271 void DicomMap::Unserialize(const Json::Value& source) |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1272 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1273 Clear(); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1274 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1275 if (source.type() != Json::objectValue) |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1276 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1277 throw OrthancException(ErrorCode_BadFileFormat); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1278 } |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1279 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1280 Json::Value::Members tags = source.getMemberNames(); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1281 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1282 for (size_t i = 0; i < tags.size(); i++) |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1283 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1284 DicomTag tag(0, 0); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1285 |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1286 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
|
1287 content_.find(tag) != content_.end()) |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1288 { |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1289 throw OrthancException(ErrorCode_BadFileFormat); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1290 } |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1291 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3690
diff
changeset
|
1292 std::unique_ptr<DicomValue> value(new DicomValue); |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1293 value->Unserialize(source[tags[i]]); |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1294 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1295 content_[tag] = value.release(); |
2863
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1296 } |
da12ba232119
serialization of DicomMap
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2804
diff
changeset
|
1297 } |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1298 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1299 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1300 void DicomMap::FromDicomWeb(const Json::Value& source) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1301 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1302 static const char* const ALPHABETIC = "Alphabetic"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1303 static const char* const IDEOGRAPHIC = "Ideographic"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1304 static const char* const INLINE_BINARY = "InlineBinary"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1305 static const char* const PHONETIC = "Phonetic"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1306 static const char* const VALUE = "Value"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1307 static const char* const VR = "vr"; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1308 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1309 Clear(); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1310 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1311 if (source.type() != Json::objectValue) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1312 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1313 throw OrthancException(ErrorCode_BadFileFormat); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1314 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1315 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1316 Json::Value::Members tags = source.getMemberNames(); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1317 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1318 for (size_t i = 0; i < tags.size(); i++) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1319 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1320 const Json::Value& item = source[tags[i]]; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1321 DicomTag tag(0, 0); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1322 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1323 if (item.type() != Json::objectValue || |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1324 !item.isMember(VR) || |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1325 item[VR].type() != Json::stringValue || |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1326 !DicomTag::ParseHexadecimal(tag, tags[i].c_str())) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1327 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1328 throw OrthancException(ErrorCode_BadFileFormat); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1329 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1330 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1331 ValueRepresentation vr = StringToValueRepresentation(item[VR].asString(), false); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1332 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1333 if (item.isMember(INLINE_BINARY)) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1334 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1335 const Json::Value& value = item[INLINE_BINARY]; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1336 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1337 if (value.type() == Json::stringValue) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1338 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1339 std::string decoded; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1340 Toolbox::DecodeBase64(decoded, value.asString()); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1341 SetValue(tag, decoded, true /* binary data */); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1342 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1343 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1344 else if (!item.isMember(VALUE)) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1345 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1346 // Tag is present, but it has a null value |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1347 SetValue(tag, "", false /* not binary */); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1348 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1349 else |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1350 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1351 const Json::Value& value = item[VALUE]; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1352 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1353 if (value.type() == Json::arrayValue) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1354 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1355 bool supported = true; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1356 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1357 std::string s; |
4199 | 1358 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
|
1359 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1360 if (!s.empty()) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1361 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1362 s += '\\'; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1363 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1364 |
4199 | 1365 switch (value[j].type()) |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1366 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1367 case Json::objectValue: |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1368 if (vr == ValueRepresentation_PersonName && |
4199 | 1369 value[j].type() == Json::objectValue) |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1370 { |
4199 | 1371 if (value[j].isMember(ALPHABETIC) && |
1372 value[j][ALPHABETIC].type() == Json::stringValue) | |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1373 { |
4199 | 1374 s += value[j][ALPHABETIC].asString(); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1375 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1376 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1377 bool hasIdeographic = false; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1378 |
4199 | 1379 if (value[j].isMember(IDEOGRAPHIC) && |
1380 value[j][IDEOGRAPHIC].type() == Json::stringValue) | |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1381 { |
4199 | 1382 s += '=' + value[j][IDEOGRAPHIC].asString(); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1383 hasIdeographic = true; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1384 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1385 |
4199 | 1386 if (value[j].isMember(PHONETIC) && |
1387 value[j][PHONETIC].type() == Json::stringValue) | |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1388 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1389 if (!hasIdeographic) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1390 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1391 s += '='; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1392 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1393 |
4199 | 1394 s += '=' + value[j][PHONETIC].asString(); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1395 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1396 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1397 else |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1398 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1399 // This is the case of sequences |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1400 supported = false; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1401 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1402 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1403 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1404 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1405 case Json::stringValue: |
4199 | 1406 s += value[j].asString(); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1407 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1408 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1409 case Json::intValue: |
4788
b47ee86a0d10
support 64 bit integers in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4501
diff
changeset
|
1410 s += boost::lexical_cast<std::string>(value[j].asInt64()); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1411 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1412 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1413 case Json::uintValue: |
4788
b47ee86a0d10
support 64 bit integers in DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4501
diff
changeset
|
1414 s += boost::lexical_cast<std::string>(value[j].asUInt64()); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1415 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1416 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1417 case Json::realValue: |
4199 | 1418 s += boost::lexical_cast<std::string>(value[j].asDouble()); |
3496
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1419 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1420 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1421 default: |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1422 break; |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1423 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1424 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1425 |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1426 if (supported) |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1427 { |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1428 SetValue(tag, s, false /* not binary */); |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1429 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1430 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1431 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1432 } |
109631ed3564
DicomMap::FromDicomWeb()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
1433 } |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1434 |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1435 |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1436 std::string DicomMap::GetStringValue(const DicomTag& tag, |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1437 const std::string& defaultValue, |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1438 bool allowBinary) const |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1439 { |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1440 std::string s; |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1441 if (LookupStringValue(s, tag, allowBinary)) |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1442 { |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1443 return s; |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1444 } |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1445 else |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1446 { |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1447 return defaultValue; |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1448 } |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1449 } |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1450 |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1451 |
3551
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1452 void DicomMap::RemoveBinaryTags() |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1453 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1454 Content kept; |
3551
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1455 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1456 for (Content::iterator it = content_.begin(); it != content_.end(); ++it) |
3551
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1457 { |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1458 assert(it->second != NULL); |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1459 |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1460 if (!it->second->IsBinary() && |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1461 !it->second->IsNull()) |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1462 { |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1463 kept[it->first] = it->second; |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1464 } |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1465 else |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1466 { |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1467 delete it->second; |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1468 } |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1469 } |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1470 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1471 content_ = kept; |
3551
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1472 } |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1473 |
173c7f363d8f
DicomMap::RemoveBinaryTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3518
diff
changeset
|
1474 |
3650
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1475 void DicomMap::DumpMainDicomTags(Json::Value& target, |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1476 ResourceType level) const |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1477 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1478 std::map<DicomTag, std::string> mainTags; // TODO - Create a singleton to hold this map |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1479 LoadMainDicomTags(mainTags, level); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1480 |
3650
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1481 target = Json::objectValue; |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1482 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1483 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
|
1484 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1485 assert(it->second != NULL); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1486 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1487 if (!it->second->IsBinary() && |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1488 !it->second->IsNull()) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1489 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1490 std::map<DicomTag, std::string>::const_iterator found = mainTags.find(it->first); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1491 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1492 if (found != mainTags.end()) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1493 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1494 target[found->second] = it->second->GetContent(); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1495 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1496 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1497 } |
3650
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1498 } |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1499 |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1500 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1501 void DicomMap::ParseMainDicomTags(const Json::Value& source, |
3650
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1502 ResourceType level) |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1503 { |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1504 if (source.type() != Json::objectValue) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1505 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1506 throw OrthancException(ErrorCode_BadFileFormat); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1507 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1508 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1509 std::map<std::string, DicomTag2> mainTags; // TODO - Create a singleton to hold this map |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1510 LoadMainDicomTags(mainTags, level); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1511 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1512 Json::Value::Members members = source.getMemberNames(); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1513 for (size_t i = 0; i < members.size(); i++) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1514 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1515 std::map<std::string, DicomTag2>::const_iterator found = mainTags.find(members[i]); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1516 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1517 if (found != mainTags.end()) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1518 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1519 const Json::Value& value = source[members[i]]; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1520 if (value.type() != Json::stringValue) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1521 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1522 throw OrthancException(ErrorCode_BadFileFormat); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1523 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1524 else |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1525 { |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1526 SetValue(found->second, value.asString(), false); |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1527 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1528 } |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3650
diff
changeset
|
1529 } |
3650
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1530 } |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1531 |
e5811a9f8df0
removing DicomMap::LoadMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
1532 |
3518
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1533 void DicomMap::Print(FILE* fp) const |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1534 { |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1535 DicomArray a(*this); |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1536 a.Print(fp); |
a57c8163d9ae
DicomMap::GetStringValue()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3498
diff
changeset
|
1537 } |
0 | 1538 } |