Carna  Version 3.3.2
VolumeSegment.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 - 2015 Leonid Kostrykin
3  *
4  * Chair of Medical Engineering (mediTEC)
5  * RWTH Aachen University
6  * Pauwelsstr. 20
7  * 52074 Aachen
8  * Germany
9  *
10  */
11 
12 #ifndef VOLUMESEGMENT_H_6014714286
13 #define VOLUMESEGMENT_H_6014714286
14 
23 #include <Carna/Carna.h>
24 #include <Carna/base/Association.h>
26 #include <Carna/base/VolumeGrid.h>
27 #include <memory>
28 
29 namespace Carna
30 {
31 
32 namespace base
33 {
34 
35 
36 
37 // ----------------------------------------------------------------------------------
38 // VolumeSegmentNormalsComponent< SegmentNormalsVolumeType >
39 // ----------------------------------------------------------------------------------
40 
47 template< typename SegmentNormalsVolumeType >
49 {
50 
52 
53  std::unique_ptr< Association< SegmentNormalsVolumeType > > myNormals;
54 
55 public:
56 
61 
66 
71  SegmentNormalsVolumeType& normals();
72 
75  const SegmentNormalsVolumeType& normals() const;
76 
80  bool hasNormals() const;
81 
82 }; // VolumeSegmentNormalsComponent
83 
84 
85 template< typename SegmentNormalsVolumeType >
87 {
88 }
89 
90 
91 template< typename SegmentNormalsVolumeType >
93 {
94  myNormals.reset( normals );
95 }
96 
97 
98 template< typename SegmentNormalsVolumeType >
100 {
102  return **myNormals;
103 }
104 
105 
106 template< typename SegmentNormalsVolumeType >
108 {
110  return **myNormals;
111 }
112 
113 
114 template< typename SegmentNormalsVolumeType >
116 {
117  return myNormals.get() != nullptr && myNormals->get() != nullptr;
118 }
119 
120 
121 
122 // ----------------------------------------------------------------------------------
123 // VolumeSegmentNormalsComponent< void >
124 // ----------------------------------------------------------------------------------
125 
132 template< >
134 {
135 
136 public:
137 
142 
143 }; // VolumeSegmentNormalsComponent
144 
145 
147 {
148 }
149 
150 
151 
152 // ----------------------------------------------------------------------------------
153 // VolumeSegment
154 // ----------------------------------------------------------------------------------
155 
162 template< typename SegmentIntensityVolumeType, typename SegmentNormalsVolumeType >
163 class VolumeSegment : public VolumeSegmentNormalsComponent< SegmentNormalsVolumeType >
164 {
165 
167 
168 public:
169 
175 
179  typedef SegmentIntensityVolumeType IntensityVolume;
180 
184  typedef SegmentNormalsVolumeType NormalsVolume;
185 
190  Grid& grid;
191 
199  VolumeSegment( Grid& grid );
200 
204  void setIntensities( Association< SegmentIntensityVolumeType >* intensities );
205 
210  SegmentIntensityVolumeType& intensities();
211 
214  const SegmentIntensityVolumeType& intensities() const;
215 
219  bool hasIntensities() const;
220 
226 
227 private:
228 
229  std::unique_ptr< Association< SegmentIntensityVolumeType > > myIntensities;
230 
231 }; // VolumeSegment
232 
233 
234 template< typename SegmentIntensityVolumeType, typename SegmentNormalsVolumeType >
237  : grid( grid )
238 {
239 }
240 
241 
242 template< typename SegmentIntensityVolumeType, typename SegmentNormalsVolumeType >
244 {
245  myIntensities.reset( intensities );
246 }
247 
248 
249 template< typename SegmentIntensityVolumeType, typename SegmentNormalsVolumeType >
251 {
252  CARNA_ASSERT( hasIntensities() );
253  return **myIntensities;
254 }
255 
256 
257 template< typename SegmentIntensityVolumeType, typename SegmentNormalsVolumeType >
259 {
260  CARNA_ASSERT( hasIntensities() );
261  return **myIntensities;
262 }
263 
264 
265 template< typename SegmentIntensityVolumeType, typename SegmentNormalsVolumeType >
267 {
268  return myIntensities.get() != nullptr && myIntensities->get() != nullptr;
269 }
270 
271 
272 
273 } // namespace Carna :: base
274 
275 } // namespace Carna
276 
277 #endif // VOLUMESEGMENT_H_6014714286
Defines Carna::base::Association.
void setNormals(Association< SegmentNormalsVolumeType > *volume)
Sets the normal map of this partition.
Definition: VolumeSegment.h:92
Grid & grid
References the volumetric data partitioning this partition belongs to.
SegmentNormalsVolumeType NormalsVolume
Reflects the type to use for storing the normal map of a single partition.
Eigen::Matrix< unsigned int, 3, 1 > Vector3ui
Defines vector.
Definition: math.h:199
Represents a single volumetric data partition.
SegmentIntensityVolumeType IntensityVolume
Reflects the type to use for storing the intensity volume of a single partition.
SegmentNormalsVolumeType & normals()
References the normal map of this partition.
Definition: VolumeSegment.h:99
Defines Carna::base::VolumeGrid.
VolumeGrid< SegmentIntensityVolumeType, SegmentNormalsVolumeType > Grid
Reflects the type to use for representation of the whole volumetric data partitioning.
math::Vector3ui offset
Holds the coordinate offset this partition within the whole volumetric data partitioning.
Represents the normal map component of an VolumeSegment object.
Definition: VolumeSegment.h:48
SegmentIntensityVolumeType & intensities()
References the intensity volume data of this partition.
Defines Carna::base::CarnaException, Carna::base::AssertionFailure.
VolumeSegment(Grid &grid)
Instantiates.
bool hasNormals() const
Tells whether this partition has a normal map associated.
void setIntensities(Association< SegmentIntensityVolumeType > *intensities)
Sets the intensity volume data of this partition.
bool hasIntensities() const
Tells whether this partition has intensity volume data associated.
#define CARNA_ASSERT(expression)
If the given expression is false, a break point is raised in debug mode and an AssertionFailure throw...
#define NON_COPYABLE
Features class it is placed in as non-copyable.
Definition: noncopyable.h:109
Represents a particular partitioning of volumetric data.
Definition: VolumeGrid.h:63