Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small Zarr Fixes #6422

Merged
merged 2 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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