Coin Logo http://www.sim.no
http://www.coin3d.org

SoVolumeReader.h

00001 #ifndef COIN_SOVOLUMEREADER_H
00002 #define COIN_SOVOLUMEREADER_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the SIM Voleon visualization library.
00007  *  Copyright (C) 2003-2004 by Systems in Motion.  All rights reserved.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using SIM Voleon with software that can not be combined with
00016  *  the GNU GPL, and for taking advantage of the additional benefits
00017  *  of our support services, please contact Systems in Motion about
00018  *  acquiring a SIM Voleon Professional Edition License.
00019  *
00020  *  See <URL:http://www.coin3d.org/> for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  <URL:http://www.sim.no/>.
00024  *
00025 \**************************************************************************/
00026 
00027 #include <VolumeViz/nodes/SoVolumeData.h>
00028 
00029 class SbBox2s;
00030 class SbBox3f;
00031 class SbVec3s;
00032 
00033 
00034 class SIMVOLEON_DLL_API SoVolumeReader {
00035 public:
00036   SoVolumeReader(void);
00037   virtual ~SoVolumeReader();
00038 
00039   virtual void setUserData(void * data);
00040   virtual int getNumSignificantBits(void);
00041 
00042   virtual void getDataChar(SbBox3f & size, SoVolumeData::DataType & type,
00043                            SbVec3s & dim) = 0;
00044 
00045   enum CopyPolicy { COPY, NO_COPY, NO_COPY_AND_DELETE };
00046   
00047   virtual void getSubSlice(SbBox2s & slice, int slicenumber, void * voxels) = 0;
00048   virtual SbBool getSubVolume(SbBox3s & volume, void * voxels);
00049   virtual SbBool getSubVolume(const SbBox3s & volume,
00050                               const SbVec3s subsamplelevel, void *& voxels);
00051   virtual SbBool getSubVolumeInfo(SbBox3s & volume,
00052                                   SbVec3s reqsubsamplelevel,
00053                                   SbVec3s & subsamplelevel,
00054                                   SoVolumeReader::CopyPolicy & policy);
00055 
00056   SbVec3s getNumVoxels(SbVec3s realsize, SbVec3s subsamplinglevel) const;
00057   SbVec3s getSizeToAllocate(SbVec3s realsize, SbVec3s subsamplinglevel) const;
00058 
00059   int setFilename(const char * filename);
00060 
00061 protected:
00062   void * getBuffer(int64_t offset, unsigned int size);
00063   int bytesToInt(unsigned char * ptr, int sizeBytes);
00064   void swapBytes(int * intPtr, int sizeBytes);
00065   int64_t fileSize(void);
00066 
00067   void * m_data;
00068 
00069 private:
00070   friend class SoVolumeReaderP;
00071   class SoVolumeReaderP * pimpl;
00072 
00073   // FIXME: SoVolumeData shouldn't really access m_data, as voxel data
00074   // should be stored within SoVolumeData, and not on this pointer.
00075   // 20041008 mortene.
00076   friend class SoVolumeData; // For m_data access.
00077 };
00078 
00079 #endif // !COIN_SOVOLUMEREADER_H

Copyright © 1998-2004 by Systems in Motion AS. All rights reserved.

Generated on Sun Feb 10 02:21:52 2008 for SIMVoleon by Doxygen. 1.5.4