GDCM  2.2.4
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 
20 #include <iostream>
21 #include <iomanip>
22 #include <string>
23 #include <algorithm>
24 
25 #include <string.h> // strlen
26 #include <ctype.h> // tolower
27 
28 namespace gdcm
29 {
30 
36 // TODO: We could save some space since we only store 8bits for element
37 class GDCM_EXPORT PrivateTag : public Tag
38 {
39  friend std::ostream& operator<<(std::ostream &_os, const PrivateTag &_val);
40 public:
41  PrivateTag(uint16_t group = 0, uint16_t element = 0, const char *owner = ""):Tag(group,element),Owner(owner ? LOComp::Trim(owner) : "") {
42  // truncate the high bits
43  SetElement( (uint8_t)element );
44  }
45 
46  const char *GetOwner() const { return Owner.c_str(); }
47  void SetOwner(const char *owner) { if(owner) Owner = LOComp::Trim(owner); }
48 
49  bool operator<(const PrivateTag &_val) const;
50 
53  bool ReadFromCommaSeparatedString(const char *str);
54 
55 private:
56  // SIEMENS MED, GEMS_PETD_01 ...
57  std::string Owner;
58 };
59 
60 inline std::ostream& operator<<(std::ostream &os, const PrivateTag &val)
61 {
62  //assert( !val.Owner.empty() );
63  os.setf( std::ios::right );
64  os << std::hex << '(' << std::setw( 4 ) << std::setfill( '0' )
65  << val[0] << ',' << std::setw( 2 ) << std::setfill( '0' )
66  << val[1] << ',';
67  os << val.Owner;
68  os << ')' << std::setfill( ' ' ) << std::dec;
69  return os;
70 }
71 
72 } // end namespace gdcm
73 
74 #endif //GDCMPRIVATETAG_H

Generated on Tue Aug 13 2013 15:33:41 for GDCM by doxygen 1.8.4
SourceForge.net Logo