@@ -220,9 +220,10 @@ default <T> void writeRegion(
220220 final long [] size ,
221221 final DataBlockSupplier <T > dataBlocks ,
222222 final boolean writeFully ) throws N5Exception {
223+ DatasetAttributes convertedDatasetAttributes = getConvertedDatasetAttributes (datasetAttributes );
223224 try {
224- final PositionValueAccess posKva = PositionValueAccess .fromKva (getKeyValueAccess (), getURI (), N5URI .normalizeGroupPath (datasetPath ), datasetAttributes );
225- datasetAttributes .<T >getDatasetAccess ().writeRegion (posKva , min , size , dataBlocks , writeFully );
225+ final PositionValueAccess posKva = PositionValueAccess .fromKva (getKeyValueAccess (), getURI (), N5URI .normalizeGroupPath (datasetPath ), convertedDatasetAttributes );
226+ convertedDatasetAttributes .<T >getDatasetAccess ().writeRegion (posKva , min , size , dataBlocks , convertedDatasetAttributes . getDimensions () , writeFully );
226227 } catch (final UncheckedIOException e ) {
227228 throw new N5IOException (
228229 "Failed to write blocks into dataset " + datasetPath , e );
@@ -238,9 +239,10 @@ default <T> void writeRegion(
238239 final DataBlockSupplier <T > dataBlocks ,
239240 final boolean writeFully ,
240241 final ExecutorService exec ) throws N5Exception , InterruptedException , ExecutionException {
242+ DatasetAttributes convertedDatasetAttributes = getConvertedDatasetAttributes (datasetAttributes );
241243 try {
242- final PositionValueAccess posKva = PositionValueAccess .fromKva (getKeyValueAccess (), getURI (), N5URI .normalizeGroupPath (datasetPath ), datasetAttributes );
243- datasetAttributes .<T >getDatasetAccess ().writeRegion (posKva , min , size , dataBlocks , writeFully , exec );
244+ final PositionValueAccess posKva = PositionValueAccess .fromKva (getKeyValueAccess (), getURI (), N5URI .normalizeGroupPath (datasetPath ), convertedDatasetAttributes );
245+ convertedDatasetAttributes .<T >getDatasetAccess ().writeRegion (posKva , min , size , dataBlocks , convertedDatasetAttributes . getDimensions () , writeFully , exec );
244246 } catch (final UncheckedIOException e ) {
245247 throw new N5IOException (
246248 "Failed to write blocks into dataset " + datasetPath , e );
@@ -253,9 +255,10 @@ default <T> void writeBlocks(
253255 final DatasetAttributes datasetAttributes ,
254256 final DataBlock <T >... dataBlocks ) throws N5Exception {
255257
258+ DatasetAttributes convertedDatasetAttributes = getConvertedDatasetAttributes (datasetAttributes );
256259 try {
257- final PositionValueAccess posKva = PositionValueAccess .fromKva (getKeyValueAccess (), getURI (), N5URI .normalizeGroupPath (datasetPath ), datasetAttributes );
258- datasetAttributes .<T >getDatasetAccess ().writeBlocks (posKva , Arrays .asList (dataBlocks ));
260+ final PositionValueAccess posKva = PositionValueAccess .fromKva (getKeyValueAccess (), getURI (), N5URI .normalizeGroupPath (datasetPath ), convertedDatasetAttributes );
261+ convertedDatasetAttributes .<T >getDatasetAccess ().writeBlocks (posKva , Arrays .asList (dataBlocks ));
259262 } catch (final UncheckedIOException e ) {
260263 throw new N5IOException (
261264 "Failed to write blocks into dataset " + datasetPath , e );
@@ -268,9 +271,10 @@ default <T> void writeBlock(
268271 final DatasetAttributes datasetAttributes ,
269272 final DataBlock <T > dataBlock ) throws N5Exception {
270273
274+ DatasetAttributes convertedDatasetAttributes = getConvertedDatasetAttributes (datasetAttributes );
271275 try {
272- final PositionValueAccess posKva = PositionValueAccess .fromKva (getKeyValueAccess (), getURI (), N5URI .normalizeGroupPath (path ), datasetAttributes );
273- datasetAttributes .<T > getDatasetAccess ().writeBlock (posKva , dataBlock );
276+ final PositionValueAccess posKva = PositionValueAccess .fromKva (getKeyValueAccess (), getURI (), N5URI .normalizeGroupPath (path ), convertedDatasetAttributes );
277+ convertedDatasetAttributes .<T > getDatasetAccess ().writeBlock (posKva , dataBlock );
274278 } catch (final UncheckedIOException e ) {
275279 throw new N5IOException (
276280 "Failed to write block " + Arrays .toString (dataBlock .getGridPosition ()) + " into dataset " + path ,
0 commit comments