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

Isosurface generation (now inluding frontend) #3495

Merged
merged 36 commits into from
Dec 12, 2018
Merged

Isosurface generation (now inluding frontend) #3495

merged 36 commits into from
Dec 12, 2018

Conversation

jfrohnhofen
Copy link
Contributor

@jfrohnhofen jfrohnhofen commented Nov 24, 2018

This PR only contains the backend code (new route) for generating iso-surfaces. The corresponding frontend changes can be found in #3493. #3493 was now merged into this, so front-end and backend changes happen in this PR. Check #3493 for front-end discussion.

URL of deployed dev instance (used for testing):

Steps to test:

  • open dataset with segmentation
  • activate rendering of iso-surfaces in dataset settings
  • move around
  • be amazed by iso-surfaces in the 3D viewport

Issues:


* origin/master:
  Add debugging methods to visualize wireframe of buckets (#3402)
  fixed bug that selects a just removed layout (#3379)
  Added button to revoke admin rights in frontend (#3378)
  Revert "Add REST API versioning support (#3385)" (#3404)
  Add REST API versioning support (#3385)
  limit number of tasks to be created in one api request (#3386)
  Use correct volume download route in TracingStoreRpcClient (#3403)
  clearer error message when uploading nml for inaccessible dataset (#3390)
  Refactored dropdown item events (#3383)
  Show dataset extent in right menu tab (#3371)
* master:
  remove -v (verbose) from backend-tests in CI (#3425)
  Add recommended configuration to TaskTypes (backend only) (#3415)
  Even if initialData is disabled, insert local stores (#3421)
  Add REST API docs (#3376)
  clearer message when annotation couldnt be found while logged out (#3413)
  prepare release 18.11.0 (#3414)
  Handle Cross-Datastore Duplicates, introducing scratch datastores (#3394)
  restrict user visibility (#3389)
  Add REST API versioning support (second try) (#3408)
  Enable hybrid tracings by default (#3399)
* master:
  Fix rgb support (#3455)
  Fix docker uid/gid + binaryData permissions. Persist postgres db (#3428)
  Script to merge volume tracing into on-disk segmentation (#3431)
  Hotfix for editing TaskTypes (#3451)
  fix keyboardjs module (#3450)
  Fix guessed dataset boundingbox for non-zero-aligned datasets (#3437)
  voxeliterator now checks if the passed map has elements (#3405)
  integrate .importjs (#3436)
  Re-write logic for selecting zoom level and support non-uniform buckets per dimension (#3398)
  fixing selecting bug and improving style of layout dropdown (#3443)
  refresh screenshots (#3445)
  Reduce the free space between viewports in tracing (#3333)
  Scala linter and formatter (#3357)
  ignore reported datasets of non-existent organization (#3438)
  Only provide shortcut for tree search and not for comment search (#3407)
  Update Datastore+Tracingstore Standalone Deployment Templates (#3424)
  In yarn refresh-schema, also invalidate Tables.scala (#3430)
  Remove BaseDirService that watched binaryData symlinks (#3416)
  Ensure that resolutions array is dense (#3406)
  Fix bucket-collection related rendering bug (#3409)
* origin/master:
  Optimize performance for the list request /api/datasets (#3441)
  add annotation dataset foreign key  (#3482)
  thumbnails: correctly use zoom value if specified (#3487)
  Store Meshes in Postgres (#3367)
  fix alpha return (#3483)
  Added script to apply all new evolutions (#3427)
  Simple fix to speed up dataset gallery (#3480)
  better errors for screenshot tests, fix imports, refresh screenshots (#3479)
  (Backend only) Add project priority to progress report json (#3476)
  Handle missing write access on datastore (#3411)
  Re-introduce "Flightmode improvements"" (#3473)
  Circleci-notify: linkify PR number (#3469)
  Revert "Flightmode improvements" (#3472)
  also flow-ignore binaryData when using symlinks (#3471)
  Flightmode improvements (#3392)
  Circleci custom notification (#3465)
  enable /api/switch cross-organization (#3464)
@jfrohnhofen jfrohnhofen requested a review from fm3 November 24, 2018 20:39
} yield {
val responseBuffer = ByteBuffer.allocate(vertices.length * 4).order(ByteOrder.LITTLE_ENDIAN)
responseBuffer.asFloatBuffer().put(vertices)
Ok(responseBuffer.array())
Copy link
Member

Choose a reason for hiding this comment

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

please add a comment about the float array semantics (3 floats being a point etc)

isosurfaceRequest = IsosurfaceRequest(dataSource, segmentationLayer, request.body.cuboid(dataLayer), request.body.segmentId, request.body.voxelDimensions, request.body.mapping)
vertices <- isosurfaceService.requestIsosurfaceViaActor(isosurfaceRequest)
} yield {
val responseBuffer = ByteBuffer.allocate(vertices.length * 4).order(ByteOrder.LITTLE_ENDIAN)
Copy link
Member

Choose a reason for hiding this comment

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

something like sizeof(float)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did not find anything useful. but unlike C, floats are guaranteed to be 4 bytes. added a comment, though.

Copy link
Member

Choose a reason for hiding this comment

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

fine by me :)

Whenever this data class is changed, the parser needs to be modified accordingly.
*/

trait AbstractDataLayerMapping
Copy link
Member

Choose a reason for hiding this comment

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

please add a comment about this empty trait being there to support putting these into a shared cache

@@ -12,6 +12,12 @@ case class Cuboid(topLeft: VoxelPosition, width: Int, height: Int, depth: Int) {

val volume: Int = width * height * depth

val hasValidDimensions: Boolean = width > 0 && width <= 512 && height > 0 && height <= 512 && depth > 0 && depth <= 512
Copy link
Member

Choose a reason for hiding this comment

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

also, pls add a comment about the intention (or name the magic number constant)

@@ -144,6 +141,8 @@ class BinaryDataService(dataBaseDir: Path, loadTimeout: FiniteDuration, maxCache
compressed
}

// private def applyMapping()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove

@@ -8,14 +8,18 @@ import javax.inject.Inject
/*
* The BinaryDataService needs to be instantiated as singleton to provide a shared DataCubeCache.
* The TracingStore one (for VolumeTracings) already is, since the surrounding VolumeTracingService is a singleton.
* The DataStore one is singleton-ized via this holder.
* The DataStore is singleton-ized via this holder.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

leave as is

val binaryDataService: BinaryDataService = dataServicesHolder.binaryDataService
val mappingService: MappingService = dataServicesHolder.mappingService

implicit val timeout: Timeout = Timeout(30 seconds)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

config


implicit val timeout: Timeout = Timeout(30 seconds)

val actor = actorSystem.actorOf(RoundRobinPool(1).props(Props(new IsosurfaceActor(this, timeout.duration))))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

config

math.ceil(cuboid.height / voxelDimensions.y).toInt,
math.ceil(cuboid.depth / voxelDimensions.z).toInt)

val offset = Vector3D(cuboid.topLeft.globalX,cuboid.topLeft.globalY,cuboid.topLeft.globalZ) / Vector3D(cuboid.topLeft.resolution)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix

@@ -40,6 +40,10 @@ case class Vector3D(x: Double = 0, y: Double = 0, z: Double = 0) {

def *:(o: Double) = this.*(o)

def *(o: Vector3D) = Vector3D(x * o.x, y * o.y, z * o.z)
Copy link
Member

Choose a reason for hiding this comment

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

please add a comment warning that this is not scalar product nor vector product

val mappingService = new MappingService(
Paths.get(config.Braingames.Binary.baseFolder),
config.Braingames.Binary.mappingCacheMaxSize)

Copy link
Member

Choose a reason for hiding this comment

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

I feel like the mapping service does not have to be in the holder, I’ll undo that and test if everything still works

jfrohnhofen and others added 2 commits December 12, 2018 13:50
* button in frontend

* startup parameters

* add mapping to isosurface request, #3313

* loading and parsing mappings, #3313

* build faster

* use raw float array as isosurface protocol, #3313

* expose voxel dimensions as parameter, proper scale, #3313

* smooth shading, #3313

* improve lighting for isosurface

* improve lighting and clean up code

* fix merge conflicts

* refactor isosurface front-end code and enable lookups according to bucket structure

* adapt code to cubeSize vector

* clean up

* clean up

* use mapped voxels if mapping is active; hide setting in non-view-mode
@fm3 fm3 changed the title Isosurface generation (backend) Isosurface generation (now inluding frontend) Dec 12, 2018
@philippotto philippotto merged commit 0638d53 into master Dec 12, 2018
@normanrz normanrz deleted the isosurface branch February 20, 2019 16:37
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.

Isosurface Frontend v1.0 Live isosurface (backend)
3 participants