From 6bf7c183efbc6f8b1c12dac9a42f71ed20107cc6 Mon Sep 17 00:00:00 2001 From: frcroth Date: Tue, 20 Sep 2022 16:29:13 +0200 Subject: [PATCH] Remove resolution parameter from requestRawCuboid (#6479) --- CHANGELOG.unreleased.md | 1 + .../datastore/controllers/BinaryDataController.scala | 8 ++------ .../datastore/models/datasource/DataLayer.scala | 7 ------- .../conf/com.scalableminds.webknossos.datastore.routes | 2 +- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 4cad9fa8b08..4a749fbe116 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -19,6 +19,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released ### Changed - Sharing links are shortened by default. Within the sharing modal, this shortening behavior can be disabled. [#6461](https://github.com/scalableminds/webknossos/pull/6461) +- Removed optional "resolution" parameter from /datasets/:organizationName/:dataSetName/layers/:dataLayerName/data route. Use mag instead. [#6479](https://github.com/scalableminds/webknossos/pull/6479) ### Fixed - Fixed sharing button for users who are currently visiting a dataset or annotation which was shared with them. [#6438](https://github.com/scalableminds/webknossos/pull/6438) diff --git a/webknossos-datastore/app/com/scalableminds/webknossos/datastore/controllers/BinaryDataController.scala b/webknossos-datastore/app/com/scalableminds/webknossos/datastore/controllers/BinaryDataController.scala index 006b8c19809..910a782a363 100644 --- a/webknossos-datastore/app/com/scalableminds/webknossos/datastore/controllers/BinaryDataController.scala +++ b/webknossos-datastore/app/com/scalableminds/webknossos/datastore/controllers/BinaryDataController.scala @@ -104,8 +104,7 @@ class BinaryDataController @Inject()( @ApiParam(value = "Target-mag width of the bounding box", required = true) width: Int, @ApiParam(value = "Target-mag height of the bounding box", required = true) height: Int, @ApiParam(value = "Target-mag depth of the bounding box", required = true) depth: Int, - @ApiParam(value = "Mag in three-component format (e.g. 1-1-1 or 16-16-8)", required = true) mag: Option[String], - resolution: Option[Int], + @ApiParam(value = "Mag in three-component format (e.g. 1-1-1 or 16-16-8)", required = true) mag: String, @ApiParam(value = "If true, use lossy compression by sending only half-bytes of the data") halfByte: Boolean, @ApiParam(value = "If set, apply set mapping name") mappingName: Option[String] ): Action[AnyContent] = Action.async { implicit request => @@ -115,10 +114,7 @@ class BinaryDataController @Inject()( (dataSource, dataLayer) <- dataSourceRepository.getDataSourceAndDataLayer(organizationName, dataSetName, dataLayerName) ~> NOT_FOUND - _ <- bool2Fox(!(resolution.isDefined && mag.isDefined)) ?~> "Can only interpret mag or zoomStep. Use only mag instead." - magFromZoomStep = resolution.map(dataLayer.magFromExponent(_, snapToClosest = true)) - magParsedOpt <- Fox.runOptional(mag)(Vec3Int.fromMagLiteral(_).toFox) - magParsed <- magParsedOpt.orElse(magFromZoomStep).toFox ?~> "No mag supplied" + magParsed <- Vec3Int.fromMagLiteral(mag).toFox request = DataRequest( VoxelPosition(x, y, z, magParsed), width, diff --git a/webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala b/webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala index 30a30f4324b..f35823d9d9d 100644 --- a/webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala +++ b/webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala @@ -111,13 +111,6 @@ trait DataLayerLike { def resolutions: List[Vec3Int] - def magFromExponent(resolutionExponent: Int, snapToClosest: Boolean = false): Vec3Int = { - val resPower = Math.pow(2, resolutionExponent).toInt - val matchOpt = resolutions.find(resolution => resolution.maxDim == resPower) - if (snapToClosest) matchOpt.getOrElse(resolutions.minBy(resolution => math.abs(resPower - resolution.maxDim))) - else matchOpt.getOrElse(Vec3Int(resPower, resPower, resPower)) - } - def elementClass: ElementClass.Value // This is the default from the DataSource JSON. diff --git a/webknossos-datastore/conf/com.scalableminds.webknossos.datastore.routes b/webknossos-datastore/conf/com.scalableminds.webknossos.datastore.routes index 07f126f2189..4848e40ac6f 100644 --- a/webknossos-datastore/conf/com.scalableminds.webknossos.datastore.routes +++ b/webknossos-datastore/conf/com.scalableminds.webknossos.datastore.routes @@ -6,7 +6,7 @@ GET /health # Read image data POST /datasets/:organizationName/:dataSetName/layers/:dataLayerName/data @com.scalableminds.webknossos.datastore.controllers.BinaryDataController.requestViaWebKnossos(token: Option[String], organizationName: String, dataSetName: String, dataLayerName: String) -GET /datasets/:organizationName/:dataSetName/layers/:dataLayerName/data @com.scalableminds.webknossos.datastore.controllers.BinaryDataController.requestRawCuboid(token: Option[String], organizationName: String, dataSetName: String, dataLayerName: String, x: Int, y: Int, z: Int, width: Int, height: Int, depth: Int, mag: Option[String], resolution: Option[Int], halfByte: Boolean ?= false, mappingName: Option[String]) +GET /datasets/:organizationName/:dataSetName/layers/:dataLayerName/data @com.scalableminds.webknossos.datastore.controllers.BinaryDataController.requestRawCuboid(token: Option[String], organizationName: String, dataSetName: String, dataLayerName: String, x: Int, y: Int, z: Int, width: Int, height: Int, depth: Int, mag: String, halfByte: Boolean ?= false, mappingName: Option[String]) GET /datasets/:organizationName/:dataSetName/layers/:dataLayerName/thumbnail.jpg @com.scalableminds.webknossos.datastore.controllers.BinaryDataController.thumbnailJpeg(token: Option[String], organizationName: String, dataSetName: String, dataLayerName: String, width: Int, height: Int, centerX: Option[Int], centerY: Option[Int], centerZ: Option[Int], zoom: Option[Double]) GET /datasets/:organizationName/:dataSetName/layers/:dataLayerName/findData @com.scalableminds.webknossos.datastore.controllers.BinaryDataController.findData(token: Option[String], organizationName: String, dataSetName: String, dataLayerName: String) GET /datasets/:organizationName/:dataSetName/layers/:dataLayerName/colorStatistics @com.scalableminds.webknossos.datastore.controllers.BinaryDataController.colorStatistics(token: Option[String], organizationName: String, dataSetName: String, dataLayerName: String)