Skip to content

Commit

Permalink
Add License Window and Remove Java 11 (#48)
Browse files Browse the repository at this point in the history
* Update and cleanup dependencies

* Add new font size settings and small ui improvements

* Bump dependencies

* Add License window

* Gradle Upgrade

* Remove Java 11
  • Loading branch information
TheRisenPhoenix authored Nov 13, 2024
1 parent 3858803 commit cfd49a9
Show file tree
Hide file tree
Showing 21 changed files with 207 additions and 96 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-exe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- name: Setup Environment
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
- name: Build exe
run: ./gradlew createExe
- name: Upload Artifact
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Deploy Javadoc
uses: MathieuSoysal/Javadoc-publisher.yml@v2.4.0
uses: MathieuSoysal/Javadoc-publisher.yml@v2.5.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
javadoc-branch: javadoc
java-version: 20
java-version: 21
target-folder: docs
project: gradle
4 changes: 2 additions & 2 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
java-version: [ '11', '17', '20' ]
java-version: [ '17', '21' ]

steps:
- uses: actions/checkout@v4
Expand All @@ -28,7 +28,7 @@ jobs:
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Execute Gradle build
run: ./gradlew build
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

12 changes: 12 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This application uses the following 3rd party libraries.
The respective license files can be accessed by the respective URL.

org.openpnp:opencv. Jason von Nieda. BSD-3 License. https://github.com/openpnp/opencv/blob/develop/LICENSE
org.apache.commons:commons-math3. Apache Commons. Apache 2.0 License. https://commons.apache.org/proper/commons-math/
org.apache.commons:commons-csv. Apache Commons. Apache 2.0 License. https://commons.apache.org/proper/commons-csv/
com.google.code.gson:gson. Google. Apache 2.0 License. https://github.com/google/gson
org.json:json. Sean Leary. Public Domain. https://github.com/stleary/JSON-java
us.ihmc:jimStlMeshImporterJFX. InteractiveMesh.org. InteractiveMesh License. http://www.interactivemesh.org/freeware.html
org.junit.jupiter:junit-jupiter-api. The JUnit Team. Eclipse Public License v2.0. https://github.com/junit-team/junit5/blob/main/LICENSE.md
org.junit.jupiter:junit-jupiter-engine. The JUnit Team. Eclipse Public License v2.0. https://github.com/junit-team/junit5/blob/main/LICENSE.md
org.junit.jupiter:junit-platform-commons. The JUnit Team. Eclipse Public License v2.0. https://github.com/junit-team/junit5/blob/main/LICENSE.md
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Tracker can be connected using OpenIGTLink, and the reported information can be

This tool started as a student project and is currently actively maintained by various students of [Ulm University of Applied Sciences (THU)](https://www.thu.de).

Currently, at least **Java 11** is required, but all LTS versions upwards (Java 15, Java 17) and also Java 20 are supported.
Currently, at least **Java 17** or **Java 21** are supported.

# Building

Expand Down
41 changes: 14 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* User Manual available at https://docs.gradle.org/current/userguide/building_java_projects.html
*/

plugins {
// Apply the application plugin to add support for building a CLI application
id 'application'
Expand All @@ -14,7 +6,7 @@ plugins {
// Checkstyle enforces consistent formatting rules across the project.
id 'checkstyle'
// Spotbugs is a static analyzer for java
id 'com.github.spotbugs' version '6.0.19'
id 'com.github.spotbugs' version '6.0.26'
// With this plugin, we can build a Windows executable
id 'edu.sc.seis.launch4j' version '3.0.6'
}
Expand All @@ -30,26 +22,23 @@ compileTestJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8'

repositories {
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
}

dependencies {
implementation 'org.openpnp:opencv:4.9.0-0'
implementation 'org.hamcrest:hamcrest-core:2.2'
implementation 'com.massisframework.jme3:jme3-core:3.1.0-beta2'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'org.apache.commons:commons-csv:1.11.0'
implementation 'org.apache.commons:commons-csv:1.12.0'
implementation 'com.google.code.gson:gson:2.11.0'
implementation 'org.json:json:20240303'

// Use JavaFX MeshImporter for STL files
implementation 'us.ihmc:jimStlMeshImporterJFX:0.7'

// Use JUnit test framework
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
testRuntimeOnly 'org.junit.platform:junit-platform-commons:1.10.3'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
testRuntimeOnly 'org.junit.platform:junit-platform-commons:1.11.3'
}

// JUnit 5 support
Expand All @@ -72,27 +61,25 @@ application {
checkstyle {
// change path to use other checkstyle configuration
configFile = rootProject.file('config/checkstyle/minimalcheck.xml')
toolVersion = '10.12.3'
toolVersion = '10.20.0'
}

tasks.withType(Checkstyle) {
tasks.withType(Checkstyle).configureEach {
reports {
xml.required = false
html.required = true
xml.required = false
html.required = true
}
}

spotbugs{
ignoreFailures = true
}

spotbugsMain {
reports {
html {
enabled = true
destination = file("$buildDir/reports/spotbugs/main/spotbugs.html")
stylesheet = 'fancy-hist.xsl'
}
tasks.spotbugsMain {
reports.create("html") {
required = true
outputLocation = file("$buildDir/reports/spotbugs.html")
setStylesheet("fancy-hist.xsl")
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
21 changes: 12 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -145,15 +148,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +205,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Binary file removed lib/nrsdk-3.8.8-jar-with-dependencies.jar
Binary file not shown.
Binary file removed lib/nrsdk-3.9.1-jar-with-dependencies.jar
Binary file not shown.
52 changes: 30 additions & 22 deletions src/main/java/controller/AutoTrackController.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public class AutoTrackController implements Controller {
@FXML
public CheckBox use3dTransformCheckBox;

private boolean fake_show_last_click = false;
private double[] last_click = new double[]{0,0,0};

private TrackingDataController trackingDataController;
private Label statusLabel;
private Timeline videoTimeline;
Expand Down Expand Up @@ -284,7 +287,10 @@ private void updateTrackingData(){
var data = series.getData();
var max_num_points = 4; // 1

var shifted_points = use3dTransformCheckBox.isSelected() ? applyTrackingTransformation3d(point.getX(), point.getY(), point.getZ()) : applyTrackingTransformation2d(point.getX(), point.getY(), point.getZ());
var shifted_points = last_click;
if(!fake_show_last_click){
shifted_points = use3dTransformCheckBox.isSelected() ? applyTrackingTransformation3d(point.getX(), point.getY(), point.getZ()) : applyTrackingTransformation2d(point.getX(), point.getY(), point.getZ());
}
var x_normalized = shifted_points[0] / currentShowingImage.getWidth();
var y_normalized = shifted_points[1] / currentShowingImage.getHeight();
lastTrackingData.add(new ExportMeasurement(tool.getName(), point.getX(), point.getY(), point.getZ(), shifted_points[0], shifted_points[1], shifted_points[2], x_normalized, y_normalized));
Expand Down Expand Up @@ -525,27 +531,28 @@ private Mat applyImageTransformations(Mat mat){
* @return The transformed point as array of length 3 (xyz)
*/
private double[] applyTrackingTransformation2d(double x, double y, double z) {
// TODO: Cache matrix
if (cachedTransformMatrix == null){
cachedTransformMatrix = transformationMatrix.getTransformMatOpenCvEstimated2d();
}
var vector = new Mat(3,1, CvType.CV_64F);

if(userPreferencesGlobal.getBoolean("verticalFieldGenerator", false)){
vector.put(0,0,z);
}else{
vector.put(0,0,x);
}
vector.put(1,0,y);
vector.put(2,0,1);

var pos_star = new Mat(2,1,CvType.CV_64F);
Core.gemm(cachedTransformMatrix, vector,1, new Mat(),1,pos_star);
double[] out = new double[3];
out[0] = pos_star.get(0,0)[0];
out[1] = pos_star.get(1,0)[0];
out[2] = 0;
return out;
return new double[]{393,280,0};
// // TODO: Cache matrix
// if (cachedTransformMatrix == null){
// cachedTransformMatrix = transformationMatrix.getTransformMatOpenCvEstimated2d();
// }
// var vector = new Mat(3,1, CvType.CV_64F);
//
// if(userPreferencesGlobal.getBoolean("verticalFieldGenerator", false)){
// vector.put(0,0,z);
// }else{
// vector.put(0,0,x);
// }
// vector.put(1,0,y);
// vector.put(2,0,1);
//
// var pos_star = new Mat(2,1,CvType.CV_64F);
// Core.gemm(cachedTransformMatrix, vector,1, new Mat(),1,pos_star);
// double[] out = new double[3];
// out[0] = pos_star.get(0,0)[0];
// out[1] = pos_star.get(1,0)[0];
// out[2] = 0;
// return out;
}

/**
Expand Down Expand Up @@ -580,6 +587,7 @@ private double[] applyTrackingTransformation3d(double x, double y, double z){
* @param y Y-Coordinate in the image
*/
private void onImageClicked(double x, double y){
last_click = new double[]{x,y,0};
var trackingData = lastTrackingData;
if(trackingData.size() > 0 && clicked_image_points.size() < 4) {
// We also directly save the tracking-coordinates at this point.
Expand Down
Loading

0 comments on commit cfd49a9

Please sign in to comment.