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

Use mapping from viewconfig when generating thumbnail #8157

Merged
merged 3 commits into from
Nov 4, 2024

Conversation

frcroth
Copy link
Member

@frcroth frcroth commented Oct 30, 2024

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

Issues:


(Please delete unneeded items, merge only when none are left open)

Summary by CodeRabbit

  • New Features

    • Enhanced annotation capabilities with the ability to add metadata to Trees and Segments.
    • Summary row added to the time tracking overview for better task management.
    • Improved slider functionality for easier value adjustments and resets.
    • Enhanced search functionality to find unnamed segments by their full default name.
    • Thumbnails for datasets now utilize selected mapping from view configuration.
  • Bug Fixes

    • Resolved issues with dataset uploads, bbox export menu, and sharing tokens.
    • Fixed automatic expansion of groups in skeleton searches and zarr streaming bugs.
  • Improvements

    • Increased loading speeds for precomputed meshes.
    • Admins can now view and cancel all jobs with ownership displayed in the job list.

Copy link

coderabbitai bot commented Oct 30, 2024

Walkthrough

The pull request introduces several enhancements and bug fixes to the WEBKNOSSOS application. Key updates include the ability to add metadata in annotations for Trees and Segments, improved slider functionality, and enhanced search capabilities for unnamed segments. Additionally, changes were made to thumbnail handling in the ThumbnailService, allowing for dynamic mapping selection. The job management system was updated for better admin control, and CI/CD processes were improved by migrating nightly tests to GitHub Actions. Various bugs related to dataset uploads and permissions were also addressed.

Changes

File Path Change Summary
CHANGELOG.unreleased.md Updated to reflect new features, changes, and bug fixes, including metadata annotations and slider improvements.
app/models/dataset/ThumbnailService.scala Modified method signatures for thumbnail handling, added readMappingName method for better mapping management.
app/models/dataset/ThumbnailDAO.scala Adjusted method signatures to accommodate changes in thumbnail mapping logic.

Assessment against linked issues

Objective Addressed Explanation
Allow selecting mapping for thumbnail (#6305)

Possibly related PRs

  • Fix bbox export via bbox menu #8152: The changes in this PR address a bug related to the bbox export menu item, which is mentioned as fixed in the main PR's changelog, indicating a direct connection between the two.

Suggested labels

frontend

Suggested reviewers

  • normanrz

Poem

In the garden of code, where changes bloom,
Thumbnails now dance, dispelling the gloom.
With sliders that glide and searches that sing,
New features emerge, oh what joy they bring!
Bugs fade away, like shadows at dawn,
A brighter experience, for all to fawn! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@frcroth frcroth requested a review from fm3 October 30, 2024 12:41
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
CHANGELOG.unreleased.md (1)

28-28: Enhance the changelog entry with deployment requirements and compatibility notes.

While the current entry correctly describes the feature, it should be expanded to include important deployment considerations and compatibility information.

Consider updating the entry to:

- Thumbnails for datasets now use the selected mapping from the view configuration if available. [#8157](https://github.com/scalableminds/webknossos/pull/8157)
+ Thumbnails for datasets now use the selected mapping from the view configuration if available. Requires a datastore update after deployment. The default behavior remains unchanged when no mapping is specified. [#8157](https://github.com/scalableminds/webknossos/pull/8157)

Additionally, consider adding a note in the "Breaking Changes" section if this change affects any existing API contracts or behaviors.

app/models/dataset/ThumbnailService.scala (1)

Line range hint 104-135: Consider introducing a case class for the return type.

The method returns a complex 5-tuple which makes the code harder to maintain and understand. Consider introducing a case class to encapsulate these related parameters.

case class ThumbnailParameters(
  boundingBox: BoundingBox,
  mag: Vec3Int,
  intensityRange: Option[(Double, Double)],
  colorSettings: Option[ThumbnailColorSettings],
  mapping: Option[String]
)

Then update the method signature:

private def selectParameters(
    viewConfiguration: DatasetViewConfiguration,
    usableDataSource: GenericDataSource[DataLayerLike],
    layerName: String,
    layer: DataLayerLike,
    targetMagWidth: Int,
    targetMagHeigt: Int,
    mappingName: Option[String]
): ThumbnailParameters
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4213684 and 539c5a1.

📒 Files selected for processing (2)
  • CHANGELOG.unreleased.md (1 hunks)
  • app/models/dataset/ThumbnailService.scala (4 hunks)
🔇 Additional comments (3)
app/models/dataset/ThumbnailService.scala (3)

17-17: LGTM: Import addition is appropriate.

The added import for JsObject is necessary for handling the mapping configuration in the new functionality.


90-90: LGTM: Consistent mapping parameter propagation.

The mapping parameter is correctly propagated through the thumbnail generation and caching pipeline.

Also applies to: 97-97


158-164: LGTM: Mapping extraction implementation is robust.

The implementation follows the established pattern for configuration readers and properly handles JSON validation. However, let's verify that the JSON structure matches the expected format across the codebase.

✅ Verification successful

The previous regex had syntax errors. Let's try with simpler patterns to find related configuration usage and validate the JSON structure consistency.


Implementation is consistent with codebase patterns

The verification confirms that the readMappingName implementation in ThumbnailService follows established patterns in the codebase. The search results show:

  • The method's JSON structure for mapping configuration (with "name" field) is consistent with other parts of the codebase, particularly in mesh and volume tracing services
  • The viewConfiguration.get("layers") pattern is used consistently within the ThumbnailService class itself
  • The implementation properly handles optional values and validation, similar to other mapping-related code in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other usages of the mapping configuration to verify consistency
rg -A 2 '"mapping".*:.*{.*"name"' --type scala

Length of output: 169


Script:

#!/bin/bash
# Search for mapping configuration patterns in Scala files
rg -A 5 'mapping.*name' --type scala

# Search for layer configuration patterns
rg -A 5 '"layers".*mapping' --type scala

# Search for view configuration usage patterns
ast-grep --pattern 'viewConfiguration.get("layers")'

Length of output: 9037

Copy link
Member

@fm3 fm3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@frcroth frcroth merged commit f937be0 into master Nov 4, 2024
3 checks passed
@frcroth frcroth deleted the thumbnail-mapping branch November 4, 2024 08:08
@coderabbitai coderabbitai bot mentioned this pull request Nov 11, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow selecting mapping for thumbnail
2 participants