<commit_before>package com.scalableminds.webknossos.datastore.jzarr;

import com.scalableminds.util.geometry.{Vec3Double, Vec3Int}
import play.api.libs.json.{Json, OFormat}

case class OmeNgffCoordinateTransformation(`type`: String = "scale", scale: List[Double])

object OmeNgffCoordinateTransformation {
  implicit val jsonFormat: OFormat[OmeNgffCoordinateTransformation] = Json.format[OmeNgffCoordinateTransformation]
}

case class OmeNgffDataset(path: String, coordinateTranformations: List[OmeNgffCoordinateTransformation])

object OmeNgffDataset {
  implicit val jsonFormat: OFormat[OmeNgffDataset] = Json.format[OmeNgffDataset]
}

case class OmeNgffAxis(name: String, `type`: String, unit: Option[String] = None)

object OmeNgffAxis {
  implicit val jsonFormat: OFormat[OmeNgffAxis] = Json.format[OmeNgffAxis]
}

case class OmeNgffOneHeader(
    version: String = "0.4", // format version number
    name: String,
    axes: List[OmeNgffAxis] = List(
      OmeNgffAxis(name = "c", `type` = "channel"),
      OmeNgffAxis(name = "x", `type` = "space", unit = Some("nanometer")),
      OmeNgffAxis(name = "y", `type` = "space", unit = Some("nanometer")),
      OmeNgffAxis(name = "z", `type` = "space", unit = Some("nanometer")),
    ),
    datasets: List[OmeNgffDataset]
)

object OmeNgffOneHeader {
  implicit val jsonFormat: OFormat[OmeNgffOneHeader] = Json.format[OmeNgffOneHeader]
}

case class OmeNgffHeader(multiscales: List[OmeNgffOneHeader])

object OmeNgffHeader {
  def fromDataLayerName(dataLayerName: String, dataSourceScale: Vec3Double, mags: List[Vec3Int]): OmeNgffHeader = {
    val datasets = mags.map(
      mag =>
        OmeNgffDataset(
          path = mag.toMagLiteral(allowScalar = true),
          List(
            OmeNgffCoordinateTransformation(scale = List[Double](1.0) ++ (dataSourceScale * Vec3Double(mag)).toList))))
    OmeNgffHeader(multiscales = List(OmeNgffOneHeader(name = dataLayerName, datasets = datasets)))
  }

  implicit val jsonFormat: OFormat[OmeNgffHeader] = Json.format[OmeNgffHeader]
}
<commit_msg>fix typo in omengff header (#6244)<commit_after>package com.scalableminds.webknossos.datastore.jzarr;

import com.scalableminds.util.geometry.{Vec3Double, Vec3Int}
import play.api.libs.json.{Json, OFormat}

case class OmeNgffCoordinateTransformation(`type`: String = "scale", scale: List[Double])

object OmeNgffCoordinateTransformation {
  implicit val jsonFormat: OFormat[OmeNgffCoordinateTransformation] = Json.format[OmeNgffCoordinateTransformation]
}

case class OmeNgffDataset(path: String, coordinateTransformations: List[OmeNgffCoordinateTransformation])

object OmeNgffDataset {
  implicit val jsonFormat: OFormat[OmeNgffDataset] = Json.format[OmeNgffDataset]
}

case class OmeNgffAxis(name: String, `type`: String, unit: Option[String] = None)

object OmeNgffAxis {
  implicit val jsonFormat: OFormat[OmeNgffAxis] = Json.format[OmeNgffAxis]
}

case class OmeNgffOneHeader(
    version: String = "0.4", // format version number
    name: String,
    axes: List[OmeNgffAxis] = List(
      OmeNgffAxis(name = "c", `type` = "channel"),
      OmeNgffAxis(name = "x", `type` = "space", unit = Some("nanometer")),
      OmeNgffAxis(name = "y", `type` = "space", unit = Some("nanometer")),
      OmeNgffAxis(name = "z", `type` = "space", unit = Some("nanometer")),
    ),
    datasets: List[OmeNgffDataset]
)

object OmeNgffOneHeader {
  implicit val jsonFormat: OFormat[OmeNgffOneHeader] = Json.format[OmeNgffOneHeader]
}

case class OmeNgffHeader(multiscales: List[OmeNgffOneHeader])

object OmeNgffHeader {
  def fromDataLayerName(dataLayerName: String, dataSourceScale: Vec3Double, mags: List[Vec3Int]): OmeNgffHeader = {
    val datasets = mags.map(
      mag =>
        OmeNgffDataset(
          path = mag.toMagLiteral(allowScalar = true),
          List(
            OmeNgffCoordinateTransformation(scale = List[Double](1.0) ++ (dataSourceScale * Vec3Double(mag)).toList))))
    OmeNgffHeader(multiscales = List(OmeNgffOneHeader(name = dataLayerName, datasets = datasets)))
  }

  implicit val jsonFormat: OFormat[OmeNgffHeader] = Json.format[OmeNgffHeader]
}

{'fraction_non_alphanumeric': 0.12020398251578436, 'fraction_numerical': 0.005342399222923749, 'mean_word_length': 5.240909090909091, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2020426', 'n_tokens_mistral': 1487, 'n_tokens_neox': 1505, 'n_words': 271}