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

Remove resolution parameter from requestRawCuboid #6479

Merged
merged 6 commits into from
Sep 20, 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
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