Mercurial > hg > orthanc-java
changeset 62:cc91717e2354
auto-generation of Java wrapper is now part of the build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 14 Aug 2025 17:27:40 +0200 |
parents | 97047be8435a |
children | 1bc05cacb6fc |
files | CodeGeneration/CodeGeneration.py CodeGeneration/CodeModel.py CodeGeneration/JavaCodeGeneration.py JavaSDK/CMakeLists.txt JavaSDK/be/uclouvain/orthanc/ChangeType.java JavaSDK/be/uclouvain/orthanc/CompressionType.java JavaSDK/be/uclouvain/orthanc/ConstraintType.java JavaSDK/be/uclouvain/orthanc/ContentType.java JavaSDK/be/uclouvain/orthanc/CreateDicomFlags.java JavaSDK/be/uclouvain/orthanc/DicomInstance.java JavaSDK/be/uclouvain/orthanc/DicomToJsonFlags.java JavaSDK/be/uclouvain/orthanc/DicomToJsonFormat.java JavaSDK/be/uclouvain/orthanc/DicomWebBinaryMode.java JavaSDK/be/uclouvain/orthanc/DicomWebNode.java JavaSDK/be/uclouvain/orthanc/ErrorCode.java JavaSDK/be/uclouvain/orthanc/FindAnswers.java JavaSDK/be/uclouvain/orthanc/FindMatcher.java JavaSDK/be/uclouvain/orthanc/FindQuery.java JavaSDK/be/uclouvain/orthanc/Functions.java JavaSDK/be/uclouvain/orthanc/HttpMethod.java JavaSDK/be/uclouvain/orthanc/IdentifierConstraint.java JavaSDK/be/uclouvain/orthanc/Image.java JavaSDK/be/uclouvain/orthanc/ImageFormat.java JavaSDK/be/uclouvain/orthanc/InstanceOrigin.java JavaSDK/be/uclouvain/orthanc/Job.java JavaSDK/be/uclouvain/orthanc/JobStepStatus.java JavaSDK/be/uclouvain/orthanc/JobStopReason.java JavaSDK/be/uclouvain/orthanc/MetricsType.java JavaSDK/be/uclouvain/orthanc/NativeSDK.java JavaSDK/be/uclouvain/orthanc/Peers.java JavaSDK/be/uclouvain/orthanc/PixelFormat.java JavaSDK/be/uclouvain/orthanc/ReceivedInstanceAction.java JavaSDK/be/uclouvain/orthanc/ResourceType.java JavaSDK/be/uclouvain/orthanc/RestOutput.java JavaSDK/be/uclouvain/orthanc/ServerChunkedRequestReader.java JavaSDK/be/uclouvain/orthanc/StorageArea.java JavaSDK/be/uclouvain/orthanc/StorageCommitmentFailureReason.java JavaSDK/be/uclouvain/orthanc/ValueRepresentation.java JavaSDK/be/uclouvain/orthanc/WorklistAnswers.java JavaSDK/be/uclouvain/orthanc/WorklistQuery.java OrthancSDKVersion.cmake Plugin/CMakeLists.txt |
diffstat | 42 files changed, 99 insertions(+), 6247 deletions(-) [+] |
line wrap: on
line diff
--- a/CodeGeneration/CodeGeneration.py Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,482 +0,0 @@ -#!/usr/bin/env python3 - -# SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium -# SPDX-License-Identifier: GPL-3.0-or-later - -# Java plugin for Orthanc -# Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - - -import argparse -import json -import os -import pystache -import re - - -SOURCE = os.path.abspath(os.path.dirname(__file__)) - -with open(os.path.join(os.path.dirname(__file__), '..', 'OrthancSDKVersion.cmake'), 'r') as f: - m = re.match('^set\(ORTHANC_SDK_VERSION "([0-9.]+)"\)$', f.read(), re.MULTILINE) - assert(m != None) - PLUGIN_SDK_VERSION = m.group(1) - - -parser = argparse.ArgumentParser(description = 'Generate Java wrapper from code model.') -parser.add_argument('--source', - default = os.path.join(SOURCE, '..', 'Resources', 'CodeModel-%s.json' % PLUGIN_SDK_VERSION), - help = 'location of the JSON code model') - -args = parser.parse_args() - - - -TARGET = os.path.join(SOURCE, '..', 'JavaSDK', 'be', 'uclouvain', 'orthanc') - -with open(args.source, 'r') as f: - model = json.loads(f.read()) - -with open(os.path.join(SOURCE, 'ClassDocumentation.json'), 'r') as f: - classDocumentation = json.loads(f.read()) - - -renderer = pystache.Renderer( - escape = lambda u: u, # No escaping -) - - -def ToUpperCase(name): - s = '' - for i in range(len(name)): - if name[i].isupper(): - if len(s) == 0: - s += name[i] - elif name[i - 1].islower(): - s += '_' + name[i] - elif (i + 1 < len(name) and - name[i - 1].islower() and - name[i + 1].isupper()): - s += '_' + name[i] - else: - s += name[i] - else: - s += name[i].upper() - return s - - -def RemoveOrthancPluginPrefix(s, isCamelCase): - PREFIX = 'OrthancPlugin' - if s.startswith(PREFIX): - t = s[len(PREFIX):] - if isCamelCase: - t = t[0].lower() + t[1:] - return t - else: - raise Exception('Incorrect prefix: %s' % s) - - -def ConvertReturnType(f): - result = None - - if f['return_sdk_type'] == 'void': - result = { - 'c_type' : 'void', - 'is_void' : True, - 'java_signature' : 'V', - 'java_type' : 'void', - } - elif f['return_sdk_type'] in [ 'int', 'int32_t', 'uint32_t' ]: - result = { - 'c_type' : 'jint', - 'default_value' : '0', - 'is_number' : True, - 'java_signature' : 'I', - 'java_type' : 'int', - } - elif f['return_sdk_type'] in [ 'int64_t' ]: - result = { - 'c_type' : 'jlong', - 'default_value' : '0', - 'is_number' : True, - 'java_signature' : 'J', - 'java_type' : 'long', - } - elif f['return_sdk_type'] == 'OrthancPluginMemoryBuffer *': - result = { - 'c_type' : 'jbyteArray', - 'default_value' : 'NULL', - 'is_bytes' : True, - 'java_signature' : '[B', - 'java_type' : 'byte[]', - } - elif f['return_sdk_type'] == 'enumeration': - if f['return_sdk_enumeration'] == 'OrthancPluginErrorCode': - result = { - 'c_type' : 'void', - 'is_exception' : True, - 'java_signature' : 'V', - 'java_type' : 'void', - } - else: - result = { - 'c_type' : 'jint', - 'default_value' : '0', - 'is_enumeration' : True, - 'java_wrapper_type' : RemoveOrthancPluginPrefix(f['return_sdk_enumeration'], False), - 'java_signature' : 'I', - 'java_type' : 'int', - } - elif f['return_sdk_type'] == 'object': - result = { - 'c_type' : 'jlong', - 'class_name' : f['return_sdk_class'], - 'default_value' : '0', - 'is_object' : True, - 'java_wrapper_type' : RemoveOrthancPluginPrefix(f['return_sdk_class'], False), - 'java_signature' : 'J', - 'java_type' : 'long', - } - elif f['return_sdk_type'] == 'char *': - result = { - 'c_type' : 'jstring', - 'default_value' : 'NULL', - 'is_dynamic_string' : True, - 'java_signature' : 'Ljava/lang/String;', - 'java_type' : 'String', - } - elif f['return_sdk_type'] == 'const char *': - result = { - 'c_type' : 'jstring', - 'default_value' : 'NULL', - 'is_static_string' : True, - 'java_signature' : 'Ljava/lang/String;', - 'java_type' : 'String', - } - else: - raise Exception('Unsupported return type: %s' % json.dumps(f, indent=4)) - - if not 'java_wrapper_type' in result: - result['java_wrapper_type'] = result['java_type'] - - return result - -def ConvertArgument(arg): - result = None - - if arg['sdk_type'] in [ 'int', 'int32_t', 'uint32_t' ]: - result = { - 'c_type' : 'jint', - 'java_signature' : 'I', - 'java_type' : 'int', - } - elif arg['sdk_type'] == 'uint8_t': - result = { - 'c_type' : 'jbyte', - 'java_signature' : 'B', - 'java_type' : 'byte', - } - elif arg['sdk_type'] == 'uint16_t': - result = { - 'c_type' : 'jshort', - 'java_signature' : 'S', - 'java_type' : 'short', - } - elif arg['sdk_type'] == 'uint64_t': - result = { - 'c_type' : 'jlong', - 'java_signature' : 'J', - 'java_type' : 'long', - } - elif arg['sdk_type'] == 'float': - result = { - 'c_type' : 'jfloat', - 'java_signature' : 'F', - 'java_type' : 'float', - } - elif arg['sdk_type'] == 'const char *': - result = { - 'c_accessor' : 'c_%s.GetValue()' % arg['name'], - 'c_type' : 'jstring', - 'convert_string' : True, - 'java_signature' : 'Ljava/lang/String;', - 'java_type' : 'String', - } - elif arg['sdk_type'] == 'const_void_pointer_with_size': - result = { - 'c_accessor' : 'c_%s.GetData(), c_%s.GetSize()' % (arg['name'], arg['name']), - 'c_type' : 'jbyteArray', - 'convert_bytes' : True, - 'java_signature' : '[B', - 'java_type' : 'byte[]', - } - elif arg['sdk_type'] == 'enumeration': - result = { - 'c_accessor' : 'static_cast<%s>(%s)' % (arg['sdk_enumeration'], arg['name']), - 'c_type' : 'jint', - 'java_wrapper_accessor' : '%s.getValue()' % arg['sdk_name'], - 'java_wrapper_type' : RemoveOrthancPluginPrefix(arg['sdk_enumeration'], False), - 'java_signature' : 'I', - 'java_type' : 'int', - } - elif arg['sdk_type'] == 'const void *': - result = { - 'c_accessor' : 'c_%s.GetData()' % arg['name'], - 'c_type' : 'jbyteArray', - 'convert_bytes' : True, - 'java_signature' : '[B', - 'java_type' : 'byte[]', - } - elif arg['sdk_type'] in [ 'object', 'const_object' ]: - result = { - 'c_accessor' : 'reinterpret_cast<%s*>(static_cast<intptr_t>(%s))' % (arg['sdk_class'], arg['name']), - 'c_type' : 'jlong', - 'java_signature' : 'J', - 'java_type' : 'long', - 'java_wrapper_accessor' : '%s.getSelf()' % arg['sdk_name'], - 'java_wrapper_type' : RemoveOrthancPluginPrefix(arg['sdk_class'], False), - } - else: - raise Exception('Unsupported argument type: %s' % json.dumps(arg, indent=4)) - - result['name'] = arg['name'] - result['sdk_name'] = arg['sdk_name'] - - if not 'java_wrapper_type' in result: - result['java_wrapper_type'] = result['java_type'] - - if not 'java_wrapper_accessor' in result: - result['java_wrapper_accessor'] = arg['sdk_name'] - - if not 'c_accessor' in result: - result['c_accessor'] = arg['name'] - - return result - - -def FixLinesWidth(source): - target = [] - - for line in source: - for word in line.split(' '): - if len(target) == 0: - target.append(word) - elif len(target[-1]) == 0: - target[-1] = word - elif len(target[-1] + ' ' + word) <= 80: - target[-1] = target[-1] + ' ' + word - else: - target.append(word) - target.append('') - - while len(target) > 0: - if target[-1] == '': - target = target[:-1] - else: - break - - return target - - -def EncodeFunctionDocumentation(f): - documentation = f['documentation'] - - paragraphs = [ ] - if 'summary' in documentation: - paragraphs.append(documentation['summary']) - paragraphs.append('') - - if 'description' in documentation: - for line in documentation['description']: - paragraphs.append(line) - paragraphs.append('') - - if 'args' in documentation: - for arg in f['args']: - name = arg['sdk_name'] - if name in documentation['args']: - doc = documentation['args'][name] - paragraphs.append('@param %s %s' % (name, doc)) - - if 'return' in documentation: - if (f['return_sdk_type'] == 'enumeration' and - f['return_sdk_enumeration'] == 'OrthancPluginErrorCode'): - pass - elif f['return_sdk_type'] == 'object': - paragraphs.append('@return The newly constructed object.') - elif f['return_sdk_type'] in [ 'char *', 'const char *' ]: - paragraphs.append('@return The resulting string.') - elif f['return_sdk_type'] == 'OrthancPluginMemoryBuffer *': - paragraphs.append('@return The resulting memory buffer.') - else: - paragraphs.append('@return ' + documentation['return']) - - lines = FixLinesWidth(paragraphs) - - return list(map(lambda x: { 'line' : x }, lines)) - - -def EncodeFunction(className, f): - args = [] - for a in f['args']: - args.append(ConvertArgument(a)) - - if len(args) > 0: - args[-1]['last'] = True - - returnType = ConvertReturnType(f) - signature = '(%s%s)%s' % ('J' if className != None else '', - ''.join(map(lambda x: x['java_signature'], args)), - returnType['java_signature']) - - result = { - 'args' : args, - 'c_function' : f['c_function'], - 'class_name' : className, - 'has_args' : len(args) > 0, - 'java_signature' : signature, - 'return' : returnType, - 'java_name' : RemoveOrthancPluginPrefix(f['c_function'], True), - } - - if 'documentation' in f: - result['has_documentation'] = True - result['documentation'] = EncodeFunctionDocumentation(f) - - if (returnType.get('is_number') == True or - returnType.get('is_bytes') == True or - returnType.get('is_dynamic_string') == True or - returnType.get('is_static_string') == True): - result['java_return_start'] = 'return ' - - elif returnType.get('is_enumeration') == True: - result['java_return_start'] = 'return %s.getInstance(' % returnType['java_wrapper_type'] - result['java_return_end'] = ')' - - elif returnType.get('is_object') == True: - result['java_return_start'] = 'return new %s(' % returnType['java_wrapper_type'] - result['java_return_end'] = ')' - - return result - - -nativeFunctions = [] - -for f in model['global_functions']: - nativeFunctions.append(EncodeFunction(None, f)) - - -for c in model['classes']: - if 'destructor' in c: - nativeFunctions.append(EncodeFunction(c['name'], { - 'args' : [], - 'c_function' : c['destructor'], - 'return_sdk_type' : 'void', - })) - - for m in c['methods']: - nativeFunctions.append(EncodeFunction(c['name'], m)) - - -with open(os.path.join(SOURCE, 'JavaNativeSDK.mustache'), 'r') as f: - template = f.read() - - with open(os.path.join(TARGET, 'NativeSDK.java'), 'w') as g: - g.write(renderer.render(template, { - 'functions' : nativeFunctions - })) - - -with open(os.path.join(SOURCE, 'JavaFunctions.mustache'), 'r') as f: - template = f.read() - - with open(os.path.join(TARGET, 'Functions.java'), 'w') as g: - g.write(renderer.render(template, { - 'functions' : filter(lambda x: (x['class_name'] == None and - x['return'].get('is_object') != True), nativeFunctions), - })) - - -with open(os.path.join(SOURCE, 'CppNativeSDK.mustache'), 'r') as f: - template = f.read() - - with open(os.path.join(SOURCE, '..', 'Plugin', 'NativeSDK.cpp'), 'w') as g: - s = renderer.render(template, { - 'functions' : nativeFunctions - }) - - s = s.splitlines() - s = filter(lambda l: not l.isspace() or len(l) == 0, s) - - g.write('\n'.join(s)) - - - -for enum in model['enumerations']: - if not enum['name'].startswith('OrthancPlugin'): - raise Exception() - - enum['short_name'] = enum['name'][len('OrthancPlugin'):] - - for i in range(len(enum['values'])): - enum['values'][i]['key'] = ToUpperCase(enum['values'][i]['key']) - - if 'documentation' in enum['values'][i]: - enum['values'][i]['has_documentation'] = True - enum['values'][i]['documentation'] = list(map(lambda x: { 'line' : x }, FixLinesWidth([ enum['values'][i]['documentation'] ]))) - - enum['values'][-1]['last'] = True - - if 'documentation' in enum: - enum['has_documentation'] = True - enum['documentation'] = list(map(lambda x: { 'line' : x }, FixLinesWidth([ enum['documentation'] ]))) - - with open(os.path.join(SOURCE, 'JavaEnumeration.mustache'), 'r') as f: - template = f.read() - - with open(os.path.join(TARGET, '%s.java' % enum['short_name']), 'w') as g: - g.write(renderer.render(template, enum)) - - - -for cls in model['classes']: - shortName = RemoveOrthancPluginPrefix(cls['name'], False) - - with open(os.path.join(SOURCE, 'JavaClass.mustache'), 'r') as f: - template = f.read() - - methods = [] - for m in cls['methods']: - methods.append(EncodeFunction(shortName, m)) - - constructors = [] - for f in nativeFunctions: - if (f['class_name'] == None and - f['return'].get('is_object') == True and - f['return']['class_name'] == cls['name']): - constructors.append(f) - - with open(os.path.join(TARGET, '%s.java' % shortName), 'w') as g: - if not cls['name'] in classDocumentation: - raise Exception('No global documentation for class: %s' % cls['name']) - - g.write(renderer.render(template, { - 'destructor' : cls.get('destructor'), - 'class_name' : shortName, - 'methods' : methods, - 'constructors' : constructors, - 'has_documentation' : True, - 'documentation' : classDocumentation[cls['name']], - }))
--- a/CodeGeneration/CodeModel.py Thu Aug 14 16:42:02 2025 +0200 +++ b/CodeGeneration/CodeModel.py Thu Aug 14 17:27:40 2025 +0200 @@ -415,8 +415,6 @@ enum['values'][i]['documentation'] = list(map(lambda x: { 'line' : x }, FixLinesWidth([ enum['values'][i]['documentation'] ]))) - enum['values'][-1]['last'] = True - if 'documentation' in enum: enum['has_documentation'] = True enum['documentation'] = list(map(lambda x: { 'line' : x },
--- a/CodeGeneration/JavaCodeGeneration.py Thu Aug 14 16:42:02 2025 +0200 +++ b/CodeGeneration/JavaCodeGeneration.py Thu Aug 14 17:27:40 2025 +0200 @@ -36,7 +36,7 @@ ## Parse the command-line arguments ## -ORTHANC_SDK_DEFAULT_VERSION = CodeModel.ReadOrthancSdkDefaultVersion(os.path.join(ROOT, '..', 'Plugin', 'CMakeLists.txt')) +ORTHANC_SDK_DEFAULT_VERSION = CodeModel.ReadOrthancSdkDefaultVersion(os.path.join(ROOT, '..', 'OrthancSDKVersion.cmake')) parser = argparse.ArgumentParser(description = 'Generate C++ native functions to wrap the Orthanc SDK in Java.') parser.add_argument('--sdk', @@ -111,6 +111,8 @@ enum['values'] = list(filter(lambda value: CodeModel.IsPrimitiveAvailable(SDK_VERSION, value, key_prefix = enum['name']), enum['values'])) + enum['values'][-1]['last'] = True + with open(os.path.join(ROOT, 'JavaEnumeration.mustache'), 'r') as f: template = f.read()
--- a/JavaSDK/CMakeLists.txt Thu Aug 14 16:42:02 2025 +0200 +++ b/JavaSDK/CMakeLists.txt Thu Aug 14 17:27:40 2025 +0200 @@ -18,7 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...4.0) project(OrthancJavaSDK) @@ -27,23 +27,66 @@ set(CMAKE_JAVA_COMPILE_FLAGS "-source" "1.8" "-target" "1.8" "-Xdoclint:all/protected") +include(${CMAKE_SOURCE_DIR}/../Resources/Orthanc/CMake/AutoGeneratedCode.cmake) +include(${CMAKE_SOURCE_DIR}/../OrthancSDKVersion.cmake) -file(GLOB JAVA_SOURCES - ${CMAKE_SOURCE_DIR}/be/uclouvain/orthanc/*.java +##################################################################### +## Auto-generate the wrapper +##################################################################### + +set(ORTHANC_CODE_MODEL ${CMAKE_SOURCE_DIR}/../Resources/Orthanc/OrthancPluginCodeModel.json) + +if(CMAKE_VERSION VERSION_GREATER "3.11") + find_package(Python REQUIRED COMPONENTS Interpreter) + set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) +else() + include(FindPythonInterp) + find_package(PythonInterp REQUIRED) +endif() + +execute_process( + COMMAND + ${PYTHON_EXECUTABLE} + ${CMAKE_SOURCE_DIR}/../CodeGeneration/JavaCodeGeneration.py + --sdk ${ORTHANC_SDK} + --model ${ORTHANC_CODE_MODEL} + --target ${AUTOGENERATED_DIR} + ) + + + +##################################################################### +## Build the plugin +##################################################################### + +set(JAVA_SOURCES + be/uclouvain/orthanc/Callbacks.java + be/uclouvain/orthanc/OrthancException.java + ) + +foreach(source IN LISTS JAVA_SOURCES) + configure_file( + ${source} + ${AUTOGENERATED_DIR}/${source} + COPYONLY) +endforeach() + +file(GLOB AUTOGENERATED_SOURCES + ${AUTOGENERATED_DIR}/be/uclouvain/orthanc/*.java ) set(JAVADOC_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/OrthancJavaSDKDocumentation") file(MAKE_DIRECTORY ${JAVADOC_OUTPUT_DIR}) add_jar(OrthancJavaSDK - ${JAVA_SOURCES} + ${AUTOGENERATED_SOURCES} DEPENDS CreateJavadocDirectory ) add_custom_command(TARGET OrthancJavaSDK POST_BUILD - COMMAND ${Java_JAVADOC_EXECUTABLE} -Xdoclint:all ${JAVA_SOURCES} + COMMAND ${Java_JAVADOC_EXECUTABLE} -Xdoclint:all ${AUTOGENERATED_SOURCES} WORKING_DIRECTORY ${JAVADOC_OUTPUT_DIR} COMMENT "Generating SDK documentation with javadoc" VERBATIM )
--- a/JavaSDK/be/uclouvain/orthanc/ChangeType.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,190 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The supported types of changes that can be signaled to the change callback. - **/ -public enum ChangeType { - /** - * Series is now complete - **/ - COMPLETED_SERIES(0), - /** - * Deleted resource - **/ - DELETED(1), - /** - * A new instance was added to this resource - **/ - NEW_CHILD_INSTANCE(2), - /** - * New instance received - **/ - NEW_INSTANCE(3), - /** - * New patient created - **/ - NEW_PATIENT(4), - /** - * New series created - **/ - NEW_SERIES(5), - /** - * New study created - **/ - NEW_STUDY(6), - /** - * Timeout: No new instance in this patient - **/ - STABLE_PATIENT(7), - /** - * Timeout: No new instance in this series - **/ - STABLE_SERIES(8), - /** - * Timeout: No new instance in this study - **/ - STABLE_STUDY(9), - /** - * Orthanc has started - **/ - ORTHANC_STARTED(10), - /** - * Orthanc is stopping - **/ - ORTHANC_STOPPED(11), - /** - * Some user-defined attachment has changed for this resource - **/ - UPDATED_ATTACHMENT(12), - /** - * Some user-defined metadata has changed for this resource - **/ - UPDATED_METADATA(13), - /** - * The list of Orthanc peers has changed - **/ - UPDATED_PEERS(14), - /** - * The list of DICOM modalities has changed - **/ - UPDATED_MODALITIES(15), - /** - * New Job submitted - **/ - JOB_SUBMITTED(16), - /** - * A Job has completed successfully - **/ - JOB_SUCCESS(17), - /** - * A Job has failed - **/ - JOB_FAILURE(18); - - private int value; - - private ChangeType(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static ChangeType getInstance(int value) { - if (value == 0) { - return COMPLETED_SERIES; - } - if (value == 1) { - return DELETED; - } - if (value == 2) { - return NEW_CHILD_INSTANCE; - } - if (value == 3) { - return NEW_INSTANCE; - } - if (value == 4) { - return NEW_PATIENT; - } - if (value == 5) { - return NEW_SERIES; - } - if (value == 6) { - return NEW_STUDY; - } - if (value == 7) { - return STABLE_PATIENT; - } - if (value == 8) { - return STABLE_SERIES; - } - if (value == 9) { - return STABLE_STUDY; - } - if (value == 10) { - return ORTHANC_STARTED; - } - if (value == 11) { - return ORTHANC_STOPPED; - } - if (value == 12) { - return UPDATED_ATTACHMENT; - } - if (value == 13) { - return UPDATED_METADATA; - } - if (value == 14) { - return UPDATED_PEERS; - } - if (value == 15) { - return UPDATED_MODALITIES; - } - if (value == 16) { - return JOB_SUBMITTED; - } - if (value == 17) { - return JOB_SUCCESS; - } - if (value == 18) { - return JOB_FAILURE; - } - - throw new IllegalArgumentException("Value out of range for enumeration ChangeType: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/CompressionType.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The compression algorithms that are supported by the Orthanc core. - **/ -public enum CompressionType { - /** - * Standard zlib compression - **/ - ZLIB(0), - /** - * zlib, prefixed with uncompressed size (uint64_t) - **/ - ZLIB_WITH_SIZE(1), - /** - * Standard gzip compression - **/ - GZIP(2), - /** - * gzip, prefixed with uncompressed size (uint64_t) - **/ - GZIP_WITH_SIZE(3); - - private int value; - - private CompressionType(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static CompressionType getInstance(int value) { - if (value == 0) { - return ZLIB; - } - if (value == 1) { - return ZLIB_WITH_SIZE; - } - if (value == 2) { - return GZIP; - } - if (value == 3) { - return GZIP_WITH_SIZE; - } - - throw new IllegalArgumentException("Value out of range for enumeration CompressionType: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/ConstraintType.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The constraints on the tags (main DICOM tags and identifier tags) that must be - * supported by the database plugins. - **/ -public enum ConstraintType { - /** - * Equal - **/ - EQUAL(1), - /** - * Less or equal - **/ - SMALLER_OR_EQUAL(2), - /** - * More or equal - **/ - GREATER_OR_EQUAL(3), - /** - * Wildcard matching - **/ - WILDCARD(4), - /** - * List of values - **/ - LIST(5); - - private int value; - - private ConstraintType(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static ConstraintType getInstance(int value) { - if (value == 1) { - return EQUAL; - } - if (value == 2) { - return SMALLER_OR_EQUAL; - } - if (value == 3) { - return GREATER_OR_EQUAL; - } - if (value == 4) { - return WILDCARD; - } - if (value == 5) { - return LIST; - } - - throw new IllegalArgumentException("Value out of range for enumeration ConstraintType: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/ContentType.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The content types that are supported by Orthanc plugins. - **/ -public enum ContentType { - /** - * Unknown content type - **/ - UNKNOWN(0), - /** - * DICOM - **/ - DICOM(1), - /** - * JSON summary of a DICOM file - **/ - DICOM_AS_JSON(2), - /** - * DICOM Header till pixel data - **/ - DICOM_UNTIL_PIXEL_DATA(3); - - private int value; - - private ContentType(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static ContentType getInstance(int value) { - if (value == 0) { - return UNKNOWN; - } - if (value == 1) { - return DICOM; - } - if (value == 2) { - return DICOM_AS_JSON; - } - if (value == 3) { - return DICOM_UNTIL_PIXEL_DATA; - } - - throw new IllegalArgumentException("Value out of range for enumeration ContentType: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/CreateDicomFlags.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Flags to the creation of a DICOM file. - **/ -public enum CreateDicomFlags { - /** - * Default mode - **/ - NONE(0), - /** - * Decode fields encoded using data URI scheme - **/ - DECODE_DATA_URI_SCHEME(1), - /** - * Automatically generate DICOM identifiers - **/ - GENERATE_IDENTIFIERS(2); - - private int value; - - private CreateDicomFlags(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static CreateDicomFlags getInstance(int value) { - if (value == 0) { - return NONE; - } - if (value == 1) { - return DECODE_DATA_URI_SCHEME; - } - if (value == 2) { - return GENERATE_IDENTIFIERS; - } - - throw new IllegalArgumentException("Value out of range for enumeration CreateDicomFlags: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/DicomInstance.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,298 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * DICOM instance managed by the Orthanc core - **/ -public class DicomInstance { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected DicomInstance(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - @Override - protected void finalize() throws Throwable { - dispose(); - super.finalize(); - } - - /** - * Manually deallocate the C object that is associated with this Java wrapper. - * - * This method can be used to immediately deallocate the C object, - * instead of waiting for the garbage collector to dispose the Java wrapper. - **/ - public void dispose() { - if (self != 0) { - NativeSDK.OrthancPluginFreeDicomInstance(self); - self = 0; - } - } - - /** - * Parse a DICOM instance. - * - * This function parses a memory buffer that contains a DICOM file. The function - * returns a new pointer to a data structure that is managed by the Orthanc core. - * - * @param buffer The memory buffer containing the DICOM instance. - * @return The newly constructed object. - **/ - public static DicomInstance createDicomInstance( - byte[] buffer) { - return new DicomInstance(NativeSDK.OrthancPluginCreateDicomInstance(buffer)); - } - - /** - * Parse and transcode a DICOM instance. - * - * This function parses a memory buffer that contains a DICOM file, then transcodes - * it to the given transfer syntax. The function returns a new pointer to a data - * structure that is managed by the Orthanc core. - * - * @param buffer The memory buffer containing the DICOM instance. - * @param transferSyntax The transfer syntax UID for the transcoding. - * @return The newly constructed object. - **/ - public static DicomInstance transcodeDicomInstance( - byte[] buffer, - String transferSyntax) { - return new DicomInstance(NativeSDK.OrthancPluginTranscodeDicomInstance(buffer, transferSyntax)); - } - - - /** - * Get the AET of a DICOM instance. - * - * This function returns the Application Entity Title (AET) of the DICOM modality - * from which a DICOM instance originates. - * - * @return The resulting string. - **/ - public String getInstanceRemoteAet() { - return NativeSDK.OrthancPluginGetInstanceRemoteAet(self); - } - - /** - * Get the size of a DICOM file. - * - * This function returns the number of bytes of the given DICOM instance. - * - * @return The size of the file, -1 in case of error. - **/ - public long getInstanceSize() { - return NativeSDK.OrthancPluginGetInstanceSize(self); - } - - /** - * Get the DICOM tag hierarchy as a JSON file. - * - * This function returns a pointer to a newly created string containing a JSON - * file. This JSON file encodes the tag hierarchy of the given DICOM instance. - * - * @return The resulting string. - **/ - public String getInstanceJson() { - return NativeSDK.OrthancPluginGetInstanceJson(self); - } - - /** - * Get the DICOM tag hierarchy as a JSON file (with simplification). - * - * This function returns a pointer to a newly created string containing a JSON - * file. This JSON file encodes the tag hierarchy of the given DICOM instance. In - * contrast with ::OrthancPluginGetInstanceJson(), the returned JSON file is in its - * simplified version. - * - * @return The resulting string. - **/ - public String getInstanceSimplifiedJson() { - return NativeSDK.OrthancPluginGetInstanceSimplifiedJson(self); - } - - /** - * Check whether a DICOM instance is associated with some metadata. - * - * This function checks whether the DICOM instance of interest is associated with - * some metadata. As of Orthanc 0.8.1, in the callbacks registered by - * ::OrthancPluginRegisterOnStoredInstanceCallback(), the only possibly available - * metadata are "ReceptionDate", "RemoteAET" and "IndexInSeries". - * - * @param metadata The metadata of interest. - * @return 1 if the metadata is present, 0 if it is absent, -1 in case of error. - **/ - public int hasInstanceMetadata( - String metadata) { - return NativeSDK.OrthancPluginHasInstanceMetadata(self, metadata); - } - - /** - * Get the value of some metadata associated with a given DICOM instance. - * - * This functions returns the value of some metadata that is associated with the - * DICOM instance of interest. Before calling this function, the existence of the - * metadata must have been checked with ::OrthancPluginHasInstanceMetadata(). - * - * @param metadata The metadata of interest. - * @return The resulting string. - **/ - public String getInstanceMetadata( - String metadata) { - return NativeSDK.OrthancPluginGetInstanceMetadata(self, metadata); - } - - /** - * Get the origin of a DICOM file. - * - * This function returns the origin of a DICOM instance that has been received by - * Orthanc. - * - * @return The origin of the instance. - **/ - public InstanceOrigin getInstanceOrigin() { - return InstanceOrigin.getInstance(NativeSDK.OrthancPluginGetInstanceOrigin(self)); - } - - /** - * Get the transfer syntax of a DICOM file. - * - * This function returns a pointer to a newly created string that contains the - * transfer syntax UID of the DICOM instance. The empty string might be returned if - * this information is unknown. - * - * @return The resulting string. - **/ - public String getInstanceTransferSyntaxUid() { - return NativeSDK.OrthancPluginGetInstanceTransferSyntaxUid(self); - } - - /** - * Check whether the DICOM file has pixel data. - * - * This function returns a Boolean value indicating whether the DICOM instance - * contains the pixel data (7FE0,0010) tag. - * - * @return "1" if the DICOM instance contains pixel data, or "0" if the tag is - * missing, or "-1" in the case of an error. - **/ - public int hasInstancePixelData() { - return NativeSDK.OrthancPluginHasInstancePixelData(self); - } - - /** - * Get the number of frames in a DICOM instance. - * - * This function returns the number of frames that are part of a DICOM image - * managed by the Orthanc core. - * - * @return The number of frames (will be zero in the case of an error). - **/ - public int getInstanceFramesCount() { - return NativeSDK.OrthancPluginGetInstanceFramesCount(self); - } - - /** - * Get the raw content of a frame in a DICOM instance. - * - * This function returns a memory buffer containing the raw content of a frame in a - * DICOM instance that is managed by the Orthanc core. This is notably useful for - * compressed transfer syntaxes, as it gives access to the embedded files (such as - * JPEG, JPEG-LS or JPEG2k). The Orthanc core transparently reassembles the - * fragments to extract the raw frame. - * - * @param frameIndex The index of the frame of interest. - * @return The resulting memory buffer. - **/ - public byte[] getInstanceRawFrame( - int frameIndex) { - return NativeSDK.OrthancPluginGetInstanceRawFrame(self, frameIndex); - } - - /** - * Decode one frame from a DICOM instance. - * - * This function decodes one frame of a DICOM image that is managed by the Orthanc - * core. - * - * @param frameIndex The index of the frame of interest. - * @return The newly constructed object. - **/ - public Image getInstanceDecodedFrame( - int frameIndex) { - return new Image(NativeSDK.OrthancPluginGetInstanceDecodedFrame(self, frameIndex)); - } - - /** - * Writes a DICOM instance to a memory buffer. - * - * This function returns a memory buffer containing the serialization of a DICOM - * instance that is managed by the Orthanc core. - * - * @return The resulting memory buffer. - **/ - public byte[] serializeDicomInstance() { - return NativeSDK.OrthancPluginSerializeDicomInstance(self); - } - - /** - * Format a DICOM memory buffer as a JSON string. - * - * This function takes as DICOM instance managed by the Orthanc core, and outputs a - * JSON string representing the tags of this DICOM file. - * - * @param format The output format. - * @param flags Flags governing the output. - * @param maxStringLength The maximum length of a field. Too long fields will be - * output as "null". The 0 value means no maximum length. - * @return The resulting string. - **/ - public String getInstanceAdvancedJson( - DicomToJsonFormat format, - DicomToJsonFlags flags, - int maxStringLength) { - return NativeSDK.OrthancPluginGetInstanceAdvancedJson(self, format.getValue(), flags.getValue(), maxStringLength); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/DicomToJsonFlags.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Flags to customize a DICOM-to-JSON conversion. By default, binary tags are - * formatted using Data URI scheme. - **/ -public enum DicomToJsonFlags { - /** - * Default formatting - **/ - NONE(0), - /** - * Include the binary tags - **/ - INCLUDE_BINARY(1), - /** - * Include the private tags - **/ - INCLUDE_PRIVATE_TAGS(2), - /** - * Include the tags unknown by the dictionary - **/ - INCLUDE_UNKNOWN_TAGS(4), - /** - * Include the pixel data - **/ - INCLUDE_PIXEL_DATA(8), - /** - * Output binary tags as-is, dropping non-ASCII - **/ - CONVERT_BINARY_TO_ASCII(16), - /** - * Signal binary tags as null values - **/ - CONVERT_BINARY_TO_NULL(32), - /** - * Stop processing after pixel data (new in 1.9.1) - **/ - STOP_AFTER_PIXEL_DATA(64), - /** - * Skip tags whose element is zero (new in 1.9.1) - **/ - SKIP_GROUP_LENGTHS(128); - - private int value; - - private DicomToJsonFlags(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static DicomToJsonFlags getInstance(int value) { - if (value == 0) { - return NONE; - } - if (value == 1) { - return INCLUDE_BINARY; - } - if (value == 2) { - return INCLUDE_PRIVATE_TAGS; - } - if (value == 4) { - return INCLUDE_UNKNOWN_TAGS; - } - if (value == 8) { - return INCLUDE_PIXEL_DATA; - } - if (value == 16) { - return CONVERT_BINARY_TO_ASCII; - } - if (value == 32) { - return CONVERT_BINARY_TO_NULL; - } - if (value == 64) { - return STOP_AFTER_PIXEL_DATA; - } - if (value == 128) { - return SKIP_GROUP_LENGTHS; - } - - throw new IllegalArgumentException("Value out of range for enumeration DicomToJsonFlags: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/DicomToJsonFormat.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The possible output formats for a DICOM-to-JSON conversion. - **/ -public enum DicomToJsonFormat { - /** - * Full output, with most details - **/ - FULL(1), - /** - * Tags output as hexadecimal numbers - **/ - SHORT(2), - /** - * Human-readable JSON - **/ - HUMAN(3); - - private int value; - - private DicomToJsonFormat(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static DicomToJsonFormat getInstance(int value) { - if (value == 1) { - return FULL; - } - if (value == 2) { - return SHORT; - } - if (value == 3) { - return HUMAN; - } - - throw new IllegalArgumentException("Value out of range for enumeration DicomToJsonFormat: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/DicomWebBinaryMode.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The available modes to export a binary DICOM tag into a DICOMweb JSON or XML - * document. - **/ -public enum DicomWebBinaryMode { - /** - * Don't include binary tags - **/ - IGNORE(0), - /** - * Inline encoding using Base64 - **/ - INLINE_BINARY(1), - /** - * Use a bulk data URI field - **/ - BULK_DATA_URI(2); - - private int value; - - private DicomWebBinaryMode(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static DicomWebBinaryMode getInstance(int value) { - if (value == 0) { - return IGNORE; - } - if (value == 1) { - return INLINE_BINARY; - } - if (value == 2) { - return BULK_DATA_URI; - } - - throw new IllegalArgumentException("Value out of range for enumeration DicomWebBinaryMode: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/DicomWebNode.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Node visited by DICOMweb conversion - **/ -public class DicomWebNode { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected DicomWebNode(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - - -}
--- a/JavaSDK/be/uclouvain/orthanc/ErrorCode.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,811 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The various error codes that can be returned by the Orthanc core. - **/ -public enum ErrorCode { - /** - * Internal error - **/ - INTERNAL_ERROR(-1), - /** - * Success - **/ - SUCCESS(0), - /** - * Error encountered within the plugin engine - **/ - PLUGIN(1), - /** - * Not implemented yet - **/ - NOT_IMPLEMENTED(2), - /** - * Parameter out of range - **/ - PARAMETER_OUT_OF_RANGE(3), - /** - * The server hosting Orthanc is running out of memory - **/ - NOT_ENOUGH_MEMORY(4), - /** - * Bad type for a parameter - **/ - BAD_PARAMETER_TYPE(5), - /** - * Bad sequence of calls - **/ - BAD_SEQUENCE_OF_CALLS(6), - /** - * Accessing an inexistent item - **/ - INEXISTENT_ITEM(7), - /** - * Bad request - **/ - BAD_REQUEST(8), - /** - * Error in the network protocol - **/ - NETWORK_PROTOCOL(9), - /** - * Error while calling a system command - **/ - SYSTEM_COMMAND(10), - /** - * Error with the database engine - **/ - DATABASE(11), - /** - * Badly formatted URI - **/ - URI_SYNTAX(12), - /** - * Inexistent file - **/ - INEXISTENT_FILE(13), - /** - * Cannot write to file - **/ - CANNOT_WRITE_FILE(14), - /** - * Bad file format - **/ - BAD_FILE_FORMAT(15), - /** - * Timeout - **/ - TIMEOUT(16), - /** - * Unknown resource - **/ - UNKNOWN_RESOURCE(17), - /** - * Incompatible version of the database - **/ - INCOMPATIBLE_DATABASE_VERSION(18), - /** - * The file storage is full - **/ - FULL_STORAGE(19), - /** - * Corrupted file (e.g. inconsistent MD5 hash) - **/ - CORRUPTED_FILE(20), - /** - * Inexistent tag - **/ - INEXISTENT_TAG(21), - /** - * Cannot modify a read-only data structure - **/ - READ_ONLY(22), - /** - * Incompatible format of the images - **/ - INCOMPATIBLE_IMAGE_FORMAT(23), - /** - * Incompatible size of the images - **/ - INCOMPATIBLE_IMAGE_SIZE(24), - /** - * Error while using a shared library (plugin) - **/ - SHARED_LIBRARY(25), - /** - * Plugin invoking an unknown service - **/ - UNKNOWN_PLUGIN_SERVICE(26), - /** - * Unknown DICOM tag - **/ - UNKNOWN_DICOM_TAG(27), - /** - * Cannot parse a JSON document - **/ - BAD_JSON(28), - /** - * Bad credentials were provided to an HTTP request - **/ - UNAUTHORIZED(29), - /** - * Badly formatted font file - **/ - BAD_FONT(30), - /** - * The plugin implementing a custom database back-end does not fulfill the proper - * interface - **/ - DATABASE_PLUGIN(31), - /** - * Error in the plugin implementing a custom storage area - **/ - STORAGE_AREA_PLUGIN(32), - /** - * The request is empty - **/ - EMPTY_REQUEST(33), - /** - * Cannot send a response which is acceptable according to the Accept HTTP header - **/ - NOT_ACCEPTABLE(34), - /** - * Cannot handle a NULL pointer - **/ - NULL_POINTER(35), - /** - * The database is currently not available (probably a transient situation) - **/ - DATABASE_UNAVAILABLE(36), - /** - * This job was canceled - **/ - CANCELED_JOB(37), - /** - * Geometry error encountered in Stone - **/ - BAD_GEOMETRY(38), - /** - * Cannot initialize SSL encryption, check out your certificates - **/ - SSL_INITIALIZATION(39), - /** - * Calling a function that has been removed from the Orthanc Framework - **/ - DISCONTINUED_ABI(40), - /** - * Incorrect range request - **/ - BAD_RANGE(41), - /** - * Database could not serialize access due to concurrent update, the transaction - * should be retried - **/ - DATABASE_CANNOT_SERIALIZE(42), - /** - * A bad revision number was provided, which might indicate conflict between - * multiple writers - **/ - REVISION(43), - /** - * SQLite: The database is not opened - **/ - SQLITE_NOT_OPENED(1000), - /** - * SQLite: Connection is already open - **/ - SQLITE_ALREADY_OPENED(1001), - /** - * SQLite: Unable to open the database - **/ - SQLITE_CANNOT_OPEN(1002), - /** - * SQLite: This cached statement is already being referred to - **/ - SQLITE_STATEMENT_ALREADY_USED(1003), - /** - * SQLite: Cannot execute a command - **/ - SQLITE_EXECUTE(1004), - /** - * SQLite: Rolling back a nonexistent transaction (have you called Begin()?) - **/ - SQLITE_ROLLBACK_WITHOUT_TRANSACTION(1005), - /** - * SQLite: Committing a nonexistent transaction - **/ - SQLITE_COMMIT_WITHOUT_TRANSACTION(1006), - /** - * SQLite: Unable to register a function - **/ - SQLITE_REGISTER_FUNCTION(1007), - /** - * SQLite: Unable to flush the database - **/ - SQLITE_FLUSH(1008), - /** - * SQLite: Cannot run a cached statement - **/ - SQLITE_CANNOT_RUN(1009), - /** - * SQLite: Cannot step over a cached statement - **/ - SQLITE_CANNOT_STEP(1010), - /** - * SQLite: Bing a value while out of range (serious error) - **/ - SQLITE_BIND_OUT_OF_RANGE(1011), - /** - * SQLite: Cannot prepare a cached statement - **/ - SQLITE_PREPARE_STATEMENT(1012), - /** - * SQLite: Beginning the same transaction twice - **/ - SQLITE_TRANSACTION_ALREADY_STARTED(1013), - /** - * SQLite: Failure when committing the transaction - **/ - SQLITE_TRANSACTION_COMMIT(1014), - /** - * SQLite: Cannot start a transaction - **/ - SQLITE_TRANSACTION_BEGIN(1015), - /** - * The directory to be created is already occupied by a regular file - **/ - DIRECTORY_OVER_FILE(2000), - /** - * Unable to create a subdirectory or a file in the file storage - **/ - FILE_STORAGE_CANNOT_WRITE(2001), - /** - * The specified path does not point to a directory - **/ - DIRECTORY_EXPECTED(2002), - /** - * The TCP port of the HTTP server is privileged or already in use - **/ - HTTP_PORT_IN_USE(2003), - /** - * The TCP port of the DICOM server is privileged or already in use - **/ - DICOM_PORT_IN_USE(2004), - /** - * This HTTP status is not allowed in a REST API - **/ - BAD_HTTP_STATUS_IN_REST(2005), - /** - * The specified path does not point to a regular file - **/ - REGULAR_FILE_EXPECTED(2006), - /** - * Unable to get the path to the executable - **/ - PATH_TO_EXECUTABLE(2007), - /** - * Cannot create a directory - **/ - MAKE_DIRECTORY(2008), - /** - * An application entity title (AET) cannot be empty or be longer than 16 - * characters - **/ - BAD_APPLICATION_ENTITY_TITLE(2009), - /** - * No request handler factory for DICOM C-FIND SCP - **/ - NO_CFIND_HANDLER(2010), - /** - * No request handler factory for DICOM C-MOVE SCP - **/ - NO_CMOVE_HANDLER(2011), - /** - * No request handler factory for DICOM C-STORE SCP - **/ - NO_CSTORE_HANDLER(2012), - /** - * No application entity filter - **/ - NO_APPLICATION_ENTITY_FILTER(2013), - /** - * DicomUserConnection: Unable to find the SOP class and instance - **/ - NO_SOP_CLASS_OR_INSTANCE(2014), - /** - * DicomUserConnection: No acceptable presentation context for modality - **/ - NO_PRESENTATION_CONTEXT(2015), - /** - * DicomUserConnection: The C-FIND command is not supported by the remote SCP - **/ - DICOM_FIND_UNAVAILABLE(2016), - /** - * DicomUserConnection: The C-MOVE command is not supported by the remote SCP - **/ - DICOM_MOVE_UNAVAILABLE(2017), - /** - * Cannot store an instance - **/ - CANNOT_STORE_INSTANCE(2018), - /** - * Only string values are supported when creating DICOM instances - **/ - CREATE_DICOM_NOT_STRING(2019), - /** - * Trying to override a value inherited from a parent module - **/ - CREATE_DICOM_OVERRIDE_TAG(2020), - /** - * Use \"Content\" to inject an image into a new DICOM instance - **/ - CREATE_DICOM_USE_CONTENT(2021), - /** - * No payload is present for one instance in the series - **/ - CREATE_DICOM_NO_PAYLOAD(2022), - /** - * The payload of the DICOM instance must be specified according to Data URI scheme - **/ - CREATE_DICOM_USE_DATA_URI_SCHEME(2023), - /** - * Trying to attach a new DICOM instance to an inexistent resource - **/ - CREATE_DICOM_BAD_PARENT(2024), - /** - * Trying to attach a new DICOM instance to an instance (must be a series, study or - * patient) - **/ - CREATE_DICOM_PARENT_IS_INSTANCE(2025), - /** - * Unable to get the encoding of the parent resource - **/ - CREATE_DICOM_PARENT_ENCODING(2026), - /** - * Unknown modality - **/ - UNKNOWN_MODALITY(2027), - /** - * Bad ordering of filters in a job - **/ - BAD_JOB_ORDERING(2028), - /** - * Cannot convert the given JSON object to a Lua table - **/ - JSON_TO_LUA_TABLE(2029), - /** - * Cannot create the Lua context - **/ - CANNOT_CREATE_LUA(2030), - /** - * Cannot execute a Lua command - **/ - CANNOT_EXECUTE_LUA(2031), - /** - * Arguments cannot be pushed after the Lua function is executed - **/ - LUA_ALREADY_EXECUTED(2032), - /** - * The Lua function does not give the expected number of outputs - **/ - LUA_BAD_OUTPUT(2033), - /** - * The Lua function is not a predicate (only true/false outputs allowed) - **/ - NOT_LUA_PREDICATE(2034), - /** - * The Lua function does not return a string - **/ - LUA_RETURNS_NO_STRING(2035), - /** - * Another plugin has already registered a custom storage area - **/ - STORAGE_AREA_ALREADY_REGISTERED(2036), - /** - * Another plugin has already registered a custom database back-end - **/ - DATABASE_BACKEND_ALREADY_REGISTERED(2037), - /** - * Plugin trying to call the database during its initialization - **/ - DATABASE_NOT_INITIALIZED(2038), - /** - * Orthanc has been built without SSL support - **/ - SSL_DISABLED(2039), - /** - * Unable to order the slices of the series - **/ - CANNOT_ORDER_SLICES(2040), - /** - * No request handler factory for DICOM C-Find Modality SCP - **/ - NO_WORKLIST_HANDLER(2041), - /** - * Cannot override the value of a tag that already exists - **/ - ALREADY_EXISTING_TAG(2042), - /** - * No request handler factory for DICOM N-ACTION SCP (storage commitment) - **/ - NO_STORAGE_COMMITMENT_HANDLER(2043), - /** - * No request handler factory for DICOM C-GET SCP - **/ - NO_CGET_HANDLER(2044), - /** - * Unsupported media type - **/ - UNSUPPORTED_MEDIA_TYPE(3000); - - private int value; - - private ErrorCode(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static ErrorCode getInstance(int value) { - if (value == -1) { - return INTERNAL_ERROR; - } - if (value == 0) { - return SUCCESS; - } - if (value == 1) { - return PLUGIN; - } - if (value == 2) { - return NOT_IMPLEMENTED; - } - if (value == 3) { - return PARAMETER_OUT_OF_RANGE; - } - if (value == 4) { - return NOT_ENOUGH_MEMORY; - } - if (value == 5) { - return BAD_PARAMETER_TYPE; - } - if (value == 6) { - return BAD_SEQUENCE_OF_CALLS; - } - if (value == 7) { - return INEXISTENT_ITEM; - } - if (value == 8) { - return BAD_REQUEST; - } - if (value == 9) { - return NETWORK_PROTOCOL; - } - if (value == 10) { - return SYSTEM_COMMAND; - } - if (value == 11) { - return DATABASE; - } - if (value == 12) { - return URI_SYNTAX; - } - if (value == 13) { - return INEXISTENT_FILE; - } - if (value == 14) { - return CANNOT_WRITE_FILE; - } - if (value == 15) { - return BAD_FILE_FORMAT; - } - if (value == 16) { - return TIMEOUT; - } - if (value == 17) { - return UNKNOWN_RESOURCE; - } - if (value == 18) { - return INCOMPATIBLE_DATABASE_VERSION; - } - if (value == 19) { - return FULL_STORAGE; - } - if (value == 20) { - return CORRUPTED_FILE; - } - if (value == 21) { - return INEXISTENT_TAG; - } - if (value == 22) { - return READ_ONLY; - } - if (value == 23) { - return INCOMPATIBLE_IMAGE_FORMAT; - } - if (value == 24) { - return INCOMPATIBLE_IMAGE_SIZE; - } - if (value == 25) { - return SHARED_LIBRARY; - } - if (value == 26) { - return UNKNOWN_PLUGIN_SERVICE; - } - if (value == 27) { - return UNKNOWN_DICOM_TAG; - } - if (value == 28) { - return BAD_JSON; - } - if (value == 29) { - return UNAUTHORIZED; - } - if (value == 30) { - return BAD_FONT; - } - if (value == 31) { - return DATABASE_PLUGIN; - } - if (value == 32) { - return STORAGE_AREA_PLUGIN; - } - if (value == 33) { - return EMPTY_REQUEST; - } - if (value == 34) { - return NOT_ACCEPTABLE; - } - if (value == 35) { - return NULL_POINTER; - } - if (value == 36) { - return DATABASE_UNAVAILABLE; - } - if (value == 37) { - return CANCELED_JOB; - } - if (value == 38) { - return BAD_GEOMETRY; - } - if (value == 39) { - return SSL_INITIALIZATION; - } - if (value == 40) { - return DISCONTINUED_ABI; - } - if (value == 41) { - return BAD_RANGE; - } - if (value == 42) { - return DATABASE_CANNOT_SERIALIZE; - } - if (value == 43) { - return REVISION; - } - if (value == 1000) { - return SQLITE_NOT_OPENED; - } - if (value == 1001) { - return SQLITE_ALREADY_OPENED; - } - if (value == 1002) { - return SQLITE_CANNOT_OPEN; - } - if (value == 1003) { - return SQLITE_STATEMENT_ALREADY_USED; - } - if (value == 1004) { - return SQLITE_EXECUTE; - } - if (value == 1005) { - return SQLITE_ROLLBACK_WITHOUT_TRANSACTION; - } - if (value == 1006) { - return SQLITE_COMMIT_WITHOUT_TRANSACTION; - } - if (value == 1007) { - return SQLITE_REGISTER_FUNCTION; - } - if (value == 1008) { - return SQLITE_FLUSH; - } - if (value == 1009) { - return SQLITE_CANNOT_RUN; - } - if (value == 1010) { - return SQLITE_CANNOT_STEP; - } - if (value == 1011) { - return SQLITE_BIND_OUT_OF_RANGE; - } - if (value == 1012) { - return SQLITE_PREPARE_STATEMENT; - } - if (value == 1013) { - return SQLITE_TRANSACTION_ALREADY_STARTED; - } - if (value == 1014) { - return SQLITE_TRANSACTION_COMMIT; - } - if (value == 1015) { - return SQLITE_TRANSACTION_BEGIN; - } - if (value == 2000) { - return DIRECTORY_OVER_FILE; - } - if (value == 2001) { - return FILE_STORAGE_CANNOT_WRITE; - } - if (value == 2002) { - return DIRECTORY_EXPECTED; - } - if (value == 2003) { - return HTTP_PORT_IN_USE; - } - if (value == 2004) { - return DICOM_PORT_IN_USE; - } - if (value == 2005) { - return BAD_HTTP_STATUS_IN_REST; - } - if (value == 2006) { - return REGULAR_FILE_EXPECTED; - } - if (value == 2007) { - return PATH_TO_EXECUTABLE; - } - if (value == 2008) { - return MAKE_DIRECTORY; - } - if (value == 2009) { - return BAD_APPLICATION_ENTITY_TITLE; - } - if (value == 2010) { - return NO_CFIND_HANDLER; - } - if (value == 2011) { - return NO_CMOVE_HANDLER; - } - if (value == 2012) { - return NO_CSTORE_HANDLER; - } - if (value == 2013) { - return NO_APPLICATION_ENTITY_FILTER; - } - if (value == 2014) { - return NO_SOP_CLASS_OR_INSTANCE; - } - if (value == 2015) { - return NO_PRESENTATION_CONTEXT; - } - if (value == 2016) { - return DICOM_FIND_UNAVAILABLE; - } - if (value == 2017) { - return DICOM_MOVE_UNAVAILABLE; - } - if (value == 2018) { - return CANNOT_STORE_INSTANCE; - } - if (value == 2019) { - return CREATE_DICOM_NOT_STRING; - } - if (value == 2020) { - return CREATE_DICOM_OVERRIDE_TAG; - } - if (value == 2021) { - return CREATE_DICOM_USE_CONTENT; - } - if (value == 2022) { - return CREATE_DICOM_NO_PAYLOAD; - } - if (value == 2023) { - return CREATE_DICOM_USE_DATA_URI_SCHEME; - } - if (value == 2024) { - return CREATE_DICOM_BAD_PARENT; - } - if (value == 2025) { - return CREATE_DICOM_PARENT_IS_INSTANCE; - } - if (value == 2026) { - return CREATE_DICOM_PARENT_ENCODING; - } - if (value == 2027) { - return UNKNOWN_MODALITY; - } - if (value == 2028) { - return BAD_JOB_ORDERING; - } - if (value == 2029) { - return JSON_TO_LUA_TABLE; - } - if (value == 2030) { - return CANNOT_CREATE_LUA; - } - if (value == 2031) { - return CANNOT_EXECUTE_LUA; - } - if (value == 2032) { - return LUA_ALREADY_EXECUTED; - } - if (value == 2033) { - return LUA_BAD_OUTPUT; - } - if (value == 2034) { - return NOT_LUA_PREDICATE; - } - if (value == 2035) { - return LUA_RETURNS_NO_STRING; - } - if (value == 2036) { - return STORAGE_AREA_ALREADY_REGISTERED; - } - if (value == 2037) { - return DATABASE_BACKEND_ALREADY_REGISTERED; - } - if (value == 2038) { - return DATABASE_NOT_INITIALIZED; - } - if (value == 2039) { - return SSL_DISABLED; - } - if (value == 2040) { - return CANNOT_ORDER_SLICES; - } - if (value == 2041) { - return NO_WORKLIST_HANDLER; - } - if (value == 2042) { - return ALREADY_EXISTING_TAG; - } - if (value == 2043) { - return NO_STORAGE_COMMITMENT_HANDLER; - } - if (value == 2044) { - return NO_CGET_HANDLER; - } - if (value == 3000) { - return UNSUPPORTED_MEDIA_TYPE; - } - - throw new IllegalArgumentException("Value out of range for enumeration ErrorCode: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/FindAnswers.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Answers to a DICOM C-FIND query - **/ -public class FindAnswers { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected FindAnswers(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - - - /** - * Add one answer to some C-Find request. - * - * This function adds one answer (encoded as a DICOM file) to the set of answers - * corresponding to some C-Find SCP request that is not related to modality - * worklists. - * - * @param dicom The answer to be added, encoded as a DICOM file. - **/ - public void findAddAnswer( - byte[] dicom) { - NativeSDK.OrthancPluginFindAddAnswer(self, dicom); - } - - /** - * Mark the set of C-Find answers as incomplete. - * - * This function marks as incomplete the set of answers corresponding to some - * C-Find SCP request that is not related to modality worklists. This must be used - * if canceling the handling of a request when too many answers are to be returned. - **/ - public void findMarkIncomplete() { - NativeSDK.OrthancPluginFindMarkIncomplete(self); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/FindMatcher.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Matcher for DICOM C-FIND query - **/ -public class FindMatcher { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected FindMatcher(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - @Override - protected void finalize() throws Throwable { - dispose(); - super.finalize(); - } - - /** - * Manually deallocate the C object that is associated with this Java wrapper. - * - * This method can be used to immediately deallocate the C object, - * instead of waiting for the garbage collector to dispose the Java wrapper. - **/ - public void dispose() { - if (self != 0) { - NativeSDK.OrthancPluginFreeFindMatcher(self); - self = 0; - } - } - - /** - * Create a C-Find matcher. - * - * This function creates a "matcher" object that can be used to check whether a - * DICOM instance matches a C-Find query. The C-Find query must be expressed as a - * DICOM buffer. - * - * @param query The C-Find DICOM query. - * @return The newly constructed object. - **/ - public static FindMatcher createFindMatcher( - byte[] query) { - return new FindMatcher(NativeSDK.OrthancPluginCreateFindMatcher(query)); - } - - - /** - * Test whether a DICOM instance matches a C-Find query. - * - * This function checks whether one DICOM instance matches C-Find matcher that was - * previously allocated using OrthancPluginCreateFindMatcher(). - * - * @param dicom The DICOM instance to be matched. - * @return 1 if the DICOM instance matches the query, 0 otherwise. - **/ - public int findMatcherIsMatch( - byte[] dicom) { - return NativeSDK.OrthancPluginFindMatcherIsMatch(self, dicom); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/FindQuery.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * DICOM C-FIND query - **/ -public class FindQuery { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected FindQuery(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - - - /** - * Get the number of tags in a C-Find query. - * - * This function returns the number of tags that are contained in the given C-Find - * query. - * - * @return The number of tags. - **/ - public int getFindQuerySize() { - return NativeSDK.OrthancPluginGetFindQuerySize(self); - } - - /** - * Get the symbolic name of one tag in a C-Find query. - * - * This function returns the symbolic name of one DICOM tag in the given C-Find - * query. - * - * @param index The index of the tag of interest. - * @return The resulting string. - **/ - public String getFindQueryTagName( - int index) { - return NativeSDK.OrthancPluginGetFindQueryTagName(self, index); - } - - /** - * Get the value associated with one tag in a C-Find query. - * - * This function returns the value associated with one tag in the given C-Find - * query. - * - * @param index The index of the tag of interest. - * @return The resulting string. - **/ - public String getFindQueryValue( - int index) { - return NativeSDK.OrthancPluginGetFindQueryValue(self, index); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/Functions.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1008 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Wrapper around the global functions provided by the Orthanc SDK. - **/ -public class Functions { - - /** - * Check that the version of the hosting Orthanc is above a given version. - * - * This function checks whether the version of the Orthanc server running this - * plugin, is above the given version. Contrarily to OrthancPluginCheckVersion(), - * it is up to the developer of the plugin to make sure that all the Orthanc SDK - * services called by the plugin are actually implemented in the given version of - * Orthanc. - * - * @param expectedMajor Expected major version. - * @param expectedMinor Expected minor version. - * @param expectedRevision Expected revision. - * @return 1 if and only if the versions are compatible. If the result is 0, the - * initialization of the plugin should fail. - **/ - public static int checkVersionAdvanced( - int expectedMajor, - int expectedMinor, - int expectedRevision) { - return NativeSDK.OrthancPluginCheckVersionAdvanced(expectedMajor, expectedMinor, expectedRevision); - } - - /** - * Check the compatibility of the plugin wrt. the version of its hosting Orthanc. - * - * This function checks whether the version of the Orthanc server running this - * plugin, is above the version of the current Orthanc SDK header. This guarantees - * that the plugin is compatible with the hosting Orthanc (i.e. it will not call - * unavailable services). The result of this function should always be checked in - * the OrthancPluginInitialize() entry point of the plugin. - * - * @return 1 if and only if the versions are compatible. If the result is 0, the - * initialization of the plugin should fail. - **/ - public static int checkVersion() { - return NativeSDK.OrthancPluginCheckVersion(); - } - - /** - * Log an error. - * - * Log an error message using the Orthanc logging system. - * - * @param message The message to be logged. - **/ - public static void logError( - String message) { - NativeSDK.OrthancPluginLogError(message); - } - - /** - * Log a warning. - * - * Log a warning message using the Orthanc logging system. - * - * @param message The message to be logged. - **/ - public static void logWarning( - String message) { - NativeSDK.OrthancPluginLogWarning(message); - } - - /** - * Log an information. - * - * Log an information message using the Orthanc logging system. - * - * @param message The message to be logged. - **/ - public static void logInfo( - String message) { - NativeSDK.OrthancPluginLogInfo(message); - } - - /** - * Retrieve a DICOM instance using its Orthanc identifier. - * - * Retrieve a DICOM instance using its Orthanc identifier. The DICOM file is stored - * into a newly allocated memory buffer. - * - * @param instanceId The Orthanc identifier of the DICOM instance of interest. - * @return The resulting memory buffer. - **/ - public static byte[] getDicomForInstance( - String instanceId) { - return NativeSDK.OrthancPluginGetDicomForInstance(instanceId); - } - - /** - * Make a GET call to the built-in Orthanc REST API. - * - * Make a GET call to the built-in Orthanc REST API. The result to the query is - * stored into a newly allocated memory buffer. - * - * Remark: If the resource is not existing (error 404), the error code will be - * OrthancPluginErrorCode_UnknownResource. - * - * @param uri The URI in the built-in Orthanc API. - * @return The resulting memory buffer. - **/ - public static byte[] restApiGet( - String uri) { - return NativeSDK.OrthancPluginRestApiGet(uri); - } - - /** - * Make a GET call to the REST API, as tainted by the plugins. - * - * Make a GET call to the Orthanc REST API, after all the plugins are applied. In - * other words, if some plugin overrides or adds the called URI to the built-in - * Orthanc REST API, this call will return the result provided by this plugin. The - * result to the query is stored into a newly allocated memory buffer. - * - * Remark: If the resource is not existing (error 404), the error code will be - * OrthancPluginErrorCode_UnknownResource. - * - * @param uri The URI in the built-in Orthanc API. - * @return The resulting memory buffer. - **/ - public static byte[] restApiGetAfterPlugins( - String uri) { - return NativeSDK.OrthancPluginRestApiGetAfterPlugins(uri); - } - - /** - * Make a POST call to the built-in Orthanc REST API. - * - * Make a POST call to the built-in Orthanc REST API. The result to the query is - * stored into a newly allocated memory buffer. - * - * Remark: If the resource is not existing (error 404), the error code will be - * OrthancPluginErrorCode_UnknownResource. - * - * @param uri The URI in the built-in Orthanc API. - * @param body The body of the POST request. - * @return The resulting memory buffer. - **/ - public static byte[] restApiPost( - String uri, - byte[] body) { - return NativeSDK.OrthancPluginRestApiPost(uri, body); - } - - /** - * Make a POST call to the REST API, as tainted by the plugins. - * - * Make a POST call to the Orthanc REST API, after all the plugins are applied. In - * other words, if some plugin overrides or adds the called URI to the built-in - * Orthanc REST API, this call will return the result provided by this plugin. The - * result to the query is stored into a newly allocated memory buffer. - * - * Remark: If the resource is not existing (error 404), the error code will be - * OrthancPluginErrorCode_UnknownResource. - * - * @param uri The URI in the built-in Orthanc API. - * @param body The body of the POST request. - * @return The resulting memory buffer. - **/ - public static byte[] restApiPostAfterPlugins( - String uri, - byte[] body) { - return NativeSDK.OrthancPluginRestApiPostAfterPlugins(uri, body); - } - - /** - * Make a DELETE call to the built-in Orthanc REST API. - * - * Make a DELETE call to the built-in Orthanc REST API. - * - * Remark: If the resource is not existing (error 404), the error code will be - * OrthancPluginErrorCode_UnknownResource. - * - * @param uri The URI to delete in the built-in Orthanc API. - **/ - public static void restApiDelete( - String uri) { - NativeSDK.OrthancPluginRestApiDelete(uri); - } - - /** - * Make a DELETE call to the REST API, as tainted by the plugins. - * - * Make a DELETE call to the Orthanc REST API, after all the plugins are applied. - * In other words, if some plugin overrides or adds the called URI to the built-in - * Orthanc REST API, this call will return the result provided by this plugin. - * - * Remark: If the resource is not existing (error 404), the error code will be - * OrthancPluginErrorCode_UnknownResource. - * - * @param uri The URI to delete in the built-in Orthanc API. - **/ - public static void restApiDeleteAfterPlugins( - String uri) { - NativeSDK.OrthancPluginRestApiDeleteAfterPlugins(uri); - } - - /** - * Make a PUT call to the built-in Orthanc REST API. - * - * Make a PUT call to the built-in Orthanc REST API. The result to the query is - * stored into a newly allocated memory buffer. - * - * Remark: If the resource is not existing (error 404), the error code will be - * OrthancPluginErrorCode_UnknownResource. - * - * @param uri The URI in the built-in Orthanc API. - * @param body The body of the PUT request. - * @return The resulting memory buffer. - **/ - public static byte[] restApiPut( - String uri, - byte[] body) { - return NativeSDK.OrthancPluginRestApiPut(uri, body); - } - - /** - * Make a PUT call to the REST API, as tainted by the plugins. - * - * Make a PUT call to the Orthanc REST API, after all the plugins are applied. In - * other words, if some plugin overrides or adds the called URI to the built-in - * Orthanc REST API, this call will return the result provided by this plugin. The - * result to the query is stored into a newly allocated memory buffer. - * - * Remark: If the resource is not existing (error 404), the error code will be - * OrthancPluginErrorCode_UnknownResource. - * - * @param uri The URI in the built-in Orthanc API. - * @param body The body of the PUT request. - * @return The resulting memory buffer. - **/ - public static byte[] restApiPutAfterPlugins( - String uri, - byte[] body) { - return NativeSDK.OrthancPluginRestApiPutAfterPlugins(uri, body); - } - - /** - * Look for a patient. - * - * Look for a patient stored in Orthanc, using its Patient ID tag (0x0010, 0x0020). - * This function uses the database index to run as fast as possible (it does not - * loop over all the stored patients). - * - * @param patientID The Patient ID of interest. - * @return The resulting string. - **/ - public static String lookupPatient( - String patientID) { - return NativeSDK.OrthancPluginLookupPatient(patientID); - } - - /** - * Look for a study. - * - * Look for a study stored in Orthanc, using its Study Instance UID tag (0x0020, - * 0x000d). This function uses the database index to run as fast as possible (it - * does not loop over all the stored studies). - * - * @param studyUID The Study Instance UID of interest. - * @return The resulting string. - **/ - public static String lookupStudy( - String studyUID) { - return NativeSDK.OrthancPluginLookupStudy(studyUID); - } - - /** - * Look for a study, using the accession number. - * - * Look for a study stored in Orthanc, using its Accession Number tag (0x0008, - * 0x0050). This function uses the database index to run as fast as possible (it - * does not loop over all the stored studies). - * - * @param accessionNumber The Accession Number of interest. - * @return The resulting string. - **/ - public static String lookupStudyWithAccessionNumber( - String accessionNumber) { - return NativeSDK.OrthancPluginLookupStudyWithAccessionNumber(accessionNumber); - } - - /** - * Look for a series. - * - * Look for a series stored in Orthanc, using its Series Instance UID tag (0x0020, - * 0x000e). This function uses the database index to run as fast as possible (it - * does not loop over all the stored series). - * - * @param seriesUID The Series Instance UID of interest. - * @return The resulting string. - **/ - public static String lookupSeries( - String seriesUID) { - return NativeSDK.OrthancPluginLookupSeries(seriesUID); - } - - /** - * Look for an instance. - * - * Look for an instance stored in Orthanc, using its SOP Instance UID tag (0x0008, - * 0x0018). This function uses the database index to run as fast as possible (it - * does not loop over all the stored instances). - * - * @param sopInstanceUID The SOP Instance UID of interest. - * @return The resulting string. - **/ - public static String lookupInstance( - String sopInstanceUID) { - return NativeSDK.OrthancPluginLookupInstance(sopInstanceUID); - } - - /** - * Return the path to the Orthanc executable. - * - * This function returns the path to the Orthanc executable. - * - * @return The resulting string. - **/ - public static String getOrthancPath() { - return NativeSDK.OrthancPluginGetOrthancPath(); - } - - /** - * Return the directory containing the Orthanc. - * - * This function returns the path to the directory containing the Orthanc - * executable. - * - * @return The resulting string. - **/ - public static String getOrthancDirectory() { - return NativeSDK.OrthancPluginGetOrthancDirectory(); - } - - /** - * Return the path to the configuration file(s). - * - * This function returns the path to the configuration file(s) that was specified - * when starting Orthanc. Since version 0.9.1, this path can refer to a folder that - * stores a set of configuration files. This function is deprecated in favor of - * OrthancPluginGetConfiguration(). - * - * @return The resulting string. - **/ - public static String getConfigurationPath() { - return NativeSDK.OrthancPluginGetConfigurationPath(); - } - - /** - * Set the URI where the plugin provides its Web interface. - * - * For plugins that come with a Web interface, this function declares the entry - * path where to find this interface. This information is notably used in the - * "Plugins" page of Orthanc Explorer. - * - * @param uri The root URI for this plugin. - **/ - public static void setRootUri( - String uri) { - NativeSDK.OrthancPluginSetRootUri(uri); - } - - /** - * Set a description for this plugin. - * - * Set a description for this plugin. It is displayed in the "Plugins" page of - * Orthanc Explorer. - * - * @param description The description. - **/ - public static void setDescription( - String description) { - NativeSDK.OrthancPluginSetDescription(description); - } - - /** - * Extend the JavaScript code of Orthanc Explorer. - * - * Add JavaScript code to customize the default behavior of Orthanc Explorer. This - * can for instance be used to add new buttons. - * - * @param javascript The custom JavaScript code. - **/ - public static void extendOrthancExplorer( - String javascript) { - NativeSDK.OrthancPluginExtendOrthancExplorer(javascript); - } - - /** - * Get the value of a global property. - * - * Get the value of a global property that is stored in the Orthanc database. - * Global properties whose index is below 1024 are reserved by Orthanc. - * - * @param property The global property of interest. - * @param defaultValue The value to return, if the global property is unset. - * @return The resulting string. - **/ - public static String getGlobalProperty( - int property, - String defaultValue) { - return NativeSDK.OrthancPluginGetGlobalProperty(property, defaultValue); - } - - /** - * Set the value of a global property. - * - * Set the value of a global property into the Orthanc database. Setting a global - * property can be used by plugins to save their internal parameters. Plugins are - * only allowed to set properties whose index are above or equal to 1024 - * (properties below 1024 are read-only and reserved by Orthanc). - * - * @param property The global property of interest. - * @param value The value to be set in the global property. - **/ - public static void setGlobalProperty( - int property, - String value) { - NativeSDK.OrthancPluginSetGlobalProperty(property, value); - } - - /** - * Get the number of command-line arguments. - * - * Retrieve the number of command-line arguments that were used to launch Orthanc. - * - * @return The number of arguments. - **/ - public static int getCommandLineArgumentsCount() { - return NativeSDK.OrthancPluginGetCommandLineArgumentsCount(); - } - - /** - * Get the value of a command-line argument. - * - * Get the value of one of the command-line arguments that were used to launch - * Orthanc. The number of available arguments can be retrieved by - * OrthancPluginGetCommandLineArgumentsCount(). - * - * @param argument The index of the argument. - * @return The resulting string. - **/ - public static String getCommandLineArgument( - int argument) { - return NativeSDK.OrthancPluginGetCommandLineArgument(argument); - } - - /** - * Get the expected version of the database schema. - * - * Retrieve the expected version of the database schema. - * - * @return The version. - **/ - public static int getExpectedDatabaseVersion() { - return NativeSDK.OrthancPluginGetExpectedDatabaseVersion(); - } - - /** - * Return the content of the configuration file(s). - * - * This function returns the content of the configuration that is used by Orthanc, - * formatted as a JSON string. - * - * @return The resulting string. - **/ - public static String getConfiguration() { - return NativeSDK.OrthancPluginGetConfiguration(); - } - - /** - * Compress or decompress a buffer. - * - * This function compresses or decompresses a buffer, using the version of the zlib - * library that is used by the Orthanc core. - * - * @param source The source buffer. - * @param compression The compression algorithm. - * @param uncompress If set to "0", the buffer must be compressed. If set to "1", - * the buffer must be uncompressed. - * @return The resulting memory buffer. - **/ - public static byte[] bufferCompression( - byte[] source, - CompressionType compression, - byte uncompress) { - return NativeSDK.OrthancPluginBufferCompression(source, compression.getValue(), uncompress); - } - - /** - * Read a file. - * - * Read the content of a file on the filesystem, and returns it into a newly - * allocated memory buffer. - * - * @param path The path of the file to be read. - * @return The resulting memory buffer. - **/ - public static byte[] readFile( - String path) { - return NativeSDK.OrthancPluginReadFile(path); - } - - /** - * Write a file. - * - * Write the content of a memory buffer to the filesystem. - * - * @param path The path of the file to be written. - * @param data The content of the memory buffer. - **/ - public static void writeFile( - String path, - byte[] data) { - NativeSDK.OrthancPluginWriteFile(path, data); - } - - /** - * Get the description of a given error code. - * - * This function returns the description of a given error code. - * - * @param error The error code of interest. - * @return The resulting string. - **/ - public static String getErrorDescription( - ErrorCode error) { - return NativeSDK.OrthancPluginGetErrorDescription(error.getValue()); - } - - /** - * Encode a PNG image. - * - * This function compresses the given memory buffer containing an image using the - * PNG specification, and stores the result of the compression into a newly - * allocated memory buffer. - * - * @param format The memory layout of the uncompressed image. - * @param width The width of the image. - * @param height The height of the image. - * @param pitch The pitch of the image (i.e. the number of bytes between 2 - * successive lines of the image in the memory buffer). - * @param buffer The memory buffer containing the uncompressed image. - * @return The resulting memory buffer. - **/ - public static byte[] compressPngImage( - PixelFormat format, - int width, - int height, - int pitch, - byte[] buffer) { - return NativeSDK.OrthancPluginCompressPngImage(format.getValue(), width, height, pitch, buffer); - } - - /** - * Encode a JPEG image. - * - * This function compresses the given memory buffer containing an image using the - * JPEG specification, and stores the result of the compression into a newly - * allocated memory buffer. - * - * @param format The memory layout of the uncompressed image. - * @param width The width of the image. - * @param height The height of the image. - * @param pitch The pitch of the image (i.e. the number of bytes between 2 - * successive lines of the image in the memory buffer). - * @param buffer The memory buffer containing the uncompressed image. - * @param quality The quality of the JPEG encoding, between 1 (worst quality, best - * compression) and 100 (best quality, worst compression). - * @return The resulting memory buffer. - **/ - public static byte[] compressJpegImage( - PixelFormat format, - int width, - int height, - int pitch, - byte[] buffer, - byte quality) { - return NativeSDK.OrthancPluginCompressJpegImage(format.getValue(), width, height, pitch, buffer, quality); - } - - /** - * Issue a HTTP GET call. - * - * Make a HTTP GET call to the given URL. The result to the query is stored into a - * newly allocated memory buffer. Favor OrthancPluginRestApiGet() if calling the - * built-in REST API of the Orthanc instance that hosts this plugin. - * - * @param url The URL of interest. - * @param username The username (can be "NULL" if no password protection). - * @param password The password (can be "NULL" if no password protection). - * @return The resulting memory buffer. - **/ - public static byte[] httpGet( - String url, - String username, - String password) { - return NativeSDK.OrthancPluginHttpGet(url, username, password); - } - - /** - * Issue a HTTP POST call. - * - * Make a HTTP POST call to the given URL. The result to the query is stored into a - * newly allocated memory buffer. Favor OrthancPluginRestApiPost() if calling the - * built-in REST API of the Orthanc instance that hosts this plugin. - * - * @param url The URL of interest. - * @param body The content of the body of the request. - * @param username The username (can be "NULL" if no password protection). - * @param password The password (can be "NULL" if no password protection). - * @return The resulting memory buffer. - **/ - public static byte[] httpPost( - String url, - byte[] body, - String username, - String password) { - return NativeSDK.OrthancPluginHttpPost(url, body, username, password); - } - - /** - * Issue a HTTP PUT call. - * - * Make a HTTP PUT call to the given URL. The result to the query is stored into a - * newly allocated memory buffer. Favor OrthancPluginRestApiPut() if calling the - * built-in REST API of the Orthanc instance that hosts this plugin. - * - * @param url The URL of interest. - * @param body The content of the body of the request. - * @param username The username (can be "NULL" if no password protection). - * @param password The password (can be "NULL" if no password protection). - * @return The resulting memory buffer. - **/ - public static byte[] httpPut( - String url, - byte[] body, - String username, - String password) { - return NativeSDK.OrthancPluginHttpPut(url, body, username, password); - } - - /** - * Issue a HTTP DELETE call. - * - * Make a HTTP DELETE call to the given URL. Favor OrthancPluginRestApiDelete() if - * calling the built-in REST API of the Orthanc instance that hosts this plugin. - * - * @param url The URL of interest. - * @param username The username (can be "NULL" if no password protection). - * @param password The password (can be "NULL" if no password protection). - **/ - public static void httpDelete( - String url, - String username, - String password) { - NativeSDK.OrthancPluginHttpDelete(url, username, password); - } - - /** - * Return the number of available fonts. - * - * This function returns the number of fonts that are built in the Orthanc core. - * These fonts can be used to draw texts on images through OrthancPluginDrawText(). - * - * @return The number of fonts. - **/ - public static int getFontsCount() { - return NativeSDK.OrthancPluginGetFontsCount(); - } - - /** - * Return the name of a font. - * - * This function returns the name of a font that is built in the Orthanc core. - * - * @param fontIndex The index of the font. This value must be less than - * OrthancPluginGetFontsCount(). - * @return The resulting string. - **/ - public static String getFontName( - int fontIndex) { - return NativeSDK.OrthancPluginGetFontName(fontIndex); - } - - /** - * Return the size of a font. - * - * This function returns the size of a font that is built in the Orthanc core. - * - * @param fontIndex The index of the font. This value must be less than - * OrthancPluginGetFontsCount(). - * @return The font size. - **/ - public static int getFontSize( - int fontIndex) { - return NativeSDK.OrthancPluginGetFontSize(fontIndex); - } - - /** - * Declare a custom error code for this plugin. - * - * This function declares a custom error code that can be generated by this plugin. - * This declaration is used to enrich the body of the HTTP answer in the case of an - * error, and to set the proper HTTP status code. - * - * @param code The error code that is internal to this plugin. - * @param httpStatus The HTTP status corresponding to this error. - * @param message The description of the error. - **/ - public static void registerErrorCode( - int code, - short httpStatus, - String message) { - NativeSDK.OrthancPluginRegisterErrorCode(code, httpStatus, message); - } - - /** - * Register a new tag into the DICOM dictionary. - * - * This function declares a new public tag in the dictionary of DICOM tags that are - * known to Orthanc. This function should be used in the OrthancPluginInitialize() - * callback. - * - * @param group The group of the tag. - * @param element The element of the tag. - * @param vr The value representation of the tag. - * @param name The nickname of the tag. - * @param minMultiplicity The minimum multiplicity of the tag (must be above 0). - * @param maxMultiplicity The maximum multiplicity of the tag. A value of 0 means - * an arbitrary multiplicity (""n""). - **/ - public static void registerDictionaryTag( - short group, - short element, - ValueRepresentation vr, - String name, - int minMultiplicity, - int maxMultiplicity) { - NativeSDK.OrthancPluginRegisterDictionaryTag(group, element, vr.getValue(), name, minMultiplicity, maxMultiplicity); - } - - /** - * Register a new private tag into the DICOM dictionary. - * - * This function declares a new private tag in the dictionary of DICOM tags that - * are known to Orthanc. This function should be used in the - * OrthancPluginInitialize() callback. - * - * @param group The group of the tag. - * @param element The element of the tag. - * @param vr The value representation of the tag. - * @param name The nickname of the tag. - * @param minMultiplicity The minimum multiplicity of the tag (must be above 0). - * @param maxMultiplicity The maximum multiplicity of the tag. A value of 0 means - * an arbitrary multiplicity (""n""). - * @param privateCreator The private creator of this private tag. - **/ - public static void registerPrivateDictionaryTag( - short group, - short element, - ValueRepresentation vr, - String name, - int minMultiplicity, - int maxMultiplicity, - String privateCreator) { - NativeSDK.OrthancPluginRegisterPrivateDictionaryTag(group, element, vr.getValue(), name, minMultiplicity, maxMultiplicity, privateCreator); - } - - /** - * Format a DICOM memory buffer as a JSON string. - * - * This function takes as input a memory buffer containing a DICOM file, and - * outputs a JSON string representing the tags of this DICOM file. - * - * @param buffer The memory buffer containing the DICOM file. - * @param format The output format. - * @param flags Flags governing the output. - * @param maxStringLength The maximum length of a field. Too long fields will be - * output as "null". The 0 value means no maximum length. - * @return The resulting string. - **/ - public static String dicomBufferToJson( - byte[] buffer, - DicomToJsonFormat format, - DicomToJsonFlags flags, - int maxStringLength) { - return NativeSDK.OrthancPluginDicomBufferToJson(buffer, format.getValue(), flags.getValue(), maxStringLength); - } - - /** - * Format a DICOM instance as a JSON string. - * - * This function formats a DICOM instance that is stored in Orthanc, and outputs a - * JSON string representing the tags of this DICOM instance. - * - * @param instanceId The Orthanc identifier of the instance. - * @param format The output format. - * @param flags Flags governing the output. - * @param maxStringLength The maximum length of a field. Too long fields will be - * output as "null". The 0 value means no maximum length. - * @return The resulting string. - **/ - public static String dicomInstanceToJson( - String instanceId, - DicomToJsonFormat format, - DicomToJsonFlags flags, - int maxStringLength) { - return NativeSDK.OrthancPluginDicomInstanceToJson(instanceId, format.getValue(), flags.getValue(), maxStringLength); - } - - /** - * Create a DICOM instance from a JSON string and an image. - * - * This function takes as input a string containing a JSON file describing the - * content of a DICOM instance. As an output, it writes the corresponding DICOM - * instance to a newly allocated memory buffer. Additionally, an image to be - * encoded within the DICOM instance can also be provided. - * - * Private tags will be associated with the private creator whose value is - * specified in the "DefaultPrivateCreator" configuration option of Orthanc. The - * function OrthancPluginCreateDicom2() can be used if another private creator must - * be used to create this instance. - * - * @param json The input JSON file. - * @param pixelData The image. Can be NULL, if the pixel data is encoded inside the - * JSON with the data URI scheme. - * @param flags Flags governing the output. - * @return The resulting memory buffer. - **/ - public static byte[] createDicom( - String json, - Image pixelData, - CreateDicomFlags flags) { - return NativeSDK.OrthancPluginCreateDicom(json, pixelData.getSelf(), flags.getValue()); - } - - /** - * Compute an MD5 hash. - * - * This functions computes the MD5 cryptographic hash of the given memory buffer. - * - * @param buffer The source memory buffer. - * @return The resulting string. - **/ - public static String computeMd5( - byte[] buffer) { - return NativeSDK.OrthancPluginComputeMd5(buffer); - } - - /** - * Compute a SHA-1 hash. - * - * This functions computes the SHA-1 cryptographic hash of the given memory buffer. - * - * @param buffer The source memory buffer. - * @return The resulting string. - **/ - public static String computeSha1( - byte[] buffer) { - return NativeSDK.OrthancPluginComputeSha1(buffer); - } - - /** - * Generate an UUID. - * - * Generate a random GUID/UUID (globally unique identifier). - * - * @return The resulting string. - **/ - public static String generateUuid() { - return NativeSDK.OrthancPluginGenerateUuid(); - } - - /** - * Detect the MIME type of a file. - * - * This function returns the MIME type of a file by inspecting its extension. - * - * @param path Path to the file. - * @return The resulting string. - **/ - public static String autodetectMimeType( - String path) { - return NativeSDK.OrthancPluginAutodetectMimeType(path); - } - - /** - * Set the value of a metrics. - * - * This function sets the value of a metrics to monitor the behavior of the plugin - * through tools such as Prometheus. The values of all the metrics are stored - * within the Orthanc context. - * - * @param name The name of the metrics to be set. - * @param value The value of the metrics. - * @param type The type of the metrics. This parameter is only taken into - * consideration the first time this metrics is set. - **/ - public static void setMetricsValue( - String name, - float value, - MetricsType type) { - NativeSDK.OrthancPluginSetMetricsValue(name, value, type.getValue()); - } - - /** - * Returns the symbolic name of a DICOM tag. - * - * This function makes a lookup to the dictionary of DICOM tags that are known to - * Orthanc, and returns the symbolic name of a DICOM tag. - * - * @param group The group of the tag. - * @param element The element of the tag. - * @param privateCreator For private tags, the name of the private creator (can be - * NULL). - * @return The resulting string. - **/ - public static String getTagName( - short group, - short element, - String privateCreator) { - return NativeSDK.OrthancPluginGetTagName(group, element, privateCreator); - } - - /** - * Generate a token to grant full access to the REST API of Orthanc - * - * This function generates a token that can be set in the HTTP header - * "Authorization" so as to grant full access to the REST API of Orthanc using an - * external HTTP client. Using this function avoids the need of adding a separate - * user in the "RegisteredUsers" configuration of Orthanc, which eases deployments. - * - * This feature is notably useful in multiprocess scenarios, where a subprocess - * created by a plugin has no access to the "OrthancPluginContext", and thus cannot - * call "OrthancPluginRestApi[Get|Post|Put|Delete]()". - * - * This situation is frequently encountered in Python plugins, where the - * "multiprocessing" package can be used to bypass the Global Interpreter Lock - * (GIL) and thus to improve performance and concurrency. - * - * @return The resulting string. - **/ - public static String generateRestApiAuthorizationToken() { - return NativeSDK.OrthancPluginGenerateRestApiAuthorizationToken(); - } - - /** - * Create a DICOM instance from a JSON string and an image, with a private creator. - * - * This function takes as input a string containing a JSON file describing the - * content of a DICOM instance. As an output, it writes the corresponding DICOM - * instance to a newly allocated memory buffer. Additionally, an image to be - * encoded within the DICOM instance can also be provided. - * - * Contrarily to the function OrthancPluginCreateDicom(), this function can be - * explicitly provided with a private creator. - * - * @param json The input JSON file. - * @param pixelData The image. Can be NULL, if the pixel data is encoded inside the - * JSON with the data URI scheme. - * @param flags Flags governing the output. - * @param privateCreator The private creator to be used for the private DICOM tags. - * Check out the global configuration option "Dictionary" of Orthanc. - * @return The resulting memory buffer. - **/ - public static byte[] createDicom2( - String json, - Image pixelData, - CreateDicomFlags flags, - String privateCreator) { - return NativeSDK.OrthancPluginCreateDicom2(json, pixelData.getSelf(), flags.getValue(), privateCreator); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/HttpMethod.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The various HTTP methods for a REST call. - **/ -public enum HttpMethod { - /** - * GET request - **/ - GET(1), - /** - * POST request - **/ - POST(2), - /** - * PUT request - **/ - PUT(3), - /** - * DELETE request - **/ - DELETE(4); - - private int value; - - private HttpMethod(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static HttpMethod getInstance(int value) { - if (value == 1) { - return GET; - } - if (value == 2) { - return POST; - } - if (value == 3) { - return PUT; - } - if (value == 4) { - return DELETE; - } - - throw new IllegalArgumentException("Value out of range for enumeration HttpMethod: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/IdentifierConstraint.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The constraints on the DICOM identifiers that must be supported by the database - * plugins. - **/ -public enum IdentifierConstraint { - /** - * Equal - **/ - EQUAL(1), - /** - * Less or equal - **/ - SMALLER_OR_EQUAL(2), - /** - * More or equal - **/ - GREATER_OR_EQUAL(3), - /** - * Case-sensitive wildcard matching (with * and ?) - **/ - WILDCARD(4); - - private int value; - - private IdentifierConstraint(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static IdentifierConstraint getInstance(int value) { - if (value == 1) { - return EQUAL; - } - if (value == 2) { - return SMALLER_OR_EQUAL; - } - if (value == 3) { - return GREATER_OR_EQUAL; - } - if (value == 4) { - return WILDCARD; - } - - throw new IllegalArgumentException("Value out of range for enumeration IdentifierConstraint: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/Image.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,209 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * 2D image managed by the Orthanc core - **/ -public class Image { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected Image(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - @Override - protected void finalize() throws Throwable { - dispose(); - super.finalize(); - } - - /** - * Manually deallocate the C object that is associated with this Java wrapper. - * - * This method can be used to immediately deallocate the C object, - * instead of waiting for the garbage collector to dispose the Java wrapper. - **/ - public void dispose() { - if (self != 0) { - NativeSDK.OrthancPluginFreeImage(self); - self = 0; - } - } - - /** - * Decode a compressed image. - * - * This function decodes a compressed image from a memory buffer. - * - * @param data Pointer to a memory buffer containing the compressed image. - * @param format The file format of the compressed image. - * @return The newly constructed object. - **/ - public static Image uncompressImage( - byte[] data, - ImageFormat format) { - return new Image(NativeSDK.OrthancPluginUncompressImage(data, format.getValue())); - } - - /** - * Create an image. - * - * This function creates an image of given size and format. - * - * @param format The format of the pixels. - * @param width The width of the image. - * @param height The height of the image. - * @return The newly constructed object. - **/ - public static Image createImage( - PixelFormat format, - int width, - int height) { - return new Image(NativeSDK.OrthancPluginCreateImage(format.getValue(), width, height)); - } - - /** - * Decode one frame from a DICOM instance. - * - * This function decodes one frame of a DICOM image that is stored in a memory - * buffer. This function will give the same result as - * OrthancPluginUncompressImage() for single-frame DICOM images. - * - * @param buffer Pointer to a memory buffer containing the DICOM image. - * @param frameIndex The index of the frame of interest in a multi-frame image. - * @return The newly constructed object. - **/ - public static Image decodeDicomImage( - byte[] buffer, - int frameIndex) { - return new Image(NativeSDK.OrthancPluginDecodeDicomImage(buffer, frameIndex)); - } - - - /** - * Return the pixel format of an image. - * - * This function returns the type of memory layout for the pixels of the given - * image. - * - * @return The pixel format. - **/ - public PixelFormat getImagePixelFormat() { - return PixelFormat.getInstance(NativeSDK.OrthancPluginGetImagePixelFormat(self)); - } - - /** - * Return the width of an image. - * - * This function returns the width of the given image. - * - * @return The width. - **/ - public int getImageWidth() { - return NativeSDK.OrthancPluginGetImageWidth(self); - } - - /** - * Return the height of an image. - * - * This function returns the height of the given image. - * - * @return The height. - **/ - public int getImageHeight() { - return NativeSDK.OrthancPluginGetImageHeight(self); - } - - /** - * Return the pitch of an image. - * - * This function returns the pitch of the given image. The pitch is defined as the - * number of bytes between 2 successive lines of the image in the memory buffer. - * - * @return The pitch. - **/ - public int getImagePitch() { - return NativeSDK.OrthancPluginGetImagePitch(self); - } - - /** - * Change the pixel format of an image. - * - * This function creates a new image, changing the memory layout of the pixels. - * - * @param targetFormat The target pixel format. - * @return The newly constructed object. - **/ - public Image convertPixelFormat( - PixelFormat targetFormat) { - return new Image(NativeSDK.OrthancPluginConvertPixelFormat(self, targetFormat.getValue())); - } - - /** - * Draw text on an image. - * - * This function draws some text on some image. - * - * @param fontIndex The index of the font. This value must be less than - * OrthancPluginGetFontsCount(). - * @param utf8Text The text to be drawn, encoded as an UTF-8 zero-terminated - * string. - * @param x The X position of the text over the image. - * @param y The Y position of the text over the image. - * @param r The value of the red color channel of the text. - * @param g The value of the green color channel of the text. - * @param b The value of the blue color channel of the text. - **/ - public void drawText( - int fontIndex, - String utf8Text, - int x, - int y, - byte r, - byte g, - byte b) { - NativeSDK.OrthancPluginDrawText(self, fontIndex, utf8Text, x, y, r, g, b); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/ImageFormat.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The image formats that are supported by the Orthanc core. - **/ -public enum ImageFormat { - /** - * Image compressed using PNG - **/ - PNG(0), - /** - * Image compressed using JPEG - **/ - JPEG(1), - /** - * Image compressed using DICOM - **/ - DICOM(2); - - private int value; - - private ImageFormat(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static ImageFormat getInstance(int value) { - if (value == 0) { - return PNG; - } - if (value == 1) { - return JPEG; - } - if (value == 2) { - return DICOM; - } - - throw new IllegalArgumentException("Value out of range for enumeration ImageFormat: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/InstanceOrigin.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The origin of a DICOM instance that has been received by Orthanc. - **/ -public enum InstanceOrigin { - /** - * Unknown origin - **/ - UNKNOWN(1), - /** - * Instance received through DICOM protocol - **/ - DICOM_PROTOCOL(2), - /** - * Instance received through REST API of Orthanc - **/ - REST_API(3), - /** - * Instance added to Orthanc by a plugin - **/ - PLUGIN(4), - /** - * Instance added to Orthanc by a Lua script - **/ - LUA(5), - /** - * Instance received through WebDAV (new in 1.8.0) - **/ - WEB_DAV(6); - - private int value; - - private InstanceOrigin(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static InstanceOrigin getInstance(int value) { - if (value == 1) { - return UNKNOWN; - } - if (value == 2) { - return DICOM_PROTOCOL; - } - if (value == 3) { - return REST_API; - } - if (value == 4) { - return PLUGIN; - } - if (value == 5) { - return LUA; - } - if (value == 6) { - return WEB_DAV; - } - - throw new IllegalArgumentException("Value out of range for enumeration InstanceOrigin: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/Job.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Orthanc job - **/ -public class Job { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected Job(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - @Override - protected void finalize() throws Throwable { - dispose(); - super.finalize(); - } - - /** - * Manually deallocate the C object that is associated with this Java wrapper. - * - * This method can be used to immediately deallocate the C object, - * instead of waiting for the garbage collector to dispose the Java wrapper. - **/ - public void dispose() { - if (self != 0) { - NativeSDK.OrthancPluginFreeJob(self); - self = 0; - } - } - - - /** - * Submit a new job to the jobs engine of Orthanc. - * - * This function adds the given job to the pending jobs of Orthanc. Orthanc will - * take take of freeing it by invoking the finalization callback provided to - * OrthancPluginCreateJob(). - * - * @param priority The priority of the job. - * @return The resulting string. - **/ - public String submitJob( - int priority) { - return NativeSDK.OrthancPluginSubmitJob(self, priority); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/JobStepStatus.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The possible status for one single step of a job. - **/ -public enum JobStepStatus { - /** - * The job has successfully executed all its steps - **/ - SUCCESS(1), - /** - * The job has failed while executing this step - **/ - FAILURE(2), - /** - * The job has still data to process after this step - **/ - CONTINUE(3); - - private int value; - - private JobStepStatus(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static JobStepStatus getInstance(int value) { - if (value == 1) { - return SUCCESS; - } - if (value == 2) { - return FAILURE; - } - if (value == 3) { - return CONTINUE; - } - - throw new IllegalArgumentException("Value out of range for enumeration JobStepStatus: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/JobStopReason.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Explains why the job should stop and release the resources it has allocated. - * This is especially important to disambiguate between the "paused" condition and - * the "final" conditions (success, failure, or canceled). - **/ -public enum JobStopReason { - /** - * The job has succeeded - **/ - SUCCESS(1), - /** - * The job was paused, and will be resumed later - **/ - PAUSED(2), - /** - * The job has failed, and might be resubmitted later - **/ - FAILURE(3), - /** - * The job was canceled, and might be resubmitted later - **/ - CANCELED(4); - - private int value; - - private JobStopReason(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static JobStopReason getInstance(int value) { - if (value == 1) { - return SUCCESS; - } - if (value == 2) { - return PAUSED; - } - if (value == 3) { - return FAILURE; - } - if (value == 4) { - return CANCELED; - } - - throw new IllegalArgumentException("Value out of range for enumeration JobStopReason: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/MetricsType.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The available types of metrics. - **/ -public enum MetricsType { - /** - * Default metrics - **/ - DEFAULT(0), - /** - * This metrics represents a time duration. Orthanc will keep the maximum value of - * the metrics over a sliding window of ten seconds, which is useful if the metrics - * is sampled frequently. - **/ - TIMER(1); - - private int value; - - private MetricsType(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static MetricsType getInstance(int value) { - if (value == 0) { - return DEFAULT; - } - if (value == 1) { - return TIMER; - } - - throw new IllegalArgumentException("Value out of range for enumeration MetricsType: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/NativeSDK.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -class NativeSDK { - public static native int OrthancPluginCheckVersionAdvanced(int arg0, int arg1, int arg2); - public static native int OrthancPluginCheckVersion(); - public static native void OrthancPluginLogError(String arg0); - public static native void OrthancPluginLogWarning(String arg0); - public static native void OrthancPluginLogInfo(String arg0); - public static native byte[] OrthancPluginGetDicomForInstance(String arg0); - public static native byte[] OrthancPluginRestApiGet(String arg0); - public static native byte[] OrthancPluginRestApiGetAfterPlugins(String arg0); - public static native byte[] OrthancPluginRestApiPost(String arg0, byte[] arg1); - public static native byte[] OrthancPluginRestApiPostAfterPlugins(String arg0, byte[] arg1); - public static native void OrthancPluginRestApiDelete(String arg0); - public static native void OrthancPluginRestApiDeleteAfterPlugins(String arg0); - public static native byte[] OrthancPluginRestApiPut(String arg0, byte[] arg1); - public static native byte[] OrthancPluginRestApiPutAfterPlugins(String arg0, byte[] arg1); - public static native String OrthancPluginLookupPatient(String arg0); - public static native String OrthancPluginLookupStudy(String arg0); - public static native String OrthancPluginLookupStudyWithAccessionNumber(String arg0); - public static native String OrthancPluginLookupSeries(String arg0); - public static native String OrthancPluginLookupInstance(String arg0); - public static native String OrthancPluginGetOrthancPath(); - public static native String OrthancPluginGetOrthancDirectory(); - public static native String OrthancPluginGetConfigurationPath(); - public static native void OrthancPluginSetRootUri(String arg0); - public static native void OrthancPluginSetDescription(String arg0); - public static native void OrthancPluginExtendOrthancExplorer(String arg0); - public static native String OrthancPluginGetGlobalProperty(int arg0, String arg1); - public static native void OrthancPluginSetGlobalProperty(int arg0, String arg1); - public static native int OrthancPluginGetCommandLineArgumentsCount(); - public static native String OrthancPluginGetCommandLineArgument(int arg0); - public static native int OrthancPluginGetExpectedDatabaseVersion(); - public static native String OrthancPluginGetConfiguration(); - public static native byte[] OrthancPluginBufferCompression(byte[] arg0, int arg2, byte arg3); - public static native byte[] OrthancPluginReadFile(String arg0); - public static native void OrthancPluginWriteFile(String arg0, byte[] arg1); - public static native String OrthancPluginGetErrorDescription(int arg0); - public static native long OrthancPluginUncompressImage(byte[] arg0, int arg2); - public static native byte[] OrthancPluginCompressPngImage(int arg0, int arg1, int arg2, int arg3, byte[] arg4); - public static native byte[] OrthancPluginCompressJpegImage(int arg0, int arg1, int arg2, int arg3, byte[] arg4, byte arg5); - public static native byte[] OrthancPluginHttpGet(String arg0, String arg1, String arg2); - public static native byte[] OrthancPluginHttpPost(String arg0, byte[] arg1, String arg3, String arg4); - public static native byte[] OrthancPluginHttpPut(String arg0, byte[] arg1, String arg3, String arg4); - public static native void OrthancPluginHttpDelete(String arg0, String arg1, String arg2); - public static native int OrthancPluginGetFontsCount(); - public static native String OrthancPluginGetFontName(int arg0); - public static native int OrthancPluginGetFontSize(int arg0); - public static native void OrthancPluginRegisterErrorCode(int arg0, short arg1, String arg2); - public static native void OrthancPluginRegisterDictionaryTag(short arg0, short arg1, int arg2, String arg3, int arg4, int arg5); - public static native void OrthancPluginRegisterPrivateDictionaryTag(short arg0, short arg1, int arg2, String arg3, int arg4, int arg5, String arg6); - public static native String OrthancPluginDicomBufferToJson(byte[] arg0, int arg2, int arg3, int arg4); - public static native String OrthancPluginDicomInstanceToJson(String arg0, int arg1, int arg2, int arg3); - public static native byte[] OrthancPluginCreateDicom(String arg0, long arg1, int arg2); - public static native long OrthancPluginCreateImage(int arg0, int arg1, int arg2); - public static native long OrthancPluginDecodeDicomImage(byte[] arg0, int arg2); - public static native String OrthancPluginComputeMd5(byte[] arg0); - public static native String OrthancPluginComputeSha1(byte[] arg0); - public static native String OrthancPluginGenerateUuid(); - public static native long OrthancPluginCreateFindMatcher(byte[] arg0); - public static native long OrthancPluginGetPeers(); - public static native String OrthancPluginAutodetectMimeType(String arg0); - public static native void OrthancPluginSetMetricsValue(String arg0, float arg1, int arg2); - public static native String OrthancPluginGetTagName(short arg0, short arg1, String arg2); - public static native long OrthancPluginCreateDicomInstance(byte[] arg0); - public static native long OrthancPluginTranscodeDicomInstance(byte[] arg0, String arg2); - public static native String OrthancPluginGenerateRestApiAuthorizationToken(); - public static native byte[] OrthancPluginCreateDicom2(String arg0, long arg1, int arg2, String arg3); - public static native void OrthancPluginFreeDicomInstance(long self ); - public static native String OrthancPluginGetInstanceRemoteAet(long self ); - public static native long OrthancPluginGetInstanceSize(long self ); - public static native String OrthancPluginGetInstanceJson(long self ); - public static native String OrthancPluginGetInstanceSimplifiedJson(long self ); - public static native int OrthancPluginHasInstanceMetadata(long self, String arg0); - public static native String OrthancPluginGetInstanceMetadata(long self, String arg0); - public static native int OrthancPluginGetInstanceOrigin(long self ); - public static native String OrthancPluginGetInstanceTransferSyntaxUid(long self ); - public static native int OrthancPluginHasInstancePixelData(long self ); - public static native int OrthancPluginGetInstanceFramesCount(long self ); - public static native byte[] OrthancPluginGetInstanceRawFrame(long self, int arg0); - public static native long OrthancPluginGetInstanceDecodedFrame(long self, int arg0); - public static native byte[] OrthancPluginSerializeDicomInstance(long self ); - public static native String OrthancPluginGetInstanceAdvancedJson(long self, int arg0, int arg1, int arg2); - public static native void OrthancPluginFindAddAnswer(long self, byte[] arg0); - public static native void OrthancPluginFindMarkIncomplete(long self ); - public static native void OrthancPluginFreeFindMatcher(long self ); - public static native int OrthancPluginFindMatcherIsMatch(long self, byte[] arg0); - public static native int OrthancPluginGetFindQuerySize(long self ); - public static native String OrthancPluginGetFindQueryTagName(long self, int arg0); - public static native String OrthancPluginGetFindQueryValue(long self, int arg0); - public static native void OrthancPluginFreeImage(long self ); - public static native int OrthancPluginGetImagePixelFormat(long self ); - public static native int OrthancPluginGetImageWidth(long self ); - public static native int OrthancPluginGetImageHeight(long self ); - public static native int OrthancPluginGetImagePitch(long self ); - public static native long OrthancPluginConvertPixelFormat(long self, int arg0); - public static native void OrthancPluginDrawText(long self, int arg0, String arg1, int arg2, int arg3, byte arg4, byte arg5, byte arg6); - public static native void OrthancPluginFreeJob(long self ); - public static native String OrthancPluginSubmitJob(long self, int arg0); - public static native void OrthancPluginFreePeers(long self ); - public static native int OrthancPluginGetPeersCount(long self ); - public static native String OrthancPluginGetPeerName(long self, int arg0); - public static native String OrthancPluginGetPeerUrl(long self, int arg0); - public static native String OrthancPluginGetPeerUserProperty(long self, int arg0, String arg1); - public static native void OrthancPluginAnswerBuffer(long self, byte[] arg0, String arg2); - public static native void OrthancPluginCompressAndAnswerPngImage(long self, int arg0, int arg1, int arg2, int arg3, byte[] arg4); - public static native void OrthancPluginRedirect(long self, String arg0); - public static native void OrthancPluginSendHttpStatusCode(long self, short arg0); - public static native void OrthancPluginSendUnauthorized(long self, String arg0); - public static native void OrthancPluginSendMethodNotAllowed(long self, String arg0); - public static native void OrthancPluginSetCookie(long self, String arg0, String arg1); - public static native void OrthancPluginSetHttpHeader(long self, String arg0, String arg1); - public static native void OrthancPluginStartMultipartAnswer(long self, String arg0, String arg1); - public static native void OrthancPluginSendMultipartItem(long self, byte[] arg0); - public static native void OrthancPluginSendHttpStatus(long self, short arg0, byte[] arg1); - public static native void OrthancPluginCompressAndAnswerJpegImage(long self, int arg0, int arg1, int arg2, int arg3, byte[] arg4, byte arg5); - public static native void OrthancPluginSetHttpErrorDetails(long self, String arg0, byte arg1); - public static native void OrthancPluginStorageAreaCreate(long self, String arg0, byte[] arg1, long arg2, int arg3); - public static native byte[] OrthancPluginStorageAreaRead(long self, String arg0, int arg1); - public static native void OrthancPluginStorageAreaRemove(long self, String arg0, int arg1); - public static native void OrthancPluginReconstructMainDicomTags(long self, int arg0); - public static native void OrthancPluginWorklistAddAnswer(long self, long arg0, byte[] arg1); - public static native void OrthancPluginWorklistMarkIncomplete(long self ); - public static native int OrthancPluginWorklistIsMatch(long self, byte[] arg0); - public static native byte[] OrthancPluginWorklistGetDicomQuery(long self ); -}
--- a/JavaSDK/be/uclouvain/orthanc/Peers.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Orthanc peer - **/ -public class Peers { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected Peers(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - @Override - protected void finalize() throws Throwable { - dispose(); - super.finalize(); - } - - /** - * Manually deallocate the C object that is associated with this Java wrapper. - * - * This method can be used to immediately deallocate the C object, - * instead of waiting for the garbage collector to dispose the Java wrapper. - **/ - public void dispose() { - if (self != 0) { - NativeSDK.OrthancPluginFreePeers(self); - self = 0; - } - } - - /** - * Return the list of available Orthanc peers. - * - * This function returns the parameters of the Orthanc peers that are known to the - * Orthanc server hosting the plugin. - * - * @return The newly constructed object. - **/ - public static Peers getPeers() { - return new Peers(NativeSDK.OrthancPluginGetPeers()); - } - - - /** - * Get the number of Orthanc peers. - * - * This function returns the number of Orthanc peers. - * - * This function is thread-safe: Several threads sharing the same - * OrthancPluginPeers object can simultaneously call this function. - * - * @return The number of peers. - **/ - public int getPeersCount() { - return NativeSDK.OrthancPluginGetPeersCount(self); - } - - /** - * Get the symbolic name of an Orthanc peer. - * - * This function returns the symbolic name of the Orthanc peer, which corresponds - * to the key of the "OrthancPeers" configuration option of Orthanc. - * - * This function is thread-safe: Several threads sharing the same - * OrthancPluginPeers object can simultaneously call this function. - * - * @param peerIndex The index of the peer of interest. This value must be lower - * than OrthancPluginGetPeersCount(). - * @return The resulting string. - **/ - public String getPeerName( - int peerIndex) { - return NativeSDK.OrthancPluginGetPeerName(self, peerIndex); - } - - /** - * Get the base URL of an Orthanc peer. - * - * This function returns the base URL to the REST API of some Orthanc peer. - * - * This function is thread-safe: Several threads sharing the same - * OrthancPluginPeers object can simultaneously call this function. - * - * @param peerIndex The index of the peer of interest. This value must be lower - * than OrthancPluginGetPeersCount(). - * @return The resulting string. - **/ - public String getPeerUrl( - int peerIndex) { - return NativeSDK.OrthancPluginGetPeerUrl(self, peerIndex); - } - - /** - * Get some user-defined property of an Orthanc peer. - * - * This function returns some user-defined property of some Orthanc peer. An - * user-defined property is a property that is associated with the peer in the - * Orthanc configuration file, but that is not recognized by the Orthanc core. - * - * This function is thread-safe: Several threads sharing the same - * OrthancPluginPeers object can simultaneously call this function. - * - * @param peerIndex The index of the peer of interest. This value must be lower - * than OrthancPluginGetPeersCount(). - * @param userProperty The user property of interest. - * @return The resulting string. - **/ - public String getPeerUserProperty( - int peerIndex, - String userProperty) { - return NativeSDK.OrthancPluginGetPeerUserProperty(self, peerIndex, userProperty); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/PixelFormat.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The memory layout of the pixels of an image. - **/ -public enum PixelFormat { - /** - * Graylevel 8bpp image. The image is graylevel. Each pixel is unsigned and stored - * in one byte. - **/ - GRAYSCALE8(1), - /** - * Graylevel, unsigned 16bpp image. The image is graylevel. Each pixel is unsigned - * and stored in two bytes. - **/ - GRAYSCALE16(2), - /** - * Graylevel, signed 16bpp image. The image is graylevel. Each pixel is signed and - * stored in two bytes. - **/ - SIGNED_GRAYSCALE16(3), - /** - * Color image in RGB24 format. This format describes a color image. The pixels are - * stored in 3 consecutive bytes. The memory layout is RGB. - **/ - RGB24(4), - /** - * Color image in RGBA32 format. This format describes a color image. The pixels - * are stored in 4 consecutive bytes. The memory layout is RGBA. - **/ - RGBA32(5), - /** - * Unknown pixel format - **/ - UNKNOWN(6), - /** - * Color image in RGB48 format. This format describes a color image. The pixels are - * stored in 6 consecutive bytes. The memory layout is RRGGBB. - **/ - RGB48(7), - /** - * Graylevel, unsigned 32bpp image. The image is graylevel. Each pixel is unsigned - * and stored in four bytes. - **/ - GRAYSCALE32(8), - /** - * Graylevel, floating-point 32bpp image. The image is graylevel. Each pixel is - * floating-point and stored in four bytes. - **/ - FLOAT32(9), - /** - * Color image in BGRA32 format. This format describes a color image. The pixels - * are stored in 4 consecutive bytes. The memory layout is BGRA. - **/ - BGRA32(10), - /** - * Graylevel, unsigned 64bpp image. The image is graylevel. Each pixel is unsigned - * and stored in eight bytes. - **/ - GRAYSCALE64(11); - - private int value; - - private PixelFormat(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static PixelFormat getInstance(int value) { - if (value == 1) { - return GRAYSCALE8; - } - if (value == 2) { - return GRAYSCALE16; - } - if (value == 3) { - return SIGNED_GRAYSCALE16; - } - if (value == 4) { - return RGB24; - } - if (value == 5) { - return RGBA32; - } - if (value == 6) { - return UNKNOWN; - } - if (value == 7) { - return RGB48; - } - if (value == 8) { - return GRAYSCALE32; - } - if (value == 9) { - return FLOAT32; - } - if (value == 10) { - return BGRA32; - } - if (value == 11) { - return GRAYSCALE64; - } - - throw new IllegalArgumentException("Value out of range for enumeration PixelFormat: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/ReceivedInstanceAction.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The action to be taken after ReceivedInstanceCallback is triggered - **/ -public enum ReceivedInstanceAction { - /** - * Keep the instance as is - **/ - KEEP_AS_IS(1), - /** - * Modify the instance - **/ - MODIFY(2), - /** - * Discard the instance - **/ - DISCARD(3); - - private int value; - - private ReceivedInstanceAction(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static ReceivedInstanceAction getInstance(int value) { - if (value == 1) { - return KEEP_AS_IS; - } - if (value == 2) { - return MODIFY; - } - if (value == 3) { - return DISCARD; - } - - throw new IllegalArgumentException("Value out of range for enumeration ReceivedInstanceAction: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/ResourceType.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The supported types of DICOM resources. - **/ -public enum ResourceType { - /** - * Patient - **/ - PATIENT(0), - /** - * Study - **/ - STUDY(1), - /** - * Series - **/ - SERIES(2), - /** - * Instance - **/ - INSTANCE(3), - /** - * Unavailable resource type - **/ - NONE(4); - - private int value; - - private ResourceType(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static ResourceType getInstance(int value) { - if (value == 0) { - return PATIENT; - } - if (value == 1) { - return STUDY; - } - if (value == 2) { - return SERIES; - } - if (value == 3) { - return INSTANCE; - } - if (value == 4) { - return NONE; - } - - throw new IllegalArgumentException("Value out of range for enumeration ResourceType: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/RestOutput.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Output for a call to the REST API of Orthanc - **/ -public class RestOutput { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected RestOutput(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - - - /** - * Answer to a REST request. - * - * This function answers to a REST request with the content of a memory buffer. - * - * @param answer Pointer to the memory buffer containing the answer. - * @param mimeType The MIME type of the answer. - **/ - public void answerBuffer( - byte[] answer, - String mimeType) { - NativeSDK.OrthancPluginAnswerBuffer(self, answer, mimeType); - } - - /** - * Answer to a REST request with a PNG image. - * - * This function answers to a REST request with a PNG image. The parameters of this - * function describe a memory buffer that contains an uncompressed image. The image - * will be automatically compressed as a PNG image by the core system of Orthanc. - * - * @param format The memory layout of the uncompressed image. - * @param width The width of the image. - * @param height The height of the image. - * @param pitch The pitch of the image (i.e. the number of bytes between 2 - * successive lines of the image in the memory buffer). - * @param buffer The memory buffer containing the uncompressed image. - **/ - public void compressAndAnswerPngImage( - PixelFormat format, - int width, - int height, - int pitch, - byte[] buffer) { - NativeSDK.OrthancPluginCompressAndAnswerPngImage(self, format.getValue(), width, height, pitch, buffer); - } - - /** - * Redirect a REST request. - * - * This function answers to a REST request by redirecting the user to another URI - * using HTTP status 301. - * - * @param redirection Where to redirect. - **/ - public void redirect( - String redirection) { - NativeSDK.OrthancPluginRedirect(self, redirection); - } - - /** - * Send a HTTP status code. - * - * This function answers to a REST request by sending a HTTP status code (such as - * "400 - Bad Request"). Note that: - Successful requests (status 200) must use - * ::OrthancPluginAnswerBuffer(). - Redirections (status 301) must use - * ::OrthancPluginRedirect(). - Unauthorized access (status 401) must use - * ::OrthancPluginSendUnauthorized(). - Methods not allowed (status 405) must use - * ::OrthancPluginSendMethodNotAllowed(). - * - * @param status The HTTP status code to be sent. - **/ - public void sendHttpStatusCode( - short status) { - NativeSDK.OrthancPluginSendHttpStatusCode(self, status); - } - - /** - * Signal that a REST request is not authorized. - * - * This function answers to a REST request by signaling that it is not authorized. - * - * @param realm The realm for the authorization process. - **/ - public void sendUnauthorized( - String realm) { - NativeSDK.OrthancPluginSendUnauthorized(self, realm); - } - - /** - * Signal that this URI does not support this HTTP method. - * - * This function answers to a REST request by signaling that the queried URI does - * not support this method. - * - * @param allowedMethods The allowed methods for this URI (e.g. "GET,POST" after a - * PUT or a POST request). - **/ - public void sendMethodNotAllowed( - String allowedMethods) { - NativeSDK.OrthancPluginSendMethodNotAllowed(self, allowedMethods); - } - - /** - * Set a cookie. - * - * This function sets a cookie in the HTTP client. - * - * @param cookie The cookie to be set. - * @param value The value of the cookie. - **/ - public void setCookie( - String cookie, - String value) { - NativeSDK.OrthancPluginSetCookie(self, cookie, value); - } - - /** - * Set some HTTP header. - * - * This function sets a HTTP header in the HTTP answer. - * - * @param key The HTTP header to be set. - * @param value The value of the HTTP header. - **/ - public void setHttpHeader( - String key, - String value) { - NativeSDK.OrthancPluginSetHttpHeader(self, key, value); - } - - /** - * Start an HTTP multipart answer. - * - * Initiates a HTTP multipart answer, as the result of a REST request. - * - * @param subType The sub-type of the multipart answer ("mixed" or "related"). - * @param contentType The MIME type of the items in the multipart answer. - **/ - public void startMultipartAnswer( - String subType, - String contentType) { - NativeSDK.OrthancPluginStartMultipartAnswer(self, subType, contentType); - } - - /** - * Send an item as a part of some HTTP multipart answer. - * - * This function sends an item as a part of some HTTP multipart answer that was - * initiated by OrthancPluginStartMultipartAnswer(). - * - * @param answer Pointer to the memory buffer containing the item. - **/ - public void sendMultipartItem( - byte[] answer) { - NativeSDK.OrthancPluginSendMultipartItem(self, answer); - } - - /** - * Send a HTTP status, with a custom body. - * - * This function answers to a HTTP request by sending a HTTP status code (such as - * "400 - Bad Request"), together with a body describing the error. The body will - * only be returned if the configuration option "HttpDescribeErrors" of Orthanc is - * set to "true". - * - * Note that: - Successful requests (status 200) must use - * ::OrthancPluginAnswerBuffer(). - Redirections (status 301) must use - * ::OrthancPluginRedirect(). - Unauthorized access (status 401) must use - * ::OrthancPluginSendUnauthorized(). - Methods not allowed (status 405) must use - * ::OrthancPluginSendMethodNotAllowed(). - * - * @param status The HTTP status code to be sent. - * @param body The body of the answer. - **/ - public void sendHttpStatus( - short status, - byte[] body) { - NativeSDK.OrthancPluginSendHttpStatus(self, status, body); - } - - /** - * Answer to a REST request with a JPEG image. - * - * This function answers to a REST request with a JPEG image. The parameters of - * this function describe a memory buffer that contains an uncompressed image. The - * image will be automatically compressed as a JPEG image by the core system of - * Orthanc. - * - * @param format The memory layout of the uncompressed image. - * @param width The width of the image. - * @param height The height of the image. - * @param pitch The pitch of the image (i.e. the number of bytes between 2 - * successive lines of the image in the memory buffer). - * @param buffer The memory buffer containing the uncompressed image. - * @param quality The quality of the JPEG encoding, between 1 (worst quality, best - * compression) and 100 (best quality, worst compression). - **/ - public void compressAndAnswerJpegImage( - PixelFormat format, - int width, - int height, - int pitch, - byte[] buffer, - byte quality) { - NativeSDK.OrthancPluginCompressAndAnswerJpegImage(self, format.getValue(), width, height, pitch, buffer, quality); - } - - /** - * Provide a detailed description for an HTTP error. - * - * This function sets the detailed description associated with an HTTP error. This - * description will be displayed in the "Details" field of the JSON body of the - * HTTP answer. It is only taken into consideration if the REST callback returns an - * error code that is different from "OrthancPluginErrorCode_Success", and if the - * "HttpDescribeErrors" configuration option of Orthanc is set to "true". - * - * @param details The details of the error message. - * @param log Whether to also write the detailed error to the Orthanc logs. - **/ - public void setHttpErrorDetails( - String details, - byte log) { - NativeSDK.OrthancPluginSetHttpErrorDetails(self, details, log); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/ServerChunkedRequestReader.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Read for a chunked HTTP request - **/ -public class ServerChunkedRequestReader { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected ServerChunkedRequestReader(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - - -}
--- a/JavaSDK/be/uclouvain/orthanc/StorageArea.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Storage area plugin - **/ -public class StorageArea { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected StorageArea(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - - - /** - * Create a file inside the storage area. - * - * This function creates a new file inside the storage area that is currently used - * by Orthanc. - * - * @param uuid The identifier of the file to be created. - * @param content The content to store in the newly created file. - * @param size The size of the content. - * @param type The type of the file content. - **/ - public void storageAreaCreate( - String uuid, - byte[] content, - long size, - ContentType type) { - NativeSDK.OrthancPluginStorageAreaCreate(self, uuid, content, size, type.getValue()); - } - - /** - * Read a file from the storage area. - * - * This function reads the content of a given file from the storage area that is - * currently used by Orthanc. - * - * @param uuid The identifier of the file to be read. - * @param type The type of the file content. - * @return The resulting memory buffer. - **/ - public byte[] storageAreaRead( - String uuid, - ContentType type) { - return NativeSDK.OrthancPluginStorageAreaRead(self, uuid, type.getValue()); - } - - /** - * Remove a file from the storage area. - * - * This function removes a given file from the storage area that is currently used - * by Orthanc. - * - * @param uuid The identifier of the file to be removed. - * @param type The type of the file content. - **/ - public void storageAreaRemove( - String uuid, - ContentType type) { - NativeSDK.OrthancPluginStorageAreaRemove(self, uuid, type.getValue()); - } - - /** - * Reconstruct the main DICOM tags. - * - * This function requests the Orthanc core to reconstruct the main DICOM tags of - * all the resources of the given type. This function can only be used as a part of - * the upgrade of a custom database back-end. A database transaction will be - * automatically setup. - * - * @param level The type of the resources of interest. - **/ - public void reconstructMainDicomTags( - ResourceType level) { - NativeSDK.OrthancPluginReconstructMainDicomTags(self, level.getValue()); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/StorageCommitmentFailureReason.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The available values for the Failure Reason (0008,1197) during storage - * commitment. - * http://dicom.nema.org/medical/dicom/2019e/output/chtml/part03/sect_C.14.html#sect_C.14.1.1 - **/ -public enum StorageCommitmentFailureReason { - /** - * Success: The DICOM instance is properly stored in the SCP - **/ - SUCCESS(0), - /** - * 0110H: A general failure in processing the operation was encountered - **/ - PROCESSING_FAILURE(1), - /** - * 0112H: One or more of the elements in the Referenced SOP Instance Sequence was - * not available - **/ - NO_SUCH_OBJECT_INSTANCE(2), - /** - * 0213H: The SCP does not currently have enough resources to store the requested - * SOP Instance(s) - **/ - RESOURCE_LIMITATION(3), - /** - * 0122H: Storage Commitment has been requested for a SOP Instance with a SOP Class - * that is not supported by the SCP - **/ - REFERENCED_SOPCLASS_NOT_SUPPORTED(4), - /** - * 0119H: The SOP Class of an element in the Referenced SOP Instance Sequence did - * not correspond to the SOP class registered for this SOP Instance at the SCP - **/ - CLASS_INSTANCE_CONFLICT(5), - /** - * 0131H: The Transaction UID of the Storage Commitment Request is already in use - **/ - DUPLICATE_TRANSACTION_UID(6); - - private int value; - - private StorageCommitmentFailureReason(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static StorageCommitmentFailureReason getInstance(int value) { - if (value == 0) { - return SUCCESS; - } - if (value == 1) { - return PROCESSING_FAILURE; - } - if (value == 2) { - return NO_SUCH_OBJECT_INSTANCE; - } - if (value == 3) { - return RESOURCE_LIMITATION; - } - if (value == 4) { - return REFERENCED_SOPCLASS_NOT_SUPPORTED; - } - if (value == 5) { - return CLASS_INSTANCE_CONFLICT; - } - if (value == 6) { - return DUPLICATE_TRANSACTION_UID; - } - - throw new IllegalArgumentException("Value out of range for enumeration StorageCommitmentFailureReason: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/ValueRepresentation.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,246 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * The value representations present in the DICOM standard (version 2013). - **/ -public enum ValueRepresentation { - /** - * Application Entity - **/ - AE(1), - /** - * Age String - **/ - AS(2), - /** - * Attribute Tag - **/ - AT(3), - /** - * Code String - **/ - CS(4), - /** - * Date - **/ - DA(5), - /** - * Decimal String - **/ - DS(6), - /** - * Date Time - **/ - DT(7), - /** - * Floating Point Double - **/ - FD(8), - /** - * Floating Point Single - **/ - FL(9), - /** - * Integer String - **/ - IS(10), - /** - * Long String - **/ - LO(11), - /** - * Long Text - **/ - LT(12), - /** - * Other Byte String - **/ - OB(13), - /** - * Other Float String - **/ - OF(14), - /** - * Other Word String - **/ - OW(15), - /** - * Person Name - **/ - PN(16), - /** - * Short String - **/ - SH(17), - /** - * Signed Long - **/ - SL(18), - /** - * Sequence of Items - **/ - SQ(19), - /** - * Signed Short - **/ - SS(20), - /** - * Short Text - **/ - ST(21), - /** - * Time - **/ - TM(22), - /** - * Unique Identifier (UID) - **/ - UI(23), - /** - * Unsigned Long - **/ - UL(24), - /** - * Unknown - **/ - UN(25), - /** - * Unsigned Short - **/ - US(26), - /** - * Unlimited Text - **/ - UT(27); - - private int value; - - private ValueRepresentation(int value) { - this.value = value; - } - - /** - * Return the enumeration value that corresponds to an integer value of interest. - * @param value The integer value. - * @return The enumeration value. - **/ - protected static ValueRepresentation getInstance(int value) { - if (value == 1) { - return AE; - } - if (value == 2) { - return AS; - } - if (value == 3) { - return AT; - } - if (value == 4) { - return CS; - } - if (value == 5) { - return DA; - } - if (value == 6) { - return DS; - } - if (value == 7) { - return DT; - } - if (value == 8) { - return FD; - } - if (value == 9) { - return FL; - } - if (value == 10) { - return IS; - } - if (value == 11) { - return LO; - } - if (value == 12) { - return LT; - } - if (value == 13) { - return OB; - } - if (value == 14) { - return OF; - } - if (value == 15) { - return OW; - } - if (value == 16) { - return PN; - } - if (value == 17) { - return SH; - } - if (value == 18) { - return SL; - } - if (value == 19) { - return SQ; - } - if (value == 20) { - return SS; - } - if (value == 21) { - return ST; - } - if (value == 22) { - return TM; - } - if (value == 23) { - return UI; - } - if (value == 24) { - return UL; - } - if (value == 25) { - return UN; - } - if (value == 26) { - return US; - } - if (value == 27) { - return UT; - } - - throw new IllegalArgumentException("Value out of range for enumeration ValueRepresentation: " + value); - } - - /** - * Get the integer value corresponding to this enumeration value. - * @return The integer value. - **/ - public int getValue() { - return value; - } -}
--- a/JavaSDK/be/uclouvain/orthanc/WorklistAnswers.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * Answers to a DICOM C-FIND worklist query - **/ -public class WorklistAnswers { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected WorklistAnswers(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - - - /** - * Add one answer to some modality worklist request. - * - * This function adds one worklist (encoded as a DICOM file) to the set of answers - * corresponding to some C-Find SCP request against modality worklists. - * - * @param query The worklist query, as received by the callback. - * @param dicom The worklist to answer, encoded as a DICOM file. - **/ - public void worklistAddAnswer( - WorklistQuery query, - byte[] dicom) { - NativeSDK.OrthancPluginWorklistAddAnswer(self, query.getSelf(), dicom); - } - - /** - * Mark the set of worklist answers as incomplete. - * - * This function marks as incomplete the set of answers corresponding to some - * C-Find SCP request against modality worklists. This must be used if canceling - * the handling of a request when too many answers are to be returned. - **/ - public void worklistMarkIncomplete() { - NativeSDK.OrthancPluginWorklistMarkIncomplete(self); - } - -}
--- a/JavaSDK/be/uclouvain/orthanc/WorklistQuery.java Thu Aug 14 16:42:02 2025 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -package be.uclouvain.orthanc; - -/** - * SPDX-FileCopyrightText: 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -/** - * Java plugin for Orthanc - * Copyright (C) 2023-2025 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - **/ - - -// WARNING: Auto-generated file. Do not modify it by hand. - -/** - * DICOM C-FIND worklist query - **/ -public class WorklistQuery { - private long self; - - /** - * Construct a Java object wrapping a C object that is managed by Orthanc. - * @param self Pointer to the C object. - **/ - protected WorklistQuery(long self) { - if (self == 0) { - throw new IllegalArgumentException("Null pointer"); - } else { - this.self = self; - } - } - - /** - * Return the C object that is associated with this Java wrapper. - * @return Pointer to the C object. - **/ - protected long getSelf() { - return self; - } - - - - /** - * Test whether a worklist matches the query. - * - * This function checks whether one worklist (encoded as a DICOM file) matches the - * C-Find SCP query against modality worklists. This function must be called before - * adding the worklist as an answer through OrthancPluginWorklistAddAnswer(). - * - * @param dicom The worklist to answer, encoded as a DICOM file. - * @return 1 if the worklist matches the query, 0 otherwise. - **/ - public int worklistIsMatch( - byte[] dicom) { - return NativeSDK.OrthancPluginWorklistIsMatch(self, dicom); - } - - /** - * Retrieve the worklist query as a DICOM file. - * - * This function retrieves the DICOM file that underlies a C-Find SCP query against - * modality worklists. - * - * @return The resulting memory buffer. - **/ - public byte[] worklistGetDicomQuery() { - return NativeSDK.OrthancPluginWorklistGetDicomQuery(self); - } - -}
--- a/OrthancSDKVersion.cmake Thu Aug 14 16:42:02 2025 +0200 +++ b/OrthancSDKVersion.cmake Thu Aug 14 17:27:40 2025 +0200 @@ -18,11 +18,23 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. + +##################################################################### +## General information +##################################################################### + set(ORTHANC_SDK_DEFAULT_VERSION "1.12.9") # This list must correspond to the content of "./Resources/SyncOrthancFolder.py" set(ORTHANC_SDK_AVAILABLE_VERSIONS "1.10.0" "1.12.6" "1.12.9") + +##################################################################### +## Define the CMake parameters to select the SDK to be used. This +## information is shared by the C++ native code and by the Java +## wrapper. +##################################################################### + # Generate the documentation about the "ORTHANC_SDK_VERSION" option set(tmp "Version of the Orthanc plugin SDK to use, if not using the system version (can be") foreach(version IN LISTS ORTHANC_SDK_AVAILABLE_VERSIONS) @@ -30,9 +42,33 @@ endforeach() set(tmp "${tmp} or \"path\")") -# Define the CMake parameters to select the SDK to be used. This -# information is shared by the C++ native code and by the Java -# wrapper. set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system-wide version of the Orthanc plugin SDK") set(ORTHANC_SDK_VERSION "${ORTHANC_SDK_DEFAULT_VERSION}" CACHE STRING "${tmp}") set(ORTHANC_SDK_PATH "" CACHE STRING "Path to the orthanc/OrthancCPlugin.h file, if ORTHANC_SDK_VERSION is set to \"path\"") + + +##################################################################### +## Find the Orthanc SDK +##################################################################### + +if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK) + if (ORTHANC_SDK_VERSION STREQUAL "path") + set(ORTHANC_SDK ${ORTHANC_SDK_PATH}/orthanc/OrthancCPlugin.h) + + else() + set(ORTHANC_SDK ${CMAKE_SOURCE_DIR}/../Resources/Orthanc/Sdk-${ORTHANC_SDK_VERSION}/orthanc/OrthancCPlugin.h) + endif() + +else() + find_path(ORTHANC_SDK_SYSTEM_DIR OrthancCPlugin.h + /usr/ + /usr/local/ + PATH_SUFFIXES include/orthanc + ) + + if (${ORTHANC_SDK_SYSTEM_DIR} STREQUAL "ORTHANC_SDK_SYSTEM_DIR-NOTFOUND") + message(FATAL_ERROR "Cannot locate the orthanc/OrthancCPlugin.h header") + endif() + + set(ORTHANC_SDK ${ORTHANC_SDK_SYSTEM_DIR}/OrthancCPlugin.h) +endif()
--- a/Plugin/CMakeLists.txt Thu Aug 14 16:42:02 2025 +0200 +++ b/Plugin/CMakeLists.txt Thu Aug 14 17:27:40 2025 +0200 @@ -18,8 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -cmake_minimum_required(VERSION 3.1) - +cmake_minimum_required(VERSION 3.1...4.0) project(OrthancJavaPlugin) set(PLUGIN_VERSION "mainline") @@ -32,7 +31,14 @@ ##################################################################### include(CheckIncludeFileCXX) -include(FindPythonInterp) + +if(CMAKE_VERSION VERSION_GREATER "3.11") + find_package(Python REQUIRED COMPONENTS Interpreter) + set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) +else() + include(FindPythonInterp) + find_package(PythonInterp REQUIRED) +endif() include(${CMAKE_SOURCE_DIR}/../Resources/Orthanc/CMake/AutoGeneratedCode.cmake) include(${CMAKE_SOURCE_DIR}/../Resources/Orthanc/CMake/Compiler.cmake)