![]() |
SlideIO 2.9.0
Open-source library for reading of medical images
|
Scene class represents a raster image contained in a slide. More...
#include <scene.hpp>
Public Member Functions | |
| std::string | getFilePath () const |
| returns path of the slide | |
| std::string | getName () const |
| returns scene name | |
| std::tuple< int, int, int, int > | getRect () const |
| returns image rectangle in pixels. More... | |
| int | getNumChannels () const |
| returns number of raster channels of the image | |
| int | getNumZSlices () const |
| returns number of slices for 3D/4D images. More... | |
| int | getNumTFrames () const |
| returns number of time frames for 3D/4D images. More... | |
| Compression | getCompression () const |
| returns compression of the raster data | |
| slideio::DataType | getChannelDataType (int channel) const |
| std::string | getChannelName (int channel) const |
| returns channel name. More... | |
| std::tuple< double, double > | getResolution () const |
| returns image resolution in x and y direction. More... | |
| double | getZSliceResolution () const |
| returns thickness of a Z slice in meters for 3D images. | |
| double | getTFrameResolution () const |
| returns time between 2 time frames in seconds for images with time frames. | |
| double | getMagnification () const |
| returns slide magnification extracted from the slide metadata. | |
| int | getBlockSize (const std::tuple< int, int > &blockSize, int refChannel, int numChannels, int numSlices, int numFrames) const |
| returns memory size in the bytes required for a raster block. More... | |
| void | readBlock (const std::tuple< int, int, int, int > &blockRect, void *buffer, size_t bufferSize) |
| reads raster rectangle of a plane image to a memory buffer. More... | |
| void | readBlockChannels (const std::tuple< int, int, int, int > &blockRect, const std::vector< int > &channelIndices, void *buffer, size_t bufferSize) |
| reads raster rectangle plane image combined from selected channels to a memory buffer. More... | |
| void | readResampledBlock (const std::tuple< int, int, int, int > &blockRect, const std::tuple< int, int > &blockSize, void *buffer, size_t bufferSize) |
| reads raster rectangle plane image and resizes it to the size specified in the parameters. More... | |
| void | readResampledBlockChannels (const std::tuple< int, int, int, int > &blockRect, const std::tuple< int, int > &blockSize, const std::vector< int > &channelIndices, void *buffer, size_t bufferSize) |
| reads raster rectangle plane image combined from selected channels and resizes it to the size specified in the parameters. More... | |
| void | read4DBlock (const std::tuple< int, int, int, int > &blockRect, const std::tuple< int, int > &zSliceRange, const std::tuple< int, int > &timeFrameRange, void *buffer, size_t bufferSize) |
| reads multi-dimensional raster block to a memory buffer. More... | |
| void | read4DBlockChannels (const std::tuple< int, int, int, int > &blockRect, const std::vector< int > &channelIndices, const std::tuple< int, int > &zSliceRange, const std::tuple< int, int > &timeFrameRange, void *buffer, size_t bufferSize) |
| reads selected channels of multi-dimensional raster block to a memory buffer. More... | |
| void | readResampled4DBlock (const std::tuple< int, int, int, int > &blockRect, const std::tuple< int, int > &blockSize, const std::tuple< int, int > &zSliceRange, const std::tuple< int, int > &timeFrameRange, void *buffer, size_t bufferSize) |
| reads multi-dimensional raster block to a memory buffer with resizing to the specified size. More... | |
| void | readResampled4DBlockChannels (const std::tuple< int, int, int, int > &blockRect, const std::tuple< int, int > &blockSize, const std::vector< int > &channelIndices, const std::tuple< int, int > &zSliceRange, const std::tuple< int, int > &timeFrameRange, void *buffer, size_t bufferSize) |
| reads selected channels of multi-dimensional raster block to a memory buffer with resizing to the specified size. More... | |
| void | readResampledLevelBlockChannels (int level, const std::tuple< int, int, int, int > &levelRect, const std::tuple< int, int > &blockSize, const std::vector< int > &channelIndices, void *buffer, size_t bufferSize) |
| reads a raster rectangle from an explicitly selected zoom level into a memory buffer. More... | |
| void | readResampledLevel4DBlockChannels (int level, const std::tuple< int, int, int, int > &levelRect, const std::tuple< int, int > &blockSize, const std::vector< int > &channelIndices, const std::tuple< int, int > &zSliceRange, const std::tuple< int, int > &timeFrameRange, void *buffer, size_t bufferSize) |
| reads a multi-dimensional raster block from an explicitly selected zoom level. More... | |
| virtual const std::list< std::string > & | getAuxImageNames () const |
| returns array of names of auxiliary images available for the scene. | |
| virtual int | getNumAuxImages () const |
| returns number of auxiliary images available for the scene. | |
| std::string | getRawMetadata () const |
| returns string of serialized metadata. Content of the string depends on image format. | |
| MetadataFormat | getMetadataFormat () const |
| returns metadata format of the scene. | |
| const Metadata & | getMetadata () const |
| returns metadata as a navigable tree. Built lazily on first call. | |
| virtual std::shared_ptr< Scene > | getAuxImage (const std::string &imageName) const |
| returns a slideio::Scene object that represents an auxiliary image. More... | |
| int | getNumZoomLevels () const |
| returns the number of zoom levels of the internal image pyramid. More... | |
| const LevelInfo * | getLevelInfo (int level) const |
| returns information about a zoom level of the internal image pyramid. More... | |
| std::string | toString () const |
| returns a human readable description of the scene. More... | |
| const Metadata & | getChannelAttributes () const |
| returns channel attributes as a Metadata tree. More... | |
Scene class represents a raster image contained in a slide.
Scene class allows extracting information from image of a slide. It includes raster data as well as metadata. The object supports multichannel multi-dimensional rasters. The class provides methods for resampling of multi-dimensional rasters.
|
virtual |
returns a slideio::Scene object that represents an auxiliary image.
| imageName | : name of the auxiliary image. |
| int Scene::getBlockSize | ( | const std::tuple< int, int > & | blockSize, |
| int | refChannel, | ||
| int | numChannels, | ||
| int | numSlices, | ||
| int | numFrames | ||
| ) | const |
returns memory size in the bytes required for a raster block.
| blockSize | : a std::tuple<int,int> defining with and height of the image block; |
| refChannel | : index of the first channel to be included in the block; |
| numChannels | : number of channels in the block; |
| numSlices | : number of Z slices in the block. For plane images it shall be 1; |
| numFrames | : number of time frames in the block. For plane images it shall be 1; |
| const slideio::Metadata & Scene::getChannelAttributes | ( | ) | const |
returns channel attributes as a Metadata tree.
Array of length getNumChannels(); each element is an Object keyed by attribute name (empty Object if a channel has no attributes).
| slideio::DataType Scene::getChannelDataType | ( | int | channel | ) | const |
brief returns data type of a channel
| channel | : index of the channel. Should be in the range (0, numberOfChannels) |
| std::string Scene::getChannelName | ( | int | channel | ) | const |
returns channel name.
| channel | : index of the channel. Should be in the range (0, numberOfChannels) |
| const LevelInfo * Scene::getLevelInfo | ( | int | level | ) | const |
returns information about a zoom level of the internal image pyramid.
| level | : zoom level index, in the range [0, getNumZoomLevels()). |
| int Scene::getNumTFrames | ( | ) | const |
returns number of time frames for 3D/4D images.
The method returns 1 for images without time frames.
| int Scene::getNumZoomLevels | ( | ) | const |
returns the number of zoom levels of the internal image pyramid.
Every scene has at least one level. Level 0 is the level of the highest resolution; the size of a level decreases with a growing level index.
| int Scene::getNumZSlices | ( | ) | const |
returns number of slices for 3D/4D images.
The method returns 1 for 2D images.
| std::tuple< int, int, int, int > Scene::getRect | ( | ) | const |
returns image rectangle in pixels.
Rectangle is represented as std::tuple (x,y,width,height). Where:
| std::tuple< double, double > Scene::getResolution | ( | ) | const |
returns image resolution in x and y direction.
Resolution is returned as a std::tuple (resolutionXdirection, resolutionYdirection). Resolution is size of a pixel in meters.
| void Scene::read4DBlock | ( | const std::tuple< int, int, int, int > & | blockRect, |
| const std::tuple< int, int > & | zSliceRange, | ||
| const std::tuple< int, int > & | timeFrameRange, | ||
| void * | buffer, | ||
| size_t | bufferSize | ||
| ) |
reads multi-dimensional raster block to a memory buffer.
| blockRect | : rectangle of the block to be read. The rectangle is represented by std::tuple(x,y,with,height). Here:
|
| zSliceRange | : range of z-slices to be read. Defined as a std::tuple<indexOfFirstSliceToRead,indexAfterLastSliceToRead> |
| timeFrameRange | : range of time frames to be read. Defined as a std::tuple<indexOfFirstTimeFrameToRead,indexAfterLastTimeFrameToRead>; |
| buffer | : pointer to an allocated memory buffer for the raster block. Size of the block can be computed with the method getBlockSize; |
| bufferSize | : size of the memory buffer in bytes. |
All channels have to be of the same type. The method will throw an error by attempt to put read several channels of different types in one block. The raster will be placed in the memory buffer. The raster is organized as a continuous multi-dimensional array.
where:
| void Scene::read4DBlockChannels | ( | const std::tuple< int, int, int, int > & | blockRect, |
| const std::vector< int > & | channelIndices, | ||
| const std::tuple< int, int > & | zSliceRange, | ||
| const std::tuple< int, int > & | timeFrameRange, | ||
| void * | buffer, | ||
| size_t | bufferSize | ||
| ) |
reads selected channels of multi-dimensional raster block to a memory buffer.
| blockRect | : rectangle of the block to be read. The rectangle is represented by std::tuple(x,y,with,height). Here:
|
| channelIndices | : vector of indices of channels to be extracted; |
| zSliceRange | : range of z-slices to be read. Defined as a std::tuple<indexOfFirstSliceToRead,indexAfterLastSliceToRead> |
| timeFrameRange | : range of time frames to be read. Defined as a std::tuple<indexOfFirstTimeFrameToRead,indexAfterLastTimeFrameToRead>; |
| buffer | : pointer to an allocated memory buffer for the raster block. Size of the block can be computed with the method getBlockSize; |
| bufferSize | : size of the memory buffer in bytes. |
All channels have to be of the same type. The method will throw an error by attempt to put read several channels of different types in one block. The raster will be placed in the memory buffer. The raster is organized as a continuous multi-dimensional array. Memory layout is the same as in read4DBlock method.
| void Scene::readBlock | ( | const std::tuple< int, int, int, int > & | blockRect, |
| void * | buffer, | ||
| size_t | bufferSize | ||
| ) |
reads raster rectangle of a plane image to a memory buffer.
| blockRect | : rectangle of the block to be read. The rectangle is represented by std::tuple(x,y,with,height). Here:
|
| buffer | : pointer to an allocated memory buffer for the raster block. Size of the block can be computed with the method getBlockSize; |
| bufferSize | : size of the memory buffer in bytes. |
All channels have to be of the same type. The method will throw an error by attempt to put read several channels of different types in one block. The raster will be placed in the memory buffer. The raster is organized as a continuous 3-dimensional array.
where:
| void Scene::readBlockChannels | ( | const std::tuple< int, int, int, int > & | blockRect, |
| const std::vector< int > & | channelIndices, | ||
| void * | buffer, | ||
| size_t | bufferSize | ||
| ) |
reads raster rectangle plane image combined from selected channels to a memory buffer.
| blockRect | : rectangle of the block to be read. The rectangle is represented by std::tuple(x,y,with,height). Here:
|
| channelIndices | : vector of indices of channels to be extracted; |
| buffer | : pointer to an allocated memory buffer for the raster block. Size of the block can be computed with the method getBlockSize; |
| bufferSize | : size of the memory buffer in bytes. |
All channels have to be of the same type. The method will throw an error by attempt to put read several channels of different types in one block. The raster will be placed in the memory buffer. Memory layout of the buffer is described in the readBlock method.
| void Scene::readResampled4DBlock | ( | const std::tuple< int, int, int, int > & | blockRect, |
| const std::tuple< int, int > & | blockSize, | ||
| const std::tuple< int, int > & | zSliceRange, | ||
| const std::tuple< int, int > & | timeFrameRange, | ||
| void * | buffer, | ||
| size_t | bufferSize | ||
| ) |
reads multi-dimensional raster block to a memory buffer with resizing to the specified size.
| blockRect | : rectangle of the block to be read. The rectangle is represented by std::tuple(x,y,with,height). Here:
|
| blockSize | : size of the block after resizing. The size is set as a std::tuple<width,height>; |
| zSliceRange | : range of z-slices to be read. Defined as a std::tuple<indexOfFirstSliceToRead,indexAfterLastSliceToRead> |
| timeFrameRange | : range of time frames to be read. Defined as a std::tuple<indexOfFirstTimeFrameToRead,indexAfterLastTimeFrameToRead>; |
| buffer | : pointer to an allocated memory buffer for the raster block. Size of the block can be computed with the method getBlockSize; |
| bufferSize | : size of the memory buffer in bytes. |
All channels have to be of the same type. The method will throw an error by attempt to put read several channels of different types in one block. The raster will be placed in the memory buffer. The raster is organized as a continuous multi-dimensional array. Memory layout is the same as in read4DBlock method.
| void Scene::readResampled4DBlockChannels | ( | const std::tuple< int, int, int, int > & | blockRect, |
| const std::tuple< int, int > & | blockSize, | ||
| const std::vector< int > & | channelIndices, | ||
| const std::tuple< int, int > & | zSliceRange, | ||
| const std::tuple< int, int > & | timeFrameRange, | ||
| void * | buffer, | ||
| size_t | bufferSize | ||
| ) |
reads selected channels of multi-dimensional raster block to a memory buffer with resizing to the specified size.
| blockRect | : rectangle of the block to be read. The rectangle is represented by std::tuple(x,y,with,height). Here:
|
| blockSize | : size of the block after resizing. The size is set as a std::tuple<width,height>; |
| channelIndices | : vector of indices of channels to be extracted; |
| zSliceRange | : range of z-slices to be read. Defined as a std::tuple<indexOfFirstSliceToRead,indexAfterLastSliceToRead> |
| timeFrameRange | : range of time frames to be read. Defined as a std::tuple<indexOfFirstTimeFrameToRead,indexAfterLastTimeFrameToRead>; |
| buffer | : pointer to an allocated memory buffer for the raster block. Size of the block can be computed with the method getBlockSize; |
| bufferSize | : size of the memory buffer in bytes. |
All channels have to be of the same type. The method will throw an error by attempt to put read several channels of different types in one block. The raster will be placed in the memory buffer. The raster is organized as a continuous multi-dimensional array. Memory layout is the same as in read4DBlock method.
| void Scene::readResampledBlock | ( | const std::tuple< int, int, int, int > & | blockRect, |
| const std::tuple< int, int > & | blockSize, | ||
| void * | buffer, | ||
| size_t | bufferSize | ||
| ) |
reads raster rectangle plane image and resizes it to the size specified in the parameters.
| blockRect | : rectangle of the block to be read. The rectangle is represented by std::tuple<x,y,with,height>. Here:
|
| blockSize | : size of the block after resizing. The size is set as a std::tuple<width,height>; |
| buffer | : pointer to an allocated memory buffer for the raster block. Size of the block can be computed with the method getBlockSize. |
| bufferSize | : size of the memory buffer in bytes. |
All channels have to be of the same type. The method will throw an error by attempt to put read several channels of different types in one block. The raster will be placed in the memory buffer. Memory layout of the buffer is described in the readBlock method.
| void Scene::readResampledBlockChannels | ( | const std::tuple< int, int, int, int > & | blockRect, |
| const std::tuple< int, int > & | blockSize, | ||
| const std::vector< int > & | channelIndices, | ||
| void * | buffer, | ||
| size_t | bufferSize | ||
| ) |
reads raster rectangle plane image combined from selected channels and resizes it to the size specified in the parameters.
| blockRect | : rectangle of the block to be read. The rectangle is represented by std::tuple<x,y,with,height>. Here:
|
| blockSize | : size of the block after resizing. The size is set as a std::tuple<width,height>; |
| channelIndices | : vector of indices of channels to be extracted; |
| buffer | : pointer to an allocated memory buffer for the raster block. Size of the block can be computed with the method getBlockSize. |
| bufferSize | : size of the memory buffer in bytes. |
All channels have to be of the same type. The method will throw an error by attempt to put read several channels of different types in one block. The raster will be placed in the memory buffer. Memory layout of the buffer is described in the readBlock method.
| void Scene::readResampledLevel4DBlockChannels | ( | int | level, |
| const std::tuple< int, int, int, int > & | levelRect, | ||
| const std::tuple< int, int > & | blockSize, | ||
| const std::vector< int > & | channelIndices, | ||
| const std::tuple< int, int > & | zSliceRange, | ||
| const std::tuple< int, int > & | timeFrameRange, | ||
| void * | buffer, | ||
| size_t | bufferSize | ||
| ) |
reads a multi-dimensional raster block from an explicitly selected zoom level.
| zSliceRange | : range of z-slices to be read, as a std::tuple<indexOfFirstSliceToRead,indexAfterLastSliceToRead>. |
| timeFrameRange | : range of time frames to be read. Other parameters are those of readResampledLevelBlockChannels. |
Memory layout of the buffer is described in the read4DBlock method.
| void Scene::readResampledLevelBlockChannels | ( | int | level, |
| const std::tuple< int, int, int, int > & | levelRect, | ||
| const std::tuple< int, int > & | blockSize, | ||
| const std::vector< int > & | channelIndices, | ||
| void * | buffer, | ||
| size_t | bufferSize | ||
| ) |
reads a raster rectangle from an explicitly selected zoom level into a memory buffer.
Unlike the readBlock family, this method reads from the level named by level and no other, so a caller that already knows which level it wants does not have to express its rectangle in scene coordinates and let the library convert it back.
| level | : zoom level index, in the range [0, getNumZoomLevels()). |
| levelRect | : rectangle in the coordinate system of level, as a std::tuple(x,y,width,height). The part of it outside the level is background filled. |
| blockSize | : size of the block after resizing, as a std::tuple<width,height>. Resizing is performed from level only. |
| channelIndices | : vector of indices of channels to be extracted. Empty means all. |
| buffer | : pointer to an allocated memory buffer. Its size can be computed with getBlockSize using blockSize. |
| bufferSize | : size of the memory buffer in bytes. |
Memory layout of the buffer is described in the readBlock method.
| std::string Scene::toString | ( | ) | const |
returns a human readable description of the scene.
The description contains the file path, the name, the rectangle, the channels and their data types, the number of z slices and time frames, the magnification and the number of auxiliary images and zoom levels. It is intended for logging and diagnostics; its layout is not part of the API.