4#ifndef OPENCV_slideio_cziscene_HPP
5#define OPENCV_slideio_cziscene_HPP
6#include "slideio/drivers/czi/czi_api_def.hpp"
7#include "slideio/core/cvscene.hpp"
8#include "slideio/core/tools/tilecomposer.hpp"
9#include "slideio/drivers/czi/czisubblock.hpp"
10#include "slideio/drivers/czi/czistructs.hpp"
14#pragma warning( push )
15#pragma warning(disable: 4251)
21 class SLIDEIO_CZI_EXPORTS CZIScene :
public CVScene,
public Tiler
26 int illuminationIndex;
27 int bAcquisitionIndex;
36 Tile() { rect = { 0,0,0,0 }; }
37 std::vector<int> blockIndices;
40 typedef std::vector<Tile> Tiles;
52 struct SceneChannelInfo
57 int32_t firstComponent;
58 int32_t numComponents;
59 DataType componentType;
70 std::string getFilePath()
const override;
71 cv::Rect getRect()
const override;
72 int getNumChannels()
const override;
73 int getNumZSlices()
const override;
74 int getNumTFrames()
const override;
75 double getZSliceResolution()
const override;
76 double getTFrameResolution()
const override;
77 slideio::DataType getChannelDataType(
int channel)
const override;
78 std::string getChannelName(
int channel)
const override;
79 Resolution getResolution()
const override;
80 double getMagnification()
const override;
81 void readResampledBlockChannels(
const cv::Rect& blockRect,
const cv::Size& blockSize,
82 const std::vector<int>& componentIndices, cv::OutputArray output)
override;
83 std::string getName()
const override;
84 void init(uint64_t sceneId, SceneParams& sceneParams,
const std::string& filePath,
const CZISubBlocks& blocks, CZISlide* slide);
86 int getTileCount(
void* userData)
override;
87 bool getTileRect(
int tileIndex, cv::Rect& tileRect,
void* userData)
override;
88 bool readTile(
int tileIndex,
const std::vector<int>& componentIndices, cv::OutputArray tileRaster,
89 void* userData)
override;
90 void initializeBlock(
const cv::Size& blockSize,
const std::vector<int>& channelIndices, cv::OutputArray output)
override;
94 void addAuxImage(
const std::string& name, std::shared_ptr<CVScene> image);
95 std::shared_ptr<CVScene> getAuxImage(
const std::string& sceneName)
const override;
96 bool isMosaic()
const {
return m_bMosaic; }
98 void readResampledBlockChannelsEx(
const cv::Rect& blockRect,
const cv::Size& blockSize,
99 const std::vector<int>& componentIndices,
int zSliceIndex,
int tFrameIndex, cv::OutputArray output)
override;
101 void setMosaic(
bool mosaic) { m_bMosaic = mosaic; }
102 void setupComponents(
const std::map<int, int>& channelPixelType);
103 void generateSceneName();
104 void computeSceneRect();
105 void computeSceneTiles();
106 void compute4DParameters();
107 void updateTileRects(ZoomLevel& value);
108 void updateTileRects();
109 const ZoomLevel& getBaseZoomLevel()
const;
110 void initZoomLevelInfo();
111 int findBlockIndex(
const Tile& tile,
const CZISubBlocks& blocks,
int channelIndex,
int zSliceIndex,
int tFrameIndex)
const ;
112 const Tile& getTile(
const TilerData* tilerData,
int tileIndex)
const;
113 const CZISubBlocks& getBlocks(
const TilerData* tilerData)
const;
114 bool blockHasData(
const CZISubBlock& block,
const std::vector<int>& componentIndices,
const TilerData* tilerData);
115 static std::vector<uint8_t> decodeData(
const CZISubBlock& block,
const std::vector<unsigned char>& encodedData);
116 void unpackChannels(
const CZISubBlock& block,
const std::vector<int>& orgComponentIndices,
const std::vector<unsigned char>& blockData,
const TilerData* tilerData, std::vector<cv::Mat>& componentRasters);
117 void computeSceneMetadata();
120 static uint64_t sceneIdFromDims(
int s,
int i,
int v,
int h,
int r,
int b);
121 static uint64_t sceneIdFromDims(
const std::vector<Dimension>& dims);
122 static void sceneIdsFromDims(
const std::vector<Dimension>& dims, std::vector<uint64_t>& ids);
123 static uint64_t sceneIdFromDims(
const SceneParams& params);
124 static void dimsFromSceneId(uint64_t sceneId,
int& s,
int& i,
int& v,
int& h,
int& r,
int& b);
125 static void dimsFromSceneId(uint64_t sceneId, SceneParams& params);
126 static void channelComponentInfo(CZIDataType channelType, DataType& componentType,
int& numComponents,
int& pixelSize);
128 void combineBlockInTiles(ZoomLevel& zoomLevel);
131 std::vector<ZoomLevel> m_zoomLevels;
132 std::vector<ComponentInfo> m_componentInfos;
133 std::vector<SceneChannelInfo> m_channelInfos;
134 std::string m_filePath;
135 cv::Rect m_sceneRect;
136 std::map<int, std::pair<int, int>> m_componentToChannelIndex;
140 SceneParams m_sceneParams{};
143 int m_firstSliceIndex = 0;
144 int m_firstTFrameIndex = 0;
146 std::map<std::string, std::shared_ptr<CVScene>> m_auxImages;
153#pragma warning( pop )
Definition: exceptions.hpp:12
Compression
raster data compression enum
Definition: slideio_enums.hpp:12