Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkDICOMGenericImageFrameInfo.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 #include "mitkException.h"
15 
17 ::DICOMGenericImageFrameInfo(const std::string& filename, unsigned int frameNo)
18 :DICOMDatasetAccessingImageFrameInfo(filename, frameNo)
19 {
20 }
21 
23 ::DICOMGenericImageFrameInfo(const DICOMImageFrameInfo::Pointer& frameinfo)
25 {
26 }
27 
30 {
31 }
32 
36 {
37  DICOMTagPath path(tag);
38  DICOMDatasetFinding result;
39 
40  const auto finding = m_Values.find(path);
41  if (finding != m_Values.cend())
42  {
43  result.isValid = true;
44  result.value = finding->second;
45  result.path = path;
46  }
47 
48  return result;
49 }
50 
53 {
54  FindingsListType result;
55 
56  for (const auto& iter : m_Values)
57  {
58  if (path.Equals(iter.first))
59  {
60  result.emplace_back(true, iter.second, iter.first);
61  }
62  }
63 
64  return result;
65 }
66 
67 void
68 mitk::DICOMGenericImageFrameInfo::SetTagValue(const DICOMTagPath& path, const std::string& value)
69 {
70  if (!path.IsExplicit())
71  {
72  mitkThrow() << "Only explicit tag paths (no wildcards) are allowed for tag values in DICOMGenericImageFrameInfo. Passed tag path:" << path.ToStr();
73  }
74 
75  m_Values[path] = value;
76 }
77 
78 std::string
81 {
82  return this->Filename;
83 }
Class is used to identify (nested) attributes in a DICOM dataset. In contrast to the class DICOMTag...
bool Equals(const DICOMTagPath &path) const
DICOMDatasetFinding GetTagValueAsString(const DICOMTag &) const override
Return a DICOMDatasetFinding instance of the tag. The return containes (if valid) the raw value of th...
const unsigned int FrameNo
frame number, starting with 0
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:32
std::string GetFilenameIfAvailable() const override
Return a filename if possible. If DICOM is not read from file but from somewhere else (network...
std::list< DICOMDatasetFinding > FindingsListType
const std::string Filename
absolute filename
#define mitkThrow()
std::string ToStr() const
Defines an abstract base class for DICOM image frame infos with data access.
DICOMGenericImageFrameInfo(const DICOMImageFrameInfo::Pointer &frameinfo)
void SetTagValue(const DICOMTagPath &path, const std::string &value)