libCZI
Reading and Writing CZI documents made easy
Loading...
Searching...
No Matches
libCZI::MetadataUtils Class Reference

Helper functions useful for constructing CZI-metadata. More...

#include <libCZI_Metadata.h>

Classes

struct  CoerceAdditionalInfoForChannelDisplaySettings
 This struct is used for controlling the operation of adding display-settings. More...
 

Static Public Member Functions

static void WriteImageSizeInformation (libCZI::ICziMetadataBuilder *builder, int width, int height)
 
static void WriteMIndexSizeInformation (libCZI::ICziMetadataBuilder *builder, int mSize)
 
static void WriteDimensionSize (libCZI::ICziMetadataBuilder *builder, libCZI::DimensionIndex dim, int size)
 
static void WriteFillWithSubBlockStatistics (libCZI::ICziMetadataBuilder *builder, const libCZI::SubBlockStatistics &statistics)
 
static void WriteDimInfoT_Interval (libCZI::ICziMetadataBuilder *builder, const libCZI::XmlDateTime *startTime, double startOffSet, double increment)
 
static void WriteDimInfoT_List (libCZI::ICziMetadataBuilder *builder, const libCZI::XmlDateTime *startTime, const std::function< double(int)> &funcGetOffsets)
 
static void WriteDimInfoZ_Interval (libCZI::ICziMetadataBuilder *builder, double startPos, double startOffSet, double increment)
 
static void WriteDimInfoZ_List (libCZI::ICziMetadataBuilder *builder, double startPos, const std::function< double(int)> &funcGetOffsets)
 
static void WriteGeneralDocumentInfo (libCZI::ICziMetadataBuilder *builder, const libCZI::GeneralDocumentInfo &info)
 
static void WriteScalingInfo (libCZI::ICziMetadataBuilder *builder, const libCZI::ScalingInfo &scalingInfo)
 
static void WriteScalingInfoEx (libCZI::ICziMetadataBuilder *builder, const libCZI::ScalingInfoEx &scalingInfo)
 
static void SetOrAddCustomKeyValuePair (libCZI::ICziMetadataBuilder *builder, const std::string &key, const libCZI::CustomValueVariant &value)
 
static void WriteDisplaySettings (libCZI::ICziMetadataBuilder *builder, const libCZI::IDisplaySettings *display_settings, const std::map< int, PixelType > *channel_pixel_type=nullptr)
 
static void WriteDisplaySettings (libCZI::ICziMetadataBuilder *builder, const libCZI::IDisplaySettings *display_settings, int channel_count, const std::map< int, PixelType > *channel_pixel_type=nullptr)
 
static void WriteDisplaySettings (libCZI::ICziMetadataBuilder *builder, const libCZI::IDisplaySettings *display_settings, int channel_count, const std::function< void(int, CoerceAdditionalInfoForChannelDisplaySettings &)> &coerce_additional_info_functor)
 

Detailed Description

Helper functions useful for constructing CZI-metadata.

Member Function Documentation

◆ SetOrAddCustomKeyValuePair()

static void libCZI::MetadataUtils::SetOrAddCustomKeyValuePair ( libCZI::ICziMetadataBuilder builder,
const std::string &  key,
const libCZI::CustomValueVariant value 
)
static

Helper function which is putting a set of key-value pairs into the XML-metadata at the position "Metadata/Information/CustomAttributes/KeyValue". An element with the specified "key"-name is created/overwritten in this node, and the value is put into this element as the value. Type of the written custom key-value pair is explicitly marked with attribute of the xml node, e.g. Type="String" if the type of value is string. Special case: If two custom key-value pairs have the same key name, the last pair would overwrite the xml node created by the previous pair.

Parameters
[in]builderThe metadata-builder object.
keyKey of the custom key-value pair.
valueValue of the custom key-value pair.

◆ WriteDimensionSize()

static void libCZI::MetadataUtils::WriteDimensionSize ( libCZI::ICziMetadataBuilder builder,
libCZI::DimensionIndex  dim,
int  size 
)
static

Writes the size-information for the specified dimension (to "Metadata/Information/Image/Size?").

Parameters
[in,out]builderThe metadata-builder object.
dimThe dimension.
sizeThe size of the dimension.

