diff --git a/main.c b/main.c index 9724f27..aa3eb2c 100644 --- a/main.c +++ b/main.c @@ -5,9 +5,9 @@ int main() { size_t shape[] = {20, 20, 20}; - size_t chunks[] = {10, 10, 10}; - size_t offset[] = {0, 0, 0}; - size_t offset2[] = {10, 10, 10}; + size_t count[] = {10, 10, 10}; + size_t start[] = {0, 0, 0}; + size_t start2[] = {10, 10, 10}; float data1[10][10][10]; float data2[10][10][10]; float rdata[10][10][10]; @@ -15,17 +15,17 @@ int main() { long long int idata2[10][10][10]; long long int irdata[10][10][10]; unsigned int ndim = 3; - for (int i = 0; i < chunks[0]; i++){ - for (int j = 0; j < chunks[1]; j++){ - for (int k = 0; k dtype({"float32"}); std::vector shape_v(shape, shape + ndim); - std::vector chunks_v(chunks, chunks + ndim); + std::vector count_v(count, count + ndim); bool asZarr = true; - DatasetMetadata floatMeta(types::Datatype::float32,shape_v,chunks_v,asZarr); + DatasetMetadata floatMeta(types::Datatype::float32,shape_v,count_v,asZarr); if (cuseZlib) { floatMeta.compressor = types::zlib; floatMeta.compressionOptions["useZlib"] = true; @@ -44,41 +44,41 @@ namespace z5 { } - void z5WriteFloat32Subarray(char *path, float *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5WriteFloat32Subarray(char *path, float *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds =openDataset(path_s); size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size=size*(*i); - xt::xarray adp_array=xt::adapt(array,size,xt::no_ownership(),shape_v); - std::vector offset_v(offset,offset + ndim); - multiarray::writeSubarray(ds,adp_array,offset_v.begin()); + xt::xarray adp_array=xt::adapt(array,size,xt::no_ownership(),count_v); + std::vector start_v(start,start + ndim); + multiarray::writeSubarray(ds,adp_array,start_v.begin()); } - void z5ReadFloat32Subarray(char *path, float *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5ReadFloat32Subarray(char *path, float *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds = openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size*=(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::readSubarray(ds,adp_array,offset_v.begin()); + multiarray::readSubarray(ds,adp_array,start_v.begin()); } - void z5CreateFloat64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level) { + void z5CreateFloat64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level) { std::string path_s(path); std::vector dtype({"float64"}); std::vector shape_v(shape, shape + ndim); - std::vector chunks_v(chunks, chunks + ndim); + std::vector count_v(count, count + ndim); bool asZarr = true; - DatasetMetadata floatMeta(types::Datatype::float64,shape_v,chunks_v,asZarr); + DatasetMetadata floatMeta(types::Datatype::float64,shape_v,count_v,asZarr); if (cuseZlib) { floatMeta.compressor = types::zlib; floatMeta.compressionOptions["useZlib"] = true; @@ -90,41 +90,41 @@ namespace z5 { } - void z5WriteFloat64Subarray(char *path, double *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5WriteFloat64Subarray(char *path, double *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds =openDataset(path_s); size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size=size*(*i); - xt::xarray adp_array=xt::adapt(array,size,xt::no_ownership(),shape_v); - std::vector offset_v(offset,offset + ndim); - multiarray::writeSubarray(ds,adp_array,offset_v.begin()); + xt::xarray adp_array=xt::adapt(array,size,xt::no_ownership(),count_v); + std::vector start_v(start,start + ndim); + multiarray::writeSubarray(ds,adp_array,start_v.begin()); } - void z5ReadFloat64Subarray(char *path, double *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5ReadFloat64Subarray(char *path, double *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds = openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size*=(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::readSubarray(ds,adp_array,offset_v.begin()); + multiarray::readSubarray(ds,adp_array,start_v.begin()); } - void z5CreateInt8Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level) { + void z5CreateInt8Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level) { std::string path_s(path); std::vector shape_v(shape, shape + ndim); - std::vector chunks_v(chunks, chunks + ndim); + std::vector count_v(count, count + ndim); bool asZarr = true; - DatasetMetadata int8Meta(types::Datatype::int8,shape_v,chunks_v,asZarr); + DatasetMetadata int8Meta(types::Datatype::int8,shape_v,count_v,asZarr); if (cuseZlib) { int8Meta.compressor = types::zlib; int8Meta.compressionOptions["useZlib"] = true; @@ -135,44 +135,44 @@ namespace z5 { writeMetadata(handle_, int8Meta); } - void z5WriteInt8Subarray(char *path, int8_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5WriteInt8Subarray(char *path, int8_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds =openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size=size*(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::writeSubarray(ds,adp_array,offset_v.begin()); + multiarray::writeSubarray(ds,adp_array,start_v.begin()); } - void z5ReadInt8Subarray(char *path, int8_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5ReadInt8Subarray(char *path, int8_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds = openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size*=(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::readSubarray(ds,adp_array,offset_v.begin()); + multiarray::readSubarray(ds,adp_array,start_v.begin()); } - void z5CreateInt16Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level) { + void z5CreateInt16Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level) { std::string path_s(path); std::vector shape_v(shape, shape + ndim); - std::vector chunks_v(chunks, chunks + ndim); + std::vector count_v(count, count + ndim); bool asZarr = true; - DatasetMetadata int16Meta(types::Datatype::int16,shape_v,chunks_v,asZarr); + DatasetMetadata int16Meta(types::Datatype::int16,shape_v,count_v,asZarr); if (cuseZlib) { int16Meta.compressor = types::zlib; int16Meta.compressionOptions["useZlib"] = true; @@ -183,44 +183,44 @@ namespace z5 { writeMetadata(handle_, int16Meta); } - void z5WriteInt16Subarray(char *path, int16_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5WriteInt16Subarray(char *path, int16_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds =openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size=size*(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::writeSubarray(ds,adp_array,offset_v.begin()); + multiarray::writeSubarray(ds,adp_array,start_v.begin()); } - void z5ReadInt16Subarray(char *path, int16_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5ReadInt16Subarray(char *path, int16_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds = openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size*=(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::readSubarray(ds,adp_array,offset_v.begin()); + multiarray::readSubarray(ds,adp_array,start_v.begin()); } - void z5CreateInt32Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level) { + void z5CreateInt32Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level) { std::string path_s(path); std::vector shape_v(shape, shape + ndim); - std::vector chunks_v(chunks, chunks + ndim); + std::vector count_v(count, count + ndim); bool asZarr = true; - DatasetMetadata int32Meta(types::Datatype::int32,shape_v,chunks_v,asZarr); + DatasetMetadata int32Meta(types::Datatype::int32,shape_v,count_v,asZarr); if (cuseZlib) { int32Meta.compressor = types::zlib; int32Meta.compressionOptions["useZlib"] = true; @@ -231,44 +231,44 @@ namespace z5 { writeMetadata(handle_, int32Meta); } - void z5WriteInt32Subarray(char *path, int32_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5WriteInt32Subarray(char *path, int32_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds =openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size=size*(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::writeSubarray(ds,adp_array,offset_v.begin()); + multiarray::writeSubarray(ds,adp_array,start_v.begin()); } - void z5ReadInt32Subarray(char *path, int32_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5ReadInt32Subarray(char *path, int32_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds = openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size*=(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::readSubarray(ds,adp_array,offset_v.begin()); + multiarray::readSubarray(ds,adp_array,start_v.begin()); } - void z5CreateInt64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level) { + void z5CreateInt64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level) { std::string path_s(path); std::vector shape_v(shape, shape + ndim); - std::vector chunks_v(chunks, chunks + ndim); + std::vector count_v(count, count + ndim); bool asZarr = true; - DatasetMetadata int64Meta(types::Datatype::int64,shape_v,chunks_v,asZarr); + DatasetMetadata int64Meta(types::Datatype::int64,shape_v,count_v,asZarr); if (cuseZlib) { int64Meta.compressor = types::zlib; int64Meta.compressionOptions["useZlib"] = true; @@ -279,44 +279,44 @@ namespace z5 { writeMetadata(handle_, int64Meta); } - void z5WriteInt64Subarray(char *path, long long int *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5WriteInt64Subarray(char *path, long long int *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds =openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size=size*(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::writeSubarray(ds,adp_array,offset_v.begin()); + multiarray::writeSubarray(ds,adp_array,start_v.begin()); } - void z5ReadInt64Subarray(char *path, long long int *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5ReadInt64Subarray(char *path, long long int *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds = openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size*=(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::readSubarray(ds,adp_array,offset_v.begin()); + multiarray::readSubarray(ds,adp_array,start_v.begin()); } - void z5CreateUInt8Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level) { + void z5CreateUInt8Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level) { std::string path_s(path); std::vector shape_v(shape, shape + ndim); - std::vector chunks_v(chunks, chunks + ndim); + std::vector count_v(count, count + ndim); bool asZarr = true; - DatasetMetadata uint8Meta(types::Datatype::uint8,shape_v,chunks_v,asZarr); + DatasetMetadata uint8Meta(types::Datatype::uint8,shape_v,count_v,asZarr); if (cuseZlib) { uint8Meta.compressor = types::zlib; uint8Meta.compressionOptions["useZlib"] = true; @@ -327,44 +327,44 @@ namespace z5 { writeMetadata(handle_, uint8Meta); } - void z5WriteUInt8Subarray(char *path, uint8_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5WriteUInt8Subarray(char *path, uint8_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds =openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size=size*(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::writeSubarray(ds,adp_array,offset_v.begin()); + multiarray::writeSubarray(ds,adp_array,start_v.begin()); } - void z5ReadUInt8Subarray(char *path, uint8_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5ReadUInt8Subarray(char *path, uint8_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds = openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size*=(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::readSubarray(ds,adp_array,offset_v.begin()); + multiarray::readSubarray(ds,adp_array,start_v.begin()); } - void z5CreateUInt16Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level) { + void z5CreateUInt16Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level) { std::string path_s(path); std::vector shape_v(shape, shape + ndim); - std::vector chunks_v(chunks, chunks + ndim); + std::vector count_v(count, count + ndim); bool asZarr = true; - DatasetMetadata uint16Meta(types::Datatype::uint16,shape_v,chunks_v,asZarr); + DatasetMetadata uint16Meta(types::Datatype::uint16,shape_v,count_v,asZarr); if (cuseZlib) { uint16Meta.compressor = types::zlib; uint16Meta.compressionOptions["useZlib"] = true; @@ -375,44 +375,44 @@ namespace z5 { writeMetadata(handle_, uint16Meta); } - void z5WriteUInt16Subarray(char *path, uint16_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5WriteUInt16Subarray(char *path, uint16_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds =openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size=size*(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::writeSubarray(ds,adp_array,offset_v.begin()); + multiarray::writeSubarray(ds,adp_array,start_v.begin()); } - void z5ReadUInt16Subarray(char *path, uint16_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5ReadUInt16Subarray(char *path, uint16_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds = openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size*=(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::readSubarray(ds,adp_array,offset_v.begin()); + multiarray::readSubarray(ds,adp_array,start_v.begin()); } - void z5CreateUInt32Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level) { + void z5CreateUInt32Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level) { std::string path_s(path); std::vector shape_v(shape, shape + ndim); - std::vector chunks_v(chunks, chunks + ndim); + std::vector count_v(count, count + ndim); bool asZarr = true; - DatasetMetadata uint32Meta(types::Datatype::uint32,shape_v,chunks_v,asZarr); + DatasetMetadata uint32Meta(types::Datatype::uint32,shape_v,count_v,asZarr); if (cuseZlib) { uint32Meta.compressor = types::zlib; uint32Meta.compressionOptions["useZlib"] = true; @@ -423,44 +423,44 @@ namespace z5 { writeMetadata(handle_, uint32Meta); } - void z5WriteUInt32Subarray(char *path, uint32_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5WriteUInt32Subarray(char *path, uint32_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds =openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size=size*(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::writeSubarray(ds,adp_array,offset_v.begin()); + multiarray::writeSubarray(ds,adp_array,start_v.begin()); } - void z5ReadUInt32Subarray(char *path, uint32_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5ReadUInt32Subarray(char *path, uint32_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds = openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size*=(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::readSubarray(ds,adp_array,offset_v.begin()); + multiarray::readSubarray(ds,adp_array,start_v.begin()); } - void z5CreateUInt64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level) { + void z5CreateUInt64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level) { std::string path_s(path); std::vector shape_v(shape, shape + ndim); - std::vector chunks_v(chunks, chunks + ndim); + std::vector count_v(count, count + ndim); bool asZarr = true; - DatasetMetadata uint64Meta(types::Datatype::uint64,shape_v,chunks_v,asZarr); + DatasetMetadata uint64Meta(types::Datatype::uint64,shape_v,count_v,asZarr); if (cuseZlib) { uint64Meta.compressor = types::zlib; uint64Meta.compressionOptions["useZlib"] = true; @@ -471,34 +471,34 @@ namespace z5 { writeMetadata(handle_, uint64Meta); } - void z5WriteUInt64Subarray(char *path, uint64_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5WriteUInt64Subarray(char *path, uint64_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds =openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size=size*(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::writeSubarray(ds,adp_array,offset_v.begin()); + multiarray::writeSubarray(ds,adp_array,start_v.begin()); } - void z5ReadUInt64Subarray(char *path, uint64_t *array, unsigned int ndim, size_t *shape, size_t *offset) { + void z5ReadUInt64Subarray(char *path, uint64_t *array, unsigned int ndim, size_t *count, size_t *start) { std::string path_s(path); auto ds = openDataset(path_s); using vec_type = std::vector; size_t size = 1; - std::vector shape_v(shape,shape + ndim); - for (std::vector::const_iterator i = shape_v.begin(); i != shape_v.end(); ++i) + std::vector count_v(count,count + ndim); + for (std::vector::const_iterator i = count_v.begin(); i != count_v.end(); ++i) size*=(*i); - using shape_type = std::vector; - shape_type s(shape,shape+ndim); - std::vector offset_v(offset,offset + ndim); + using count_type = std::vector; + count_type s(count,count+ndim); + std::vector start_v(start,start + ndim); auto adp_array=xt::adapt(array,size,xt::no_ownership(),s); - multiarray::readSubarray(ds,adp_array,offset_v.begin()); + multiarray::readSubarray(ds,adp_array,start_v.begin()); } size_t z5GetFileSize(char *path){ diff --git a/z5wrapper.h b/z5wrapper.h index 7ef6029..9e641f5 100644 --- a/z5wrapper.h +++ b/z5wrapper.h @@ -29,54 +29,54 @@ namespace z5 { void z5CreateGroup(char* path); // float 32 - void z5CreateFloat32Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level); - void z5WriteFloat32Subarray(char *path, float *array, unsigned int ndim, size_t *shape, size_t *offset); - void z5ReadFloat32Subarray(char *path, float *array, unsigned int ndim, size_t *shape, size_t *offset); + void z5CreateFloat32Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level); + void z5WriteFloat32Subarray(char *path, float *array, unsigned int ndim, size_t *count, size_t *start); + void z5ReadFloat32Subarray(char *path, float *array, unsigned int ndim, size_t *count, size_t *start); // float 64 / double - void z5CreateFloat64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level); - void z5WriteFloat64Subarray(char *path, double *array, unsigned int ndim, size_t *shape, size_t *offset); - void z5ReadFloat64Subarray(char *path, double *array, unsigned int ndim, size_t *shape, size_t *offset); + void z5CreateFloat64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level); + void z5WriteFloat64Subarray(char *path, double *array, unsigned int ndim, size_t *count, size_t *start); + void z5ReadFloat64Subarray(char *path, double *array, unsigned int ndim, size_t *count, size_t *start); // int8_t - void z5CreateInt8Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level); - void z5WriteInt8Subarray(char *path, int8_t *array, unsigned int ndim, size_t *shape, size_t *offset); - void z5ReadInt8Subarray(char *path, int8_t *array, unsigned int ndim, size_t *shape, size_t *offset); + void z5CreateInt8Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level); + void z5WriteInt8Subarray(char *path, int8_t *array, unsigned int ndim, size_t *count, size_t *start); + void z5ReadInt8Subarray(char *path, int8_t *array, unsigned int ndim, size_t *count, size_t *start); // int16_t - void z5CreateInt16Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level); - void z5WriteInt16Subarray(char *path, int16_t *array, unsigned int ndim, size_t *shape, size_t *offset); - void z5ReadInt16Subarray(char *path, int16_t *array, unsigned int ndim, size_t *shape, size_t *offset); + void z5CreateInt16Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level); + void z5WriteInt16Subarray(char *path, int16_t *array, unsigned int ndim, size_t *count, size_t *start); + void z5ReadInt16Subarray(char *path, int16_t *array, unsigned int ndim, size_t *count, size_t *start); // int32_t - void z5CreateInt32Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level); - void z5WriteInt32Subarray(char *path, int32_t *array, unsigned int ndim, size_t *shape, size_t *offset); - void z5ReadInt32Subarray(char *path, int32_t *array, unsigned int ndim, size_t *shape, size_t *offset); + void z5CreateInt32Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level); + void z5WriteInt32Subarray(char *path, int32_t *array, unsigned int ndim, size_t *count, size_t *start); + void z5ReadInt32Subarray(char *path, int32_t *array, unsigned int ndim, size_t *count, size_t *start); // int64 - void z5CreateInt64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level); - void z5WriteInt64Subarray(char *path, long long int *array, unsigned int ndim, size_t *shape, size_t *offset); - void z5ReadInt64Subarray(char *path, long long int *array, unsigned int ndim, size_t *shape, size_t *offset); + void z5CreateInt64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level); + void z5WriteInt64Subarray(char *path, long long int *array, unsigned int ndim, size_t *count, size_t *start); + void z5ReadInt64Subarray(char *path, long long int *array, unsigned int ndim, size_t *count, size_t *start); // uint8_t - void z5CreateUInt8Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level); - void z5WriteUInt8Subarray(char *path, uint8_t *array, unsigned int ndim, size_t *shape, size_t *offset); - void z5ReadUInt8Subarray(char *path, uint8_t *array, unsigned int ndim, size_t *shape, size_t *offset); + void z5CreateUInt8Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level); + void z5WriteUInt8Subarray(char *path, uint8_t *array, unsigned int ndim, size_t *count, size_t *start); + void z5ReadUInt8Subarray(char *path, uint8_t *array, unsigned int ndim, size_t *count, size_t *start); // uint16_t - void z5CreateUInt16Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level); - void z5WriteUInt16Subarray(char *path, uint16_t *array, unsigned int ndim, size_t *shape, size_t *offset); - void z5ReadUInt16Subarray(char *path, uint16_t *array, unsigned int ndim, size_t *shape, size_t *offset); + void z5CreateUInt16Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level); + void z5WriteUInt16Subarray(char *path, uint16_t *array, unsigned int ndim, size_t *count, size_t *start); + void z5ReadUInt16Subarray(char *path, uint16_t *array, unsigned int ndim, size_t *count, size_t *start); // uint32_t - void z5CreateUInt32Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level); - void z5WriteUInt32Subarray(char *path, uint32_t *array, unsigned int ndim, size_t *shape, size_t *offset); - void z5ReadUInt32Subarray(char *path, uint32_t *array, unsigned int ndim, size_t *shape, size_t *offset); + void z5CreateUInt32Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level); + void z5WriteUInt32Subarray(char *path, uint32_t *array, unsigned int ndim, size_t *count, size_t *start); + void z5ReadUInt32Subarray(char *path, uint32_t *array, unsigned int ndim, size_t *count, size_t *start); // uint64 - void z5CreateUInt64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *chunks, int cuseZlib, int level); - void z5WriteUInt64Subarray(char *path, uint64_t *array, unsigned int ndim, size_t *shape, size_t *offset); - void z5ReadUInt64Subarray(char *path, uint64_t *array, unsigned int ndim, size_t *shape, size_t *offset); + void z5CreateUInt64Dataset(char *path, unsigned int ndim, size_t *shape, size_t *count, int cuseZlib, int level); + void z5WriteUInt64Subarray(char *path, uint64_t *array, unsigned int ndim, size_t *count, size_t *start); + void z5ReadUInt64Subarray(char *path, uint64_t *array, unsigned int ndim, size_t *count, size_t *start); size_t z5GetFileSize(char *path);