-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from zegLine/create-path
Create path
- Loading branch information
Showing
19 changed files
with
2,570 additions
and
26 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
*.class | ||
|
||
# Log file | ||
*.log | ||
*.log* | ||
*.log.lck | ||
|
||
# BlueJ files | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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,65 @@ | ||
""" | ||
============================ | ||
Tracked image data server | ||
============================ | ||
Simple application that starts a server that sends images, transforms, and strings | ||
""" | ||
|
||
import pyigtl # pylint: disable=import-error | ||
from math import cos, sin, pi | ||
from time import sleep | ||
import numpy as np | ||
|
||
server = pyigtl.OpenIGTLinkServer(port=18944, local_server=True) | ||
|
||
image_size = [400, 200] | ||
|
||
timestep = 0 | ||
last_matrix = np.eye(4) | ||
|
||
while True: | ||
|
||
if not server.is_connected(): | ||
# Wait for client to connect | ||
sleep(0.1) | ||
continue | ||
|
||
# Init vars | ||
timestep += 1 | ||
theta = timestep * 0.01 | ||
|
||
# Generate transform | ||
matrix = np.eye(4) | ||
|
||
# Set position | ||
matrix[0, 3] = sin(theta) * 100.0 | ||
matrix[1, 3] = sin(theta) * cos(theta) * 100.0 | ||
|
||
# Set orientation | ||
direction = last_matrix[:3, 3] - matrix[:3, 3] | ||
angle = (-np.pi) + np.arctan2(direction[1], direction[0]) # -90 degree offset because -X is the forward direction of the IGTP pointer model | ||
nlah = np.array([[np.cos(angle), -np.sin(angle), 0], [np.sin(angle), np.cos(angle), 0], [0, 0, 1]]) | ||
matrix[:3, :3] = nlah | ||
|
||
# Debugging | ||
print(f"Y Coord: {direction[1]}") | ||
print(f"X Coord: {direction[0]}") | ||
print(f"Angle: {angle}") | ||
|
||
# Send transform message | ||
last_matrix = matrix | ||
transform_message = pyigtl.TransformMessage(matrix, device_name="ImageToReference", timestamp=1) | ||
|
||
# Send messages | ||
server.send_message(transform_message) | ||
|
||
# Print received messages | ||
messages = server.get_latest_messages() | ||
for message in messages: | ||
print(message.device_name) | ||
|
||
# Do not flood the message queue, | ||
# but allow a little time for background network transfer | ||
sleep(0.01) |
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,176 @@ | ||
Apr 11, 2024 2:04:20 AM javafx.scene.Node$FocusedProperty markInvalid | ||
FINE: ReadOnlyBooleanProperty [bean: TabPane[id=tabPane, styleClass=tab-pane], name: focused, value: true] focused=true | ||
Apr 11, 2024 2:04:20 AM javafx.scene.Scene$12 invalidated | ||
FINE: Changed focus from null to TabPane[id=tabPane, styleClass=tab-pane] | ||
Apr 11, 2024 2:04:21 AM javafx.scene.Node$FocusedProperty markInvalid | ||
FINE: ReadOnlyBooleanProperty [bean: TabPane[id=tabPane, styleClass=tab-pane], name: focused, value: false] focused=false | ||
Apr 11, 2024 2:04:21 AM javafx.scene.Node$FocusedProperty markInvalid | ||
FINE: ReadOnlyBooleanProperty [bean: ToggleButton@61665b10[styleClass=toggle-button green-toggle-button]'Connect via OpenIGTLink (localhost)', name: focused, value: true] focused=true | ||
Apr 11, 2024 2:04:21 AM javafx.scene.Scene$12 invalidated | ||
FINE: Changed focus from TabPane[id=tabPane, styleClass=tab-pane] to ToggleButton@61665b10[styleClass=toggle-button green-toggle-button]'Connect via OpenIGTLink (localhost)' | ||
Apr 11, 2024 2:04:21 AM inputOutput.OpenIGTLinkConnection <init> | ||
INFO: Starting OIGTL client | ||
Apr 11, 2024 2:04:21 AM org.medcare.igtl.network.OpenIGTClient <init> | ||
SEVERE: OpenIGTClient Exception while creating socket | ||
java.net.ConnectException: Connection refused: connect | ||
at java.base/sun.nio.ch.Net.connect0(Native Method) | ||
at java.base/sun.nio.ch.Net.connect(Net.java:579) | ||
at java.base/sun.nio.ch.Net.connect(Net.java:568) | ||
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588) | ||
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) | ||
at java.base/java.net.Socket.connect(Socket.java:633) | ||
at java.base/java.net.Socket.connect(Socket.java:583) | ||
at java.base/java.net.Socket.<init>(Socket.java:507) | ||
at java.base/java.net.Socket.<init>(Socket.java:287) | ||
at java.base/javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:271) | ||
at org.medcare.igtl.network.OpenIGTClient.<init>(OpenIGTClient.java:80) | ||
at org.medcare.igtl.network.GenericIGTLinkClient.<init>(GenericIGTLinkClient.java:23) | ||
at inputOutput.OpenIGTLinkConnection.<init>(OpenIGTLinkConnection.java:46) | ||
at inputOutput.OIGTTrackingDataSource.connect(OIGTTrackingDataSource.java:31) | ||
at controller.TrackingDataController.lambda$onConnectButtonClicked$1(TrackingDataController.java:157) | ||
at java.base/java.lang.Thread.run(Thread.java:833) | ||
|
||
Apr 11, 2024 2:04:21 AM org.medcare.igtl.network.GenericIGTLinkClient <init> | ||
FINE: Starting GenericIGTLinkClient | ||
Apr 11, 2024 2:04:21 AM mainMethod.App lambda$start$0 | ||
SEVERE: Uncaught exception in thread Thread-4 | ||
java.lang.NullPointerException: Cannot invoke "java.net.Socket.isClosed()" because "this.socket" is null | ||
at org.medcare.igtl.network.OpenIGTClient.isConnected(OpenIGTClient.java:246) | ||
at org.medcare.igtl.network.GenericIGTLinkClient$Sender.run(GenericIGTLinkClient.java:246) | ||
|
||
Apr 11, 2024 2:04:22 AM javafx.scene.Node$FocusedProperty markInvalid | ||
FINE: ReadOnlyBooleanProperty [bean: ToggleButton@61665b10[styleClass=toggle-button green-toggle-button]'Connect via OpenIGTLink (localhost)', name: focused, value: false] focused=false | ||
Apr 11, 2024 2:04:22 AM javafx.scene.Node$FocusedProperty markInvalid | ||
FINE: ReadOnlyBooleanProperty [bean: Button[id=visualizeTrackingBtn, styleClass=button]'Start Tracking and Visualization', name: focused, value: true] focused=true | ||
Apr 11, 2024 2:04:22 AM javafx.scene.Scene$12 invalidated | ||
FINE: Changed focus from ToggleButton@61665b10[styleClass=toggle-button green-toggle-button]'Connect via OpenIGTLink (localhost)' to Button[id=visualizeTrackingBtn, styleClass=button]'Start Tracking and Visualization' | ||
Apr 11, 2024 2:04:22 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:22 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:22 AM algorithm.VisualizationManager loadLastSTLModels | ||
INFO: STL file read from: C:\GitHub\IGTPrototypingTool\src\test\resources\Tool13_v2.stl | ||
Apr 11, 2024 2:04:22 AM algorithm.VisualizationManager loadLastSTLModels | ||
INFO: STL file read from: C:\GitHub\IGTPrototypingTool\src\test\resources\Phantom_final-decimated25000.stl | ||
Apr 11, 2024 2:04:22 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:22 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:22 AM javafx.scene.Node$FocusedProperty markInvalid | ||
FINE: ReadOnlyBooleanProperty [bean: Button[id=visualizeTrackingBtn, styleClass=button]'Start Tracking and Visualization', name: focused, value: false] focused=false | ||
Apr 11, 2024 2:04:22 AM javafx.scene.Scene$12 invalidated | ||
FINE: Changed focus from Button[id=visualizeTrackingBtn, styleClass=button]'Start Tracking and Visualization' to null | ||
Apr 11, 2024 2:04:22 AM javafx.scene.Node$FocusedProperty markInvalid | ||
FINE: ReadOnlyBooleanProperty [bean: ToggleButton[id=freezeTglBtn, styleClass=toggle-button]'Freeze / Unfreeze', name: focused, value: true] focused=true | ||
Apr 11, 2024 2:04:22 AM javafx.scene.Scene$12 invalidated | ||
FINE: Changed focus from null to ToggleButton[id=freezeTglBtn, styleClass=toggle-button]'Freeze / Unfreeze' | ||
Apr 11, 2024 2:04:22 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:23 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:23 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:23 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:23 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:23 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:23 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:23 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:23 AM javafx.scene.Node$FocusedProperty markInvalid | ||
FINE: ReadOnlyBooleanProperty [bean: ToggleButton[id=freezeTglBtn, styleClass=toggle-button]'Freeze / Unfreeze', name: focused, value: false] focused=false | ||
Apr 11, 2024 2:04:23 AM javafx.scene.Node$FocusedProperty markInvalid | ||
FINE: ReadOnlyBooleanProperty [bean: ToggleButton@61665b10[styleClass=toggle-button green-toggle-button]'Connect via OpenIGTLink (localhost)', name: focused, value: true] focused=true | ||
Apr 11, 2024 2:04:23 AM javafx.scene.Scene$12 invalidated | ||
FINE: Changed focus from ToggleButton[id=freezeTglBtn, styleClass=toggle-button]'Freeze / Unfreeze' to ToggleButton@61665b10[styleClass=toggle-button green-toggle-button]'Connect via OpenIGTLink (localhost)' | ||
Apr 11, 2024 2:04:23 AM algorithm.TrackingDataManager getNextData | ||
WARNING: Toollist is empty. | ||
Apr 11, 2024 2:04:23 AM mainMethod.App lambda$start$0 | ||
SEVERE: Uncaught exception in thread JavaFX Application Thread | ||
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException | ||
at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1857) | ||
at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1724) | ||
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) | ||
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234) | ||
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) | ||
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) | ||
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49) | ||
at javafx.base/javafx.event.Event.fireEvent(Event.java:198) | ||
at javafx.graphics/javafx.scene.Node.fireEvent(Node.java:8792) | ||
at javafx.controls/javafx.scene.control.ToggleButton.fire(ToggleButton.java:257) | ||
at javafx.controls/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:208) | ||
at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274) | ||
at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247) | ||
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80) | ||
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234) | ||
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) | ||
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) | ||
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) | ||
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) | ||
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) | ||
at javafx.base/javafx.event.Event.fireEvent(Event.java:198) | ||
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3897) | ||
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1878) | ||
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2623) | ||
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411) | ||
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301) | ||
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) | ||
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450) | ||
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424) | ||
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449) | ||
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:557) | ||
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:943) | ||
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) | ||
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184) | ||
at java.base/java.lang.Thread.run(Thread.java:833) | ||
Caused by: java.lang.reflect.InvocationTargetException | ||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | ||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) | ||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | ||
at java.base/java.lang.reflect.Method.invoke(Method.java:568) | ||
at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:77) | ||
at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source) | ||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | ||
at java.base/java.lang.reflect.Method.invoke(Method.java:568) | ||
at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:275) | ||
at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:84) | ||
at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1854) | ||
... 58 more | ||
Caused by: java.lang.NullPointerException: Cannot invoke "org.medcare.igtl.network.ResponseQueueManager.destroy()" because "this.responseQueue" is null | ||
at org.medcare.igtl.network.OpenIGTClient.interrupt(OpenIGTClient.java:207) | ||
at org.medcare.igtl.network.GenericIGTLinkClient.stopClient(GenericIGTLinkClient.java:160) | ||
at inputOutput.OpenIGTLinkConnection.stop(OpenIGTLinkConnection.java:145) | ||
at inputOutput.OIGTTrackingDataSource.closeConnection(OIGTTrackingDataSource.java:91) | ||
at controller.TrackingDataController.disconnectSource(TrackingDataController.java:185) | ||
at controller.TrackingDataController.onConnectButtonClicked(TrackingDataController.java:152) | ||
... 69 more | ||
|
||
Apr 11, 2024 2:04:24 AM javafx.scene.Node$FocusedProperty markInvalid | ||
FINE: ReadOnlyBooleanProperty [bean: ToggleButton@61665b10[styleClass=toggle-button green-toggle-button]'Connect via OpenIGTLink (localhost)', name: focused, value: false] focused=false |
Empty file.
Oops, something went wrong.