GDCM  2.2.3
gdcmPhotometricInterpretation.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 
00015 #ifndef GDCMPHOTOMETRICINTERPRETATION_H
00016 #define GDCMPHOTOMETRICINTERPRETATION_H
00017 
00018 #include "gdcmTypes.h"
00019 #include <iostream>
00020 
00021 namespace gdcm
00022 {
00023 
00024 class TransferSyntax;
00028 class GDCM_EXPORT PhotometricInterpretation
00029 {
00030 public:
00031   typedef enum {
00032     UNKNOW = 0,
00033     MONOCHROME1,
00034     MONOCHROME2,
00035     PALETTE_COLOR,
00036     RGB,
00037     HSV,
00038     ARGB, // retired
00039     CMYK,
00040     YBR_FULL,
00041     YBR_FULL_422,
00042     YBR_PARTIAL_422,
00043     YBR_PARTIAL_420,
00044     YBR_ICT,
00045     YBR_RCT,
00046     // PALETTE_COLOR ?
00047     //MONOCHROME = MONOCHROME1 | MONOCHROME2,
00048     //COLOR      = RGB | HSV | ARGB | CMYK | YBR_FULL | YBR_FULL_422 | YBR_PARTIAL_422 | YBR_PARTIAL_420 | YBR_ICT | YBR_RCT,
00049     PI_END  // Helpfull for internal implementation
00050   } PIType; // PhotometricInterpretationType
00051 
00052   PhotometricInterpretation(PIType pi = UNKNOW):PIField(pi) {}
00053 
00054   static const char *GetPIString(PIType pi);
00055 
00056   const char *GetString() const;
00057 
00058   // You need to make sure end of string is \0
00059   static PIType GetPIType(const char *pi);
00060 
00061   static bool IsRetired(PIType pi);
00062 
00063   bool IsLossy() const;
00064   bool IsLossless() const;
00065 
00067   unsigned short GetSamplesPerPixel() const;
00068 
00069   // TODO
00070   // not all PhotometricInterpretation are allowed for compressed Transfer
00071   // syntax
00072   // static bool IsAllowedForCompressedTS(PIType pi);
00073 
00074   friend std::ostream& operator<<(std::ostream& os, const PhotometricInterpretation& pi);
00075 
00076   operator PIType () const { return PIField; }
00077 
00078   PIType GetType () const { return PIField; }
00079 
00080   // Will return whether current PhotometricInterpretation is the same Color Space as input:
00081   // eg. RGB and YBR_RCT are
00082   bool IsSameColorSpace( PhotometricInterpretation const &pi ) const;
00083 
00084   //static PIType GetEquivalent(TransferSyntax const &ts);
00085 
00086 private:
00087   PIType PIField;
00088 };
00089 //-----------------------------------------------------------------------------
00090 inline std::ostream& operator<<(std::ostream& os, const PhotometricInterpretation &val)
00091 {
00092   const char *s = PhotometricInterpretation::GetPIString(val.PIField);
00093   os << (s ? s : "");
00094   return os;
00095 }
00096 
00097 
00098 } // end namespace gdcm
00099 
00100 #endif //GDCMPHOTOMETRICINTERPRETATION_H

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