GDCM 3.2.1

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
21 namespace gdcm
22{
23
24 class TransferSyntax;
28 class GDCM_EXPORT PhotometricInterpretation
29{
30 public:
31 typedef enum {
32 UNKNOWN = 0,
33 MONOCHROME1,
34 MONOCHROME2,
35 PALETTE_COLOR,
36 RGB,
37 HSV,
38 ARGB, // retired
39 CMYK,
40 YBR_FULL,
41 YBR_FULL_422,
42 YBR_PARTIAL_422,
43 YBR_PARTIAL_420,
44 YBR_ICT,
45 YBR_RCT,
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
82 bool IsSameColorSpace( PhotometricInterpretation const &pi ) const;
83
84 //static PIType GetEquivalent(TransferSyntax const &ts);
85
86 private:
87 PIType PIField;
88};
89//-----------------------------------------------------------------------------
90 inline 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
gdcm::PhotometricInterpretation::GetPIString
static const char * GetPIString(PIType pi)
gdcm::PhotometricInterpretation::GetSamplesPerPixel
unsigned short GetSamplesPerPixel() const
return the value for Sample Per Pixel associated with a particular Photometric Interpretation
gdcm::PhotometricInterpretation::IsLossy
bool IsLossy() const
gdcm::PhotometricInterpretation::PhotometricInterpretation
PhotometricInterpretation(PIType pi=UNKNOWN)
Definition gdcmPhotometricInterpretation.h:52
gdcm::PhotometricInterpretation::IsLossless
bool IsLossless() const
gdcm::PhotometricInterpretation::IsSameColorSpace
bool IsSameColorSpace(PhotometricInterpretation const &pi) const
gdcm::PhotometricInterpretation::GetPIType
static PIType GetPIType(const char *pi)
gdcm::PhotometricInterpretation::GetType
PIType GetType() const
Definition gdcmPhotometricInterpretation.h:78
gdcm::PhotometricInterpretation::PIType
PIType
Definition gdcmPhotometricInterpretation.h:31
gdcm::PhotometricInterpretation::YBR_PARTIAL_420
@ YBR_PARTIAL_420
Definition gdcmPhotometricInterpretation.h:43
gdcm::PhotometricInterpretation::ARGB
@ ARGB
Definition gdcmPhotometricInterpretation.h:38
gdcm::PhotometricInterpretation::YBR_RCT
@ YBR_RCT
Definition gdcmPhotometricInterpretation.h:45
gdcm::PhotometricInterpretation::PALETTE_COLOR
@ PALETTE_COLOR
Definition gdcmPhotometricInterpretation.h:35
gdcm::PhotometricInterpretation::UNKNOWN
@ UNKNOWN
Definition gdcmPhotometricInterpretation.h:32
gdcm::PhotometricInterpretation::YBR_FULL_422
@ YBR_FULL_422
Definition gdcmPhotometricInterpretation.h:41
gdcm::PhotometricInterpretation::YBR_FULL
@ YBR_FULL
Definition gdcmPhotometricInterpretation.h:40
gdcm::PhotometricInterpretation::YBR_ICT
@ YBR_ICT
Definition gdcmPhotometricInterpretation.h:44
gdcm::PhotometricInterpretation::RGB
@ RGB
Definition gdcmPhotometricInterpretation.h:36
gdcm::PhotometricInterpretation::MONOCHROME1
@ MONOCHROME1
Definition gdcmPhotometricInterpretation.h:33
gdcm::PhotometricInterpretation::MONOCHROME2
@ MONOCHROME2
Definition gdcmPhotometricInterpretation.h:34
gdcm::PhotometricInterpretation::PI_END
@ PI_END
Definition gdcmPhotometricInterpretation.h:49
gdcm::PhotometricInterpretation::YBR_PARTIAL_422
@ YBR_PARTIAL_422
Definition gdcmPhotometricInterpretation.h:42
gdcm::PhotometricInterpretation::HSV
@ HSV
Definition gdcmPhotometricInterpretation.h:37
gdcm::PhotometricInterpretation::CMYK
@ CMYK
Definition gdcmPhotometricInterpretation.h:39
gdcm::PhotometricInterpretation::GetString
const char * GetString() const
gdcm::PhotometricInterpretation::IsRetired
static bool IsRetired(PIType pi)
gdcm::PhotometricInterpretation::operator<<
friend std::ostream & operator<<(std::ostream &os, const PhotometricInterpretation &pi)
Definition gdcmPhotometricInterpretation.h:90
gdcm::TransferSyntax
Class to manipulate Transfer Syntax.
Definition gdcmTransferSyntax.h:40
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88