Skip to content

Commit 7df0ce7

Browse files
authored
Fix saving volume after brushing on mapped fallback buckets (#7833)
* Fix saving volume after brushing on mapped fallback buckets * changelog
1 parent 3feb8d5 commit 7df0ce7

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

CHANGELOG.unreleased.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
1717
### Changed
1818

1919
### Fixed
20+
- Fixed a bug where brushing on a fallback segmentation with active mapping and with segment index file would lead to failed saves. [#7833](https://github.com/scalableminds/webknossos/pull/7833)
2021

2122
### Removed
2223

webknossos-datastore/app/com/scalableminds/webknossos/datastore/controllers/DSMeshController.scala

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class DSMeshController @Inject()(
6464
editableMappingTracingId,
6565
request.body.segmentId,
6666
mappingNameForMeshFile,
67+
omitMissing = false,
6768
urlOrHeaderToken(token, request)
6869
)
6970
chunkInfos <- meshFileService.listMeshChunksForSegments(organizationName,

webknossos-datastore/app/com/scalableminds/webknossos/datastore/controllers/DataSourceController.scala

+2
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ class DataSourceController @Inject()(
654654
request.body.editableMappingTracingId,
655655
segmentId.toLong,
656656
mappingNameForMeshFile = None,
657+
omitMissing = false,
657658
urlOrHeaderToken(token, request)
658659
)
659660
fileMag <- segmentIndexFileService.readFileMag(organizationName, datasetName, dataLayerName)
@@ -694,6 +695,7 @@ class DataSourceController @Inject()(
694695
request.body.editableMappingTracingId,
695696
segmentOrAgglomerateId,
696697
mappingNameForMeshFile = None,
698+
omitMissing = true, // assume agglomerate ids not present in the mapping belong to user-brushed segments
697699
urlOrHeaderToken(token, request)
698700
)
699701
fileMag <- segmentIndexFileService.readFileMag(organizationName, datasetName, dataLayerName)

webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DSFullMeshService.scala

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class DSFullMeshService @Inject()(dataSourceRepository: DataSourceRepository,
134134
fullMeshRequest.editableMappingTracingId,
135135
fullMeshRequest.segmentId,
136136
mappingNameForMeshFile,
137+
omitMissing = false,
137138
token
138139
)
139140
chunkInfos: WebknossosSegmentInfo <- meshFileService.listMeshChunksForSegments(organizationName,

webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/MeshMappingHelper.scala

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package com.scalableminds.webknossos.datastore.services
22

33
import com.scalableminds.util.tools.Fox
4-
import com.scalableminds.util.tools.Fox.option2Fox
4+
import com.scalableminds.util.tools.Fox.{box2Fox, option2Fox}
55
import com.scalableminds.webknossos.datastore.storage.AgglomerateFileKey
6+
import net.liftweb.common.Full
67

78
import scala.concurrent.ExecutionContext
89

@@ -20,6 +21,7 @@ trait MeshMappingHelper {
2021
editableMappingTracingId: Option[String],
2122
agglomerateId: Long,
2223
mappingNameForMeshFile: Option[String],
24+
omitMissing: Boolean, // If true, failing lookups in the agglomerate file will just return empty list.
2325
token: Option[String])(implicit ec: ExecutionContext): Fox[List[Long]] =
2426
targetMappingName match {
2527
case None =>
@@ -59,10 +61,16 @@ trait MeshMappingHelper {
5961
case _ =>
6062
for {
6163
agglomerateService <- binaryDataServiceHolder.binaryDataService.agglomerateServiceOpt.toFox
62-
segmentIds <- agglomerateService.segmentIdsForAgglomerateId(
63-
agglomerateFileKey,
64-
agglomerateId
65-
)
64+
segmentIdsBox <- agglomerateService
65+
.segmentIdsForAgglomerateId(
66+
agglomerateFileKey,
67+
agglomerateId
68+
)
69+
.futureBox
70+
segmentIds <- segmentIdsBox match {
71+
case Full(segmentIds) => Fox.successful(segmentIds)
72+
case _ => if (omitMissing) Fox.successful(List.empty) else segmentIdsBox.toFox
73+
}
6674
} yield segmentIds
6775
}
6876
}

webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/volume/VolumeSegmentIndexBuffer.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class VolumeSegmentIndexBuffer(tracingId: String,
148148
(hits, misses)
149149
}
150150

151-
// Get a map from segment index to bucket position (e.g. an index) from all sources (buffer, fossilDB, file)
151+
// Get a map from segment to bucket position (e.g. an index) from all sources (buffer, fossilDB, file)
152152
def getSegmentToBucketIndexMap(segmentIds: List[Long],
153153
mag: Vec3Int,
154154
mappingName: Option[String],

0 commit comments

Comments
 (0)