Skip to content

Commit 14f5b9b

Browse files
authored
Enable custom path + credentialID for WKW mags as well (#8725)
The `wkwResolutions` entries in `datasource-properties.json`s can now also contain custom `path` and `credentialId`, much like with the `mags` entries for zarr,zarr3,n5,neuroP. ### Steps to test: - Move a mag directory of a WKW dataset away from its standard location - Edit the json, specifying the `path`. - Reload the dataset in wk. Data should be visible - Change the path again to where the data is not - Reload again, data should no longer be visible - Data in the standard location `layerName/magLiteral` e.g. `color/2-2-1` should still be shown even if no path is supplied. ### Issues: - fixes https://scm.slack.com/archives/C5AKLAV0B/p1751030574372869 ------ - [x] Added changelog entry (create a `$PR_NUMBER.md` file in `unreleased_changes` or use `./tools/create-changelog-entry.py`) - [x] Considered [common edge cases](../blob/master/.github/common_edge_cases.md) - [x] Needs datastore update after deployment
1 parent 96b7158 commit 14f5b9b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

unreleased_changes/8725.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
### Added
2+
- WKW datasets can now also have custom paths in their datasource-properties.json.

webknossos-datastore/app/com/scalableminds/webknossos/datastore/dataformats/layers/WKWDataLayers.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import com.scalableminds.webknossos.datastore.storage.RemoteSourceDescriptorServ
99
import play.api.libs.json.{Json, OFormat}
1010
import ucar.ma2.{Array => MultiArray}
1111

12-
case class WKWResolution(resolution: Vec3Int, cubeLength: Int)
12+
case class WKWResolution(resolution: Vec3Int,
13+
cubeLength: Int,
14+
path: Option[String] = None,
15+
credentialId: Option[String] = None) {
16+
def toMagLocator: MagLocator =
17+
MagLocator(mag = resolution, path = path, credentialId = credentialId)
18+
}
1319

1420
object WKWResolution extends MagFormatHelper {
1521
implicit val jsonFormat: OFormat[WKWResolution] = Json.format[WKWResolution]
@@ -26,7 +32,7 @@ trait WKWLayer extends DataLayer {
2632

2733
def wkwResolutions: List[WKWResolution]
2834

29-
def mags: List[MagLocator] = wkwResolutions.map(wkwResolution => MagLocator(wkwResolution.resolution))
35+
def mags: List[MagLocator] = wkwResolutions.map(_.toMagLocator)
3036

3137
def resolutions: List[Vec3Int] = wkwResolutions.map(_.resolution)
3238

0 commit comments

Comments
 (0)