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;
Method Description
get_image_interpretation(image) Gets the image intensity interpretation (binary, label, or other values).
  • image: The input IOLink image
set_image_interpretation(image, interpretation) Sets the image intensity interpretation (binary, label, or other values).
  • image: The input IOLink image
  • interpretation: The interpretation value
get_dimensional_interpretation(image) Gets the image dimensional interpretation for an image having more than 2 dimensions (volume, sequence, multi-channel).
  • image: The input IOLink image
set_dimensional_interpretation(image, 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
get_calibration_origin(image) Gets the calibration origin from an IOLink image.
  • image: The IOLink image
set_calibration_origin(image, 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.
get_calibration_spacing(image) Gets the calibration spacing from an IOLink image.
  • image: The IOLink image
set_calibration_spacing(image, 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.
set_calibration_unit(image, unit) Sets the calibration unit of an IOLink image.
  • image: The input IOLink image
  • unit: the new calibration unit
get_calibration_unit(image) Gets the calibration unit from an IOLink image. The unit is returned as a string.
  • image: The input IOLink image
# Create demo image
image = iolink.ImageViewFactory.allocate(iolink.VectorXu64(5, 6, 7), iolink.DataTypeId_UINT8)
# Similar to image.properties().image_info().interpretation() originalInterpretation = imagedev.get_image_interpretation(image) if (originalInterpretation == iolink.ImageInterpretation_UNKNOWN): print("Interpretation is UNKNOWN.")
imagedev.data.set_image_interpretation(image, iolink.ImageInterpretation_BINARY) if (imagedev.data.get_image_interpretation(image) == iolink.ImageInterpretation_BINARY): print("Interpretation is BINARY.")
# Similar to image.properties().image_info().axes_interpretation(); originalImageType = imagedev.get_dimensional_interpretation(image) if (originalImageType == iolink.ImageTypeId.UNKNOWN): print("ImageType is UNKNOWN.")
imagedev.data.set_dimensional_interpretation(image,iolink.ImageTypeId.VOLUME) if (imagedev.data.get_dimensional_interpretation(image) == image,iolink.ImageTypeId.VOLUME): print("ImageType is VOLUME.")
# Similar to image->properties()->calibration()->origin() originalOrigin = imagedev.data.get_calibration_origin(image) if (originalOrigin == imagedev.data.get_calibration_origin(image)): print("Calibration origin is", originalOrigin)
imagedev.data.set_calibration_origin(image, iolink.Vector3d(1, 2, 3)) if (imagedev.data.get_calibration_origin(image) == iolink.Vector3d(1, 2, 3)): print("Calibration origin is", iolink.Vector3d(1, 2, 3))
# Similar to image.properties().calibration().spacing() originalSpacing = imagedev.data.get_calibration_spacing(image) if (originalSpacing == imagedev.data.get_calibration_spacing(image)): print("Calibration spacing is", originalSpacing)
imagedev.data.set_calibration_spacing(image, iolink.Vector3d(2, 3, 4)) if (imagedev.data.get_calibration_spacing(image) == iolink.Vector3d(2, 3, 4)): print("Calibration spacing is", iolink.Vector3d(2, 3, 4))
Method Description
public static ImageInterpretation GetImageInterpretation(ImageView image) Gets the image intensity interpretation (binary, label, or other values).
  • image: The input IOLink image
public static void SetImageInterpretation(ImageView image, ImageInterpretation interpretation) Sets the image intensity interpretation (binary, label, or other values).
  • image: The input IOLink image
  • interpretation: The interpretation value
public static ImageType GetDimensionalInterpretation(ImageView image) Gets the image dimensional interpretation for an image having more than 2 dimensions (volume, sequence, multi-channel).
  • image: The input IOLink image
public static void SetDimensionalInterpretation(ImageView image, 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
public static Vector3d GetCalibrationOrigin(ImageView image) Gets the calibration origin from an IOLink image.
  • image: The IOLink image
public static void SetCalibrationOrigin(ImageView image, 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.
public static Vector3d GetCalibrationSpacing(ImageView image) Gets the calibration spacing from an IOLink image.
  • image: The IOLink image
public static void SetCalibrationSpacing(ImageView image, 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.
public static void SetCalibrationUnit(ImageView image, String unit) Sets the calibration unit of an IOLink image.
  • image: The input IOLink image
  • unit: the new calibration unit
public string void GetCalibrationUnit(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
var image = IOLink.ImageViewFactory.Allocate(new VectorXu64(5, 6, 7), IOLink.DataTypeId.VEC3_UINT8);
// Similar to image.GetProperties().ImageInfo.Interpretation; var originalInterpretation = Data.GetImageInterpretation(image); if (originalInterpretation == ImageInterpretation.UNKNOWN) { Utilities.WriteInfoMsg("Interpretation is UNKNOWN."); }
Data.SetImageInterpretation(image, ImageInterpretation.BINARY); if (Data.GetImageInterpretation(image) == ImageInterpretation.BINARY) { Utilities.WriteInfoMsg("Interpretation is BINARY."); }
// Similar to image.GetProperties().ImageInfo.AxesInterpretation; var originalImageType = Data.GetDimensionalInterpretation(image); if (originalImageType == ImageTypeId.UNKNOWN) { Utilities.WriteInfoMsg("ImageType is UNKNOWN."); }
Data.SetDimensionalInterpretation(image, ImageTypeId.VOLUME); if (Data.GetDimensionalInterpretation(image) == ImageTypeId.VOLUME) { Utilities.WriteInfoMsg("ImageType is VOLUME."); }
// Similar to image.GetProperties().Calibration.Origin; var originalOrigin = Data.GetCalibrationOrigin(image); if (originalOrigin == new Vector3d(0, 0, 0)) { Utilities.WriteInfoMsg("Calibration origin is (0, 0, 0)."); }
Data.SetCalibrationOrigin(image, new Vector3d(1, 2, 3)); if (Data.GetCalibrationOrigin(image) == new Vector3d(1, 2, 3)) { Utilities.WriteInfoMsg("Calibration origin is (1, 2, 3)."); }
// Similar to image.GetProperties().Calibration.Spacing; var originalSpacing = Data.GetCalibrationSpacing(image); if (originalSpacing == new Vector3d(1, 1, 1)) { Utilities.WriteInfoMsg("Calibration spacing is (1, 1, 1)."); }
Data.SetCalibrationSpacing(image, new Vector3d(2, 3, 4)); if (Data.GetCalibrationSpacing(image) == new Vector3d(2, 3, 4)) { Utilities.WriteInfoMsg("Calibration spacing is (2, 3, 4)."); }