GDCM  2.2.3
gdcmPrivateTag.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program: GDCM (Grassroots DICOM). A DICOM library
00004 
00005   Copyright (c) 2006-2011 Mathieu Malaterre
00006   All rights reserved.
00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 #ifndef GDCMPRIVATETAG_H
00015 #define GDCMPRIVATETAG_H
00016 
00017 #include "gdcmTag.h"
00018 #include "gdcmVR.h"
00019 
00020 #include <iostream>
00021 #include <iomanip>
00022 #include <string>
00023 #include <algorithm>
00024 
00025 #include <string.h> // strlen
00026 #include <ctype.h> // tolower
00027 
00028 namespace gdcm
00029 {
00030 
00036 // TODO: We could save some space since we only store 8bits for element
00037 class GDCM_EXPORT PrivateTag : public Tag
00038 {
00039   friend std::ostream& operator<<(std::ostream &_os, const PrivateTag &_val);
00040 public:
00041   PrivateTag(uint16_t group = 0, uint16_t element = 0, const char *owner = ""):Tag(group,element),Owner(owner ? LOComp::Trim(owner) : "") {
00042     // truncate the high bits
00043     SetElement( (uint8_t)element );
00044   }
00045 
00046   const char *GetOwner() const { return Owner.c_str(); }
00047   void SetOwner(const char *owner) { if(owner) Owner = LOComp::Trim(owner); }
00048 
00049   bool operator<(const PrivateTag &_val) const;
00050 
00053   bool ReadFromCommaSeparatedString(const char *str);
00054 
00055 private:
00056   // SIEMENS MED, GEMS_PETD_01 ...
00057   std::string Owner;
00058 };
00059 
00060 inline std::ostream& operator<<(std::ostream &os, const PrivateTag &val)
00061 {
00062   //assert( !val.Owner.empty() );
00063   os.setf( std::ios::right );
00064   os << std::hex << '(' << std::setw( 4 ) << std::setfill( '0' )
00065     << val[0] << ',' << std::setw( 2 ) << std::setfill( '0' )
00066     << val[1] << ',';
00067   os << val.Owner;
00068   os << ')' << std::setfill( ' ' ) << std::dec;
00069   return os;
00070 }
00071 
00072 } // end namespace gdcm
00073 
00074 #endif //GDCMPRIVATETAG_H

Generated on Thu Nov 28 2013 07:02:50 for GDCM by doxygen 1.7.6.1
SourceForge.net Logo