Skip to content

Commit

Permalink
EyeTrackingDemo: fix vertex positions
Browse files Browse the repository at this point in the history
  • Loading branch information
smlpt committed Sep 19, 2024
1 parent 34b76f8 commit 7325742
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import org.scijava.log.LogService
import graphics.scenery.attribute.material.Material
import graphics.scenery.primitives.Cylinder
import graphics.scenery.primitives.TextBoard
import graphics.scenery.volumes.RAIVolume

@Plugin(type = Command::class,
menuRoot = "SciView",
Expand Down Expand Up @@ -551,7 +552,7 @@ class EyeTrackingDemo: Command{
// TODO We dont need the local direction for grid traversal, but its still in the spine metadata for now
val localDirection = Vector3f(0f)
val (samples, samplePos) = volume.sampleRayGridTraversal(localEntry, localExit) ?: (null to null)

val volumeScale = (volume as RAIVolume).getVoxelScale()
// if (samples != null && localDirection != null) {
// val metadata = SpineMetadata(
// timepoint,
Expand Down Expand Up @@ -581,7 +582,7 @@ class EyeTrackingDemo: Command{
cam.spatial().position,
confidence,
samples.map { it ?: 0.0f },
samplePos.map { it ?: Vector3f(0f) }
samplePos.map { it?.mul(volumeScale) ?: Vector3f(0f) }
)
val count = samples.filterNotNull().count { it > 0.2f }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class HedgehogAnalysis(val spines: List<SpineMetadata>, val localToWorld: Matrix
}

//step2: find the maxIndices along the spine
// yo dawg, this will be a list of lists, where each entry in the first-level list
// this will be a list of lists, where each entry in the first-level list
// corresponds to a time point, which then contains a list of vertices within that timepoint.
val candidates: List<List<SpineGraphVertex>> = timepoints.map { tp ->
val vs = tp.value.mapIndexedNotNull { i, spine ->
Expand All @@ -173,7 +173,8 @@ class HedgehogAnalysis(val spines: List<SpineMetadata>, val localToWorld: Matrix
//filter { it.first <1200}.
maxIndices.map { index ->
logger.debug("Generating vertex at index $index")
val position = spine.position
// get the position of the current index along the spine
val position = spine.samplePosList[index.first]
val worldPosition = localToWorld.transform((Vector3f(position)).xyzw()).xyz()
SpineGraphVertex(tp.key,
position,
Expand Down

0 comments on commit 7325742

Please sign in to comment.