SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
volume.hpp
1// This file is part of slideio project.
2// It is subject to the license terms in the LICENSE file found in the top-level directory
3// of this distribution and at http://slideio.com/license.html.
4#pragma once
5#include <string>
6#include <vector>
7#include <boost/json.hpp>
8
9#include "taginfo.hpp"
10#include "vsistruct.hpp"
11#include "slideio/drivers/vsi/vsi_api_def.hpp"
12#include "slideio/imagetools/tifftools.hpp"
13#include "slideio/drivers/vsi/dimensions.hpp"
14
15#if defined(_MSC_VER)
16#pragma warning( push )
17#pragma warning(disable: 4251)
18#endif
19
20
21namespace slideio
22{
23 namespace vsi
24 {
25 class SLIDEIO_VSI_EXPORTS Volume : public IDimensionOrder
26 {
27 public:
28 Volume() {
29 m_dimensionOrder[0] = 0;
30 m_dimensionOrder[1] = 1;
31 }
32 std::string getName() const { return m_name; }
33 void setName(const std::string& name) { m_name = name; }
34
35 double getMagnification() const { return m_magnification; }
36 void setMagnification(double magnification) { m_magnification = magnification; }
37
38 StackType getType() const { return m_type; }
39 void setType(StackType type) { m_type = type; }
40
41 cv::Size getSize() const { return m_size; }
42 void setSize(const cv::Size& size) { m_size = size; }
43
44 int getBitDepth() const { return m_bitDepth; }
45 void setBitDepth(int bitDepth) { m_bitDepth = bitDepth; }
46
47 bool hasExternalFile() const { return m_hasExternalFile; }
48 void setHasExternalFile(bool hasExternalFile) { m_hasExternalFile = hasExternalFile; }
49
50 int getNumAuxVolumes() const { return static_cast<int>(m_auxVolumes.size()); }
51 std::shared_ptr<Volume> getAuxVolume(int index) const { return m_auxVolumes[index]; }
52 void addAuxVolume(std::shared_ptr<Volume>& volume) { m_auxVolumes.push_back(volume); }
53
54 void setIFD(int ifd) { m_ifd = ifd; }
55 int getIFD() const { return m_ifd; }
56
57 void setDefaultColor(int color) { m_defaultColor = color; }
58 int getDefaultColor() const { return m_defaultColor; }
59
60 int getDimensionOrder(Dimensions dim) const override { return m_dimensionOrder[dimensionIndex(dim)]; }
61 void setDimensionOrder(Dimensions dim, int value) { m_dimensionOrder[dimensionIndex(dim)] = value; }
62
63 const Resolution& getResolution() const { return m_resolution; }
64 void setResolution(const Resolution& resolution) { m_resolution = resolution; }
65 void setZResolution(double res) { m_zResolution = res; }
66 double getZResolution() const { return m_zResolution; }
67 void setTResolution(double res) { m_tResolution = res; }
68 double getTResolution() const { return m_tResolution; }
69 void setChannelName(int channelIndex, const std::string& channelName);
70 std::string getChannelName(int channelIndex) const;
71
72 private:
73 static int dimensionIndex(Dimensions dim) {
74 return static_cast<int>(dim);
75 }
76 private:
77 std::string m_name;
78 double m_magnification = 0.;
79 StackType m_type = StackType::UNKNOWN;
80 cv::Size m_size = {};
81 int m_bitDepth = 0;
82 bool m_hasExternalFile = false;
83 int m_ifd = -1;
84 std::vector<std::shared_ptr<Volume>> m_auxVolumes;
85 int m_defaultColor = 0;
86 int m_dimensionOrder[MAX_DIMENSIONS] = {-1};
87 Resolution m_resolution;
88 double m_zResolution = 0.;
89 double m_tResolution = 0.;
90 std::vector<std::string> m_channelNames;
91 };
92
93 };
94};
Definition: exceptions.hpp:12