Class CDimCoordinate#

Inheritance Relationships#

Base Types#

Class Documentation#

class CDimCoordinate : public libCZI::CDimBase, public libCZI::IDimCoordinate#

Implementation of a class representing a coordinate (and implementing the IDimCoordinate-interface).

Public Functions

inline CDimCoordinate()#

Default constructor which constructs an empty coordinate (no valid dimensions).

inline CDimCoordinate(std::initializer_list<DimensionAndValue> list)#

Constructor which constructs a coordinate object from the specified initializer list. It can be used like this:

auto coord = CDimCoordinate{ { DimensionIndex::Z,8 } , { DimensionIndex::T,0 }, { DimensionIndex::C,1 } };

Remark

If the same dimension appears multiple times in the initializer list, then the last occurence wins.

Parameters:

list – The list of dimensions-and-values.

inline explicit CDimCoordinate(const libCZI::IDimCoordinate *other)#

Copy-constructor which creates a copy of the specifed coordinate.

Parameters:

other – The coordinate for which to create a copy. It may be null in which case an empty coordinate is created.

inline void Set(libCZI::DimensionIndex dimension, int value)#

Sets the value for the specified dimension. The specified dimension will be marked ‘valid’.

Parameters:
  • dimension – The dimension to set.

  • value – The value to set.

inline void Clear(libCZI::DimensionIndex dimension)#

Clears the validity of the specified dimension.

Parameters:

dimension – The dimension to mark as ‘not valid for this coordinate’.

inline void Clear()#

Clears the validity of all dimensions.

inline void EnumValidDimensions(const std::function<bool(libCZI::DimensionIndex dim, int value)> &func) const#

Enumerate the valid dimensions contained in this coordinate. The specified functor will be called for each valid dimension (and providing the functor with the dimension index and the coordinate). If the functor returns false, the enumeration is cancelled.

Parameters:

func – The functor to call for each valid dimension. If returning false, the enumeration is cancelled.

inline int GetValidDimensionsCount() const#

Determine the number the valid dimensions contained in this coordinate.

inline virtual bool TryGetPosition(libCZI::DimensionIndex dim, int *coordinate) const override#

Attempts to get position index in the specified dimension.

Parameters:
  • dim – The dimension.

  • coordinate[out] If non-null and the dimension is valid (in this coordinate), it will receive the value of the coordinate for the specified dimension.

Returns:

True if it succeeds (i. e. the specified dimension is given in this coordinate), false otherwise.

Public Static Functions

static CDimCoordinate Parse(const char *str)#

Parse the specified string and construct a CDimCoordinate-object from the information. The syntax for the string is - a character identifying the dimension (one of ‘Z’, ‘C’, ‘T’, ‘R’, ‘S’, ‘I’, ‘H’, ‘V’, ‘B’) followed by an integer (possibly with a + or -). There can be more than one dimension given, in which case the parts can be separated by a comma, a semicolon or spaces. The regular expression is:

([:blank:]*[Z|C|T|R|S|I|H|V|B][\\+|-]?[[:digit:]]+[,|;| ]*)
It is illegal to give the same dimension multiple times.

Throws:

LibCZIStringParseException – Thrown when the specified string cannot be parsed because of a syntactical error.

Parameters:

str – The string to parse.

Returns:

A CDimCoordinate object constructed from the string.