SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
Public Member Functions | List of all members
slideio::CVScene Class Referenceabstract

class CVScene represents a base class for opencv based representations of raster images contained in a medical slide. More...

#include <cvscene.hpp>

Inherits slideio::RefCounter.

Inherited by slideio::CVSmallScene, slideio::CZIScene, slideio::DCMScene, slideio::GDALScene, slideio::NDPIScene, slideio::SCNScene, slideio::SVSScene, slideio::TransformerScene, slideio::WSIScene, slideio::ZVIScene, and slideio::vsi::VSIScene.

Public Member Functions

virtual ~CVScene ()=default
 default constructor
 
virtual std::string getFilePath () const =0
 returns path of the slide
 
virtual std::string getName () const =0
 returns scene name
 
virtual cv::Rect getRect () const =0
 returns image rectangle. More...
 
virtual int getNumChannels () const =0
 returns number of image channels.
 
virtual int getNumZSlices () const
 returns number of z-slices in the images. More...
 
virtual int getNumTFrames () const
 returns number of time frames in the image. More...
 
virtual slideio::DataType getChannelDataType (int channel) const =0
 returns channel data type. More...
 
virtual std::string getChannelName (int channel) const
 
virtual Resolution getResolution () const =0
 returns image resolution in x and y direction. More...
 
virtual double getZSliceResolution () const
 returns thickness of a Z slice in meters for 3D images.
 
virtual double getTFrameResolution () const
 returns time between 2 time frames in seconds for images with time frames.
 
virtual double getMagnification () const =0
 returns slide magnification extracted from the slide metadata.
 
virtual Compression getCompression () const =0
 returns compression of the raster data
 
virtual void readBlock (const cv::Rect &blockRect, cv::OutputArray output)
 reads raster rectangle of a plane image. More...
 
virtual void readBlockChannels (const cv::Rect &blockRect, const std::vector< int > &channelIndices, cv::OutputArray output)
 reads selected channels of raster rectangle of a plane image. More...
 
virtual void readResampledBlock (const cv::Rect &blockRect, const cv::Size &blockSize, cv::OutputArray output)
 reads raster rectangle of a plane image with resizing. More...
 
virtual void readResampledBlockChannels (const cv::Rect &blockRect, const cv::Size &blockSize, const std::vector< int > &channelIndices, cv::OutputArray output)
 reads selected channels raster rectangle of a plane image with resizing. More...
 
virtual void read4DBlock (const cv::Rect &blockRect, const cv::Range &zSliceRange, const cv::Range &timeFrameRange, cv::OutputArray output)
 reads multi-dimensional raster block. More...
 
virtual void read4DBlockChannels (const cv::Rect &blockRect, const std::vector< int > &channelIndices, const cv::Range &zSliceRange, const cv::Range &timeFrameRange, cv::OutputArray output)
 multi-dimensional raster block with resizing. More...
 
virtual void readResampled4DBlock (const cv::Rect &blockRect, const cv::Size &blockSize, const cv::Range &zSliceRange, const cv::Range &timeFrameRange, cv::OutputArray output)
 reads multi-dimensional raster block with resizing. More...
 
virtual void readResampled4DBlockChannels (const cv::Rect &blockRect, const cv::Size &blockSize, const std::vector< int > &channelIndices, const cv::Range &zSliceRange, const cv::Range &timeFrameRange, cv::OutputArray output)
 reads selected channels of multi-dimensional raster block. More...
 
virtual const std::list< std::string > & getAuxImageNames () const
 returns list of auxiliary image names.
 
virtual int getNumAuxImages () const
 returns number of auxiliary images in the scene object.
 
virtual std::shared_ptr< CVScenegetAuxImage (const std::string &imageName) const
 returns a slideio::CVScene object that represents an auxiliary image. More...
 
virtual std::string getRawMetadata () const
 returns string of serialized metadata. Content of the string depends on image format.
 

Detailed Description

class CVScene represents a base class for opencv based representations of raster images contained in a medical slide.

Most of the class methods are pure virtual and must be overriten by child classes that implement specific image format. The class exposes methods for extraction raster data as well as metadata for the image. The class supports 2D, 3D and 4D multi-channel images and provides methods for extraction of arbitrary image regions, optionally with resizing. Methods for working with raster data deliver image blocks as opencv Mat objects.

Member Function Documentation

◆ getAuxImage()

std::shared_ptr< CVScene > CVScene::getAuxImage ( const std::string &  imageName) const
virtual

returns a slideio::CVScene object that represents an auxiliary image.

Parameters
imageName: name of the auxiliary image.

◆ getChannelDataType()

virtual slideio::DataType slideio::CVScene::getChannelDataType ( int  channel) const
pure virtual

returns channel data type.

Some image format may have channels with different data types.

◆ getChannelName()

std::string CVScene::getChannelName ( int  channel) const
virtual

@ returns channel name by channel index.

Some formats provide human readable names for image channels. The method returns such names extracted from image metadata.

◆ getNumTFrames()

virtual int slideio::CVScene::getNumTFrames ( ) const
inlinevirtual

returns number of time frames in the image.

The method returns 1 for single frame images (images without time sequences).

◆ getNumZSlices()

virtual int slideio::CVScene::getNumZSlices ( ) const
inlinevirtual

returns number of z-slices in the images.

The method returns 1 for plain images.

◆ getRect()

virtual cv::Rect slideio::CVScene::getRect ( ) const
pure virtual

