Skip to content

Commit

Permalink
Remove resolution parameter from requestRawCuboid (#6479)
Browse files Browse the repository at this point in the history
  • Loading branch information
frcroth authored Sep 20, 2022
1 parent 7eeb7f9 commit 6bf7c18
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6bf7c18

Please sign in to comment.