GDCM  2.2.6
gdcmPrivateTag.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef GDCMPRIVATETAG_H
15 #define GDCMPRIVATETAG_H
16 
17 #include "gdcmTag.h"
18 #include "gdcmVR.h"
19 #include "gdcmDataElement.h"
20 
21 #include <iostream>
22 #include <iomanip>
23 #include <string>
24 #include <algorithm>
25 
26 #include <string.h> // strlen
27 #include <ctype.h> // tolower
28 
29 namespace gdcm
30 {
31 
37 // TODO: We could save some space since we only store 8bits for element
38 class GDCM_EXPORT PrivateTag : public Tag
39 {
40  friend std::ostream& operator<<(std::ostream &_os, const PrivateTag &_val);
41 public:
42  PrivateTag(uint16_t group = 0, uint16_t element = 0, const char *owner = ""):Tag(group,element),Owner(owner ? LOComp::Trim(owner) : "") {
43  // truncate the high bits
44  SetElement( (uint8_t)element );
45  }
46  PrivateTag( Tag const & t, const char *owner = ""):Tag(t),Owner(owner ? LOComp::Trim(owner) : "") {
47  // truncate the high bits
48  SetElement( (uint8_t)t.GetElement());
49  }
50 
51  const char *GetOwner() const { return Owner.c_str(); }
52  void SetOwner(const char *owner) { if(owner) Owner = LOComp::Trim(owner); }
53 
54  bool operator<(const PrivateTag &_val) const;
55 
58  bool ReadFromCommaSeparatedString(const char *str);
59 
60  DataElement GetAsDataElement() const;
61 
62 private:
63  // SIEMENS MED, GEMS_PETD_01 ...
64  std::string Owner;
65 };
66 
67 inline std::ostream& operator<<(std::ostream &os, const PrivateTag &val)
68 {
69  //assert( !val.Owner.empty() );
70  os.setf( std::ios::right );
71  os << std::hex << '(' << std::setw( 4 ) << std::setfill( '0' )
72  << val[0] << ',' << std::setw( 2 ) << std::setfill( '0' )
73  << val[1] << ',';
74  os << val.Owner;
75  os << ')' << std::setfill( ' ' ) << std::dec;
76  return os;
77 }
78 
79 } // end namespace gdcm
80 
81 #endif //GDCMPRIVATETAG_H
PrivateTag(Tag const &t, const char *owner="")
Definition: gdcmPrivateTag.h:46
Class to represent a Private DICOM Data Element (Attribute) Tag (Group, Element, Owner) ...
Definition: gdcmPrivateTag.h:38
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
uint16_t GetElement() const
Returns the &#39;Element number&#39; of the given Tag.
Definition: gdcmTag.h:57
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition: gdcmDirectory.h:92
String<'\\', 64 > LOComp
Definition: gdcmVR.h:248
Class to represent a Data Element either Implicit or Explicit.
Definition: gdcmDataElement.h:58
const char * GetOwner() const
Definition: gdcmPrivateTag.h:51
PrivateTag(uint16_t group=0, uint16_t element=0, const char *owner="")
Definition: gdcmPrivateTag.h:42
void SetOwner(const char *owner)
Definition: gdcmPrivateTag.h:52
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element). Basically an uint32_t which...
Definition: gdcmTag.h:38

Generated on Sat Dec 21 2013 05:56:17 for GDCM by doxygen 1.8.5
SourceForge.net Logo