GDCM 3.0.24
gdcmPhotometricInterpretation.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
15#ifndef GDCMPHOTOMETRICINTERPRETATION_H
16#define GDCMPHOTOMETRICINTERPRETATION_H
17
18#include "gdcmTypes.h"
19#include <iostream>
20
21namespace gdcm
22{
23
24class TransferSyntax;
29{
30public:
31 typedef enum {
32 UNKNOWN = 0,
38 ARGB, // retired
46 // PALETTE_COLOR ?
47 //MONOCHROME = MONOCHROME1 | MONOCHROME2,
48 //COLOR = RGB | HSV | ARGB | CMYK | YBR_FULL | YBR_FULL_422 | YBR_PARTIAL_422 | YBR_PARTIAL_420 | YBR_ICT | YBR_RCT,
49 PI_END // Helpful for internal implementation
50 } PIType; // PhotometricInterpretationType
51
52 PhotometricInterpretation(PIType pi = UNKNOWN):PIField(pi) {}
53
54 static const char *GetPIString(PIType pi);
55
56 const char *GetString() const;
57
58 // You need to make sure end of string is \0
59 static PIType GetPIType(const char *pi);
60
61 static bool IsRetired(PIType pi);
62
63 bool IsLossy() const;
64 bool IsLossless() const;
65
67 unsigned short GetSamplesPerPixel() const;
68
69 // TODO
70 // not all PhotometricInterpretation are allowed for compressed Transfer
71 // syntax
72 // static bool IsAllowedForCompressedTS(PIType pi);
73
74 friend std::ostream& operator<<(std::ostream& os, const PhotometricInterpretation& pi);
75
76 operator PIType () const { return PIField; }
77
78 PIType GetType () const { return PIField; }
79
80 // Will return whether current PhotometricInterpretation is the same Color Space as input:
81 // eg. RGB and YBR_RCT are
83
84 //static PIType GetEquivalent(TransferSyntax const &ts);
85
86private:
87 PIType PIField;
88};
89//-----------------------------------------------------------------------------
90inline std::ostream& operator<<(std::ostream& os, const PhotometricInterpretation &val)
91{
92 const char *s = PhotometricInterpretation::GetPIString(val.PIField);
93 os << (s ? s : "");
94 return os;
95}
96
97
98} // end namespace gdcm
99
100#endif //GDCMPHOTOMETRICINTERPRETATION_H
Class to represent an PhotometricInterpretation.
Definition gdcmPhotometricInterpretation.h:29
static const char * GetPIString(PIType pi)
unsigned short GetSamplesPerPixel() const
return the value for Sample Per Pixel associated with a particular Photometric Interpretation
PhotometricInterpretation(PIType pi=UNKNOWN)
Definition gdcmPhotometricInterpretation.h:52
bool IsSameColorSpace(PhotometricInterpretation const &pi) const
static PIType GetPIType(const char *pi)
PIType GetType() const
Definition gdcmPhotometricInterpretation.h:78
PIType
Definition gdcmPhotometricInterpretation.h:31
@ YBR_PARTIAL_420
Definition gdcmPhotometricInterpretation.h:43
@ ARGB
Definition gdcmPhotometricInterpretation.h:38
@ YBR_RCT
Definition gdcmPhotometricInterpretation.h:45
@ PALETTE_COLOR
Definition gdcmPhotometricInterpretation.h:35
@ YBR_FULL_422
Definition gdcmPhotometricInterpretation.h:41
@ YBR_FULL
Definition gdcmPhotometricInterpretation.h:40
@ YBR_ICT
Definition gdcmPhotometricInterpretation.h:44
@ RGB
Definition gdcmPhotometricInterpretation.h:36
@ MONOCHROME1
Definition gdcmPhotometricInterpretation.h:33
@ MONOCHROME2
Definition gdcmPhotometricInterpretation.h:34
@ YBR_PARTIAL_422
Definition gdcmPhotometricInterpretation.h:42
@ HSV
Definition gdcmPhotometricInterpretation.h:37
@ CMYK
Definition gdcmPhotometricInterpretation.h:39
const char * GetString() const
static bool IsRetired(PIType pi)
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88