returns image rectangle.

Origins of the rectangle define shift of top left image corner from top left slide corner.

◆ getResolution()

virtual Resolution slideio::CVScene::getResolution ( ) const
pure virtual

returns image resolution in x and y direction.

Resolution is returned as class Resolution with pixel sizes in meters for x and y directions.

◆ read4DBlock()

void CVScene::read4DBlock ( const cv::Rect &  blockRect,
const cv::Range &  zSliceRange,
const cv::Range &  timeFrameRange,
cv::OutputArray  output 
)
virtual

reads multi-dimensional raster block.

Parameters
blockRect: rectangle of the block to be read. The rectangle is represented by cv::Rect structure where x and y properties define shift of the top left corner of the block from the top left corner of the image.
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>;
output: reference to cv::OutputArray object. The method creates cv::Mat object for the parameters and allocate memory for the object if it is not yet allocated or allocated not enough memory. 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.

◆ read4DBlockChannels()

void CVScene::read4DBlockChannels ( const cv::Rect &  blockRect,
const std::vector< int > &  channelIndices,
const cv::Range &  zSliceRange,
const cv::Range &  timeFrameRange,
cv::OutputArray  output 
)
virtual

multi-dimensional raster block with resizing.

Parameters
blockRect: rectangle of the block to be read. The rectangle is represented by cv::Rect structure where x and y properties define shift of the top left corner of the block from the top left corner of the image.
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>;
output: reference to cv::OutputArray object. The method creates cv::Mat object for the parameters and allocate memory for the object if it is not yet allocated or allocated not enough memory. 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.

◆ readBlock()

void CVScene::readBlock ( const cv::Rect &  blockRect,
cv::OutputArray  output 
)
virtual

reads raster rectangle of a plane image.

Parameters
blockRect: rectangle of the block to be read. The rectangle is represented by cv::Rect structure where x and y properties define shift of the top left corner of the block from the top left corner of the image.
output: reference to cv::OutputArray object. The method creates cv::Mat object for the parameters and allocate memory for the object if it is not yet allocated or allocated not enough memory. 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.

◆ readBlockChannels()

void CVScene::readBlockChannels ( const cv::Rect &  blockRect,
const std::vector< int > &  channelIndices,
cv::OutputArray  output 
)
virtual

reads selected channels of raster rectangle of a plane image.

Parameters
blockRect: rectangle of the block to be read. The rectangle is represented by cv::Rect structure.
channelIndices: vector of indices of channels to be extracted;
output: reference to cv::OutputArray object. The method creates cv::Mat object for the parameters and allocate memory for the object if it is not yet allocated or allocated not enough memory. 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.

◆ readResampled4DBlock()

void CVScene::readResampled4DBlock ( const cv::Rect &  blockRect,
const cv::Size &  blockSize,
const cv::Range &  zSliceRange,
const cv::Range &  timeFrameRange,
cv::OutputArray  output 
)
virtual

reads multi-dimensional raster block with resizing.

Parameters
blockRect: rectangle of the block to be read. The rectangle is represented by cv::Rect structure where x and y properties define shift of the top left corner of the block from the top left corner of the image.
blockSize: size of the block after resizing.
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>;
output: reference to cv::OutputArray object. The method creates cv::Mat object for the parameters and allocate memory for the object if it is not yet allocated or allocated not enough memory. 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.

◆ readResampled4DBlockChannels()

void CVScene::readResampled4DBlockChannels ( const cv::Rect &  blockRect,
const cv::Size &  blockSize,
const std::vector< int > &  channelIndices,
const cv::Range &  zSliceRange,
const cv::Range &  timeFrameRange,
cv::OutputArray  output 
)
virtual

reads selected channels of multi-dimensional raster block.

Parameters
blockRect: rectangle of the block to be read. The rectangle is represented by cv::Rect structure where x and y properties define shift of the top left corner of the block from the top left corner of the image.
blockSize: size of the block after resizing.
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>;
output: reference to cv::OutputArray object. The method creates cv::Mat object for the parameters and allocate memory for the object if it is not yet allocated or allocated not enough memory. 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.

◆ readResampledBlock()

void CVScene::readResampledBlock ( const cv::Rect &  blockRect,
const cv::Size &  blockSize,
cv::OutputArray  output 
)
virtual

reads raster rectangle of a plane image with resizing.

Parameters
blockRect: rectangle of the block to be read. The rectangle is represented by cv::Rect structure where x and y properties define shift of the top left corner of the block from the top left corner of the image.
blockSize: size of the block after resizing.
output: reference to cv::OutputArray object. The method creates cv::Mat object for the parameters and allocate memory for the object if it is not yet allocated or allocated not enough memory. 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.

◆ readResampledBlockChannels()

void CVScene::readResampledBlockChannels ( const cv::Rect &  blockRect,
const cv::Size &  blockSize,
const std::vector< int > &  channelIndices,
cv::OutputArray  output 
)
virtual

reads selected channels raster rectangle of a plane image with resizing.

Parameters
blockRect: rectangle of the block to be read. The rectangle is represented by cv::Rect structure where x and y properties define shift of the top left corner of the block from the top left corner of the image.
blockSize: size of the block after resizing.
channelIndices: vector of indices of channels to be extracted;
output: reference to cv::OutputArray object. The method creates cv::Mat object for the parameters and allocate memory for the object if it is not yet allocated or allocated not enough memory. 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 documentation for this class was generated from the following files: