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
8#include "taginfo.hpp"
9#include "vsistruct.hpp"
10#include "slideio/drivers/vsi/vsi_api_def.hpp"
11#include "slideio/imagetools/tifftools.hpp"
12#include "slideio/drivers/vsi/dimensions.hpp"
13
14#if defined(_MSC_VER)
15#pragma warning( push )
16#pragma warning(disable: 4251)
17#endif
18
19
20namespace slideio
21{
22 namespace vsi
23 {
24 class SLIDEIO_VSI_EXPORTS Volume : public IDimensionOrder
25 {
26 public:
27 Volume() {
28 m_dimensionOrder[0] = 0;
29 m_dimensionOrder[1] = 1;
30 }
31 std::string getName() const { return m_name; }
32 void setName(const std::string& name) { m_name = name; }
33
34 double getMagnification() const { return m_magnification; }
35 void setMagnification(double magnification) { m_magnification = magnification; }
36
37 StackType getType() const { return m_type; }
38 void setType(StackType type) { m_type = type; }
39
40 cv::Size getSize() const { return m_size; }
41 void setSize(const cv::Size& size) { m_size = size; }
42
43 int getBitDepth() const { return m_bitDepth; }
44 void setBitDepth(int bitDepth) { m_bitDepth = bitDepth; }
45
46 bool hasExternalFile() const { return m_hasExternalFile; }
47 void setHasExternalFile(bool hasExternalFile) { m_hasExternalFile = hasExternalFile; }
48
49 int getNumAuxVolumes() const { return static_cast<int>(m_auxVolumes.size()); }
50 std::shared_ptr<Volume> getAuxVolume(int index) const { return m_auxVolumes[index]; }
51 void addAuxVolume(std::shared_ptr<Volume>& volume) { m_auxVolumes.push_back(volume); }
52
53 void setIFD(int ifd) { m_ifd = ifd; }
54 int getIFD() const { return m_ifd; }
55
56 void setDefaultColor(int color) { m_defaultColor = color; }
57 int getDefaultColor() const { return m_defaultColor; }
58
59 int getDimensionOrder(Dimensions dim) const override { return m_dimensionOrder[dimensionIndex(dim)]; }
60 void setDimensionOrder(Dimensions dim, int value) { m_dimensionOrder[dimensionIndex(dim)] = value; }
61
62 const Resolution& getResolution() const { return m_resolution; }
63 void setResolution(const Resolution& resolution) { m_resolution = resolution; }
64 void setZResolution(double res) { m_zResolution = res; }
65 double getZResolution() const { return m_zResolution; }
66 void setTResolution(double res) { m_tResolution = res; }
67 double getTResolution() const { return m_tResolution; }
68 void setChannelName(int channelIndex, const std::string& channelName);
69 std::string getChannelName(int channelIndex) const;
70 const bool isValid() const {
71 return m_size.height>0 && m_size.width>0;
72 }
73
74 private:
75 static int dimensionIndex(Dimensions dim) {
76 return static_cast<int>(dim);
77 }
78 private:
79 std::string m_name;
80 double m_magnification = 0.;
81 StackType m_type = StackType::UNKNOWN;
82 cv::Size m_size = {};
83 int m_bitDepth = 0;
84 bool m_hasExternalFile = false;
85 int m_ifd = -1;
86 std::vector<std::shared_ptr<Volume>> m_auxVolumes;
87 int m_defaultColor = 0;
88 int m_dimensionOrder[MAX_DIMENSIONS] = {-1};
89 Resolution m_resolution;
90 double m_zResolution = 0.;
91 double m_tResolution = 0.;
92 std::vector<std::string> m_channelNames;
93 };
94
95 };
96};
Definition: exceptions.hpp:15