![]() |
SlideIO 2.9.0
Open-source library for reading of medical images
|
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::PKEScene, slideio::SCNScene, slideio::SVSScene, slideio::TransformerScene, slideio::WSIScene, slideio::ZVIScene, slideio::ometiff::OTScene, 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< CVScene > | getAuxImage (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. | |
| const Metadata & | getMetadata () const |
| returns metadata as a navigable tree. Built lazily on first call. | |
| virtual void | readResampledLevelBlockChannelsEx (int level, const cv::Rect &levelRect, const cv::Size &blockSize, const std::vector< int > &channelIndices, int zSliceIndex, int tFrameIndex, cv::OutputArray output) |
| reads a raster rectangle from an explicitly selected zoom level. More... | |
| void | readResampledLevelBlockChannels (int level, const cv::Rect &levelRect, const cv::Size &blockSize, const std::vector< int > &channelIndices, cv::OutputArray output) |
| reads a plane raster rectangle from an explicitly selected zoom level. More... | |
| void | readResampledLevel4DBlockChannels (int level, const cv::Rect &levelRect, const cv::Size &blockSize, const std::vector< int > &channelIndices, const cv::Range &zSliceRange, const cv::Range &timeFrameRange, cv::OutputArray output) |
| reads a multi-dimensional raster block from an explicitly selected zoom level. More... | |
| virtual MetadataFormat | getMetadataFormat () const |
| returns metadata format of the image | |
| const Metadata & | getChannelAttributes () const |
| returns channel attributes as a Metadata tree. More... | |
Protected Member Functions | |
| virtual void | setChannelAttribute (int channelIndex, const std::string &attributeName, const std::string &attributeValue) |
| adds a new attribute to channels | |
| virtual void | setChannelAttribute (int channelIndex, const std::string &attributeName, const char *attributeValue) |
| adds a string-literal attribute to a channel | |
| virtual void | setChannelAttribute (int channelIndex, const std::string &attributeName, bool attributeValue) |
| adds a boolean attribute to a channel | |
| virtual void | setChannelAttribute (int channelIndex, const std::string &attributeName, int64_t attributeValue) |
| adds an integer attribute to a channel | |
| virtual void | setChannelAttribute (int channelIndex, const std::string &attributeName, double attributeValue) |
| adds a floating-point attribute to a channel | |
| void | validateLevel (int level) const |
| throws unless level names a zoom level of this scene. | |
| virtual MetadataBuilder | buildMetadataTree () const |
| Driver hook: convert m_rawMetadata into a Metadata tree. More... | |
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.
|
protectedvirtual |
Driver hook: convert m_rawMetadata into a Metadata tree.
The default implementation handles MetadataFormat::{None,Text,JSON,XML}. Drivers that need semantic structure override and return a MetadataBuilder. To wrap an existing JSON tree, use slideio::detail::builderFromJson from "slideio/core/metadata_internal.hpp".
|
virtual |
returns a slideio::CVScene object that represents an auxiliary image.
| imageName | : name of the auxiliary image. |
| const Metadata & CVScene::getChannelAttributes | ( | ) | const |
returns channel attributes as a Metadata tree.
Always an Array of length getNumChannels(). Each element is an Object keyed by attribute name; channels with no attributes get an empty Object. Built lazily on first call; neither the channel count nor the attribute values must change after the first read.
|
pure virtual |
returns channel data type.
Some image format may have channels with different data types.
|
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.
|
inlinevirtual |
returns number of time frames in the image.
The method returns 1 for single frame images (images without time sequences).
|
inlinevirtual |
returns number of z-slices in the images.
The method returns 1 for plain images.
|
pure virtual |
returns image rectangle.
Origins of the rectangle define shift of top left image corner from top left slide corner.
|
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.
|
virtual |
reads multi-dimensional raster block.
| 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. |
|
virtual |
multi-dimensional raster block with resizing.
| 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. |
|
virtual |
reads raster rectangle of a plane image.
| 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. |
|
virtual |
reads selected channels of raster rectangle of a plane image.
| 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. |
|
virtual |
reads multi-dimensional raster block with resizing.
| 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. |
|
virtual |
reads selected channels of multi-dimensional raster block.
| 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. |
|
virtual |
reads raster rectangle of a plane image with resizing.
| 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. |
|
virtual |
reads selected channels raster rectangle of a plane image with resizing.
| 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. |
| void CVScene::readResampledLevel4DBlockChannels | ( | int | level, |
| const cv::Rect & | levelRect, | ||
| const cv::Size & | blockSize, | ||
| const std::vector< int > & | channelIndices, | ||
| const cv::Range & | zSliceRange, | ||
| const cv::Range & | timeFrameRange, | ||
| cv::OutputArray | output | ||
| ) |
reads a multi-dimensional raster block from an explicitly selected zoom level.
| zSliceRange | : range of z-slices to be read. |
| timeFrameRange | : range of time frames to be read. Other parameters are those of readResampledLevelBlockChannelsEx. |
| void CVScene::readResampledLevelBlockChannels | ( | int | level, |
| const cv::Rect & | levelRect, | ||
| const cv::Size & | blockSize, | ||
| const std::vector< int > & | channelIndices, | ||
| cv::OutputArray | output | ||
| ) |
reads a plane raster rectangle from an explicitly selected zoom level.
Parameters are those of readResampledLevelBlockChannelsEx, with the z slice and the time frame fixed at 0.
|
virtual |
reads a raster rectangle from an explicitly selected zoom level.
Unlike the readBlock family, this method does not choose a zoom level: it reads from the level named by level and from no other. It exists for callers that already know the level they want – tiled viewers above all – and that would otherwise have to convert their rectangle to scene coordinates and let the library convert it back, rounding twice on the way.
| level | : zoom level index, in the range [0, getNumZoomLevels()). |
| levelRect | : rectangle in the pixel coordinate system of level. It is not scene coordinates and receives no scaling. The part of it lying outside the level is filled with the background value. |
| blockSize | : size of the returned block. Resampling is performed from level only; a blockSize that would suit a different level does not cause one to be selected. blockSize equal to levelRect.size() means no resampling at all. |
| channelIndices | : vector of indices of channels to be extracted. Empty means every channel. |
| zSliceIndex | : index of the z slice to read. |
| tFrameIndex | : index of the time frame to read. |
| output | : reference to a cv::OutputArray object. |
The default implementation clamps levelRect to the level, maps it to scene coordinates through LevelInfo::getScale() and delegates to readResampledBlockChannelsEx. For a single level scene that mapping is the identity. Drivers with a real pyramid override it to read the named level directly.