5#ifndef _SignificanceMap_h_
6#define _SignificanceMap_h_
63 SignificanceMap(
const unsigned char *map,
size_t nx,
size_t ny = 1,
size_t nz = 1,
size_t nt = 1);
83 int Reshape(
size_t nx,
size_t ny = 1,
size_t nz = 1,
size_t nt = 1);
87 void GetShape(std::vector<size_t> &dims)
const { dims = _dimsVec; };
106 int SetXYZT(
size_t x,
size_t y = 0,
size_t z = 0,
size_t t = 0);
117 bool inline Test(
size_t idx)
const;
118 bool inline TestXYZT(
size_t x,
size_t y = 0,
size_t z = 0,
size_t t = 0)
const;
127 int ClearXYZT(
size_t x,
size_t y = 0,
size_t z = 0,
size_t t = 0);
149 int GetCoordinatesXYZT(
size_t i,
size_t *x,
size_t *y = NULL,
size_t *z = NULL,
size_t *t = NULL)
const;
185 static size_t GetMapSize(vector<size_t> dims,
size_t num_entries);
218 void GetMap(
const unsigned char **map,
size_t *maplen);
287 static const int HEADER_SIZE = 64;
288 static const int VDF_VERSION = 2;
296 std::vector<size_t> _dimsVec;
298 std::vector<size_t> _sigMapVec;
301 unsigned char *_sigMapEncode;
302 size_t _sigMapEncodeSize;
306 int _SignificanceMap(std::vector<size_t> dims);
307 int _SignificanceMap(
const unsigned char *map, std::vector<size_t> dims);
309 static size_t _GetBitsPerIdx(vector<size_t> dims);
314 if (idx > _sigMapSize)
return (0);
316 if (_sorted) {
return (binary_search(_sigMapVec.begin(), _sigMapVec.end(), idx)); }
318 for (
size_t i = 0; i < _sigMapVec.size(); i++) {
319 if (_sigMapVec[i] == idx)
return (1);
326 size_t idx = (t * _nz * _ny * _nx) + (z * _ny * _nx) + (y * _nx) + x;
328 return (this->
Test(idx));
Implements a significance map.
size_t GetMapSize() const
int GetNextEntryXYZT(size_t *x, size_t *y, size_t *z, size_t *t)
void GetMap(const unsigned char **map, size_t *maplen)
SignificanceMap(size_t nx, size_t ny=1, size_t nz=1, size_t nt=1)
void GetNextEntryRestart()
friend std::ostream & operator<<(std::ostream &o, const SignificanceMap &sigmap)
int GetCoordinatesXYZT(size_t i, size_t *x, size_t *y=NULL, size_t *z=NULL, size_t *t=NULL) const
SignificanceMap & operator=(const SignificanceMap &map)
SignificanceMap(std::vector< size_t > dims)
static size_t GetMapSize(vector< size_t > dims, size_t num_entries)
int GetNextEntry(size_t *idx)
int SetMap(const unsigned char *map)
int Reshape(size_t nx, size_t ny=1, size_t nz=1, size_t nt=1)
SignificanceMap(const unsigned char *map, std::vector< size_t > dims)
SignificanceMap(const SignificanceMap &)
void GetMap(unsigned char *map)
size_t GetMapSize(size_t num_entries) const
int Append(const SignificanceMap &smap)
bool TestXYZT(size_t x, size_t y=0, size_t z=0, size_t t=0) const
SignificanceMap(const unsigned char *map, size_t nx, size_t ny=1, size_t nz=1, size_t nt=1)
size_t GetNumSignificant() const
int Reshape(std::vector< size_t > dims)
bool Test(size_t idx) const
int SetXYZT(size_t x, size_t y=0, size_t z=0, size_t t=0)
int ClearXYZT(size_t x, size_t y=0, size_t z=0, size_t t=0)
void GetShape(std::vector< size_t > &dims) const
int GetCoordinates(size_t i, size_t *idx) const