◆ WriteDimInfoT_Interval()

static void libCZI::MetadataUtils::WriteDimInfoT_Interval ( libCZI::ICziMetadataBuilder builder,
const libCZI::XmlDateTime startTime,
double  startOffSet,
double  increment 
)
static

Writes the "dimension-T"-information ("Information/Dimensions/T") - this associates a timestamp with each T-coordinate. With this function we provide the timestamps for the equidistant case (= the difference between consecutive T-indices is constant). The difference is specified as "increment". It is possible to specify an offset for the first T-index, given as startOffset. An absolute time-point may be specified as startTime. Example: say, startOffSet is 1 and increment is 2. Then T=0 is associated with 1, T=1 with 1+2, T=2 with 1+2*2, T=3 with 1+2*3 and so on.

Parameters
[in,out]builderThe metadata-builder object.
startTimeIf non-null, the (absolute) start time.
startOffSetThe offset for the first timepoint (in units of seconds). If numeric_limits<double>::quiet_NaN() is specified, this parameter is ignored.
incrementThe increment (in units of seconds). If numeric_limits<double>::quiet_NaN() is specified, this parameter is ignored.

◆ WriteDimInfoT_List()

static void libCZI::MetadataUtils::WriteDimInfoT_List ( libCZI::ICziMetadataBuilder builder,
const libCZI::XmlDateTime startTime,
const std::function< double(int)> &  funcGetOffsets 
)
static

Writes the "dimension-T"-information ("Information/Dimensions/T") - this associates a timestamp with each T-coordinate. With this function we provide a list of timestamps.

Parameters
[in,out]builderThe metadata-builder object.
startTimeIf non-null, the (absolute) start time.
funcGetOffsetsA function which is called for providing the timestamp. The integer parameter is incremented with each call, starting with 0. The return value is the timestamp (in units of seconds). If numeric_limits<double>::quiet_NaN() is returned, the enumeration is ended.

◆ WriteDimInfoZ_Interval()

static void libCZI::MetadataUtils::WriteDimInfoZ_Interval ( libCZI::ICziMetadataBuilder builder,
double  startPos,
double  startOffSet,
double  increment 
)
static

Helper function in order to write the Dimension-Z information - as a an equal-distance sequence.

Parameters
[in]builderThe metadata-builder object.
startPosThe start position.
startOffSetThe offset of the first item in the sequence.
incrementThe increment.

◆ WriteDimInfoZ_List()

static void libCZI::MetadataUtils::WriteDimInfoZ_List ( libCZI::ICziMetadataBuilder builder,
double  startPos,
const std::function< double(int)> &  funcGetOffsets 
)
static

Helper function in order to write the Dimension-Z information - as a an explicit list.

Parameters
[in]builderThe metadata-builder object.
startPosThe start position.
funcGetOffsetsThe function which is called to retrieve the offset. The argument is incremented with each call (starting with 0); a return value of infinity or NaN will end the enumeration.

◆ WriteDisplaySettings() [1/3]

static void libCZI::MetadataUtils::WriteDisplaySettings ( libCZI::ICziMetadataBuilder builder,
const libCZI::IDisplaySettings display_settings,
const std::map< int, PixelType > *  channel_pixel_type = nullptr 
)
static

Helper function which writes the specified display-settings into the specified metadata-builder. The display-settings XML-metadata-node will have as many channel-items as the highest channel-number found in the display-settings object. If there are nodes with name "Channel" existing (prior to calling this function) under the node "Metadata/DisplaySetting/Channels", they are removed (before adding new content). The argument 'channel_pixel_type' is optional. If it is specified, the pixel-type of the channel is written into the display-settings XML-metadata-node. This is not a mandatory piece of information, but was found to be useful in some cases.

Parameters
[in]builderThe metadata-builder object.
display_settingsThe display settings.
channel_pixel_typeThe map of the channel and its corresponding pixel type.

◆ WriteDisplaySettings() [2/3]

static void libCZI::MetadataUtils::WriteDisplaySettings ( libCZI::ICziMetadataBuilder builder,
const libCZI::IDisplaySettings display_settings,
int  channel_count,
const std::function< void(int, CoerceAdditionalInfoForChannelDisplaySettings &)> &  coerce_additional_info_functor 
)
static

