Skip to content

Commit

Permalink
Rename Resolution to Mag (#8111)
Browse files Browse the repository at this point in the history
* start to replace term resolution

* rename resolution to mag in backend where possible

* rename resolution restrictions

* rename resolution info to mag info

* rename in dataset accessor, a.o.

* rename in frontend code

* rename in docs

* rename node resolution to mag

* adjust mag slider

* fix tests

* add explaining sentences

* refresh snapshots

* improve explanation in info tab and status bar

* adapt param name

* remove application conf edits

* lint

* rename columns + table in sql, add migration

* adapt test db after schema change

* changelog

* slightly adjust changelog entry to lower expectations

* adjust docs and revert some changes

* adjust neuroglancer docs

* Update webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/volume/VolumeTracingDownsampling.scala

Co-authored-by: MichaelBuessemeyer <[email protected]>

* address review

* fix previous version in db evolution

* adjust version in schema.sql

* also adapt schema version in reversion

* adjust form names

* adjust get params for /createExplorational

* remove unused messages

---------

Co-authored-by: Florian M <[email protected]>
Co-authored-by: Florian M <[email protected]>
Co-authored-by: MichaelBuessemeyer <[email protected]>
Co-authored-by: Tom Herold <[email protected]>
  • Loading branch information
5 people authored Oct 21, 2024
1 parent 934bb6a commit 60f77ac
Show file tree
Hide file tree
Showing 140 changed files with 1,308 additions and 1,373 deletions.
22 changes: 0 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,25 +211,3 @@ workflows:
filters:
tags:
only: /.*/
circleci_nightly:
jobs:
- nightly
triggers:
- schedule:
# 02:15 AM UTC
cron: "15 2 * * *"
filters:
branches:
only:
- master
circleci_wkorg_nightly:
jobs:
- wkorg_nightly
triggers:
- schedule:
# 03:15 AM UTC
cron: "15 3 * * *"
filters:
branches:
only:
- master
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Most sliders have been improved: Wheeling above a slider now changes its value and double-clicking its knob resets it to its default value. [#8095](https://github.com/scalableminds/webknossos/pull/8095)
- It is now possible to search for unnamed segments with the full default name instead of only their id. [#8133](https://github.com/scalableminds/webknossos/pull/8133)
- Increased loading speed for precomputed meshes. [#8110](https://github.com/scalableminds/webknossos/pull/8110)
- Unified wording in UI and code: “Magnification”/“mag” is now used in place of “Resolution“ most of the time, compare [https://docs.webknossos.org/webknossos/terminology.html](terminology document). [#8111](https://github.com/scalableminds/webknossos/pull/8111)

### Changed
- Some mesh-related actions were disabled in proofreading-mode when using meshfiles that were created for a mapping rather than an oversegmentation. [#8091](https://github.com/scalableminds/webknossos/pull/8091)
Expand Down
1 change: 1 addition & 0 deletions MIGRATIONS.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ User-facing changes are documented in the [changelog](CHANGELOG.released.md).
### Postgres Evolutions:

- [121-worker-name.sql](conf/evolutions/121-worker-name.sql)
- [122-resolution-to-mag.sql](conf/evolutions/122-resolution-to-mag.sql)
4 changes: 2 additions & 2 deletions app/controllers/AnnotationController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.scalableminds.webknossos.datastore.models.annotation.{
}
import com.scalableminds.webknossos.datastore.models.datasource.AdditionalAxis
import com.scalableminds.webknossos.datastore.rpc.RPC
import com.scalableminds.webknossos.tracingstore.tracings.volume.ResolutionRestrictions
import com.scalableminds.webknossos.tracingstore.tracings.volume.MagRestrictions
import com.scalableminds.webknossos.tracingstore.tracings.{TracingIds, TracingType}
import mail.{MailchimpClient, MailchimpTag}
import models.analytics.{AnalyticsService, CreateAnnotationEvent, OpenAnnotationEvent}
Expand Down Expand Up @@ -44,7 +44,7 @@ case class AnnotationLayerParameters(typ: AnnotationLayerType,
fallbackLayerName: Option[String],
autoFallbackLayer: Boolean = false,
mappingName: Option[String] = None,
resolutionRestrictions: Option[ResolutionRestrictions],
magRestrictions: Option[MagRestrictions],
name: Option[String],
additionalAxes: Option[Seq[AdditionalAxis]])
object AnnotationLayerParameters {
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/AnnotationIOController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ class AnnotationIOController @Inject()(
largestSegmentId =
annotationService.combineLargestSegmentIdsByPrecedence(volumeTracing.largestSegmentId,
fallbackLayerOpt.map(_.largestSegmentId)),
resolutions = VolumeTracingDownsampling.magsForVolumeTracing(dataSource, fallbackLayerOpt).map(vec3IntToProto),
mags = VolumeTracingDownsampling.magsForVolumeTracing(dataSource, fallbackLayerOpt).map(vec3IntToProto),
hasSegmentIndex = Some(tracingCanHaveSegmentIndex)
)
}
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/LegacyApiController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import play.silhouette.api.actions.SecuredRequest
import com.scalableminds.util.tools.Fox
import com.scalableminds.webknossos.datastore.models.VoxelSize
import com.scalableminds.webknossos.datastore.models.annotation.{AnnotationLayer, AnnotationLayerType}
import com.scalableminds.webknossos.tracingstore.tracings.volume.ResolutionRestrictions
import com.scalableminds.webknossos.tracingstore.tracings.volume.MagRestrictions
import models.dataset.DatasetService
import models.organization.OrganizationDAO

Expand All @@ -24,7 +24,7 @@ import scala.concurrent.ExecutionContext

case class LegacyCreateExplorationalParameters(typ: String,
fallbackLayerName: Option[String],
resolutionRestrictions: Option[ResolutionRestrictions])
resolutionRestrictions: Option[MagRestrictions])
object LegacyCreateExplorationalParameters {
implicit val jsonFormat: OFormat[LegacyCreateExplorationalParameters] =
Json.format[LegacyCreateExplorationalParameters]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/TaskTypeController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class TaskTypeController @Inject()(taskTypeDAO: TaskTypeDAO,
taskTypeIdValidated <- ObjectId.fromString(taskTypeId) ?~> "taskType.id.invalid"
taskType <- taskTypeDAO.findOne(taskTypeIdValidated) ?~> "taskType.notFound" ~> NOT_FOUND
_ <- bool2Fox(taskTypeFromForm.tracingType == taskType.tracingType) ?~> "taskType.tracingTypeImmutable"
_ <- bool2Fox(taskTypeFromForm.settings.resolutionRestrictions == taskType.settings.resolutionRestrictions) ?~> "taskType.resolutionRestrictionsImmutable"
_ <- bool2Fox(taskTypeFromForm.settings.magRestrictions == taskType.settings.magRestrictions) ?~> "taskType.magRestrictionsImmutable"
updatedTaskType = taskTypeFromForm.copy(_id = taskType._id)
_ <- Fox.assertTrue(userService.isTeamManagerOrAdminOf(request.identity, taskType._team)) ?~> "notAllowed" ~> FORBIDDEN
_ <- Fox
Expand Down
35 changes: 17 additions & 18 deletions app/models/annotation/AnnotationService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import com.scalableminds.webknossos.datastore.rpc.RPC
import com.scalableminds.webknossos.tracingstore.tracings._
import com.scalableminds.webknossos.tracingstore.tracings.volume.VolumeDataZipFormat.VolumeDataZipFormat
import com.scalableminds.webknossos.tracingstore.tracings.volume.{
ResolutionRestrictions,
MagRestrictions,
VolumeDataZipFormat,
VolumeTracingDefaults,
VolumeTracingDownsampling
Expand Down Expand Up @@ -144,15 +144,15 @@ class AnnotationService @Inject()(
boundingBox: Option[BoundingBox] = None,
startPosition: Option[Vec3Int] = None,
startRotation: Option[Vec3Double] = None,
resolutionRestrictions: ResolutionRestrictions,
magRestrictions: MagRestrictions,
mappingName: Option[String]
): Fox[VolumeTracing] = {
val resolutions = VolumeTracingDownsampling.magsForVolumeTracing(dataSource, fallbackLayer)
val resolutionsRestricted = resolutionRestrictions.filterAllowed(resolutions)
val mags = VolumeTracingDownsampling.magsForVolumeTracing(dataSource, fallbackLayer)
val magsRestricted = magRestrictions.filterAllowed(mags)
val additionalAxes =
fallbackLayer.map(_.additionalAxes).getOrElse(dataSource.additionalAxesUnion)
for {
_ <- bool2Fox(resolutionsRestricted.nonEmpty) ?~> "annotation.volume.resolutionRestrictionsTooTight"
_ <- bool2Fox(magsRestricted.nonEmpty) ?~> "annotation.volume.magRestrictionsTooTight"
remoteDatastoreClient = new WKRemoteDataStoreClient(datasetDataStore, rpc)
fallbackLayerHasSegmentIndex <- fallbackLayer match {
case Some(layer) =>
Expand All @@ -175,7 +175,7 @@ class AnnotationService @Inject()(
VolumeTracingDefaults.zoomLevel,
organizationId = Some(datasetOrganizationId),
mappingName = mappingName,
resolutions = resolutionsRestricted.map(vec3IntToProto),
mags = magsRestricted.map(vec3IntToProto),
hasSegmentIndex = Some(fallbackLayer.isEmpty || fallbackLayerHasSegmentIndex),
additionalAxes = AdditionalAxis.toProto(additionalAxes)
)
Expand Down Expand Up @@ -286,8 +286,7 @@ class AnnotationService @Inject()(
datasetOrganizationId,
dataStore,
fallbackLayer,
resolutionRestrictions =
annotationLayerParameters.resolutionRestrictions.getOrElse(ResolutionRestrictions.empty),
magRestrictions = annotationLayerParameters.magRestrictions.getOrElse(MagRestrictions.empty),
mappingName = annotationLayerParameters.mappingName
)
volumeTracingAdapted = oldPrecedenceLayerProperties.map { p =>
Expand Down Expand Up @@ -417,7 +416,7 @@ class AnnotationService @Inject()(
usedFallbackLayerName,
autoFallbackLayer = false,
None,
Some(ResolutionRestrictions.empty),
Some(MagRestrictions.empty),
Some(AnnotationLayer.defaultNameForType(newAnnotationLayerType)),
None
)
Expand Down Expand Up @@ -551,14 +550,14 @@ class AnnotationService @Inject()(
)
}

def createVolumeTracingBase(datasetName: String,
organizationId: String,
boundingBox: Option[BoundingBox],
startPosition: Vec3Int,
startRotation: Vec3Double,
volumeShowFallbackLayer: Boolean,
resolutionRestrictions: ResolutionRestrictions)(implicit ctx: DBAccessContext,
m: MessagesProvider): Fox[VolumeTracing] =
def createVolumeTracingBase(
datasetName: String,
organizationId: String,
boundingBox: Option[BoundingBox],
startPosition: Vec3Int,
startRotation: Vec3Double,
volumeShowFallbackLayer: Boolean,
magRestrictions: MagRestrictions)(implicit ctx: DBAccessContext, m: MessagesProvider): Fox[VolumeTracing] =
for {
organization <- organizationDAO.findOne(organizationId)
dataset <- datasetDAO.findOneByNameAndOrganization(datasetName, organizationId) ?~> Messages("dataset.notFound",
Expand All @@ -583,7 +582,7 @@ class AnnotationService @Inject()(
},
startPosition = Some(startPosition),
startRotation = Some(startRotation),
resolutionRestrictions = resolutionRestrictions,
magRestrictions = magRestrictions,
mappingName = None
)
} yield volumeTracing
Expand Down
4 changes: 2 additions & 2 deletions app/models/annotation/AnnotationSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package models.annotation
import com.scalableminds.util.enumeration.ExtendedEnumeration
import com.scalableminds.webknossos.tracingstore.tracings.TracingType
import com.scalableminds.webknossos.tracingstore.tracings.TracingType.TracingType
import com.scalableminds.webknossos.tracingstore.tracings.volume.ResolutionRestrictions
import com.scalableminds.webknossos.tracingstore.tracings.volume.MagRestrictions
import play.api.libs.json._

object TracingMode extends ExtendedEnumeration {
Expand All @@ -18,7 +18,7 @@ case class AnnotationSettings(
somaClickingAllowed: Boolean = true,
volumeInterpolationAllowed: Boolean = true,
mergerMode: Boolean = false,
resolutionRestrictions: ResolutionRestrictions = ResolutionRestrictions.empty
magRestrictions: MagRestrictions = MagRestrictions.empty
)

object AnnotationSettings {
Expand Down
14 changes: 7 additions & 7 deletions app/models/annotation/WKRemoteTracingStoreClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.scalableminds.webknossos.datastore.models.annotation.{
import com.scalableminds.webknossos.datastore.models.datasource.DataSourceLike
import com.scalableminds.webknossos.datastore.rpc.RPC
import com.scalableminds.webknossos.tracingstore.tracings.TracingSelector
import com.scalableminds.webknossos.tracingstore.tracings.volume.ResolutionRestrictions
import com.scalableminds.webknossos.tracingstore.tracings.volume.MagRestrictions
import com.scalableminds.webknossos.tracingstore.tracings.volume.VolumeDataZipFormat.VolumeDataZipFormat
import com.typesafe.scalalogging.LazyLogging
import controllers.RpcTokenHolder
Expand Down Expand Up @@ -100,7 +100,7 @@ class WKRemoteTracingStoreClient(
def duplicateVolumeTracing(volumeTracingId: String,
isFromTask: Boolean = false,
datasetBoundingBox: Option[BoundingBox] = None,
resolutionRestrictions: ResolutionRestrictions = ResolutionRestrictions.empty,
magRestrictions: MagRestrictions = MagRestrictions.empty,
downsample: Boolean = false,
editPosition: Option[Vec3Int] = None,
editRotation: Option[Vec3Double] = None,
Expand All @@ -109,8 +109,8 @@ class WKRemoteTracingStoreClient(
rpc(s"${tracingStore.url}/tracings/volume/$volumeTracingId/duplicate").withLongTimeout
.addQueryString("token" -> RpcTokenHolder.webknossosToken)
.addQueryString("fromTask" -> isFromTask.toString)
.addQueryStringOptional("minResolution", resolutionRestrictions.minStr)
.addQueryStringOptional("maxResolution", resolutionRestrictions.maxStr)
.addQueryStringOptional("minMag", magRestrictions.minStr)
.addQueryStringOptional("maxMag", magRestrictions.maxStr)
.addQueryStringOptional("editPosition", editPosition.map(_.toUriLiteral))
.addQueryStringOptional("editRotation", editRotation.map(_.toUriLiteral))
.addQueryStringOptional("boundingBox", boundingBox.map(_.toLiteral))
Expand Down Expand Up @@ -173,7 +173,7 @@ class WKRemoteTracingStoreClient(

def saveVolumeTracing(tracing: VolumeTracing,
initialData: Option[File] = None,
resolutionRestrictions: ResolutionRestrictions = ResolutionRestrictions.empty,
magRestrictions: MagRestrictions = MagRestrictions.empty,
dataSource: Option[DataSourceLike] = None): Fox[String] = {
logger.debug("Called to create VolumeTracing." + baseInfo)
for {
Expand All @@ -185,8 +185,8 @@ class WKRemoteTracingStoreClient(
case Some(file) =>
rpc(s"${tracingStore.url}/tracings/volume/$tracingId/initialData").withLongTimeout
.addQueryString("token" -> RpcTokenHolder.webknossosToken)
.addQueryStringOptional("minResolution", resolutionRestrictions.minStr)
.addQueryStringOptional("maxResolution", resolutionRestrictions.maxStr)
.addQueryStringOptional("minMag", magRestrictions.minStr)
.addQueryStringOptional("maxMag", magRestrictions.maxStr)
.post(file)
case _ =>
Fox.successful(())
Expand Down
19 changes: 5 additions & 14 deletions app/models/annotation/nml/NmlParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object NmlParser extends LazyLogging with ProtoGeometryImplicits with ColorGener

private val DEFAULT_TIME = 0L
private val DEFAULT_VIEWPORT = 0
private val DEFAULT_RESOLUTION = 0
private val DEFAULT_MAG = 0
private val DEFAULT_BITDEPTH = 0
private val DEFAULT_DESCRIPTION = ""
private val DEFAULT_INTERPOLATION = false
Expand Down Expand Up @@ -519,8 +519,8 @@ object NmlParser extends LazyLogging with ProtoGeometryImplicits with ColorGener
private def parseViewport(node: XMLNode) =
getSingleAttribute(node, "inVp").toIntOpt.getOrElse(DEFAULT_VIEWPORT)

private def parseResolution(node: XMLNode) =
getSingleAttribute(node, "inMag").toIntOpt.getOrElse(DEFAULT_RESOLUTION)
private def parseMag(node: XMLNode) =
getSingleAttribute(node, "inMag").toIntOpt.getOrElse(DEFAULT_MAG)

private def parseBitDepth(node: XMLNode) =
getSingleAttribute(node, "bitDepth").toIntOpt.getOrElse(DEFAULT_BITDEPTH)
Expand All @@ -540,21 +540,12 @@ object NmlParser extends LazyLogging with ProtoGeometryImplicits with ColorGener
position <- parseVec3Int(node) ?~ Messages("nml.node.attribute.invalid", "position", id)
} yield {
val viewport = parseViewport(node)
val resolution = parseResolution(node)
val mag = parseMag(node)
val timestamp = parseTimestamp(node)
val bitDepth = parseBitDepth(node)
val interpolation = parseInterpolation(node)
val rotation = parseRotationForNode(node).getOrElse(NodeDefaults.rotation)
Node(id,
position,
rotation,
radius,
viewport,
resolution,
bitDepth,
interpolation,
timestamp,
additionalCoordinates)
Node(id, position, rotation, radius, viewport, mag, bitDepth, interpolation, timestamp, additionalCoordinates)
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/models/annotation/nml/NmlWriter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class NmlWriter @Inject()(implicit ec: ExecutionContext) extends FoxImplicits {
writer.writeAttribute("rotY", n.rotation.y.toString)
writer.writeAttribute("rotZ", n.rotation.z.toString)
writer.writeAttribute("inVp", n.viewport.toString)
writer.writeAttribute("inMag", n.resolution.toString)
writer.writeAttribute("inMag", n.mag.toString)
writer.writeAttribute("bitDepth", n.bitDepth.toString)
writer.writeAttribute("interpolation", n.interpolation.toString)
writer.writeAttribute("time", n.createdTimestamp.toString)
Expand Down
Loading

0 comments on commit 60f77ac

Please sign in to comment.