diff --git a/cpp/test/0-128_0-128_0-10 b/cpp/test/0-128_0-128_0-10 new file mode 100644 index 0000000..1e7495f Binary files /dev/null and b/cpp/test/0-128_0-128_0-10 differ diff --git a/cpp/test/Makefile b/cpp/test/Makefile new file mode 100644 index 0000000..451be42 --- /dev/null +++ b/cpp/test/Makefile @@ -0,0 +1,2 @@ +all: + g++ -lzfp -Izfp-1.0.0/include -std=c++14 main.cpp -o test \ No newline at end of file diff --git a/cpp/test/libzfp.a b/cpp/test/libzfp.a new file mode 100644 index 0000000..d9f22b8 Binary files /dev/null and b/cpp/test/libzfp.a differ diff --git a/cpp/test/main.cpp b/cpp/test/main.cpp new file mode 100644 index 0000000..73f726b --- /dev/null +++ b/cpp/test/main.cpp @@ -0,0 +1,42 @@ +#include "zfp.hpp" +#include "zfpc.hpp" +#include + + +#include +#include +#include + +std::string slurp(const char *filename) { + std::ifstream in; + in.open(filename, std::ifstream::in | std::ifstream::binary); + std::stringstream sstr; + sstr << in.rdbuf(); + in.close(); + return sstr.str(); +} + + +int main () { + std::string data = slurp("/Users/wms/code/zfpc/wasm/0-128_0-128_0-10"); + + + size_t voxels = 128 * 128 * 10 * 2; + float* out = new float[voxels](); + const unsigned char* ptr = reinterpret_cast(const_cast(data.c_str())); + + int err = zfpc::decompress(ptr, data.size(), out, voxels * 4); + + std::ofstream f; + f.open("/Users/wms/code/zfpc/wasm/0-128_0-128_0-10.raw"); + + unsigned char* outc = reinterpret_cast(out); + + for (int i = 0; i < voxels * 4; i++) { + f << outc[i]; + } + + f.close(); + + return 0; +} \ No newline at end of file diff --git a/cpp/test/test.py b/cpp/test/test.py new file mode 100644 index 0000000..a9389ef --- /dev/null +++ b/cpp/test/test.py @@ -0,0 +1,9 @@ +import numpy as np +from cloudvolume import view +import zfpy + +data = open("0-128_0-128_0-10-1.zfp", "rb").read() +img = zfpy.decompress_numpy(data) + +print(img) +view(img, port=8081) \ No newline at end of file