Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
ac16240
utilize eyetracking in sciview
RuoshanLan Aug 2, 2021
c3bc1b4
a working version and adjust the size of some messages
RuoshanLan Sep 9, 2021
f1f00c7
code clean
RuoshanLan Sep 9, 2021
9eb458e
let the volume show before starting the eye tracking
RuoshanLan Oct 7, 2021
785eb2c
update bionic tracking
RuoshanLan Oct 12, 2021
0c8afc7
solve conflict
RuoshanLan Oct 12, 2021
b4f7188
add headset for cell tracking
RuoshanLan Nov 15, 2021
0d613f6
add test without VR headset
RuoshanLan Nov 29, 2021
3ddfcfc
a working version of utilizing VRHeadset for cell tracking - part of …
RuoshanLan Dec 3, 2021
efe9902
add function of tracking with controllers
RuoshanLan Dec 17, 2021
7370519
replace numerictype with realtype
RuoshanLan May 19, 2022
7e4c128
resolve conflicts
RuoshanLan May 19, 2022
9fb6c22
fix issue in controller version
RuoshanLan Jul 26, 2022
e1c6013
improve the VRHeadsSettTrackingDemo and fix a bug caused by UV coordi…
RuoshanLan Oct 28, 2022
9348a25
add VR interaction to VRHeadSetTrackingDemo and add nodetaggedevent
RuoshanLan Nov 9, 2022
8aa32f4
code clean
RuoshanLan Nov 9, 2022
3eb8741
merge
RuoshanLan Nov 9, 2022
1d59a30
Fix line endings
RuoshanLan Nov 15, 2022
a7057b0
Gradle: Add missing transitive dependencies
RuoshanLan Nov 15, 2022
12cd940
SciView: Revert failed merge for addVolume functions
RuoshanLan Nov 15, 2022
e909c79
clean and add comment
RuoshanLan Dec 19, 2022
954ae8e
Merge branch 'master' into eyetracking-utilization
smlpt Jul 4, 2023
3735f6c
Gradle Build: update to scenery 0.9.0
smlpt Jul 4, 2023
1ecaf0f
Gradle Build: fixing outdated code
smlpt Jul 6, 2023
0a78f66
SciView: bring back openDirTiff and openTrackFile
smlpt Jul 6, 2023
9efcb08
Gradle: fix directories dep issue
smlpt Jul 11, 2023
80aeccd
build: update gradle and make the build compatible with java 21
smlpt Mar 28, 2024
f116a80
Merge branch 'main' into eyetracking-utilization
smlpt Mar 28, 2024
8b2839d
improve volume loading from scene
smlpt Apr 12, 2024
6136a3c
fix filtering for volumes in the scene
smlpt Apr 12, 2024
d883c68
Merge branch 'main' into eyetracking-utilization
smlpt Apr 15, 2024
279a846
Merge remote-tracking branch 'origin/eyetracking-utilization' into ey…
smlpt Apr 15, 2024
a754d09
SciView: fix VR toggling changes to stereo rendering
smlpt May 7, 2024
bbca486
EyeTrackingDemo: catch if no volume is found
smlpt May 7, 2024
6fe0805
HedgehogAnalysis: add docs and comments
smlpt May 7, 2024
da9979a
Add: test object for loading a volume and starting the eye tracking d…
smlpt Aug 23, 2024
6d94bbd
Merge branch 'main' into eyetracking-utilization
smlpt Aug 26, 2024
8c6c93a
Make newest sciview compatible with local scenery (stupid jackson)
smlpt Aug 26, 2024
fc6dd31
Fix toggleVRRendering
smlpt Aug 26, 2024
4b4bd77
Minor changes to fix finding local maxima, adding info logs
smlpt Aug 26, 2024
5e6f99c
Increase volume size for testing dataset
smlpt Aug 27, 2024
f58cb0b
Clean up logging
smlpt Aug 27, 2024
e1fe8a3
Change showMessage to centered, try to fix track instancing
smlpt Aug 27, 2024
8560296
Fix track cylinder radius
smlpt Sep 2, 2024
1d64c4c
EyeTrackingDemo: update sciview API usage
smlpt Sep 3, 2024
7b8031d
Make eye tracking compatible with mastodon bridge
smlpt Sep 6, 2024
153dabf
Change log to logger for consistency
smlpt Sep 10, 2024
b03c042
Add: gaussian smoothing function
smlpt Sep 11, 2024
b5e5eda
Change to sampleRayGridTraversal and add samplePos list to SpineMetadata
smlpt Sep 11, 2024
1d77ea3
HedgehogAnalysis: get spine vertex position from grid traversal
smlpt Sep 13, 2024
34b76f8
Fix: ignore children in AABB intersection
smlpt Sep 17, 2024
7325742
EyeTrackingDemo: fix vertex positions
smlpt Sep 19, 2024
f51de82
Create CellTrackingBase, let other classes inherit most of the (other…
smlpt Oct 8, 2024
8f05cc4
Make sure that cam is not inside volume when tracking
smlpt Oct 9, 2024
9bcafe8
Add names to scene objects to make it easier to find and remove them …
smlpt Oct 9, 2024
e6c8612
CellTrackingBase: moved file to demo/advanced
smlpt Oct 9, 2024
886997a
Refactor the eye tracking logic into EyeTracking, so that EyeTracking…
smlpt Oct 9, 2024
6d93dc0
Add proper eyetracking shutdown handling
smlpt Oct 10, 2024
9cafe64
Unified naming scheme, extracted tracking functionality into separate…
smlpt Oct 11, 2024
f072138
Use lazylogger instead of Logservice
smlpt Oct 11, 2024
7c2f2c3
StartEyeTrackingDirectly: Rename to EyeTrackingCommand
smlpt Oct 14, 2024
d2d2618
SciviewBridge: wrap eyeTracking into a separate thread to fix blank s…
smlpt Nov 6, 2024
317734b
Add TimepointObserver to unify timepoint updates across VR and bridge
smlpt Nov 12, 2024
eb34260
Fix monoscopic render rebuild after disabling VR
smlpt Nov 18, 2024
0263305
SciView: improve VR shutdown handling in toggleVRRendering
smlpt Nov 18, 2024
2c82070
Improve scene cleanup after turning off VR
smlpt Nov 18, 2024
148ceb5
Cleaned up files for PR, removed comments, added documentation
smlpt Nov 19, 2024
09d3e9e
Rename VR controller bindings using TrackerRole and OpenVRButton
smlpt Dec 9, 2024
6036da3
push without content to get CI logs again
smlpt Mar 31, 2025
e86327a
build: bump to scenery 0.12.0
smlpt Sep 16, 2025
fe63bab
build: add mavenCentral repository
smlpt Sep 16, 2025
ff0ddff
OpenN5: add Datatype.STRING for exhaustive when expression
smlpt Sep 16, 2025
945f845
Merge branch 'main' into eyetracking-utilization
skalarproduktraum Sep 16, 2025
1ec7858
remove legacy classes, not needed by manvr3d
smlpt Sep 17, 2025
f3df3c1
updated Menuweights to remove legacy eyetracking command
smlpt Sep 17, 2025
1a70e39
SciView: removed legacy methods for loading tracks from files
smlpt Sep 17, 2025
daaae8a
added documentation
smlpt Sep 17, 2025
81207f8
Move classes to commands.analysis
smlpt Sep 17, 2025
d7c15c4
PR cleanup
smlpt Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ java {
}

repositories {
mavenCentral()
if(project.properties["useMavenLocal"] == "true") {
logger.warn("Using local Maven repository as source")
mavenLocal()
Expand All @@ -44,7 +45,7 @@ dependencies {
exclude("org.lwjgl")
}

val sceneryVersion = "0.11.2"
val sceneryVersion = "0.12.0"
api("graphics.scenery:scenery:$sceneryVersion") {
version { strictly(sceneryVersion) }
exclude("org.biojava.thirdparty", "forester")
Expand Down
85 changes: 85 additions & 0 deletions src/main/java/sc/iview/commands/file/OpenDirOfTIFF.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*-
* #%L
* Scenery-backed 3D visualization package for ImageJ.
* %%
* Copyright (C) 2016 - 2021 SciView developers.
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package sc.iview.commands.file;

import org.scijava.command.Command;
import org.scijava.io.IOService;
import org.scijava.log.LogService;
import org.scijava.plugin.Menu;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;
import sc.iview.SciView;

import java.io.File;
import java.io.IOException;

import static sc.iview.commands.MenuWeights.FILE;
import static sc.iview.commands.MenuWeights.FILE_OPEN;

/**
* Command to open a file in SciView
*
* @author Kyle Harrington
*
*/
@Plugin(type = Command.class, menuRoot = "SciView", //
menu = { @Menu(label = "File", weight = FILE), //
@Menu(label = "Open Directory of tif...", weight = FILE_OPEN) })
public class OpenDirOfTIFF implements Command {

@Parameter
private IOService io;

@Parameter
private LogService log;

@Parameter
private SciView sciView;

// TODO: Find a more extensible way than hard-coding the extensions.
@Parameter(style = "directory")
private File file;

@Parameter
private int onlyFirst = 0;

@Override
public void run() {
try {
if(onlyFirst > 0) {
sciView.openDirTiff(file.toPath(), onlyFirst);
} else {
sciView.openDirTiff(file.toPath(), null);
}
}
catch (final IOException | IllegalArgumentException exc) {
log.error( exc );
}
}
}
84 changes: 64 additions & 20 deletions src/main/kotlin/sc/iview/SciView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ import graphics.scenery.utils.ExtractsNatives.Companion.getPlatform
import graphics.scenery.utils.LogbackUtils
import graphics.scenery.utils.SceneryPanel
import graphics.scenery.utils.Statistics
import graphics.scenery.utils.extensions.times
import graphics.scenery.volumes.Colormap
import graphics.scenery.volumes.RAIVolume
import graphics.scenery.volumes.TransferFunction
import graphics.scenery.volumes.Volume
import graphics.scenery.volumes.Volume.Companion.fromXML
import graphics.scenery.volumes.Volume.Companion.setupId
Expand Down Expand Up @@ -85,6 +85,7 @@ import net.imglib2.type.numeric.integer.UnsignedByteType
import net.imglib2.view.Views
import org.joml.Quaternionf
import org.joml.Vector3f
import org.joml.Vector4f
import org.scijava.Context
import org.scijava.`object`.ObjectService
import org.scijava.display.Display
Expand All @@ -100,6 +101,7 @@ import org.scijava.thread.ThreadService
import org.scijava.util.ColorRGB
import org.scijava.util.Colors
import org.scijava.util.VersionUtils
import sc.iview.commands.demo.animation.ParticleDemo
import sc.iview.commands.edit.InspectorInteractiveCommand
import sc.iview.event.NodeActivatedEvent
import sc.iview.event.NodeAddedEvent
Expand All @@ -110,14 +112,14 @@ import sc.iview.ui.CustomPropertyUI
import sc.iview.ui.MainWindow
import sc.iview.ui.SwingMainWindow
import sc.iview.ui.TaskManager
import ucar.units.ConversionException
import java.awt.event.WindowListener
import java.io.File
import java.io.IOException
import java.net.JarURLConnection
import java.net.URL
import java.nio.ByteBuffer
import java.nio.FloatBuffer
import java.nio.file.Path
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.*
Expand All @@ -134,6 +136,7 @@ import kotlin.concurrent.thread
import javax.swing.JOptionPane
import kotlin.math.cos
import kotlin.math.sin
import kotlin.system.measureTimeMillis

/**
* Main SciView class.
Expand Down Expand Up @@ -784,6 +787,25 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
}
}

@Throws(IOException::class)
fun openDirTiff(source: Path, onlyFirst: Int? = null)
{
val v = Volume.fromPath(source, hub, onlyFirst)
v.name = "volume"
v.spatial().position = Vector3f(-3.0f, 10.0f, 0.0f)
v.colormap = Colormap.get("jet")
v.spatial().scale = Vector3f(15.0f, 15.0f,45.0f)
v.transferFunction = TransferFunction.ramp(0.05f, 0.8f)
v.metadata["animating"] = true
v.converterSetups.firstOrNull()?.setDisplayRange(0.0, 1500.0)
v.visible = true

v.spatial().wantsComposeModel = true
v.spatial().updateWorld(true)
addNode(v)
}


/**
* Open a file specified by the source path. The file can be anything that SciView knows about: mesh, volume, point cloud
* @param source string of a data source
Expand Down Expand Up @@ -1697,28 +1719,41 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
val cam = scene.activeObserver as? DetachedHeadCamera ?: return
var ti: TrackerInput? = null
var hmdAdded = false
if (!hub.has(SceneryElement.HMDInput)) {
try {
val hmd = OpenVRHMD(false, true)
if (hmd.initializedAndWorking()) {
hub.add(SceneryElement.HMDInput, hmd)
ti = hmd
} else {
logger.warn("Could not initialise VR headset, just activating stereo rendering.")

if (vrActive) {

// VR activation logic
if (!hub.has(SceneryElement.HMDInput)) {
try {
val hmd = OpenVRHMD(false, true)
if (hmd.initializedAndWorking()) {
hub.add(SceneryElement.HMDInput, hmd)
ti = hmd
} else {
logger.warn("Could not initialise VR headset, just activating stereo rendering.")
}
} catch (e: Exception) {
logger.error("Could not add OpenVRHMD: $e")
}
hmdAdded = true
} catch (e: Exception) {
logger.error("Could not add OpenVRHMD: $e")
} else {
ti = hub.getWorkingHMD()
}

// Set tracker on the DetachedHeadCamera
if (ti != null) {
cam.tracker = ti
logger.info("tracker set")
}
} else {
ti = hub.getWorkingHMD()
}
if (vrActive && ti != null) {
cam.tracker = ti
} else {
// VR deactivation logic
// Convert back to normal Camera
logger.info("Shutting down VR")
cam.tracker = null
}
renderer.pushMode = false

// Enable push mode if VR is inactive, and the other way round
renderer.pushMode = !vrActive

// we need to force reloading the renderer as the HMD might require device or instance extensions
if (renderer is VulkanRenderer && hmdAdded) {
Expand All @@ -1732,8 +1767,17 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
e.printStackTrace()
}
}

renderer.toggleVR()
}
logger.debug("Replaced renderer.")
renderer.toggleVR()
// Cleanup HMD after VR has been toggled off
if (!vrActive) {
if (hub.has(SceneryElement.HMDInput)) {
val hmd = hub.get(SceneryElement.HMDInput) as? OpenVRHMD
hmd?.close()
// TODO hub.remove(hmd)
logger.debug("Closed HMD.")
}
}
}

Expand Down
Loading
Loading