-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unified naming scheme, extracted tracking functionality into separate…
… classes
- Loading branch information
Showing
7 changed files
with
249 additions
and
174 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/main/kotlin/sc/iview/commands/demo/advanced/EyeTrackingCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package sc.iview.commands.demo.advanced | ||
|
||
import graphics.scenery.* | ||
import org.joml.* | ||
import org.scijava.command.Command | ||
import org.scijava.command.CommandService | ||
import org.scijava.plugin.Menu | ||
import org.scijava.plugin.Parameter | ||
import org.scijava.plugin.Plugin | ||
import sc.iview.SciView | ||
import sc.iview.commands.MenuWeights | ||
import java.util.HashMap | ||
|
||
@Plugin( | ||
type = Command::class, | ||
menuRoot = "SciView", | ||
menu = [Menu(label = "Demo", weight = MenuWeights.DEMO), | ||
Menu(label = "Advanced", weight = MenuWeights.DEMO_ADVANCED), | ||
Menu(label = "Utilize Eye Tracker for Cell Tracking", weight = MenuWeights.DEMO_ADVANCED_EYETRACKING)] | ||
) | ||
/** | ||
* Command class that forwards to the [EyeTracking] class to perform the actual tracking and analysis. | ||
*/ | ||
class EyeTrackingCommand : Command { | ||
|
||
@Parameter | ||
var mastodonCallbackLinkCreate: ((HedgehogAnalysis.SpineGraphVertex) -> Unit)? = null | ||
|
||
@Parameter | ||
var mastodonUpdateGraph: (() -> Unit)? = null | ||
|
||
@Parameter | ||
private lateinit var sv: SciView | ||
|
||
override fun run() { | ||
// the actual eye tracking logic happens in here | ||
val eyeTracking = EyeTracking(mastodonCallbackLinkCreate, mastodonUpdateGraph, sv) | ||
eyeTracking.run() | ||
} | ||
|
||
companion object { | ||
|
||
@Throws(Exception::class) | ||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
val sv = SciView.create() | ||
val command = sv.scijavaContext!!.getService(CommandService::class.java) | ||
val argmap = HashMap<String, Any>() | ||
argmap["sv"] = sv | ||
command.run(EyeTrackingCommand::class.java, true, argmap) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/kotlin/sc/iview/commands/demo/advanced/TrackingTestCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package sc.iview.commands.demo.advanced | ||
|
||
import org.scijava.command.Command | ||
import org.scijava.command.CommandService | ||
import org.scijava.plugin.Menu | ||
import org.scijava.plugin.Parameter | ||
import org.scijava.plugin.Plugin | ||
import sc.iview.SciView | ||
import sc.iview.commands.MenuWeights | ||
|
||
@Plugin(type = Command::class, | ||
menuRoot = "SciView", | ||
menu = [Menu(label = "Demo", weight = MenuWeights.DEMO), | ||
Menu(label = "Advanced", weight = MenuWeights.DEMO_ADVANCED), | ||
Menu(label = "Test without VR and Eye Tracker", weight = MenuWeights.DEMO_ADVANCED_EYETRACKING)]) | ||
class TrackingTestCommand: Command { | ||
|
||
@Parameter | ||
private lateinit var sv: SciView | ||
|
||
override fun run() { | ||
val test = TrackingTest(sv) | ||
test.run() | ||
} | ||
|
||
companion object { | ||
|
||
@Throws(Exception::class) | ||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
val sv = SciView.create() | ||
val command = sv.scijavaContext!!.getService(CommandService::class.java) | ||
val argmap = HashMap<String, Any>() | ||
argmap["sv"] = sv | ||
command.run(TrackingTestCommand::class.java, true, argmap) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 13 additions & 30 deletions
43
...commands/demo/advanced/EyeTrackingDemo.kt → ...o/advanced/VRControllerTrackingCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,55 @@ | ||
package sc.iview.commands.demo.advanced | ||
|
||
import graphics.scenery.* | ||
import graphics.scenery.controls.OpenVRHMD | ||
import graphics.scenery.controls.TrackedDeviceType | ||
import graphics.scenery.controls.eyetracking.PupilEyeTracker | ||
import graphics.scenery.textures.Texture | ||
import graphics.scenery.utils.SystemHelpers | ||
import graphics.scenery.utils.extensions.minus | ||
import graphics.scenery.utils.extensions.xyz | ||
import graphics.scenery.utils.extensions.xyzw | ||
import graphics.scenery.volumes.Volume | ||
import net.imglib2.type.numeric.integer.UnsignedByteType | ||
import org.joml.* | ||
import org.scijava.command.Command | ||
import org.scijava.command.CommandService | ||
import org.scijava.plugin.Menu | ||
import org.scijava.plugin.Parameter | ||
import org.scijava.plugin.Plugin | ||
import org.scijava.ui.behaviour.ClickBehaviour | ||
import sc.iview.SciView | ||
import sc.iview.commands.MenuWeights | ||
import java.awt.image.DataBufferByte | ||
import java.io.ByteArrayInputStream | ||
import java.nio.file.Files | ||
import java.nio.file.Paths | ||
import java.util.HashMap | ||
import javax.imageio.ImageIO | ||
import kotlin.concurrent.thread | ||
import kotlin.math.PI | ||
import graphics.scenery.attribute.material.Material | ||
import graphics.scenery.controls.* | ||
import graphics.scenery.primitives.Cylinder | ||
import graphics.scenery.primitives.TextBoard | ||
import org.scijava.plugin.Parameter | ||
|
||
@Plugin(type = Command::class, | ||
menuRoot = "SciView", | ||
menu = [Menu(label = "Demo", weight = MenuWeights.DEMO), | ||
Menu(label = "Advanced", weight = MenuWeights.DEMO_ADVANCED), | ||
Menu(label = "Utilize Eye Tracker for Cell Tracking", weight = MenuWeights.DEMO_ADVANCED_EYETRACKING)]) | ||
/** | ||
* Command class that forwards to the [EyeTracking] class to perform the actual tracking and analysis. | ||
*/ | ||
class EyeTrackingDemo: Command { | ||
|
||
@Parameter | ||
var mastodonCallbackLinkCreate: ((HedgehogAnalysis.SpineGraphVertex) -> Unit)? = null | ||
|
||
@Parameter | ||
var mastodonUpdateGraph: (() -> Unit)? = null | ||
@Plugin( | ||
type = Command::class, | ||
menuRoot = "SciView", | ||
menu = [Menu(label = "Demo", weight = MenuWeights.DEMO), | ||
Menu(label = "Advanced", weight = MenuWeights.DEMO_ADVANCED), | ||
Menu(label = "Utilize VR Controller for Cell Tracking", weight = MenuWeights.DEMO_ADVANCED_EYETRACKING)] | ||
) | ||
class VRControllerTrackingCommand : Command { | ||
|
||
@Parameter | ||
private lateinit var sv: SciView | ||
|
||
override fun run() { | ||
// the actual eye tracking logic happens in here | ||
val eyeTracking = EyeTracking(mastodonCallbackLinkCreate, mastodonUpdateGraph, sv) | ||
eyeTracking.run() | ||
val tracking = VRControllerTracking(sv) | ||
tracking.run() | ||
} | ||
|
||
companion object { | ||
|
||
@Throws(Exception::class) | ||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
val sv = SciView.create() | ||
val command = sv.scijavaContext!!.getService(CommandService::class.java) | ||
val argmap = HashMap<String, Any>() | ||
argmap["sv"] = sv | ||
command.run(EyeTrackingDemo::class.java, true, argmap) | ||
command.run(VRControllerTrackingCommand::class.java, true, argmap) | ||
} | ||
} | ||
} |
Oops, something went wrong.