| IOLink 1.11.0

Loading...
Searching...
No Matches
ImageType.h
1#pragma once
2
3#include <cstdint>
4#include <initializer_list>
5#include <string>
6
7#include <iolink/IOLinkAPI.h>
8
9 namespace iolink
10{
11
15 enum class ImageDimension
16{
18 COLUMN = 0,
20 ROW = 1,
22 SLICE = 2,
24 CHANNEL = 3,
26 SEQUENCE = 4,
27};
28
29// create an alias for ImageDimension
30 using ImageAxis = ImageDimension;
31
42 class IOLINK_API ImageType
43{
44 public:
48 ImageType();
49
53 explicit ImageType(ImageDimension dimension);
54
58 explicit ImageType(const ImageDimension* dimensionsList, size_t count);
59
63 explicit ImageType(std::initializer_list<ImageDimension> dimensionsList);
64
68 explicit ImageType(uint64_t val);
69
75 bool has(ImageDimension dimension) const;
76
81 void add(ImageDimension dimension);
82
86 size_t dimensionCount() const;
87
92 void add(ImageType other);
93
98 void remove(ImageDimension dimension);
99
104 void remove(size_t index);
105
110 void remove(ImageType other);
111
124 ImageDimension dimension(size_t index) const;
125
137 size_t indexDimension(ImageDimension dimension);
138
144 ImageType operator|(ImageDimension rhs) const;
145
151 bool operator==(ImageType other) const;
152
158 bool operator!=(ImageType other) const;
159
163 std::string toString() const;
164
168 uint64_t value() const;
169
170 private:
171 static uint64_t dimensionFlag(ImageDimension dimension);
172
173 uint64_t m_value;
174};
175
182 inline ImageType
183 operator|(ImageDimension lhs, ImageDimension rhs)
184{
185 return ImageType(ImageType(lhs) | rhs);
186}
187
188// create an alias for ImageType
189 using AxesInterpretation = ImageType;
190
197 inline ImageType
198 operator|(ImageDimension lhs, ImageType rhs)
199{
200 return rhs | lhs;
201}
202
213 class IOLINK_API ImageTypeId
214{
215 public:
217 static const ImageType UNKNOWN;
219 static const ImageType IMAGE;
222 static const ImageType VOLUME;
225 static const ImageType MULTISPECTRAL_IMAGE;
228 static const ImageType MULTISPECTRAL_VOLUME;
231 static const ImageType IMAGE_SEQUENCE;
234 static const ImageType VOLUME_SEQUENCE;
237 static const ImageType MULTISPECTRAL_IMAGE_SEQUENCE;
241 static const ImageType MULTISPECTRAL_VOLUME_SEQUENCE;
242};
243
244// create an alias for ImageTypeId
245 using AxesInterpretationId = ImageTypeId;
246
247} // end namespace iolink
iolink::ImageType
A flag system that describes the dimensions of an image.
Definition ImageType.h:43
iolink::ImageType::ImageType
ImageType(const ImageDimension *dimensionsList, size_t count)
Create an ImageType with a list of dimensions (C array style)
iolink::ImageType::ImageType
ImageType()
Create an ImageType with no known dimensions.
iolink::ImageType::dimension
ImageDimension dimension(size_t index) const
Return the nth dimension at the given position.
iolink::ImageType::dimensionCount
size_t dimensionCount() const
Give the number of dimensions in the ImageType.
iolink::ImageType::add
void add(ImageType other)
Add all the dimensions from given ImageType to current ImageType.
iolink::ImageType::toString
std::string toString() const
Return string interpretation.
iolink::ImageType::ImageType
ImageType(uint64_t val)
Create an ImageType from an 64-bits integer.
iolink::ImageType::remove
void remove(size_t index)
Remove the nth dimension to the ImageType.
iolink::ImageType::remove
void remove(ImageDimension dimension)
Remove the given dimension to the ImageType.
iolink::ImageType::has
bool has(ImageDimension dimension) const
Checks if the ImageType has the given dimension.
iolink::ImageType::value
uint64_t value() const
Return internal 64-bit integer value.
iolink::ImageType::operator==
bool operator==(ImageType other) const
Equality operator.
iolink::ImageType::ImageType
ImageType(std::initializer_list< ImageDimension > dimensionsList)
Create an ImageType with a list of dimensions.
iolink::ImageType::operator!=
bool operator!=(ImageType other) const
Not-Equality operator.
iolink::ImageType::indexDimension
size_t indexDimension(ImageDimension dimension)
Return the position of given dimension in the current ImageType.
iolink::ImageType::add
void add(ImageDimension dimension)
Add the given dimension to the ImageType.
iolink::ImageType::ImageType
ImageType(ImageDimension dimension)
Create an ImageType with only one given dimension.
iolink::ImageType::operator|
ImageType operator|(ImageDimension rhs) const
Equivalent to add.
iolink::ImageType::remove
void remove(ImageType other)
Remove all the given dimensions to the ImageType.
iolink::ImageTypeId
Enum for the image type (see ImageType)
Definition ImageType.h:214
iolink::ImageTypeId::VOLUME
static const ImageType VOLUME
Represents a 3D image (COLUMN, ROW, SLICE)
Definition ImageType.h:222
iolink::ImageTypeId::MULTISPECTRAL_VOLUME_SEQUENCE
static const ImageType MULTISPECTRAL_VOLUME_SEQUENCE
Represents a 5D temporal volume (COLUMN, ROW, SLICE, CHANNEL, SEQUENCE)
Definition ImageType.h:241
iolink::ImageTypeId::VOLUME_SEQUENCE
static const ImageType VOLUME_SEQUENCE
Represents a 4D temporal volume (COLUMN, ROW, SLICE, SEQUENCE)
Definition ImageType.h:234
iolink::ImageTypeId::MULTISPECTRAL_IMAGE_SEQUENCE
static const ImageType MULTISPECTRAL_IMAGE_SEQUENCE
Represents a 4D temporal volume (COLUMN, ROW, CHANNEL, SEQUENCE)
Definition ImageType.h:237
iolink::ImageTypeId::IMAGE_SEQUENCE
static const ImageType IMAGE_SEQUENCE
Represents a 3D temporal image (COLUMN, ROW, SEQUENCE)
Definition ImageType.h:231
iolink::ImageTypeId::MULTISPECTRAL_VOLUME
static const ImageType MULTISPECTRAL_VOLUME
Represents a 4D multi-spectral volume (COLUMN, ROW, SLICE, CHANNEL)
Definition ImageType.h:228
iolink::ImageTypeId::IMAGE
static const ImageType IMAGE
Represents a 2D image (COLUMN, ROW)
Definition ImageType.h:219
iolink::ImageTypeId::UNKNOWN
static const ImageType UNKNOWN
When ImageType is not known or defined.
Definition ImageType.h:217
iolink::ImageTypeId::MULTISPECTRAL_IMAGE
static const ImageType MULTISPECTRAL_IMAGE
Represents a 3D multi-spectral image (COLUMN, ROW, CHANNEL)
Definition ImageType.h:225
iolink
All IOLink symbols are enclosed in this namespace.
Definition ArrayX.h:8
iolink::operator|
ImageType operator|(ImageDimension lhs, ImageDimension rhs)
Binary Operator to combine two dimensions.
Definition ImageType.h:183
iolink::ImageDimension
ImageDimension
Enum used in ImageType to represent each dimension of an Image.
Definition ImageType.h:16
iolink::ImageDimension::SLICE
@ SLICE
represents depth for a volumetric image
iolink::ImageDimension::SEQUENCE
@ SEQUENCE
represents the temporality for a sequence of images
iolink::ImageDimension::ROW
@ ROW
represents a image height
iolink::ImageDimension::COLUMN
@ COLUMN
represents a image width
iolink::ImageDimension::CHANNEL
@ CHANNEL
represents channel planes of a multi-spectral image