00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SO_LDM_CONVERTER_
00025 #define _SO_LDM_CONVERTER_
00026
00027 #include <LDM/converters/SoConverter.h>
00028 class SoVolumeReader;
00029
00030 #ifdef _WIN32
00031 #pragma warning( push )
00032 #pragma warning(disable:4251)
00033 #endif
00034
00063 class SoBaseLDMConverter : public SoConverter
00064 {
00065
00066 public:
00070 SoBaseLDMConverter(SbBool isClient = FALSE);
00071
00080 virtual SoVolumeReader* getReader( const SbString& filename, const SbString& fileExt );
00081
00085 virtual ~SoBaseLDMConverter();
00086
00087
00088 private:
00089
00091 virtual void instanciateReader(SoConverter::ConverterError& error);
00092
00093
00094 virtual void getSubSlice( const SbBox2i32& subSlice, int sliceNumber, void * data ) ;
00095
00096
00097 virtual SbBox3f getSize(int& error) ;
00098 virtual std::vector<SoDataSet::DatumElement> getDatum(int& error) ;
00099 virtual SbVec3i32 getDimension(int& error) ;
00100 virtual int getRange( double & rangeMin, double & rangeMax );
00101 virtual SoVolumeHistogram* getHistogram();
00102 virtual std::vector<SbVec2d>& getTileMinMax(int numTiles);
00103 virtual void closeInputFileHandles();
00104
00105
00106
00107
00108 virtual bool getNumSignificantBits(int& numsigbits);
00109
00110 virtual void outputHeader( FILE* );
00112
00122 virtual void sampleTile( const SbVec3i32& tileDim, int border,
00123 const void* const octantTile[8],
00124 const int octantExists[8],
00125 void *parentTile );
00126
00136 virtual void sampleTile( const SbVec3i32& tileDim, int type, int border,
00137 const void* const octantTile[8],
00138 const int octantExists[8],
00139 void *parentTile );
00140
00148 virtual void sampleAverage( const SbVec3i32& tileDim, int type, int border,
00149 const void* const octantTile[8], const int octantExists[8],
00150 void *parentTile );
00151
00158 virtual void sampleDecimation(const SbVec3i32& tileDim, int dataType, int border,
00159 const void* const octantTile[8],
00160 const int octantExists[8],
00161 void *parentTile );
00162
00163 virtual void adjustParameters();
00164 virtual void handleCustomTags(FILE* filePtr);
00165
00166
00167 virtual void endConversion();
00168
00169 private:
00170 static void sampleAverageS(
00171 int pondCoef,const SbVec3i32& tileDim, int type,
00172 const void* const childTile,
00173 void *parentTile,
00174 int octant, const int octantExists[8]);
00175
00176 static void sampleDecimationS(
00177 const SbVec3i32& tileDim, int type,
00178 const void* const childTile,
00179 void *parentTile,
00180 int octant, const int octantExists[8]);
00181
00182 private:
00183 template <typename T>
00184 static void sampleAverage(int pondCoef, const SbVec3i32& tileDim, const void* const childTile,
00185 void *parentTile, int octant, const int octantExists[8]);
00186
00187 static void sampleAverageRGBA(int pondCoef, const SbVec3i32& tileDim, const void* const childTile,
00188 void *parentTile, int octant, const int octantExists[8]);
00189 template <typename T>
00190 static void sampleDecimation(const SbVec3i32& tileDim, const void* const childTile,
00191 void *parentTile, int octant, const int octantExists[8]);
00192
00193 static void getShiftAndHalfTileDim(SbVec2i32& shiftParentOctant,
00194 SbVec3i32& halfTileDim,
00195 const SbVec3i32& tileDim,
00196 int octant);
00197
00198 static void getRatio ( SbVec3f &ratio,
00199 SbVec3i32 &shiftOctant,
00200 SbVec3i32 tileDim,
00201 SbVec3i32 halfTileDim,
00202 int octant,
00203 const int octantExists[8]);
00204
00205 SoDataSet::DataType m_dataType;
00206 };
00207
00208 inline SoVolumeReader*
00209 SoBaseLDMConverter::getReader( const SbString& , const SbString& )
00210 {
00211 return NULL;
00212 }
00213
00214 #if defined(_WIN32)
00215 #pragma warning( pop )
00216 #pragma warning(disable:4251)
00217 #endif
00218
00219 #endif // _SO_LDM_CONVERTER_
00220
00221
00222