SIMVoleon  2.1.0
Coin3D volume rendering library
Loading...
Searching...
No Matches
SoVolumeReader.h
1#ifndef COIN_SOVOLUMEREADER_H
2#define COIN_SOVOLUMEREADER_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <VolumeViz/nodes/SoVolumeData.h>
37
38class SbBox2s;
39class SbBox3f;
40class SbVec3s;
41
42
43class SIMVOLEON_DLL_API SoVolumeReader {
44public:
45 SoVolumeReader(void);
46 virtual ~SoVolumeReader();
47
48 virtual void setUserData(void * data);
49 virtual int getNumSignificantBits(void);
50
51 virtual void getDataChar(SbBox3f & size, SoVolumeData::DataType & type,
52 SbVec3s & dim) = 0;
53
54 enum CopyPolicy { COPY, NO_COPY, NO_COPY_AND_DELETE };
55
56 virtual void getSubSlice(SbBox2s & slice, int slicenumber, void * voxels) = 0;
57 virtual SbBool getSubVolume(SbBox3s & volume, void * voxels);
58 virtual SbBool getSubVolume(const SbBox3s & volume,
59 const SbVec3s subsamplelevel, void *& voxels);
60 virtual SbBool getSubVolumeInfo(SbBox3s & volume,
61 SbVec3s reqsubsamplelevel,
62 SbVec3s & subsamplelevel,
63 SoVolumeReader::CopyPolicy & policy);
64
65 SbVec3s getNumVoxels(SbVec3s realsize, SbVec3s subsamplinglevel) const;
66 SbVec3s getSizeToAllocate(SbVec3s realsize, SbVec3s subsamplinglevel) const;
67
68 int setFilename(const char * filename);
69
70protected:
71 void * getBuffer(int64_t offset, unsigned int size);
72 int bytesToInt(unsigned char * ptr, int sizeBytes);
73 void swapBytes(int * intPtr, int sizeBytes);
74 int64_t fileSize(void);
75
76 void * m_data;
77
78private:
79 friend class SoVolumeReaderP;
80 class SoVolumeReaderP * pimpl;
81
82 // FIXME: SoVolumeData shouldn't really access m_data, as voxel data
83 // should be stored within SoVolumeData, and not on this pointer.
84 // 20041008 mortene.
85 friend class SoVolumeData; // For m_data access.
86};
87
88#endif // !COIN_SOVOLUMEREADER_H
The main interface for setting up volume data sets.
Definition SoVolumeData.h:54
Abstract superclass for all volume data reader classes.
Definition SoVolumeReader.h:43
virtual void getSubSlice(SbBox2s &slice, int slicenumber, void *voxels)=0
virtual void getDataChar(SbBox3f &size, SoVolumeData::DataType &type, SbVec3s &dim)=0