Mercurial > hg > orthanc-java
changeset 29:118adbad648f
sharing common properties between samples
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 12 Jun 2024 14:44:37 +0200 |
parents | 43923934e934 |
children | 296798e75896 |
files | .reuse/dep5 Samples/Basic/NOTES.txt Samples/Basic/configuration.json Samples/Basic/configuration.json.license Samples/Basic/pom.xml Samples/Dcm4Che/NOTES.txt Samples/Dcm4Che/configuration.json Samples/Dcm4Che/configuration.json.license Samples/Dcm4Che/pom.xml Samples/FHIR/NOTES.txt Samples/FHIR/configuration.json Samples/FHIR/pom.xml Samples/MammographyDeepLearning/NOTES.txt Samples/MammographyDeepLearning/configuration.json Samples/MammographyDeepLearning/pom.xml Samples/global.properties |
diffstat | 16 files changed, 179 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/.reuse/dep5 Wed Jun 12 13:58:29 2024 +0200 +++ b/.reuse/dep5 Wed Jun 12 14:44:37 2024 +0200 @@ -3,7 +3,7 @@ Upstream-Contact: Sebastien Jodogne <s.jodogne@gmail.com> Source: https://orthanc.uclouvain.be/ -Files: NEWS README Samples/Basic/NOTES.txt Samples/Dcm4Che/NOTES.txt Samples/FHIR/NOTES.txt Samples/FHIR/configuration.json Samples/MammographyDeepLearning/NOTES.txt Samples/MammographyDeepLearning/configuration.json +Files: NEWS README Samples/Basic/NOTES.txt Samples/Dcm4Che/NOTES.txt Samples/FHIR/NOTES.txt Samples/MammographyDeepLearning/NOTES.txt Copyright: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium License: CC0-1.0
--- a/Samples/Basic/NOTES.txt Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/Basic/NOTES.txt Wed Jun 12 14:44:37 2024 +0200 @@ -15,14 +15,17 @@ (2) Compile the Java plugin using Maven: # cd ../../Samples/Basic -# mvn package +# mvn compile package (3) Start Orthanc: -On Ubuntu 22.04: +On Ubuntu 20.04 or 22.04 (replace "mainline" with the version of the +Java plugin for Orthanc): -# LD_LIBRARY_PATH=/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/ Orthanc ./configuration.json +# LD_LIBRARY_PATH=/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/ \ + ORTHANC_JAVA_VERSION=mainline \ + Orthanc ./configuration.json (4) Call the REST API implemented by the Java plugin:
--- a/Samples/Basic/configuration.json Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/Basic/configuration.json Wed Jun 12 14:44:37 2024 +0200 @@ -1,8 +1,13 @@ +/** + * SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium + * SPDX-License-Identifier: GPL-3.0-or-later + **/ + { "Plugins" : [ "../../Plugin/Build" ], "Java" : { "Enabled" : true, - "Classpath" : "target/Sample-0.0-SNAPSHOT-jar-with-dependencies.jar", + "Classpath" : "target/OrthancBasic-${ORTHANC_JAVA_VERSION}-jar-with-dependencies.jar", "InitializationClass" : "Main" } }
--- a/Samples/Basic/configuration.json.license Wed Jun 12 13:58:29 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium -# SPDX-License-Identifier: GPL-3.0-or-later
--- a/Samples/Basic/pom.xml Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/Basic/pom.xml Wed Jun 12 14:44:37 2024 +0200 @@ -60,12 +60,32 @@ </executions> </plugin> + <!-- Sharing properties between the samples --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>properties-maven-plugin</artifactId> + <version>1.0.0</version> + <executions> + <execution> + <phase>initialize</phase> + <goals> + <goal>read-project-properties</goal> + </goals> + <configuration> + <files> + <file>${project.basedir}/../global.properties</file> + </files> + </configuration> + </execution> + </executions> + </plugin> + </plugins> </build> <groupId>OrthancJava</groupId> - <artifactId>Sample</artifactId> - <version>0.0-SNAPSHOT</version> + <artifactId>OrthancBasic</artifactId> + <version>${orthanc_java.version}</version> <dependencies> </dependencies>
--- a/Samples/Dcm4Che/NOTES.txt Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/Dcm4Che/NOTES.txt Wed Jun 12 14:44:37 2024 +0200 @@ -15,14 +15,17 @@ (2) Compile the Java plugin using Maven: # cd ../../Samples/Dcm4Che -# mvn package +# mvn compile package (3) Start Orthanc: -On Ubuntu 22.04: +On Ubuntu 20.04 or 22.04 (replace "mainline" with the version of the +Java plugin for Orthanc): -# LD_LIBRARY_PATH=/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/ Orthanc ./configuration.json +# LD_LIBRARY_PATH=/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/ \ + ORTHANC_JAVA_VERSION=mainline \ + Orthanc ./configuration.json (4) Send an arbitrary DICOM file to Java:
--- a/Samples/Dcm4Che/configuration.json Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/Dcm4Che/configuration.json Wed Jun 12 14:44:37 2024 +0200 @@ -1,8 +1,13 @@ +/** + * SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium + * SPDX-License-Identifier: GPL-3.0-or-later + **/ + { "Plugins" : [ "../../Plugin/Build" ], "Java" : { "Enabled" : true, - "Classpath" : "target/Sample-0.0-SNAPSHOT-jar-with-dependencies.jar", + "Classpath" : "target/OrthancDcm4Che-${ORTHANC_JAVA_VERSION}-jar-with-dependencies.jar", "InitializationClass" : "Main" } }
--- a/Samples/Dcm4Che/configuration.json.license Wed Jun 12 13:58:29 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium -# SPDX-License-Identifier: GPL-3.0-or-later
--- a/Samples/Dcm4Che/pom.xml Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/Dcm4Che/pom.xml Wed Jun 12 14:44:37 2024 +0200 @@ -60,12 +60,32 @@ </executions> </plugin> + <!-- Sharing properties between the samples --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>properties-maven-plugin</artifactId> + <version>1.0.0</version> + <executions> + <execution> + <phase>initialize</phase> + <goals> + <goal>read-project-properties</goal> + </goals> + <configuration> + <files> + <file>${project.basedir}/../global.properties</file> + </files> + </configuration> + </execution> + </executions> + </plugin> + </plugins> </build> <groupId>OrthancJava</groupId> - <artifactId>Sample</artifactId> - <version>0.0-SNAPSHOT</version> + <artifactId>OrthancDcm4Che</artifactId> + <version>${orthanc_java.version}</version> <repositories> <repository>
--- a/Samples/FHIR/NOTES.txt Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/FHIR/NOTES.txt Wed Jun 12 14:44:37 2024 +0200 @@ -1,7 +1,7 @@ This sample Java plugin runs a FHIR server based on the HAPI library. -Note that contrarily to the other samples that can run using Java 1.8, -this Java plugin requires Java 11. +Note that contrarily to the "Basic" and "Dcm4Che" samples that can run +using Java 1.8, this Java plugin requires Java 11. (1) Make sure to build the C++ plugin: @@ -15,14 +15,20 @@ (2) Compile the Java plugin using Maven: # cd ../../Samples/FHIR -# mvn package +# mvn compile package (3) Start Orthanc: -On Ubuntu 20.04 or 22.04: +On Ubuntu 20.04 or 22.04 (replace "mainline" with the version of the +Java plugin for Orthanc): -# LD_LIBRARY_PATH=/usr/lib/jvm/java-11-openjdk-amd64/lib/server/ Orthanc ./configuration.json +# LD_LIBRARY_PATH=/usr/lib/jvm/java-11-openjdk-amd64/lib/server/ \ + ORTHANC_JAVA_VERSION=mainline \ + Orthanc ./configuration.json + +IMPORTANT: The DICOMweb plugin must be installed in the current +directory. (4) Access the FHIR server. For instance, using the FHIRPACK
--- a/Samples/FHIR/configuration.json Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/FHIR/configuration.json Wed Jun 12 14:44:37 2024 +0200 @@ -1,3 +1,8 @@ +/** + * SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium + * SPDX-License-Identifier: GPL-3.0-or-later + **/ + { "Plugins" : [ "../../Plugin/Build", @@ -5,7 +10,7 @@ ], "Java" : { "Enabled" : true, - "Classpath" : "target/OrthancFHIR-mainline-jar-with-dependencies.jar", + "Classpath" : "target/OrthancFHIR-${ORTHANC_JAVA_VERSION}-jar-with-dependencies.jar", "InitializationClass" : "Main" } }
--- a/Samples/FHIR/pom.xml Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/FHIR/pom.xml Wed Jun 12 14:44:37 2024 +0200 @@ -61,12 +61,32 @@ </executions> </plugin> + <!-- Sharing properties between the samples --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>properties-maven-plugin</artifactId> + <version>1.0.0</version> + <executions> + <execution> + <phase>initialize</phase> + <goals> + <goal>read-project-properties</goal> + </goals> + <configuration> + <files> + <file>${project.basedir}/../global.properties</file> + </files> + </configuration> + </execution> + </executions> + </plugin> + </plugins> </build> <groupId>OrthancJava</groupId> <artifactId>OrthancFHIR</artifactId> - <version>mainline</version> + <version>${orthanc_java.version}</version> <dependencies>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Samples/MammographyDeepLearning/NOTES.txt Wed Jun 12 14:44:37 2024 +0200 @@ -0,0 +1,39 @@ + +This sample Java plugin runs a deep learning algorithm for mammography. +Note that contrarily to the "Basic" and "Dcm4Che" samples that can run +using Java 1.8, this Java plugin requires Java 11. + +(1) Make sure to build the C++ plugin: + +# cd ../../Plugin/ +# mkdir Build +# cd Build +# cmake .. -DCMAKE_BUILD_TYPE=Release +# make -j4 + + +(2) Compile the Java plugin using Maven: + +# cd ../../Samples/MammographyDeepLearning +# mvn compile package + +IMPORTANT: By default, this sample plugin targets GNU/Linux +distributions. To run this plugin on Microsoft Windows or Apple macOS, +make sure to uncomment the suitable classifier section in "pom.xml" +(i.e., "win-x86_64", "osx-x86_64", or "osx-aarch64"). + + +(3) Start Orthanc: + +On Ubuntu 20.04 or 22.04 (replace "mainline" with the version of the +Java plugin for Orthanc): + +# LD_LIBRARY_PATH=/usr/lib/jvm/java-11-openjdk-amd64/lib/server/ \ + ORTHANC_JAVA_VERSION=mainline \ + Orthanc ./configuration.json + +IMPORTANT: The DICOMweb plugin must be installed in the current +directory. + + +(4) Open the Orthanc Explorer interface at: http://localhost:8042/
--- a/Samples/MammographyDeepLearning/configuration.json Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/MammographyDeepLearning/configuration.json Wed Jun 12 14:44:37 2024 +0200 @@ -1,3 +1,8 @@ +/** + * SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium + * SPDX-License-Identifier: GPL-3.0-or-later + **/ + { "Plugins" : [ "../../Plugin/Build", @@ -5,7 +10,7 @@ ], "Java" : { "Enabled" : true, - "Classpath" : "target/OrthancMammographyDeepLearning-mainline.jar", + "Classpath" : "target/OrthancMammographyDeepLearning-${ORTHANC_JAVA_VERSION}.jar", "InitializationClass" : "Main" } }
--- a/Samples/MammographyDeepLearning/pom.xml Wed Jun 12 13:58:29 2024 +0200 +++ b/Samples/MammographyDeepLearning/pom.xml Wed Jun 12 14:44:37 2024 +0200 @@ -66,12 +66,32 @@ </executions> </plugin> + <!-- Sharing properties between the samples --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>properties-maven-plugin</artifactId> + <version>1.0.0</version> + <executions> + <execution> + <phase>initialize</phase> + <goals> + <goal>read-project-properties</goal> + </goals> + <configuration> + <files> + <file>${project.basedir}/../global.properties</file> + </files> + </configuration> + </execution> + </executions> + </plugin> + </plugins> </build> <groupId>OrthancMammographyDeepLearning</groupId> <artifactId>OrthancMammographyDeepLearning</artifactId> - <version>mainline</version> + <version>${orthanc_java.version}</version> <properties> <maven.compiler.source>11</maven.compiler.source>