Blue Brain BioExplorer
Volume.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2024, EPFL/Blue Brain Project
3  * All rights reserved. Do not distribute without permission.
4  * Responsible Author: Daniel Nachbaur <daniel.nachbaur@epfl.ch>
5  *
6  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
7  *
8  * This library is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU Lesser General Public License version 3.0 as published
10  * by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15  * details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #pragma once
23 
27 
28 namespace core
29 {
33 class Volume : public BaseObject
34 {
35 public:
42  PLATFORM_API Volume(const Vector3ui& dimensions, const Vector3f& spacing, const DataType type);
43 
44  /*
45  * @brief Sets the range of data in the volume.
46  * @param range The data range represented as a Vector2f object.
47  */
48  PLATFORM_API virtual void setDataRange(const Vector2f& range) = 0;
49 
50  /*
51  * @brief Gets the range of values in the volume.
52  */
54 
58  PLATFORM_API virtual void commit() = 0;
59 
64  PLATFORM_API size_t getSizeInBytes() const { return _sizeInBytes; }
65 
71 
78 
85 
91  PLATFORM_API Vector3f getOffset() const { return _offset; }
92 
99 
100 protected:
101  std::atomic_size_t _sizeInBytes{0}; // The size of the volume in bytes.
102  const Vector3ui _dimensions; // The dimensions of the volume as a Vector3ui object.
103  const Vector3f _spacing; // The spacing between voxels as a Vector3f object.
104  Vector3f _offset; // Volume offset
105  const DataType _dataType; // The data type of the volume.
106  Vector2f _valueRange{-1e6f, 1e6f}; // The voxel value range in the volume.
107 };
108 } // namespace core
#define PLATFORM_API
Definition: Api.h:37
A base class for volumes.
Definition: Volume.h:34
virtual PLATFORM_API void commit()=0
Commits changes to the volume.
PLATFORM_API Vector2f getValueRange() const
Get the Value Range object.
Definition: Volume.h:98
PLATFORM_API Vector2f getDataRange() const
Definition: Volume.h:53
PLATFORM_API Volume(const Vector3ui &dimensions, const Vector3f &spacing, const DataType type)
Constructs a Volume object.
Definition: Volume.cpp:26
Vector2f _valueRange
Definition: Volume.h:106
virtual PLATFORM_API void setDataRange(const Vector2f &range)=0
const Vector3f _spacing
Definition: Volume.h:103
PLATFORM_API Boxd getBounds() const
Gets the bounding box of the volume.
Definition: Volume.h:70
PLATFORM_API Vector3f getOffset() const
Get the Offset object.
Definition: Volume.h:91
PLATFORM_API Vector3f getDimensions() const
Get the Dimensions object.
Definition: Volume.h:77
PLATFORM_API Vector3f getElementSpacing() const
Get the Element Spacing object.
Definition: Volume.h:84
PLATFORM_API size_t getSizeInBytes() const
Gets the size of the volume in bytes.
Definition: Volume.h:64
const Vector3ui _dimensions
Definition: Volume.h:102
const DataType _dataType
Definition: Volume.h:105
Vector3f _offset
Definition: Volume.h:104
std::atomic_size_t _sizeInBytes
Definition: Volume.h:101
glm::vec3 Vector3f
Definition: MathTypes.h:137
glm::vec< 3, uint32_t > Vector3ui
Definition: MathTypes.h:134
glm::vec2 Vector2f
Definition: MathTypes.h:136
DataType
Definition: Types.h:344