From c36ba0f4fc3c0b4ef61040b00637d5ac9534c0c3 Mon Sep 17 00:00:00 2001 From: Florian M Date: Thu, 25 Aug 2022 13:58:26 +0200 Subject: [PATCH] Small Zarr Fixes (#6422) --- .../webknossos/datastore/jzarr/BytesConverter.scala | 6 +++--- .../webknossos/datastore/jzarr/ZarrHeader.scala | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/webknossos-datastore/app/com/scalableminds/webknossos/datastore/jzarr/BytesConverter.scala b/webknossos-datastore/app/com/scalableminds/webknossos/datastore/jzarr/BytesConverter.scala index c0b3d229948..fa93de7f37c 100644 --- a/webknossos-datastore/app/com/scalableminds/webknossos/datastore/jzarr/BytesConverter.scala +++ b/webknossos-datastore/app/com/scalableminds/webknossos/datastore/jzarr/BytesConverter.scala @@ -38,17 +38,17 @@ object BytesConverter { case ZarrDataType.i8 | ZarrDataType.u8 => val arrayTyped = array.asInstanceOf[Array[Long]] val byteBuffer = makeByteBuffer(arrayTyped.length * bytesPerElement, byteOrder) - byteBuffer.asLongBuffer().put(arrayTyped).array() + byteBuffer.asLongBuffer().put(arrayTyped) byteBuffer.array() case ZarrDataType.f4 => val arrayTyped = array.asInstanceOf[Array[Float]] val byteBuffer = makeByteBuffer(arrayTyped.length * bytesPerElement, byteOrder) - byteBuffer.asFloatBuffer().put(arrayTyped).array() + byteBuffer.asFloatBuffer().put(arrayTyped) byteBuffer.array() case ZarrDataType.f8 => val arrayTyped = array.asInstanceOf[Array[Double]] val byteBuffer = makeByteBuffer(arrayTyped.length * bytesPerElement, byteOrder) - byteBuffer.asDoubleBuffer().put(arrayTyped).array() + byteBuffer.asDoubleBuffer().put(arrayTyped) byteBuffer.array() } } diff --git a/webknossos-datastore/app/com/scalableminds/webknossos/datastore/jzarr/ZarrHeader.scala b/webknossos-datastore/app/com/scalableminds/webknossos/datastore/jzarr/ZarrHeader.scala index bf19fc0c0c6..c0422e1e631 100644 --- a/webknossos-datastore/app/com/scalableminds/webknossos/datastore/jzarr/ZarrHeader.scala +++ b/webknossos-datastore/app/com/scalableminds/webknossos/datastore/jzarr/ZarrHeader.scala @@ -9,6 +9,7 @@ import com.scalableminds.webknossos.datastore.jzarr.DimensionSeparator.Dimension import com.scalableminds.webknossos.datastore.jzarr.ZarrDataType.ZarrDataType import com.scalableminds.webknossos.datastore.models.datasource.{DataLayer, ElementClass} import net.liftweb.common.Box.tryo +import play.api.libs.json.Json.WithDefaultValues import play.api.libs.json._ case class ZarrHeader( @@ -133,7 +134,7 @@ object ZarrHeader { implicit object ZarrHeaderFormat extends Format[ZarrHeader] { override def reads(json: JsValue): JsResult[ZarrHeader] = - Json.reads[ZarrHeader].reads(json) + Json.using[WithDefaultValues].reads[ZarrHeader].reads(json) override def writes(zarrHeader: ZarrHeader): JsValue = Json.obj(