Skip to content

Commit

Permalink
Fix merging a single volume (#5198)
Browse files Browse the repository at this point in the history
  • Loading branch information
fm3 authored Feb 24, 2021
1 parent b75a10f commit 8af51a2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fixed some scenarios where the Meshes tab could cause errors (e.g., when the UI was used but no segmentation layer was available). [#5142](https://github.com/scalableminds/webknossos/pull/5142)
- Fixed a bug where the user (and telemetry) would get a cryptic error message when trying to register with an email that is already in use. [#5152](https://github.com/scalableminds/webknossos/pull/5152)
- Fixed a bug where default dataset configuration could not be loaded if a dataset was accessed via sharing token [#5164](https://github.com/scalableminds/webknossos/pull/5164)
- Fixed a bug where viewing a volume task as compound annotation failed for tasks with single instances. [#5198](https://github.com/scalableminds/webknossos/pull/5198)

### Removed
- Support for KNOSSOS cubes data format was removed. Use the [webKnossos cuber](https://github.com/scalableminds/webknossos-cuber) tool to convert existing datasets saved as KNOSSOS cubes. [#5085](https://github.com/scalableminds/webknossos/pull/5085)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,14 @@ class SkeletonTracingService @Inject()(tracingDataStore: TracingDataStore,
}

def merge(tracings: Seq[SkeletonTracing]): SkeletonTracing =
tracings.reduceLeft(mergeTwo)
tracings
.reduceLeft(mergeTwo)
.copy(
createdTimestamp = System.currentTimeMillis(),
version = 0L,
)

def mergeTwo(tracingA: SkeletonTracing, tracingB: SkeletonTracing): SkeletonTracing = {
private def mergeTwo(tracingA: SkeletonTracing, tracingB: SkeletonTracing): SkeletonTracing = {
val nodeMapping = TreeUtils.calculateNodeMapping(tracingA.trees, tracingB.trees)
val groupMapping = TreeUtils.calculateGroupMapping(tracingA.treeGroups, tracingB.treeGroups)
val mergedTrees = TreeUtils.mergeTrees(tracingA.trees, tracingB.trees, nodeMapping, groupMapping)
Expand All @@ -169,7 +174,6 @@ class SkeletonTracingService @Inject()(tracingDataStore: TracingDataStore,
trees = mergedTrees,
treeGroups = mergedGroups,
boundingBox = mergedBoundingBox,
version = 0,
userBoundingBox = None,
userBoundingBoxes = userBoundingBoxes
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,15 @@ class VolumeTracingService @Inject()(
} else None
} yield bucketPosOpt

def merge(tracings: Seq[VolumeTracing]): VolumeTracing = tracings.reduceLeft(mergeTwo)
def merge(tracings: Seq[VolumeTracing]): VolumeTracing =
tracings
.reduceLeft(mergeTwo)
.copy(
createdTimestamp = System.currentTimeMillis(),
version = 0L,
)

def mergeTwo(tracingA: VolumeTracing, tracingB: VolumeTracing): VolumeTracing = {
private def mergeTwo(tracingA: VolumeTracing, tracingB: VolumeTracing): VolumeTracing = {
val largestSegmentId = Math.max(tracingA.largestSegmentId, tracingB.largestSegmentId)
val mergedBoundingBox = combineBoundingBoxes(Some(tracingA.boundingBox), Some(tracingB.boundingBox))
val userBoundingBoxes = combineUserBoundingBoxes(tracingA.userBoundingBox,
Expand All @@ -405,8 +411,6 @@ class VolumeTracingService @Inject()(
tracingB.userBoundingBoxes)

tracingA.copy(
createdTimestamp = System.currentTimeMillis(),
version = 0L,
largestSegmentId = largestSegmentId,
boundingBox = mergedBoundingBox.getOrElse(
com.scalableminds.webknossos.datastore.geometry.BoundingBox(
Expand Down

0 comments on commit 8af51a2

Please sign in to comment.