7 #include "ImportExport.h"
8 #include "libCZI_exceptions.h"
11 #include <initializer_list>
57 return this->TryGetPosition(dim,
nullptr);
97 return this->TryGetInterval(dim,
nullptr,
nullptr);
142 auto i = ((std::underlying_type<libCZI::DimensionIndex>::type)dim) - 1;
151 std::uint32_t validDims;
167 for (
const auto& d : list)
169 this->Set(d.dimension, d.value);
178 if (other !=
nullptr)
198 this->values[index] = value;
199 this->validDims |= (1 << index);
208 this->validDims &= ~(1 << index);
227 if ((this->validDims & (1 << bitIndex)) != 0)
242 if ((this->validDims & (1 << bitIndex)) != 0)
272 if ((this->validDims & (1 << index)) != 0)
274 if (coordinate !=
nullptr)
276 *coordinate = this->values[index];
290 std::uint32_t validDims;
302 if (other !=
nullptr)
321 this->Set(d.dimension, d.start, d.size);
332 this->start[index] = start;
333 this->size[index] = size;
334 this->validDims |= (1 << index);
344 if ((this->validDims & (1 << bitIndex)) != 0)
359 this->validDims &= ~(1 << index);
373 return this->validDims == 0;
401 if ((this->validDims & (1 << index)) != 0)
403 if (startIndex !=
nullptr)
405 *startIndex = this->start[index];
410 *size = this->size[index];
Base class containing some commonly used methods.
Definition: libCZI_DimCoordinate.h:134
static std::underlying_type< libCZI::DimensionIndex >::type GetBitIndexForDimension(libCZI::DimensionIndex dim)
Definition: libCZI_DimCoordinate.h:139
Implementation of a class representing an interval (and implementing the libCZI::IDimBounds-interface...
Definition: libCZI_DimCoordinate.h:288
static CDimBounds Parse(const char *str)
CDimBounds(const IDimBounds *other)
Definition: libCZI_DimCoordinate.h:300
void EnumValidDimensions(const std::function< bool(libCZI::DimensionIndex dim, int start, int size)> &func) const
Definition: libCZI_DimCoordinate.h:339
bool TryGetInterval(libCZI::DimensionIndex dim, int *startIndex, int *size) const override
Definition: libCZI_DimCoordinate.h:398
void Set(libCZI::DimensionIndex dimension, int start, int size)
Definition: libCZI_DimCoordinate.h:329
void Clear()
Clears this object to its blank/initial state. All dimensions will be set to invalid.
Definition: libCZI_DimCoordinate.h:363
CDimBounds()
Default constructor - the object will contain no valid dimension.
Definition: libCZI_DimCoordinate.h:295
bool IsEmpty() const
Definition: libCZI_DimCoordinate.h:371
void Clear(libCZI::DimensionIndex dimension)
Definition: libCZI_DimCoordinate.h:356
CDimBounds(std::initializer_list< DimensionAndStartSize > list)
Definition: libCZI_DimCoordinate.h:317
Implementation of a class representing a coordinate (and implementing the IDimCoordinate-interface).
Definition: libCZI_DimCoordinate.h:149
CDimCoordinate(std::initializer_list< DimensionAndValue > list)
Definition: libCZI_DimCoordinate.h:165
CDimCoordinate()
Default constructor which constructs an empty coordinate (no valid dimensions).
Definition: libCZI_DimCoordinate.h:155
static CDimCoordinate Parse(const char *str)
int GetValidDimensionsCount() const
Determine the number the valid dimensions contained in this coordinate.
Definition: libCZI_DimCoordinate.h:236
CDimCoordinate(const libCZI::IDimCoordinate *other)
Definition: libCZI_DimCoordinate.h:176
void Set(libCZI::DimensionIndex dimension, int value)
Definition: libCZI_DimCoordinate.h:195
void EnumValidDimensions(const std::function< bool(libCZI::DimensionIndex dim, int value)> &func) const
Definition: libCZI_DimCoordinate.h:222
void Clear(libCZI::DimensionIndex dimension)
Definition: libCZI_DimCoordinate.h:205
bool TryGetPosition(libCZI::DimensionIndex dim, int *coordinate) const override
Definition: libCZI_DimCoordinate.h:269
void Clear()
Clears the validity of all dimensions.
Definition: libCZI_DimCoordinate.h:212
Interface used to represent an interval (for several dimensions).
Definition: libCZI_DimCoordinate.h:80
virtual bool TryGetInterval(DimensionIndex dim, int *startIndex, int *size) const =0
bool IsValid(DimensionIndex dim) const
Definition: libCZI_DimCoordinate.h:95
Interface used to represent a coordinate (in the space of the dimensions identified by DimensionIndex...
Definition: libCZI_DimCoordinate.h:37
virtual bool TryGetPosition(DimensionIndex dim, int *coordinate) const =0
bool IsValid(DimensionIndex dim) const
Definition: libCZI_DimCoordinate.h:55
int GetNumberOfValidDimensions() const
Definition: libCZI_DimCoordinate.h:63
Definition: libCZI_DimCoordinate.h:104
virtual bool IsContained(int index) const =0
External interfaces, classes, functions and structs are found in the namespace "libCZI".
Definition: libCZI.h:31
DimensionIndex
Values that represent dimension indexes.
Definition: libCZI_DimCoordinate.h:17
@ C
The C-dimension ("channel").
@ MaxDim
This enum must be have the value of the highest (valid) dimension index.
@ MinDim
This enum must be have the value of the lowest (valid) dimension index.
@ V
The V-dimension ("view").
@ S
The S-dimension ("scene").
@ B
The B-dimension ("block") - its use is deprecated.
@ T
The T-dimension ("time").
@ H
The H-dimension ("phase").
@ I
The I-dimension ("illumination").
@ R
The R-dimension ("rotation").
@ invalid
Invalid dimension index.
A structure combining a dimension and an interval (defined by a start value and the size).
Definition: libCZI_DimCoordinate.h:126
libCZI::DimensionIndex dimension
The dimension.
Definition: libCZI_DimCoordinate.h:127
int start
The start value.
Definition: libCZI_DimCoordinate.h:128
int size
The size.
Definition: libCZI_DimCoordinate.h:129
A structure combining a dimension and a value.
Definition: libCZI_DimCoordinate.h:119
libCZI::DimensionIndex dimension
The dimension.
Definition: libCZI_DimCoordinate.h:120
int value
The value (for this dimension).
Definition: libCZI_DimCoordinate.h:121