Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomFormat/DicomArray.cpp @ 5161:b6dc4606ab04
release notes for 1.11.3
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 03 Feb 2023 14:24:43 +0100 |
parents | 304514ce84ee |
children | 0ea402b4d901 |
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:
824
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:
689
diff
changeset
|
24 #include "../PrecompiledHeaders.h" |
0 | 25 #include "DicomArray.h" |
26 | |
4692
e68edf92e5cc
C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
27 #include "../OrthancException.h" |
e68edf92e5cc
C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
28 |
0 | 29 #include <stdio.h> |
30 | |
59 | 31 namespace Orthanc |
0 | 32 { |
33 DicomArray::DicomArray(const DicomMap& map) | |
34 { | |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
35 elements_.reserve(map.content_.size()); |
0 | 36 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
37 for (DicomMap::Content::const_iterator it = |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
38 map.content_.begin(); it != map.content_.end(); ++it) |
0 | 39 { |
40 elements_.push_back(new DicomElement(it->first, *it->second)); | |
41 } | |
42 } | |
43 | |
44 | |
45 DicomArray::~DicomArray() | |
46 { | |
47 for (size_t i = 0; i < elements_.size(); i++) | |
48 { | |
49 delete elements_[i]; | |
50 } | |
51 } | |
52 | |
53 | |
4297 | 54 size_t DicomArray::GetSize() const |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
55 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
56 return elements_.size(); |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
57 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
58 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
59 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
60 const DicomElement &DicomArray::GetElement(size_t i) const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
61 { |
4692
e68edf92e5cc
C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
62 if (i >= elements_.size()) |
e68edf92e5cc
C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
63 { |
e68edf92e5cc
C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
64 throw OrthancException(ErrorCode_ParameterOutOfRange); |
e68edf92e5cc
C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
65 } |
e68edf92e5cc
C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
66 else |
e68edf92e5cc
C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
67 { |
e68edf92e5cc
C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
68 return *elements_[i]; |
e68edf92e5cc
C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
69 } |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
70 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
71 |
4940
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
72 void DicomArray::GetTags(std::set<DicomTag>& tags) const |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
73 { |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
74 tags.clear(); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
75 |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
76 for (size_t i = 0; i < elements_.size(); i++) |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
77 { |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
78 tags.insert(elements_[i]->GetTag()); |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
79 } |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
80 |
304514ce84ee
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
81 } |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
82 |
0 | 83 void DicomArray::Print(FILE* fp) const |
84 { | |
85 for (size_t i = 0; i < elements_.size(); i++) | |
86 { | |
87 DicomTag t = elements_[i]->GetTag(); | |
1737
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
88 const DicomValue& v = elements_[i]->GetValue(); |
ec66a16aa398
removal of DicomStringValue and DicomNullValue
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
89 std::string s = v.IsNull() ? "(null)" : v.GetContent(); |
0 | 90 printf("0x%04x 0x%04x [%s]\n", t.GetGroup(), t.GetElement(), s.c_str()); |
91 } | |
92 } | |
93 } |