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

WIP: user-defined key-value properties for Segments,Nodes,Trees #7875

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

fm3
Copy link
Member

@fm3 fm3 commented Jun 11, 2024

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • abc

TODOs:

  • Backend
    • Introduce properties in proto definitions
    • Update actions (Create+Update for Segment,Node,Tree)
    • NML Writer
    • NML Parser
    • Unit tests
    • Snapshots
    • Add assertions on duplicate keys? Might break annotation reloading…
  • Frontend
    • UI to display/edit properties
    • Update actions
    • NML Spec
    • NML Writer
    • NML Parser
  • Include this in the end-to-end tests
  • docs
  • follow-up issue for libs

Issues:


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

@fm3 fm3 self-assigned this Jun 11, 2024
@fm3
Copy link
Member Author

fm3 commented Jun 12, 2024

I created a first version of this in the backend. It works for Trees, Nodes and Segments (not yet for groups).

In proto, each of these now has a field repeated UserDefinedPropertyProto userDefinedProperties, a type defined as

message UserDefinedPropertyProto {
  required string key = 1;
  optional string stringValue = 2;
  optional bool boolValue = 3;
  optional double numberValue = 4;
  repeated string stringListValue = 6;
}

They can be set both in the “Create” and “Update” UpdateActions of the respective items. For example, the UpdateNodeSkeletonAction now has an optional field userDefinedProperties: Option[Seq[UserDefinedProperty]] = None (None has the same semantic as empty list). The format for a UserDefinedProperty expected in the json update actions is

key: String,
stringValue: Option[String] = None,
boolValue: Option[Boolean] = None,
numberValue: Option[Double] = None,
stringListValue: Option[Seq[String]] = None

The backend expects all update actions to include the full list for the edited item. So if it was nonempty first and is then updated to None, it is all cleared.

The frontend should ensure that only one of stringValue, boolValue, numberValue, stringListValue is set for each item, and that each key is used only once per item.

I also updated the NML format as written and parsed by the backend to include the userDeinedProperties. Looks like this:

    <userDefinedProperty key="aKey" numberValue="5.7"/>
    <userDefinedProperty key="anotherKey" boolValue="true"/>
    <userDefinedProperty key="thirdKey" stringListValue-0="hello"/>
    <userDefinedProperty key="fourthKey" stringListValue-1="there"/>

@fm3 fm3 changed the title WIP: user-defined key-value properties for skeletons & co WIP: user-defined key-value properties for Segments,Nodes,Trees Jun 12, 2024
@fm3 fm3 added the frontend label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to assign key/value properties to trees, nodes and segments
2 participants