Isis Developer Reference
PixelType.h
Go to the documentation of this file.
1#ifndef PixelType_h
2#define PixelType_h
8/* SPDX-License-Identifier: CC0-1.0 */
9#include <QString>
10
11namespace Isis {
38
46 inline int SizeOf(Isis::PixelType pixelType) {
47 if(pixelType == Isis::None) return 0;
48 if(pixelType == Isis::UnsignedByte) return sizeof(unsigned char);
49 if(pixelType == Isis::SignedByte) return sizeof(char);
50 if(pixelType == Isis::UnsignedWord) return sizeof(unsigned short);
51 if(pixelType == Isis::SignedWord) return sizeof(short);
52 if(pixelType == Isis::UnsignedInteger) return sizeof(unsigned int);
53 if(pixelType == Isis::SignedInteger) return sizeof(int);
54 if(pixelType == Isis::Real) return sizeof(float);
55 if(pixelType == Isis::Double) return sizeof(double);
56 return -1;
57 }
58
66 inline QString PixelTypeName(Isis::PixelType pixelType) {
67 if(pixelType == Isis::None) return "None";
68 if(pixelType == Isis::UnsignedByte) return "UnsignedByte";
69 if(pixelType == Isis::SignedByte) return "SignedByte";
70 if(pixelType == Isis::UnsignedWord) return "UnsignedWord";
71 if(pixelType == Isis::SignedWord) return "SignedWord";
72 if(pixelType == Isis::UnsignedInteger) return "UnsignedInteger";
73 if(pixelType == Isis::SignedInteger) return "SignedInteger";
74 if(pixelType == Isis::Real) return "Real";
75 if(pixelType == Isis::Double) return "Double";
76 return "Error";
77 }
78
89 inline Isis::PixelType PixelTypeEnumeration(const QString &type) {
90 QString temp = type.toUpper();
91 if(temp == "UNSIGNEDBYTE" || temp == "8BIT" || temp == "8-BIT") return Isis::UnsignedByte;
92 if(temp == "SIGNEDBYTE") return Isis::SignedByte;
93 if(temp == "UNSIGNEDWORD") return Isis::UnsignedWord;
94 if(temp == "SIGNEDWORD") return Isis::SignedWord;
95 if(temp == "UNSIGNEDINTEGER") return Isis::UnsignedInteger;
96 if(temp == "SIGNEDINTEGER") return Isis::SignedInteger;
97 if(temp == "REAL") return Isis::Real;
98 if(temp == "DOUBLE") return Isis::Double;
99 return Isis::None;
100 }
101}
102
103#endif
104
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
int SizeOf(Isis::PixelType pixelType)
Returns the number of bytes of the specified PixelType.
Definition PixelType.h:46
Isis::PixelType PixelTypeEnumeration(const QString &type)
Returns PixelType enumeration given a string.
Definition PixelType.h:89
QString PixelTypeName(Isis::PixelType pixelType)
Returns string name of PixelType enumeration entered as input parameter.
Definition PixelType.h:66
PixelType
Enumerations for Isis Pixel Types.
Definition PixelType.h:27
@ SignedByte
Definition PixelType.h:30
@ SignedWord
Definition PixelType.h:32
@ SignedInteger
Definition PixelType.h:34
@ UnsignedInteger
Definition PixelType.h:33
@ None
Definition PixelType.h:28
@ UnsignedByte
Definition PixelType.h:29
@ UnsignedWord
Definition PixelType.h:31
@ Double
Definition PixelType.h:36
@ Real
Definition PixelType.h:35