15 #ifndef GDCMPIXELFORMAT_H
16 #define GDCMPIXELFORMAT_H
60 unsigned short samplesperpixel = 1,
61 unsigned short bitsallocated = 8,
62 unsigned short bitsstored = 8,
63 unsigned short highbit = 7,
64 unsigned short pixelrepresentation = 0 ) :
65 SamplesPerPixel(samplesperpixel),
66 BitsAllocated(bitsallocated),
67 BitsStored(bitsstored),
69 PixelRepresentation(pixelrepresentation) {}
79 unsigned short GetSamplesPerPixel()
const;
80 void SetSamplesPerPixel(
unsigned short spp)
83 SamplesPerPixel = spp;
84 assert( SamplesPerPixel == 1 || SamplesPerPixel == 3 || SamplesPerPixel == 4 );
88 unsigned short GetBitsAllocated()
const
92 void SetBitsAllocated(
unsigned short ba)
98 HighBit = (
unsigned short)(ba - 1);
103 unsigned short GetBitsStored()
const
105 assert( BitsStored <= BitsAllocated );
108 void SetBitsStored(
unsigned short bs)
110 if( bs <= BitsAllocated && bs )
113 SetHighBit( (
unsigned short) (bs - 1) );
118 unsigned short GetHighBit()
const
120 assert( HighBit < BitsStored );
123 void SetHighBit(
unsigned short hb)
125 if( hb < BitsStored )
130 unsigned short GetPixelRepresentation()
const
132 return (
unsigned short)(PixelRepresentation ? 1 : 0);
134 void SetPixelRepresentation(
unsigned short pr)
136 PixelRepresentation = (
unsigned short)(pr ? 1 : 0);
140 ScalarType GetScalarType()
const;
144 void SetScalarType(ScalarType st);
145 const char *GetScalarTypeAsString()
const;
152 uint8_t GetPixelSize()
const;
155 void Print(std::ostream &os)
const;
158 int64_t GetMin()
const;
161 int64_t GetMax()
const;
164 bool IsValid()
const;
168 return GetScalarType() == st;
172 return GetScalarType() != st;
177 SamplesPerPixel == pf.SamplesPerPixel &&
178 BitsAllocated == pf.BitsAllocated &&
179 BitsStored == pf.BitsStored &&
180 HighBit == pf.HighBit &&
181 PixelRepresentation == pf.PixelRepresentation;
186 SamplesPerPixel != pf.SamplesPerPixel ||
187 BitsAllocated != pf.BitsAllocated ||
188 BitsStored != pf.BitsStored ||
189 HighBit != pf.HighBit ||
190 PixelRepresentation != pf.PixelRepresentation;
199 unsigned short SamplesPerPixel;
201 unsigned short BitsAllocated;
203 unsigned short BitsStored;
205 unsigned short HighBit;
207 unsigned short PixelRepresentation;
218 #endif //GDCMPIXELFORMAT_H