Mercurial > hg > orthanc-java
changeset 63:1bc05cacb6fc
fix samples
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 14 Aug 2025 18:13:57 +0200 |
parents | cc91717e2354 |
children | 9817ca245a49 |
files | .hgignore JavaSDK/CMakeLists.txt Samples/Basic/NOTES.txt Samples/Basic/configuration.json Samples/Basic/pom.xml Samples/Dcm4Che/pom.xml Samples/FHIR/pom.xml Samples/MammographyDeepLearning/pom.xml |
diffstat | 8 files changed, 63 insertions(+), 65 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Thu Aug 14 17:27:40 2025 +0200 +++ b/.hgignore Thu Aug 14 18:13:57 2025 +0200 @@ -5,6 +5,8 @@ *.orig *~ CodeGeneration/__pycache__/ +JavaSDK/Build/ +JavaSDK/OrthancJavaSDK.jar JavaSDK/i/ Plugin/Build/ Plugin/ThirdPartyDownloads/
--- a/JavaSDK/CMakeLists.txt Thu Aug 14 17:27:40 2025 +0200 +++ b/JavaSDK/CMakeLists.txt Thu Aug 14 18:13:57 2025 +0200 @@ -90,3 +90,8 @@ WORKING_DIRECTORY ${JAVADOC_OUTPUT_DIR} COMMENT "Generating SDK documentation with javadoc" VERBATIM ) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/OrthancJavaSDK.jar + DESTINATION . + )
--- a/Samples/Basic/NOTES.txt Thu Aug 14 17:27:40 2025 +0200 +++ b/Samples/Basic/NOTES.txt Thu Aug 14 18:13:57 2025 +0200 @@ -8,17 +8,26 @@ # cd ../../Plugin/ # mkdir Build # cd Build -# cmake .. -DCMAKE_BUILD_TYPE=Release +# cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_ORTHANC_SDK=OFF # make -j4 -(2) Compile the Java plugin using Maven: +(2) Make sure to build the Java wrapper: + +# cd ../../JavaSDK/ +# mkdir Build +# cd Build +# cmake .. -DUSE_SYSTEM_ORTHANC_SDK=OFF -DCMAKE_INSTALL_PREFIX=.. +# make -j4 install + + +(3) Compile the Java plugin using Maven: # cd ../../Samples/Basic # mvn compile package -(3) Start Orthanc: +(4) Start Orthanc: On Ubuntu 20.04 or 22.04 (replace "mainline" with the version of the Java plugin for Orthanc): @@ -28,7 +37,7 @@ Orthanc ./configuration.json -(4) Call the REST API implemented by the Java plugin: +(5) Call the REST API implemented by the Java plugin: # curl http://localhost:8042/java Hello from Java!
--- a/Samples/Basic/configuration.json Thu Aug 14 17:27:40 2025 +0200 +++ b/Samples/Basic/configuration.json Thu Aug 14 18:13:57 2025 +0200 @@ -7,7 +7,7 @@ "Plugins" : [ "../../Plugin/Build" ], "Java" : { "Enabled" : true, - "Classpath" : "target/OrthancBasic-${ORTHANC_JAVA_VERSION}-jar-with-dependencies.jar", + "Classpath" : "target/OrthancBasic-${ORTHANC_JAVA_VERSION}-jar-with-dependencies.jar:../../JavaSDK/OrthancJavaSDK.jar", "InitializationClass" : "Main" } }
--- a/Samples/Basic/pom.xml Thu Aug 14 17:27:40 2025 +0200 +++ b/Samples/Basic/pom.xml Thu Aug 14 18:13:57 2025 +0200 @@ -40,26 +40,6 @@ </configuration> </plugin> - <!-- Include the Orthanc Java SDK --> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>${project.basedir}/../../JavaSDK/be/uclouvain/orthanc</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <!-- Sharing properties between the samples --> <plugin> <groupId>org.codehaus.mojo</groupId> @@ -88,5 +68,15 @@ <version>${orthanc_java.version}</version> <dependencies> + + <!-- Include the Orthanc Java SDK --> + <dependency> + <artifactId>OrthancJavaSDK</artifactId> + <groupId>OrthancJavaSDK</groupId> + <scope>system</scope> + <version>mainline</version> + <systemPath>${project.basedir}/../../JavaSDK/OrthancJavaSDK.jar</systemPath> + </dependency> + </dependencies> </project>
--- a/Samples/Dcm4Che/pom.xml Thu Aug 14 17:27:40 2025 +0200 +++ b/Samples/Dcm4Che/pom.xml Thu Aug 14 18:13:57 2025 +0200 @@ -40,26 +40,6 @@ </configuration> </plugin> - <!-- Include the Orthanc Java SDK --> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>${project.basedir}/../../JavaSDK/be/uclouvain/orthanc</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <!-- Sharing properties between the samples --> <plugin> <groupId>org.codehaus.mojo</groupId> @@ -95,11 +75,22 @@ </repositories> <dependencies> + + <!-- Include the Orthanc Java SDK --> + <dependency> + <artifactId>OrthancJavaSDK</artifactId> + <groupId>OrthancJavaSDK</groupId> + <scope>system</scope> + <version>mainline</version> + <systemPath>${project.basedir}/../../JavaSDK/OrthancJavaSDK.jar</systemPath> + </dependency> + <!-- https://mvnrepository.com/artifact/org.dcm4che/dcm4che-core --> <dependency> <groupId>org.dcm4che</groupId> <artifactId>dcm4che-core</artifactId> <version>5.29.1</version> </dependency> + </dependencies> </project>
--- a/Samples/FHIR/pom.xml Thu Aug 14 17:27:40 2025 +0200 +++ b/Samples/FHIR/pom.xml Thu Aug 14 18:13:57 2025 +0200 @@ -41,26 +41,6 @@ </configuration> </plugin> - <!-- Include the Orthanc Java SDK --> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-source</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>${project.basedir}/../../JavaSDK/be/uclouvain/orthanc</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - <!-- Sharing properties between the samples --> <plugin> <groupId>org.codehaus.mojo</groupId> @@ -102,6 +82,16 @@ <dependencies> + <!-- Include the Orthanc Java SDK --> + <dependency> + <artifactId>OrthancJavaSDK</artifactId> + <groupId>OrthancJavaSDK</groupId> + <scope>system</scope> + <version>mainline</version> + <systemPath>${project.basedir}/../../JavaSDK/OrthancJavaSDK.jar</systemPath> + </dependency> + + <!-- Include HAPI --> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId>
--- a/Samples/MammographyDeepLearning/pom.xml Thu Aug 14 17:27:40 2025 +0200 +++ b/Samples/MammographyDeepLearning/pom.xml Thu Aug 14 18:13:57 2025 +0200 @@ -120,6 +120,17 @@ </dependencyManagement> <dependencies> + + <!-- Include the Orthanc Java SDK --> + <dependency> + <artifactId>OrthancJavaSDK</artifactId> + <groupId>OrthancJavaSDK</groupId> + <scope>system</scope> + <version>mainline</version> + <systemPath>${project.basedir}/../../JavaSDK/OrthancJavaSDK.jar</systemPath> + </dependency> + + <!-- Include Deep Java Library --> <dependency> <groupId>ai.djl</groupId> <artifactId>api</artifactId>