-
Notifications
You must be signed in to change notification settings - Fork 29
Use native bucket scanner also in EditableMappingService #8489
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
Conversation
… with outdated mapping?)
📝 WalkthroughWalkthroughThis PR expands and refactors the segment ID collection functionality across multiple components. A new Boolean parameter Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
…ngstore/tracings/volume/VolumeSegmentIndexBuffer.scala Co-authored-by: MichaelBuessemeyer <[email protected]>
…ngstore/tracings/volume/VolumeSegmentIndexBuffer.scala Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingService.scala (2)
113-113
: Consider externalizing the path configuration.Using a hardcoded path (
Paths.get("")
) may cause deployment mismatches. For improved maintainability, consider loading it from a configuration file or environment variable.
375-375
: Avoid potential duplication withbytesToLongs
.
bytesToSegmentInt
is similar tobytesToLongs
, so consider unifying both methods if possible to prevent code duplication and reduce maintenance overhead.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/helpers/NativeBucketScanner.scala
(1 hunks)webknossos-jni/src/bucketScanner.cpp
(2 hunks)webknossos-jni/src/include/com_scalableminds_webknossos_datastore_helpers_NativeBucketScanner.h
(1 hunks)webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingLayer.scala
(1 hunks)webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingService.scala
(4 hunks)webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/volume/VolumeSegmentIndexService.scala
(1 hunks)
🧰 Additional context used
🧬 Code Definitions (4)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/helpers/NativeBucketScanner.scala (3)
webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingService.scala (1)
collectSegmentIds
(351-360)webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/volume/VolumeSegmentIndexService.scala (1)
collectSegmentIds
(132-141)webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala (2)
bytesPerElement
(101-113)isSigned
(67-82)
webknossos-jni/src/include/com_scalableminds_webknossos_datastore_helpers_NativeBucketScanner.h (1)
webknossos-jni/src/bucketScanner.cpp (1)
jlongArray
(60-88)
webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/volume/VolumeSegmentIndexService.scala (2)
webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingService.scala (1)
collectSegmentIds
(351-360)webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala (2)
bytesPerElement
(101-113)isSigned
(67-82)
webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingService.scala (3)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/helpers/NativeBucketScanner.scala (1)
NativeBucketScanner
(5-11)webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala (3)
ElementClass
(45-189)bytesPerElement
(101-113)isSigned
(67-82)webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/volume/VolumeSegmentIndexService.scala (1)
collectSegmentIds
(132-141)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: circleci_build
🔇 Additional comments (10)
webknossos-datastore/app/com/scalableminds/webknossos/datastore/helpers/NativeBucketScanner.scala (1)
7-10
: Method signature updated with a new parameterThe
collectSegmentIds
method now includes a new boolean parameterskipZeroes
to control whether zero values should be included or excluded during segment ID collection. This change is consistent with the PR objective to use the native bucket scanner in EditableMappingService.webknossos-jni/src/include/com_scalableminds_webknossos_datastore_helpers_NativeBucketScanner.h (1)
13-16
: JNI header signature updated to match Scala implementationThe method signature has been updated from
([BIZ)[J
to([BIZZ)[J
to accommodate the newskipZeroes
parameter, ensuring consistency between the JNI interface and the Scala implementation. This signature change correctly reflects the parameter addition in the native implementation.webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/volume/VolumeSegmentIndexService.scala (1)
135-138
: Parameter added to skip zero values in VolumeSegmentIndexServiceThe
skipZeroes
parameter is now set totrue
in this service, which will exclude zero values when collecting segment IDs. This is consistent with the implementation in the native bucket scanner and aligns with the PR objective.webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingLayer.scala (3)
62-62
: Streamlined segment ID collection using native scannerThe implementation now directly collects segment IDs from the unmapped data bytes rather than converting to a typed format first. This simplifies the code and leverages the native bucket scanner as intended in the PR.
68-68
: Direct use of unmapped data for mappingSimilar to the segment ID collection change, the mapData method now directly uses the original unmapped data bytes instead of a converted typed format. This approach is more efficient and consistent with the PR's goal of utilizing the native bucket scanner throughout the EditableMappingService.
62-68
: Verify data consistency after split and merge operationsThe changes to how data is processed could potentially affect split and merge operations. According to the PR objectives, testing should include verification that split and merge results remain logical after service reload.
Could you confirm that you've tested split and merge operations after these changes and verified that the results remain consistent after reloading the service?
webknossos-jni/src/bucketScanner.cpp (1)
61-72
: ParameterskipZeroes
logic appears correct.The added condition
(!skipZeroes || currentValue != 0)
accurately controls whether zero values should be skipped. The JNI signature update and the accompanying logic are consistent with the intended functionality.webknossos-tracingstore/app/com/scalableminds/webknossos/tracingstore/tracings/editablemapping/EditableMappingService.scala (3)
15-20
: Imports appear appropriate.All newly added imports (e.g.,
NativeBucketScanner
) are used and relevant. No issues to report.Also applies to: 23-23
124-125
: Lazy initialization ofnativeBucketScanner
.Declaring
nativeBucketScanner
aslazy val
is a sensible approach for on-demand usage, avoiding unnecessary initialization. No concerns here.
351-358
: Double-checkskipZeroes = false
necessity.This method always includes zero values when collecting IDs. Verify that including zero segment IDs is truly desired in all cases, or consider making this choice configurable.
#8460 introduced the native bucket scanner, that collects the segment ids from a bucket.
This PR now uses that also in the EditableMappingService, which previously had its own implementation of collectSegments.
Steps to test: