Image Data
This section introduces the ImageView object, an image data model used by ImageDev.
In ImageDev, an image object is defined by an
ImageView class of the IOLink library.
IOLink is an abstract data model that manages agnostic data. As it is very generic, views are proposed to represent data with a simpler model. Views are specialized to a type of data, like the ImageView class, which describes images. An interface mechanism allows the connection of data to IOLink in a unified way.
The IOLink data model can theoritically manage any type of data. ImageDev only supports the ImageView object from IOLink.
The IOFormat library can be used to:
IOFormat supports most of common file formats and several other formats dedicated to electron microscopy. The list of available file formats is available here.
The IOLink library is essential for ImageDev operation, and is embedded in its distribution. However, IOFormat must be installed separately, as described in the Getting Started sections.
The IOLink library is binary compatible between its minor versions. \begin{array}{|c|c|c|c|} \hline \textbf{ImageDev version} & \textbf{Embedded IOLink version}& \textbf{Supported IOLink versions} & \textbf{Recommended IOFormat versions} \\ \hline \hline \text{ 2024.1 } & \text{1.8.0} & \text{>=1.8.0 and <2.0} & \text{>=1.5.2 and <2.0} \\ \hline \text{ 2023.2 } & \text{1.6.1} & \text{>=1.6.1 and <2.0} & \text{>=1.3.1 and <2.0} \\ \hline \text{ 2023.1 } & \text{1.4} & \text{>=1.4 and <2.0} & \text{>=1.1 and <2.0} \\ \hline \text{ 2022.2 } & \text{1.2} & \text{>=1.2 and <2.0} & \text{>=0.33 and <2.0} \\ \hline \text{ 2022.1 } & \text{1.1} & \text{>=1.1 and <2.0} & \text{>=0.33 and <2.0} \\ \hline \end{array}
The vip extension refers to the proprietary file format managing all data generated by ImageDev. The ReadVipImage and WriteVipImage functions can be used to load and save data with the vip extension.
The following functions can be used to know and change the dimensional organization of ImageView data:
it returns:
If the following instruction is added:
the same ImageView is now considered to be a time series (or sequence) of 15 two-dimensional images.
The calibration information affects the result of most Image Analysis algorithms.
In ImageDev, the calibration information is directly given by the ImageView with two properties:
IOLink is an abstract data model that manages agnostic data. As it is very generic, views are proposed to represent data with a simpler model. Views are specialized to a type of data, like the ImageView class, which describes images. An interface mechanism allows the connection of data to IOLink in a unified way.
The IOLink data model can theoritically manage any type of data. ImageDev only supports the ImageView object from IOLink.
Loading and saving image files
Managing standard image files with IOFormat
IOFormat is a library developed by Thermo Fisher Scientific that is independent from ImageDev.The IOFormat library can be used to:
- Load an image file as an ImageView class
- Save an ImageView class into an image file
IOFormat supports most of common file formats and several other formats dedicated to electron microscopy. The list of available file formats is available here.
The IOLink library is essential for ImageDev operation, and is embedded in its distribution. However, IOFormat must be installed separately, as described in the Getting Started sections.
The IOLink library is binary compatible between its minor versions. \begin{array}{|c|c|c|c|} \hline \textbf{ImageDev version} & \textbf{Embedded IOLink version}& \textbf{Supported IOLink versions} & \textbf{Recommended IOFormat versions} \\ \hline \hline \text{ 2024.1 } & \text{1.8.0} & \text{>=1.8.0 and <2.0} & \text{>=1.5.2 and <2.0} \\ \hline \text{ 2023.2 } & \text{1.6.1} & \text{>=1.6.1 and <2.0} & \text{>=1.3.1 and <2.0} \\ \hline \text{ 2023.1 } & \text{1.4} & \text{>=1.4 and <2.0} & \text{>=1.1 and <2.0} \\ \hline \text{ 2022.2 } & \text{1.2} & \text{>=1.2 and <2.0} & \text{>=0.33 and <2.0} \\ \hline \text{ 2022.1 } & \text{1.1} & \text{>=1.1 and <2.0} & \text{>=0.33 and <2.0} \\ \hline \end{array}
Managing specific image files with the vip format
ImageDev may generate some specific data that cannot be properly saved and reopened with a standard file format. For instance, the output of the GaussianHessianMatrix3d is a 6-channel 3D image. IOFormat is not able to save such data correctly, at least not in a consistent way for ImageDev.The vip extension refers to the proprietary file format managing all data generated by ImageDev. The ReadVipImage and WriteVipImage functions can be used to load and save data with the vip extension.
Image types
IOLink image types are defined by three parameters, returned by the functions:- bitDepth: the number of bits used to encode a pixel intensity
- dataType.primitiveType(): the data type (signed or unsigned integer, float)
- imageInterpretation: the interpretation of data for an algorithm (color space identification, grayscale meaning)
Dimensional management
ImageView objects supported by ImageDev can have 5 dimensions: the X, Y and Z axis of a volume, the channels of a spectral image, and the time steps of an image sequence.The following functions can be used to know and change the dimensional organization of ImageView data:
- dimensionCount returns the number of dimensions.
- shape returns the size for each dimension; that is, the corresponding number of elements.
- axesInterpretation returns the description of the image dimensions.
std::cout << "myImage is a " << myImage->axesInterpretation().toString() << std::endl; std::cout << "Number of Dimensions = " << myImage->dimensionCount() << std::endl; for ( size_t i = 0; i < myImage->dimensionCount(); i++ ) { std::cout << "Dimension " << i << ": size = " << myImage->shape().at( i ) << " - interpretation = " << std::endl; }
print("my_image is a " + my_image.axes_interpretation.to_string() ) print("Number of Dimensions = " + str(my_image.dimension_count) ) for i in range(my_image.dimension_count) : print("Dimension " + str(i) + ": size = " + str(my_image.shape.at( i )))
Console.WriteLine("myImage is a " + myImage.AxesInterpretation.ToString()); Console.WriteLine("Number of Dimensions = " + myImage.DimensionCount ); for (Byte i = 0; i < myImage.DimensionCount; i++) { Console.WriteLine($"Dimension {i}: size = {myImage.Shape.At(i)}"); }
-
myImage is a VOLUME
Number of Dimensions = 3
Dimension 0: size = 100
Dimension 1: size = 125
Dimension 2: size = 15
If the following instruction is added:
myImage->setAxesInterpretation( iolink::ImageTypeId::IMAGE_SEQUENCE );
my_image.axes_interpretation = iolink.ImageTypeId.IMAGE_SEQUENCE
myImage.AxesInterpretation = ImageTypeId.IMAGE_SEQUENCE;
Data Access
Data values of an image view can be read or modified, mostly by two methods:- Point-wise access: Image intensities can be edited using the Read() and Write() functions.
- Region access: All intensities of a box area can be edited using the ReadRegion() and WriteRegion() functions.
Calibration
The image calibration information gives the real distance corresponding to a pixel. Depending on the file format from which an image is extracted and the way it has been loaded, a calibration may be directly imported or not, and this calibration may be relevant or not.The calibration information affects the result of most Image Analysis algorithms.
In ImageDev, the calibration information is directly given by the ImageView with two properties:
- spatialOrigin: The origin of each dimension, in world coordinates. For spatial dimensions, it represents the position of the image's upper left corner in a global coordinate system.
- spatialSpacing: The elementary size of each dimension, in world coordinates. For spatial dimensions, it represents the pixel or voxel size in each image axis direction.
Color management
There are two usual ways to represent color images:- As interlaced data: $[R_1, G_1, B_1, R_2, G_2, B_2, ..., R_N, G_N, B_N]$
- As planar data: $[R_1, R_2, ..., R_N, G_1, G_2, ..., G_N, B_1, B_2, ..., B_N]$
- dimensionCount = 2
- shape.size() = 2
- type.elementCount = 3
- axesInterpretation = IMAGE
- dimensionCount = 3
- shape.size() = 3
- type.elementCount = 1
- axesInterpretation = MULTISPECTRAL_IMAGE