Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
6  Division of Medical and Biological Informatics.
7  All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without
10  even the implied warranty of MERCHANTABILITY or FITNESS FOR
11  A PARTICULAR PURPOSE.
12 
13  See LICENSE.txt or http://www.mitk.org for details.
14 
15  ===================================================================*/
16 
18 #include "mitkException.h"
19 
21 ::DICOMGenericImageFrameInfo(const std::string& filename, unsigned int frameNo)
22 :DICOMDatasetAccessingImageFrameInfo(filename, frameNo)
23 {
24 }
25 
28 :DICOMDatasetAccessingImageFrameInfo(frameinfo->Filename, frameinfo->FrameNo)
29 {
30 }
31 
34 {
35 }
36 
40 {
41  DICOMTagPath path(tag);
42  DICOMDatasetFinding result;
43 
44  const auto finding = m_Values.find(path);
45  if (finding != m_Values.cend())
46  {
47  result.isValid = true;
48  result.value = finding->second;
49  result.path = path;
50  }
51 
52  return result;
53 }
54 
57 {
58  FindingsListType result;
59 
60  for (const auto& iter : m_Values)
61  {
62  if (path.Equals(iter.first))
63  {
64  result.emplace_back(true, iter.second, iter.first);
65  }
66  }
67 
68  return result;
69 }
70 
71 void
72 mitk::DICOMGenericImageFrameInfo::SetTagValue(const DICOMTagPath& path, const std::string& value)
73 {
74  if (!path.IsExplicit())
75  {
76  mitkThrow() << "Only explicit tag paths (no wildcards) are allowed for tag values in DICOMGenericImageFrameInfo. Passed tag path:" << path.ToStr();
77  }
78 
79  m_Values[path] = value;
80 }
81 
82 std::string
85 {
86  return this->Filename;
87 }
itk::SmartPointer< Self > Pointer
Class is used to identify (nested) attributes in a DICOM dataset. In contrast to the class DICOMTag...
bool Equals(const DICOMTagPath &path) const
virtual DICOMDatasetFinding GetTagValueAsString(const DICOMTag &) const override
Return a DICOMDatasetFinding instance of the tag. The return containes (if valid) the raw value of th...
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:37
std::string ToStr() const
bool IsExplicit() const
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
static const std::string filename
#define mitkThrow()
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)