| 159 | } |
| 160 | |
| 161 | size_t countVoxelsWithValuePred( const FloatGrid& grid, const std::function<bool( float )>& pred ) |
| 162 | { |
| 163 | MR_TIMER; |
| 164 | if ( !pred || !grid ) |
| 165 | { |
| 166 | assert( false ); |
| 167 | return 0; |
| 168 | } |
| 169 | tbb::enumerable_thread_specific<size_t> tls( 0 ); |
| 170 | openvdb::tools::foreach( grid->cbeginValueAll(), [&] ( const openvdb::FloatGrid::ValueAllCIter& it ) |
| 171 | { |
| 172 | if ( !pred( it.getValue() ) ) |
| 173 | return; |
| 174 | auto& local = tls.local(); |
| 175 | local += it.getBoundingBox().volume(); |
| 176 | } ); |
| 177 | size_t res = 0; |
| 178 | for ( const auto& t : tls ) |
| 179 | res += t; |
| 180 | return res; |
| 181 | } |
| 182 | |
| 183 | size_t countVoxelsWithValueLess( const FloatGrid& grid, float value ) |
| 184 | { |
no test coverage detected