ImageDev

Image Data

This section introduces the ImageDev helpers for interacting with ImageView meta data.

These methods help to handle ImageView objects that are described more precisely in the Image Data section.

Syntax

Method Description
iolink::ImageInterpretation getImageInterpretation( std::shared_ptr < iolink::ImageView > image ) Gets the image intensity interpretation (binary, label, or other values).
  • image: The input IOLink image
void setImageInterpretation( std::shared_ptr < iolink::ImageView > image, const iolink::ImageInterpretation interpretation ) Sets the image intensity interpretation (binary, label, or other values).
  • image: The input IOLink image
  • interpretation: The interpretation value
iolink::ImageType getDimensionalInterpretation( std::shared_ptr < iolink::ImageView > image ) Gets the image dimensional interpretation for an image having more than 2 dimensions (volume, sequence, multi-channel).
  • image: The input IOLink image
void setDimensionalInterpretation( std::shared_ptr < iolink::ImageView > image, const iolink::ImageType& imageType ) Sets the image dimensional interpretation for an image having more than 2 dimensions (volume, sequence, multi-channel).
  • image: The input IOLink image
  • imageType: The imageType value
iolink::Vector3d getCalibrationOrigin( std::shared_ptr <iolink::ImageView > image ) Gets the calibration origin from an IOLink image.
  • image: The IOLink image
void setCalibrationOrigin( std::shared_ptr <iolink::ImageView > image, const iolink::Vector3d& origin ) Sets the calibration origin of an IOLink image.
  • image: The input IOLink image
  • origin: The calibration origin value to give to the input image.
iolink::Vector3d getCalibrationSpacing( std::shared_ptr < iolink::ImageView > image ) Gets the calibration spacing from an IOLink image.
  • image: The IOLink image
void setCalibrationSpacing( std::shared_ptr < iolink::ImageView > image, const iolink::Vector3d& spacing ) Sets the calibration spacing of an IOLink image.
  • image: The input IOLink image
  • spacing: The calibration spacing value to give to the input image.
void setCalibrationUnit( std::shared_ptr< iolink::ImageView > image, const std::string& unit ) Sets the calibration unit of an IOLink image.
  • image: The input IOLink image
  • unit: the new calibration unit
std::string getCalibrationUnit( std::shared_ptr< iolink::ImageView > image ) Gets the calibration unit from an IOLink image. The unit is returned as a string.
  • image: The input IOLink image

// Create demo image
std::shared_ptr < iolink::ImageView > image =
            iolink::ImageViewFactory::allocate( { 5, 6 }, iolink::DataTypeId::UINT8 );
// Similar to image->properties()->sampleInfo().interpretation(); iolink::ImageInterpretation originalInterpretation = imagedev::getImageInterpretation( image ); if( originalInterpretation == iolink::ImageInterpretation::UNKNOWN ) std::cout << "Interpretation is UNKNOWN." << std::endl;
// Similar to image->setProperties( // iolink::PropertyMap::fromPropertyMap( // image->properties(), // iolink::SampleInfoProperty( interpretation, false ) ) ); imagedev::setImageInterpretation( image, iolink::ImageInterpretation::BINARY ); if( imagedev::getImageInterpretation( image ) == iolink::ImageInterpretation::BINARY ) std::cout << "Interpretation is BINARY." << std::endl;

// Similar to image->properties()->dimensionInfo().type(); iolink::ImageType originalImageType = imagedev::getDimensionalInterpretation( image ); if( originalImageType == iolink::ImageTypeId::UNKNOWN ) std::cout << "ImageType is UNKNOWN." << std::endl;
// Similar to image->setProperties( // iolink::PropertyMap::fromPropertyMap( // image->properties(), // iolink::DimensionInfoProperty( interpretation ) ) ); imagedev::setDimensionalInterpretation( image, iolink::ImageTypeId::VOLUME ); if( imagedev::getDimensionalInterpretation( image ) == iolink::ImageTypeId::VOLUME ) std::cout << "ImageType is VOLUME." << std::endl;

// Similar to image->properties()->calibration()->origin(); iolink::Vector3d originalOrigin = imagedev::getCalibrationOrigin( image ); if( originalOrigin == imagedev::getCalibrationOrigin( image ) ) std::cout << "Calibration origin is" << originalOrigin << std::endl;
// Similar to image->setProperties( // iolink::PropertyMap::fromPropertyMap( // image->properties(), // iolink::SpatialCalibrationProperty( origin, image->properties()->calibration()->spacing() ) ) ); imagedev::setCalibrationOrigin( image, { 1, 2, 3 } ); if ( imagedev::getCalibrationOrigin( image ) == iolink::Vector3d( { 1, 2, 3 } ) ) std::cout << "Calibration origin is" << originalOrigin << std::endl;
// Similar to image->properties()->calibration()->spacing(); iolink::Vector3d originalSpacing = imagedev::getCalibrationSpacing( image ); if( originalSpacing == imagedev::getCalibrationSpacing( image ) ) std::cout << "Calibration spacing is" << originalSpacing << std::endl;
// Similar to image->setProperties( // iolink::PropertyMap::fromPropertyMap( // image->properties(), // iolink::SpatialCalibrationProperty( image->properties()->calibration()->origin(), spacing ) ) ); imagedev::setCalibrationSpacing( image, { 2, 3, 4 } ); if ( imagedev::getCalibrationSpacing( image ) == iolink::Vector3d( { 2, 3, 4 } ) ) std::cout << "Calibration spacing is" << originalSpacing << std::endl;