# HG changeset patch # User Sebastien Jodogne # Date 1719065634 -7200 # Node ID 08ea8401f7b205a953690bee57bdc3175d247616 # Parent 4faec1378b89d910b74c0381626a0b52ac67214b mammography plugin checking whether DICOMweb plugin is installed diff -r 4faec1378b89 -r 08ea8401f7b2 Samples/MammographyDeepLearning/src/main/java/Main.java --- a/Samples/MammographyDeepLearning/src/main/java/Main.java Fri Jun 14 15:03:10 2024 +0200 +++ b/Samples/MammographyDeepLearning/src/main/java/Main.java Sat Jun 22 16:13:54 2024 +0200 @@ -31,6 +31,7 @@ import be.uclouvain.orthanc.ResourceType; import be.uclouvain.orthanc.RestOutput; import org.apache.commons.compress.utils.IOUtils; +import org.json.JSONArray; import org.json.JSONObject; import java.awt.image.BufferedImage; @@ -113,6 +114,19 @@ if (!connection.isOrthancVersionAbove(1, 12, 5)) { throw new RuntimeException("Your version of Orthanc must be >= 1.12.5 to run this plugin"); } + + JSONArray plugins = new JSONArray(connection.doGetAsString("/plugins")); + + boolean hasDicomWeb = false; + for (int i = 0; i < plugins.length() && !hasDicomWeb; i++) { + if (plugins.getString(i).equals("dicom-web")) { + hasDicomWeb = true; + } + } + + if (!hasDicomWeb) { + throw new RuntimeException("The DICOMweb plugin is required, but is not installed"); + } } catch (IOException | InterruptedException e) { throw new RuntimeException(e); }