Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix “merging” a single volume annotation #5198

Merged
merged 2 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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