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

Add route to load full mesh stl of a segment/agglomerate #7587

Merged
merged 58 commits into from
Mar 11, 2024
Merged

Conversation

fm3
Copy link
Member

@fm3 fm3 commented Jan 24, 2024

  • Adds possibility to download meshes as STL (both for meshfile, ad-hoc, both for annotations and view modes, both for mappings and oversegmentations): POST <datastore_uri>/data/datasets/:organizationName/:datasetName/layers/:dataLayerName/meshes/fullMesh.stl and POST <tracingstore_uri>/tracings/volume/:tracingId/fullMesh.stl with json body:
     meshFileName: Option[String], // None means ad-hoc meshing
    lod: Option[Int],
    segmentId: Long, // if mappingName is set, this is an agglomerate id
    mappingName: Option[String],
    mappingType: Option[String], // json, agglomerate, editableMapping
    editableMappingTracingId: Option[String],
    mag: Option[Vec3Int], // required for ad-hoc meshing
    seedPosition: Option[Vec3Int], // required for ad-hoc meshing
    additionalCoordinates: Option[Seq[AdditionalCoordinate]]
  • Introduces subproject webknossosNative which makes use of JNI to provide native functions (currently only one: a dracoToStlConverter)
  • Some renamings to unify things: webKnossos → webknossos in some more places in the backend code and adHocMeshing → adHocMesh
  • new dependency draco
  • removes the subsamplingStrides feature for ad-hoc meshes. This was already unused. Compare internal discussion.

URL of deployed dev instance (used for testing):

Steps to test:

  • Create volume annotation, brush some, test via curl 'http://localhost:9000/tracings/volume/71a2eaeb-3413-4c88-a99c-45547e6d9de5/fullMesh.stl?token=secretSampleUserToken' -X POST -H 'Accept-Encoding: gzip, deflate, br' -H 'content-type: application/json' --data-raw '{"mag": [1,1,1], "seedPosition": [99, 102, 81], "segmentId": 1}' > out.stl (insert your tracing id, seed position)
  • Test the datastore route as well
  • Test other combinations (static mappings, editable mappings, brushed on mapping, meshfile is for oversegmentation, meshfile is for target mapping, other mags, other segment ids)
  • Inspect downloaded stl files for example with meshlab on ubuntu

TODOs:

  • Implementation for Meshfile
    • read mesh chunk infos
    • decode draco
    • serialize as headless stl
    • add single stl header
    • c++ error handling with try/catch, create java exception?
    • get a review by someone who is more familiar with c++
    • transform geometry with position
      • (+matrix?)
    • mapping support (also editable)
      • do not map ids if meshfile is already computed for this mapping
  • Implementation for ad-hoc meshes
    • Encode ad-hoc mesh float buffer as stl
    • continue with neighbors
    • glue together the chunks better (overlap/merge vertices?)
    • mapping support (not editable, that goes to the tracingstore)
  • Should also be available in tracingstore
    • Ad-Hoc
      • Should use segment index for meshing if available
      • how to get dataset voxel size?
        • Cache timeout?
      • Mapping support
        • Test after changing an existing mapped segment by brushing
        • Editable Mappings
    • With File: forward to datastore
      • with mapping support
      • Editable Mappings
  • Measure perf
  • test JNI stuff on mac
  • Cleanup
  • document JNI development process

Follow-up

  • Parameter range listing route
  • Python client
  • Pass all infos to Render Animation Job

Issues:


@fm3 fm3 self-assigned this Jan 24, 2024
@fm3 fm3 changed the title WIP: Add route to load full mesh stl of a segment/agglomerate Add route to load full mesh stl of a segment/agglomerate Mar 7, 2024
@fm3 fm3 marked this pull request as ready for review March 7, 2024 12:50
@fm3 fm3 requested a review from normanrz March 7, 2024 12:50
Copy link
Member

@normanrz normanrz left a comment

Choose a reason for hiding this comment

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

Code looks great! I'll do some testing next.

build.sbt Outdated Show resolved Hide resolved
webknossos-native/readme.md Outdated Show resolved Hide resolved
webknossos-native/readme.md Outdated Show resolved Hide resolved
webknossos-native/src/dracoToStlDecoder.cpp Outdated Show resolved Hide resolved
@normanrz
Copy link
Member

normanrz commented Mar 8, 2024

Not sure if it is just the rendering in my Mac or if the normals in the STL are wrong
Screenshot 2024-03-08 at 12 00 38

@fm3 fm3 merged commit 9d4a3c9 into master Mar 11, 2024
2 checks passed
@fm3 fm3 deleted the load-full-mesh branch March 11, 2024 09:08
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.

Unified Mesh Loading API
2 participants