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.
These methods help to handle ImageView objects that are described more precisely in the Image Data section.
Syntax
// 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;
# 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))
// 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)."); }