SlideIO 2.0.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 () |
returns number of slices for 3D/4D images. More... | |
int | getNumTFrames () |
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... | |
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. | |
virtual std::shared_ptr< Scene > | getAuxImage (const std::string &imageName) const |
returns a slideio::Scene object that represents an auxiliary image. 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; |
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) |
int Scene::getNumTFrames | ( | ) |
returns number of time frames for 3D/4D images.
The method returns 1 for images without time frames.
int Scene::getNumZSlices | ( | ) |
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,numberOfSlicesToRead> |
timeFrameRange | : range of time frames to be read. Defined as a std::tuple<indexOfFirstTimeFrameToRead,numberOfTimeFramesToRead>; |
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,numberOfSlicesToRead> |
timeFrameRange | : range of time frames to be read. Defined as a std::tuple<indexOfFirstTimeFrameToRead,numberOfTimeFramesToRead>; |
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,numberOfSlicesToRead> |
timeFrameRange | : range of time frames to be read. Defined as a std::tuple<indexOfFirstTimeFrameToRead,numberOfTimeFramesToRead>; |
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,numberOfSlicesToRead> |
timeFrameRange | : range of time frames to be read. Defined as a std::tuple<indexOfFirstTimeFrameToRead,numberOfTimeFramesToRead>; |
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.