Skip to content

Commit

Permalink
Small Zarr Fixes (#6422)
Browse files Browse the repository at this point in the history
  • Loading branch information
fm3 authored Aug 25, 2022
1 parent 862da65 commit c36ba0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit c36ba0f

Please sign in to comment.