Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SbImageDataAccessor.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Thibaut Andrieu (Feb 2014)
22**=======================================================================*/
23
24#ifndef _SB_IMAGE_DATA_ACCESSOR_H_
25#define _SB_IMAGE_DATA_ACCESSOR_H_
26
27#include <ImageViz/SoImageViz.h>
28#include <Inventor/SbVec.h>
30#include <Inventor/SbBox.h>
33
36class SoDEPRECATED SbImageDataAccessor
58{
59public:
60class SoDEPRECATED Region
72 {
73 public:
80 virtual SbVec4i32 getPosition(uint64_t i) const = 0;
81
88 virtual SbVec4i32 getSize() const = 0;
89
91 virtual uint64_t getNumVoxel() const = 0;
92
98 virtual SbBox4i32 getExtent() const = 0;
99 };
100class SoDEPRECATED SubVolumeRegion : public Region
105 {
106 public:
108 SubVolumeRegion(const SbBox3i32& subVolume);
109
114 virtual SbVec4i32 getPosition(uint64_t i) const;
115
120 virtual SbVec4i32 getSize() const { return m_bbox.getSize(); }
121
123 virtual uint64_t getNumVoxel() const;
124
128 virtual SbBox4i32 getExtent() const { return m_bbox; }
129
130 private:
131 // Default constructor required for wrapping
132 SubVolumeRegion() {}
133
134 private:
135
138 SbBox4i32 m_bbox;
139 };
140
144
147 static SubVolumeRegion createSliceRegion(SoImageDataAdapter* image, uint32_t sliceNumber);
148
157
169 double getVoxel( int x, int y, int z = 0, int t = 0, int c = 0 );
170
181 bool setVoxel( double value, int x, int y, int z = 0, int t = 0, int c = 0 );
182
193 bool getRow( SoCpuBufferObject* values, int y, int z = 0, int t = 0, int c = 0 );
194
198 bool getRow( std::vector<double>& values, int y, int z = 0, int t = 0, int c = 0 );
199
210 bool setRow( const SoCpuBufferObject* values, int y, int z = 0, int t = 0, int c = 0 );
211
215 bool setRow( const std::vector<double>& values, int y, int z = 0, int t = 0, int c = 0 );
216
227 bool getColumn( SoCpuBufferObject* values, int x, int z = 0, int t = 0, int c = 0 );
228
232 bool getColumn( std::vector<double>& values, int x, int z = 0, int t = 0, int c = 0 );
233
244 bool setColumn( const SoCpuBufferObject* values, int x, int z = 0, int t = 0, int c = 0 );
245
249 bool setColumn( const std::vector<double>& values, int x, int z = 0, int t = 0, int c = 0 );
250
262 SoMemoryDataAdapter* copyRegion(const Region& region, const SbChannelList& channels);
263
276
278 SoImageDataAdapter* getImageAdapter() const { return m_image; }
279
280private:
281
283 friend class SoImageDataAdapter;
285
286private:
287
290
292 SbImageDataAccessor& operator=(const SbImageDataAccessor&) { return *this; }
294
295
298 template <typename IMAGE_TYPE, typename REGION>
299 SoMemoryDataAdapter* copyRegionGeneric(const REGION& region, const SbChannelList& channelList);
300
306 template <typename IMAGE_TYPE>
307 void getVoxelInternal(const SbVec4i32& pos, SoCpuBufferObject* voxelBuff);
308
310 static bool checkRegionConsistency( const Region& region );
311
314 SoImageDataAdapter* m_image;
315};
316
317#endif // _SB_IMAGE_DATA_ACCESSOR_H_
318
valueRef operator=(valueRef newValue)
Sets this field to newValue.
Definition SoSubField.h:242
void getSize(float &sizeX, float &sizeY, float &sizeZ) const
Gets box size.
Definition SbBox.h:829
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box class.
Definition SbBox.h:96
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 4D box class.
Definition SbBox.h:2586
<a href="IconLegend.html"><img src="extIP.gif" alt="ImageViz" border="0"></a> List of channel to ext...
A region must be an ordered set with a first voxel and for each voxel a next voxel,...
virtual SbVec4i32 getSize() const =0
Returns dimensions of the region.
virtual uint64_t getNumVoxel() const =0
Returns number of voxels contained in the region.
virtual SbVec4i32 getPosition(uint64_t i) const =0
Returns position of the ith voxel in the region.
virtual SbBox4i32 getExtent() const =0
Returns extent of the region in image space.
virtual SbVec4i32 getPosition(uint64_t i) const
Returns position of the ith voxel of the region.
SubVolumeRegion(const SbBox3i32 &subVolume)
Constructor.
virtual SbBox4i32 getExtent() const
Returns extent of region.
virtual uint64_t getNumVoxel() const
Returns number of voxels contained in the region.
virtual SbVec4i32 getSize() const
Returns the dimensions of the region.
<a href="IconLegend.html"><img src="extIP.gif" alt="ImageViz" border="0"></a> Class used to retrieve...
double getVoxel(int x, int y, int z=0, int t=0, int c=0)
Returns value of voxel at specified position.
SbImageDataVoxel getVoxel(const SbVec4i32 &pos)
Returns voxel at specified position.
static SubVolumeRegion createFullRegion(SoImageDataAdapter *image)
Helper to create a SubVolumeRegion corresponding to the whole region of the given image.
static SubVolumeRegion createSliceRegion(SoImageDataAdapter *image, uint32_t sliceNumber)
Helper to create a SubVolumeRegion corresponding to one slice of the given image.
bool setRow(const SoCpuBufferObject *values, int y, int z=0, int t=0, int c=0)
Set values to a row at specified coordinates.
SoMemoryDataAdapter * copyRegion(const Region &region)
Returns an SoMemoryDataAdapter corresponding to the requested region.
bool getRow(std::vector< double > &values, int y, int z=0, int t=0, int c=0)
Alternate method to getRow( SoCpuBufferObject* values, int y, int z, int t, int c ).
SoMemoryDataAdapter * copyRegion(const Region &region, const SbChannelList &channels)
Returns an SoMemoryDataAdapter corresponding to the requested region.
bool setVoxel(double value, int x, int y, int z=0, int t=0, int c=0)
Set the value of voxel at specified coordinates.
bool setColumn(const SoCpuBufferObject *values, int x, int z=0, int t=0, int c=0)
Set values to a column at specified coordinates.
bool getColumn(SoCpuBufferObject *values, int x, int z=0, int t=0, int c=0)
Get values of the full column at specified coordinates.
bool setRow(const std::vector< double > &values, int y, int z=0, int t=0, int c=0)
Alternate method to setRow( const SoCpuBufferObject* values, int y, int z, int t, int c ).
bool setColumn(const std::vector< double > &values, int x, int z=0, int t=0, int c=0)
Alternate method to setColumn( const SoCpuBufferObject* values, int x, int z, int t,...
SoImageDataAdapter * getImageAdapter() const
Returns the SoImageDataAdapter associated with this DataAccessor.
bool getColumn(std::vector< double > &values, int x, int z=0, int t=0, int c=0)
Alternate method to getColumn( SoCpuBufferObject* values, int x, int z, int t, int c ).
bool getRow(SoCpuBufferObject *values, int y, int z=0, int t=0, int c=0)
Get values of the full row at specified coordinates.
<a href="IconLegend.html"><img src="extIP.gif" alt="ImageViz" border="0"></a> Utility class used to ...
4D vector class.
Definition SbVec.h:2639
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> CPU buffer objec...
<a href="IconLegend.html"><img src="extIP.gif" alt="ImageViz" border="0"></a> Abstract base class fo...
<a href="IconLegend.html"><img src="extIP.gif" alt="ImageViz" border="0"></a> Image data adapter for...