4#ifndef OPENCV_slideio_czislide_HPP
5#define OPENCV_slideio_czislide_HPP
6#include "slideio/drivers/czi/czi_api_def.hpp"
7#include "slideio/core/cvslide.hpp"
8#include "slideio/drivers/czi/cziscene.hpp"
9#include "slideio/drivers/czi/czistructs.hpp"
21#pragma warning( push )
22#pragma warning(disable: 4251)
27 class SLIDEIO_CZI_EXPORTS CZISlide :
public CVSlide
29 friend class CZIImageDriver;
31 CZISlide(
const std::string& filePath);
33 virtual ~CZISlide()
override;
34 int getNumScenes()
const override;
35 std::string getFilePath()
const override;
36 std::shared_ptr<CVScene> getScene(
int index)
const override;
37 double getMagnification()
const {
return m_magnification; }
38 Resolution getResolution()
const {
return m_res; }
39 double getZSliceResolution()
const {
return m_resZ;}
40 double getTFrameResolution()
const {
return m_resT;}
41 const CZIChannelInfos& getChannelInfo()
const {
return m_channels; }
42 const std::string& getTitle()
const {
return m_title; }
43 void readBlock(uint64_t pos, uint64_t size, std::vector<unsigned char>& data);;
44 std::shared_ptr<CVScene> getAuxImage(
const std::string& sceneName)
const override;
45 void readFileHeader(FileHeader& fileHeader);
46 void readSubBlocks(uint64_t pos, uint64_t originPos, std::vector<CZISubBlocks>& sceneBlocks, std::vector<uint64_t>& sceneIds);
47 std::shared_ptr<CZIScene> constructScene(uint64_t sceneId,
const CZISubBlocks& blocks);
49 void readAttachments();
52 void readFileHeader();
54 void parseMagnification(tinyxml2::XMLNode* root);
55 void parseMetadataXmL(
const char* xml,
size_t dataSize);
56 void parseResolutions(tinyxml2::XMLNode* root);
57 void parseSizes(tinyxml2::XMLNode* root);
58 void createJpgAttachmentScenes(int64_t dataPosition, int64_t dataSize,
const std::string& name);
59 void parseChannels(tinyxml2::XMLNode* root);
60 void createCZIAttachmentScenes(
const int64_t dataPos, int64_t dataSize,
const std::string& attachmentName);
61 void addAuxiliaryImage(
const std::string& name,
const std::string& type, int64_t position);
62 static void updateSegmentHeaderBE(SegmentHeader& header);
63 static void updateFileHeaderBE(FileHeader& header);
64 static void updateMetadataHeaderBE(MetadataHeader& header);
65 static void updateDirectoryHeaderBE(DirectoryHeader& header);
66 static void updateDirectoryEntryBE(DirectoryEntryDV& entry);
67 static void updateDimensionEntryBE(DimensionEntryDV& entry);
68 static void updateSublockHeaderBE(SubBlockHeader& header);
69 static void updateAttachmentEntryBE(AttachmentEntry& entry);
70 static void updateAttachmentDirectorySegmentDataBE(AttachmentDirectorySegmentData& data);
71 static void updateAttachmentDirectorySegmentBE(AttachmentDirectorySegment& segment);
72 static void updateAttachmentEntryA1BE(AttachmentEntryA1& entry);
73 static void updateAttachmentSegmentDataBE(AttachmentSegmentData& data);
74 static void updateAttachmentSegmentBE(AttachmentSegment& segment);
75 static void updateDimensionBE(Dimension& dim);
77 std::vector<std::shared_ptr<CZIScene>> m_scenes;
78 std::string m_filePath;
79 std::ifstream m_fileStream;
80 uint64_t m_directoryPosition{};
81 uint64_t m_metadataPosition{};
82 uint64_t m_attachmentDirectoryPosition;
95 double m_magnification{};
99 CZIChannelInfos m_channels;
101 std::map<std::string, std::shared_ptr<CVScene >> m_auxImages;
108#pragma warning( pop )
Definition: exceptions.hpp:15