Isis 3 Programmer Reference
PixelType.h
Go to the documentation of this file.
1 #ifndef PixelType_h
2 #define PixelType_h
3 
25 #include <QString>
26 
27 namespace Isis {
43  enum PixelType {
44  None = 0,
45  UnsignedByte,
46  SignedByte,
47  UnsignedWord,
48  SignedWord,
49  UnsignedInteger,
50  SignedInteger,
51  Real,
52  Double
53  };
54 
62  inline int SizeOf(Isis::PixelType pixelType) {
63  if(pixelType == Isis::None) return 0;
64  if(pixelType == Isis::UnsignedByte) return sizeof(unsigned char);
65  if(pixelType == Isis::SignedByte) return sizeof(char);
66  if(pixelType == Isis::UnsignedWord) return sizeof(unsigned short);
67  if(pixelType == Isis::SignedWord) return sizeof(short);
68  if(pixelType == Isis::UnsignedInteger) return sizeof(unsigned int);
69  if(pixelType == Isis::SignedInteger) return sizeof(int);
70  if(pixelType == Isis::Real) return sizeof(float);
71  if(pixelType == Isis::Double) return sizeof(double);
72  return -1;
73  }
74 
82  inline QString PixelTypeName(Isis::PixelType pixelType) {
83  if(pixelType == Isis::None) return "None";
84  if(pixelType == Isis::UnsignedByte) return "UnsignedByte";
85  if(pixelType == Isis::SignedByte) return "SignedByte";
86  if(pixelType == Isis::UnsignedWord) return "UnsignedWord";
87  if(pixelType == Isis::SignedWord) return "SignedWord";
88  if(pixelType == Isis::UnsignedInteger) return "UnsignedInteger";
89  if(pixelType == Isis::SignedInteger) return "SignedInteger";
90  if(pixelType == Isis::Real) return "Real";
91  if(pixelType == Isis::Double) return "Double";
92  return "Error";
93  }
94 
105  inline Isis::PixelType PixelTypeEnumeration(const QString &type) {
106  QString temp = type.toUpper();
107  if(temp == "UNSIGNEDBYTE" || temp == "8BIT" || temp == "8-BIT") return Isis::UnsignedByte;
108  if(temp == "SIGNEDBYTE") return Isis::SignedByte;
109  if(temp == "UNSIGNEDWORD") return Isis::UnsignedWord;
110  if(temp == "SIGNEDWORD") return Isis::SignedWord;
111  if(temp == "UNSIGNEDINTEGER") return Isis::UnsignedInteger;
112  if(temp == "SIGNEDINTEGER") return Isis::SignedInteger;
113  if(temp == "REAL") return Isis::Real;
114  if(temp == "DOUBLE") return Isis::Double;
115  return Isis::None;
116  }
117 }
118 
119 #endif
120 
int SizeOf(Isis::PixelType pixelType)
Returns the number of bytes of the specified PixelType.
Definition: PixelType.h:62
QString PixelTypeName(Isis::PixelType pixelType)
Returns string name of PixelType enumeration entered as input parameter.
Definition: PixelType.h:82
PixelType
Enumerations for Isis Pixel Types.
Definition: PixelType.h:43
Isis::PixelType PixelTypeEnumeration(const QString &type)
Returns PixelType enumeration given a string.
Definition: PixelType.h:105
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31