GDCM 2.0.17
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 Module: $URL$ 00005 00006 Copyright (c) 2006-2010 Mathieu Malaterre 00007 All rights reserved. 00008 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 00016 #ifndef GDCMPHOTOMETRICINTERPRETATION_H 00017 #define GDCMPHOTOMETRICINTERPRETATION_H 00018 00019 #include "gdcmTypes.h" 00020 #include <iostream> 00021 00022 namespace gdcm 00023 { 00024 00025 class TransferSyntax; 00029 class GDCM_EXPORT PhotometricInterpretation 00030 { 00031 public: 00032 typedef enum { 00033 UNKNOW = 0, 00034 MONOCHROME1, 00035 MONOCHROME2, 00036 PALETTE_COLOR, 00037 RGB, 00038 HSV, 00039 ARGB, // retired 00040 CMYK, 00041 YBR_FULL, 00042 YBR_FULL_422, 00043 YBR_PARTIAL_422, 00044 YBR_PARTIAL_420, 00045 YBR_ICT, 00046 YBR_RCT, 00047 // PALETTE_COLOR ? 00048 //MONOCHROME = MONOCHROME1 | MONOCHROME2, 00049 //COLOR = RGB | HSV | ARGB | CMYK | YBR_FULL | YBR_FULL_422 | YBR_PARTIAL_422 | YBR_PARTIAL_420 | YBR_ICT | YBR_RCT, 00050 PI_END // Helpfull for internal implementation 00051 } PIType; // PhotometricInterpretationType 00052 00053 PhotometricInterpretation(PIType pi = UNKNOW):PIField(pi) {} 00054 00055 static const char *GetPIString(PIType pi); 00056 00057 const char *GetString() const; 00058 00059 // You need to make sure end of string is \0 00060 static PIType GetPIType(const char *pi); 00061 00062 static bool IsRetired(PIType pi); 00063 00064 bool IsLossy() const; 00065 bool IsLossless() const; 00066 00068 unsigned short GetSamplesPerPixel() const; 00069 00070 // TODO 00071 // not all PhotometricInterpretation are allowed for compressed Transfer 00072 // syntax 00073 // static bool IsAllowedForCompressedTS(PIType pi); 00074 00075 friend std::ostream& operator<<(std::ostream& os, const PhotometricInterpretation& pi); 00076 00077 operator PIType () const { return PIField; } 00078 00079 // Will return whether current PhotometricInterpretation is the same Color Space as input: 00080 // eg. RGB and YBR_RCT are 00081 bool IsSameColorSpace( PhotometricInterpretation const &pi ) const; 00082 00083 //static PIType GetEquivalent(TransferSyntax const &ts); 00084 00085 private: 00086 PIType PIField; 00087 }; 00088 //----------------------------------------------------------------------------- 00089 inline std::ostream& operator<<(std::ostream& os, const PhotometricInterpretation &val) 00090 { 00091 const char *s = PhotometricInterpretation::GetPIString(val.PIField); 00092 os << (s ? s : ""); 00093 return os; 00094 } 00095 00096 00097 } // end namespace gdcm 00098 00099 #endif //GDCMPHOTOMETRICINTERPRETATION_H