Helper function which writes the specified display-settings into the specified metadata-builder. The display-settings XML-metadata-node will have as many channel-items as specified with the argument 'channel_count'. If there are nodes with name "Channel" existing (prior to calling this function) under the node "Metadata/DisplaySetting/Channels", they are removed (before adding new content). This function allows to coerce and control some additional information that is written to the XML-metadata-node.

Parameters
[in,out]builderThe metadata-builder object.
display_settingsThe display settings.
channel_countThe number of channels (which are constructed in the display-settings XML-metadata).
coerce_additional_info_functorA functor which allows to mutate and/or control what additional information is written to the XML-metadata-node.

◆ WriteDisplaySettings() [3/3]

static void libCZI::MetadataUtils::WriteDisplaySettings ( libCZI::ICziMetadataBuilder builder,
const libCZI::IDisplaySettings display_settings,
int  channel_count,
const std::map< int, PixelType > *  channel_pixel_type = nullptr 
)
static

Helper function which writes the specified display-settings into the specified metadata-builder. The display-settings XML-metadata-node will have as many channel-items as specified with the argument 'channel_count'. If there are nodes with name "Channel" existing (prior to calling this function) under the node "Metadata/DisplaySetting/Channels", they are removed (before adding new content). The argument 'channel_pixel_type' is optional. If it is specified, the pixel-type of the channel is written into the display-settings XML-metadata-node. This is not a mandatory piece of information, but was found to be useful in some cases.

Parameters
[in]builderThe metadata-builder object.
display_settingsThe display settings.
channel_countThe number of channels (which are constructed in the display-settings XML-metadata).
channel_pixel_typeThe map of the channel and its corresponding pixel type.

◆ WriteFillWithSubBlockStatistics()

static void libCZI::MetadataUtils::WriteFillWithSubBlockStatistics ( libCZI::ICziMetadataBuilder builder,
const libCZI::SubBlockStatistics statistics 
)
static

Uses the specified statistics-data in order to write the "size"-information-

Parameters
[in,out]builderThe metadata-builder object.
statisticsThe subblock-statistics.

◆ WriteGeneralDocumentInfo()

static void libCZI::MetadataUtils::WriteGeneralDocumentInfo ( libCZI::ICziMetadataBuilder builder,
const libCZI::GeneralDocumentInfo info 
)
static

Helper function which writes the information from the specified "GeneralDocumentInfo" into the metadata-builder object.

Parameters
[in]builderThe metadata-builder object.
infoThe general-document-information to be written into the metadata-builder object.

◆ WriteImageSizeInformation()

static void libCZI::MetadataUtils::WriteImageSizeInformation ( libCZI::ICziMetadataBuilder builder,
int  width,
int  height 
)
static

Writes the nodes ""Metadata/Information/Image/SizeX" and ""Metadata/Information/Image/SizeY".

Parameters
[in,out]builderThe metadata-builder object.
widthThe width (=SizeX).
heightThe height (=SizeY).

◆ WriteMIndexSizeInformation()

static void libCZI::MetadataUtils::WriteMIndexSizeInformation ( libCZI::ICziMetadataBuilder builder,
int  mSize 
)
static

Writes the node ""Metadata/Information/Image/SizeM".

Parameters
[in,out]builderThe metadata-builder object.
mSizeThe M-size.

◆ WriteScalingInfo()

static void libCZI::MetadataUtils::WriteScalingInfo ( libCZI::ICziMetadataBuilder builder,
const libCZI::ScalingInfo scalingInfo 
)
static

Helper function in order to write scaling-information into the metadata-builder object.

Parameters
[in]builderThe metadata-builder object.
scalingInfoThe scaling to be written into the metadata-builder object.

◆ WriteScalingInfoEx()

static void libCZI::MetadataUtils::WriteScalingInfoEx ( libCZI::ICziMetadataBuilder builder,
const libCZI::ScalingInfoEx scalingInfo 
)
static

Helper function in order to write scaling-information into the metadata-builder object.

Parameters
[in]builderThe metadata-builder object.
scalingInfoThe scaling to be written into the metadata-builder object.

The documentation for this class was generated from the following file: