62 if (isVDBFile(_fileName)) {
63 openvdb::initialize();
64 openvdb::io::File _vdbFile(_fileName);
67 grids = _vdbFile.getGrids();
68 auto grid = openvdb::gridPtrCast<openvdb::FloatGrid>(*grids->begin());
70 openvdb::CoordBBox bounds = grid->evalActiveVoxelBoundingBox();
71 _shape[0] = bounds.max().x() - bounds.min().x();
72 _shape[1] = bounds.max().y() - bounds.min().y();
73 _shape[2] = bounds.max().z() - bounds.min().z();
76 #if not defined(FEATURE_VTK)
77 if (isVTKFile(_fileName))
79 std::cerr <<
"To use the VTK format, add VTK to the FEATURES list in config.mk";
83 #if defined(FEATURE_VTK)
84 if (isVTKFile(_fileName)) {
85 _reader->SetFileName(fileName.c_str());
87 _reader->SetScalarsName(_reader->GetScalarsNameInFile(0));
88 auto* _data = _reader->GetOutput();
89 _data->GetDimensions(_shape.
data());
93 if (isVDBFile(_fileName))
95 std::cerr <<
"To use the VDB format, add VDB to the FEATURES list in config.mk";
107 if (isVDBFile(_fileName)) {
114 if (iX >= 0 && iY >= 0 && iZ >= 0 && iX < _shape[0] && iY < _shape[1] && iZ < _shape[2]) {
115 auto grid = openvdb::gridPtrCast<openvdb::FloatGrid>(*grids->begin());
116 openvdb::Coord location(iX, iY, iZ);
117 openvdb::FloatGrid::Accessor accessor = grid->getAccessor();
118 output[0] =accessor.getValue(location);
125 #if defined(FEATURE_VTK)
126 if(isVTKFile(_fileName)) {
133 if (iX >= 0 && iY >= 0 && iZ >= 0 && iX < _shape[0] && iY < _shape[1] && iZ < _shape[2]) {
134 auto* _data = _reader->GetOutput();
135 output[0] = *
static_cast<T*
>(_data->GetScalarPointer(iX, iY, iZ));