Skip to content

Commit 1cec124

Browse files
committed
in backend, make agglomerateIds and mag optional in proofreading update actions
1 parent aaeebf0 commit 1cec124

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingService.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,18 @@ class EditableMappingService @Inject()(
185185
def findSegmentIdAtPositionIfNeeded(remoteFallbackLayer: RemoteFallbackLayer,
186186
positionOpt: Option[Vec3Int],
187187
segmentIdOpt: Option[Long],
188-
mag: Vec3Int)(implicit tc: TokenContext): Fox[Long] =
188+
magOpt: Option[Vec3Int])(implicit tc: TokenContext): Fox[Long] =
189189
segmentIdOpt match {
190190
case Some(segmentId) => Fox.successful(segmentId)
191-
case None => findSegmentIdAtPosition(remoteFallbackLayer, positionOpt, mag)
191+
case None => findSegmentIdAtPosition(remoteFallbackLayer, positionOpt, magOpt)
192192
}
193193

194194
private def findSegmentIdAtPosition(remoteFallbackLayer: RemoteFallbackLayer,
195195
positionOpt: Option[Vec3Int],
196-
mag: Vec3Int)(implicit tc: TokenContext): Fox[Long] =
196+
magOpt: Option[Vec3Int])(implicit tc: TokenContext): Fox[Long] =
197197
for {
198198
pos <- positionOpt.toFox ?~> "segment id or position is required in editable mapping action"
199+
mag <- magOpt.toFox ?~> "segment id or mag is required in editable mapping action"
199200
voxelAsBytes: Array[Byte] <- remoteDatastoreClient.getVoxelAtPosition(remoteFallbackLayer, pos, mag)
200201
voxelAsLongArray: Array[Long] <- bytesToLongs(voxelAsBytes, remoteFallbackLayer.elementClass)
201202
_ <- Fox.fromBool(voxelAsLongArray.length == 1) ?~> s"Expected one, got ${voxelAsLongArray.length} segment id values for voxel."

webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingUpdateActions.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ trait EditableMappingUpdateAction extends LayerUpdateAction {
1111

1212
// we switched from positions to segment ids in https://github.com/scalableminds/webknossos/pull/7742.
1313
// Both are now optional to support applying old update actions stored in the db.
14-
case class SplitAgglomerateUpdateAction(agglomerateId: Long, // Unused, we now look this up by position/segment
14+
case class SplitAgglomerateUpdateAction(agglomerateId: Option[Long], // Unused, we now look this up by position/segment
1515
segmentPosition1: Option[Vec3Int],
1616
segmentPosition2: Option[Vec3Int],
1717
segmentId1: Option[Long],
1818
segmentId2: Option[Long],
19-
mag: Vec3Int,
19+
mag: Option[Vec3Int],
2020
actionTracingId: String,
2121
actionTimestamp: Option[Long] = None,
2222
actionAuthorId: Option[ObjectId] = None,
@@ -36,13 +36,13 @@ object SplitAgglomerateUpdateAction {
3636

3737
// we switched from positions to segment ids in https://github.com/scalableminds/webknossos/pull/7742.
3838
// Both are now optional to support applying old update actions stored in the db.
39-
case class MergeAgglomerateUpdateAction(agglomerateId1: Long, // Unused, we now look this up by position/segment
40-
agglomerateId2: Long, // Unused, we now look this up by position/segment
39+
case class MergeAgglomerateUpdateAction(agglomerateId1: Option[Long], // Unused, we now look this up by position/segment
40+
agglomerateId2: Option[Long], // Unused, we now look this up by position/segment
4141
segmentPosition1: Option[Vec3Int],
4242
segmentPosition2: Option[Vec3Int],
4343
segmentId1: Option[Long],
4444
segmentId2: Option[Long],
45-
mag: Vec3Int,
45+
mag: Option[Vec3Int],
4646
actionTracingId: String,
4747
actionTimestamp: Option[Long] = None,
4848
actionAuthorId: Option[ObjectId] = None,

0 commit comments

Comments
 (0)