├── .bumpversion.cfg ├── .ci ├── build │ ├── apt.py │ ├── build.py │ ├── conda.py │ └── post_build.py ├── readthedocs │ └── conda.yml ├── run.sh └── windows │ ├── build.cmd │ ├── install.cmd │ ├── post_build.cmd │ └── python_executable.cmake ├── .github └── workflows │ └── build.yml ├── .readthedocs.yaml ├── .travis.yml ├── CMakeLists.txt ├── FindJsonCpp.cmake ├── LICENSE.txt ├── OdilConfig.cmake.in ├── README.md ├── applications ├── CMakeLists.txt ├── cli │ ├── __init__.py │ ├── dicomdir.py │ ├── echo.py │ ├── find.py │ ├── get.py │ ├── print_.py │ ├── store.py │ └── transcode.py └── odil ├── cmake_uninstall.cmake.in ├── documentation ├── Doxyfile ├── Doxyfile.breathe ├── DoxygenLayout.xml ├── Makefile ├── conf.py ├── developer │ ├── cpp │ │ ├── association.rst │ │ ├── data_sets.rst │ │ ├── index.rst │ │ ├── io.rst │ │ ├── services-scp.rst │ │ ├── services-scu.rst │ │ └── webservices.rst │ ├── index.rst │ ├── javascript │ │ └── index.rst │ └── python │ │ └── index.rst ├── index.rst ├── installation │ ├── index.rst │ ├── linux.rst │ └── mac.rst ├── make.bat └── user │ ├── dicomdir.rst │ ├── echo.rst │ ├── find.rst │ ├── get.rst │ ├── index.rst │ ├── print.rst │ ├── store.rst │ └── transcode.rst ├── examples ├── CMakeLists.txt ├── cpp │ ├── CMakeLists.txt │ ├── dicomdir.cpp │ ├── dump.cpp │ ├── find.cpp │ ├── genericscp.cpp │ ├── get.cpp │ ├── move.cpp │ ├── qido-rs-client.cpp │ ├── store.cpp │ ├── stow-rs-client.cpp │ └── wado-rs-client.cpp ├── js │ ├── CMakeLists.txt │ ├── print.html │ ├── print.js │ ├── qido.html │ ├── qido.js │ ├── wado.html │ └── wado.js └── python │ ├── CMakeLists.txt │ ├── convert.py │ ├── dump.py │ └── find.py ├── generate_registry ├── registry.cpp.tmpl ├── registry.h.tmpl ├── registry_group.cpp.tmpl ├── registry_group.h.tmpl ├── src ├── CMakeLists.txt └── odil │ ├── Association.cpp │ ├── Association.h │ ├── AssociationAcceptor.cpp │ ├── AssociationAcceptor.h │ ├── AssociationParameters.cpp │ ├── AssociationParameters.h │ ├── BasicDirectoryCreator.cpp │ ├── BasicDirectoryCreator.h │ ├── DataSet.cpp │ ├── DataSet.h │ ├── EchoSCP.cpp │ ├── EchoSCP.h │ ├── EchoSCU.cpp │ ├── EchoSCU.h │ ├── Element.cpp │ ├── Element.h │ ├── Element.txx │ ├── ElementsDictionary.cpp │ ├── ElementsDictionary.h │ ├── Exception.cpp │ ├── Exception.h │ ├── FindSCP.cpp │ ├── FindSCP.h │ ├── FindSCU.cpp │ ├── FindSCU.h │ ├── GetSCP.cpp │ ├── GetSCP.h │ ├── GetSCU.cpp │ ├── GetSCU.h │ ├── MoveSCP.cpp │ ├── MoveSCP.h │ ├── MoveSCU.cpp │ ├── MoveSCU.h │ ├── NCreateSCP.cpp │ ├── NCreateSCP.h │ ├── NSetSCP.cpp │ ├── NSetSCP.h │ ├── NSetSCU.cpp │ ├── NSetSCU.h │ ├── Reader.cpp │ ├── Reader.h │ ├── Reader.txx │ ├── SCP.cpp │ ├── SCP.h │ ├── SCPDispatcher.cpp │ ├── SCPDispatcher.h │ ├── SCU.cpp │ ├── SCU.h │ ├── StoreSCP.cpp │ ├── StoreSCP.h │ ├── StoreSCU.cpp │ ├── StoreSCU.h │ ├── StringStream.h │ ├── Tag.cpp │ ├── Tag.h │ ├── UIDsDictionary.cpp │ ├── UIDsDictionary.h │ ├── VR.cpp │ ├── VR.h │ ├── VRFinder.cpp │ ├── VRFinder.h │ ├── Value.cpp │ ├── Value.h │ ├── Value.txx │ ├── Writer.cpp │ ├── Writer.h │ ├── Writer.txx │ ├── base64.cpp │ ├── base64.h │ ├── base64.txx │ ├── dcmtk │ ├── ElementAccessor.cpp │ ├── ElementAccessor.h │ ├── ElementAccessor.txx │ ├── ElementTraits.cpp │ ├── ElementTraits.h │ ├── Exception.cpp │ ├── Exception.h │ ├── VRTraits.h │ ├── conversion.cpp │ ├── conversion.h │ └── conversion.txx │ ├── dul │ ├── EventData.h │ ├── StateMachine.cpp │ ├── StateMachine.h │ ├── Transport.cpp │ └── Transport.h │ ├── endian.cpp │ ├── endian.h │ ├── json_converter.cpp │ ├── json_converter.h │ ├── logging.cpp │ ├── logging.h │ ├── message │ ├── CEchoRequest.cpp │ ├── CEchoRequest.h │ ├── CEchoResponse.cpp │ ├── CEchoResponse.h │ ├── CFindRequest.cpp │ ├── CFindRequest.h │ ├── CFindResponse.cpp │ ├── CFindResponse.h │ ├── CGetRequest.cpp │ ├── CGetRequest.h │ ├── CGetResponse.cpp │ ├── CGetResponse.h │ ├── CMoveRequest.cpp │ ├── CMoveRequest.h │ ├── CMoveResponse.cpp │ ├── CMoveResponse.h │ ├── CStoreRequest.cpp │ ├── CStoreRequest.h │ ├── CStoreResponse.cpp │ ├── CStoreResponse.h │ ├── Cancellation.cpp │ ├── Cancellation.h │ ├── Message.cpp │ ├── Message.h │ ├── NCreateRequest.cpp │ ├── NCreateRequest.h │ ├── NCreateResponse.cpp │ ├── NCreateResponse.h │ ├── NSetRequest.cpp │ ├── NSetRequest.h │ ├── NSetResponse.cpp │ ├── NSetResponse.h │ ├── Request.cpp │ ├── Request.h │ ├── Response.cpp │ └── Response.h │ ├── odil.h │ ├── pdu │ ├── AAbort.cpp │ ├── AAbort.h │ ├── AAssociate.cpp │ ├── AAssociate.h │ ├── AAssociateAC.cpp │ ├── AAssociateAC.h │ ├── AAssociateRJ.cpp │ ├── AAssociateRJ.h │ ├── AAssociateRQ.cpp │ ├── AAssociateRQ.h │ ├── AReleaseRP.cpp │ ├── AReleaseRP.h │ ├── AReleaseRQ.cpp │ ├── AReleaseRQ.h │ ├── ApplicationContext.cpp │ ├── ApplicationContext.h │ ├── AsynchronousOperationsWindow.cpp │ ├── AsynchronousOperationsWindow.h │ ├── ImplementationClassUID.cpp │ ├── ImplementationClassUID.h │ ├── ImplementationVersionName.cpp │ ├── ImplementationVersionName.h │ ├── Item.cpp │ ├── Item.h │ ├── MaximumLength.cpp │ ├── MaximumLength.h │ ├── Object.cpp │ ├── Object.h │ ├── PDataTF.cpp │ ├── PDataTF.h │ ├── PresentationContext.cpp │ ├── PresentationContext.h │ ├── PresentationContextAC.cpp │ ├── PresentationContextAC.h │ ├── PresentationContextRQ.cpp │ ├── PresentationContextRQ.h │ ├── RoleSelection.cpp │ ├── RoleSelection.h │ ├── SOPClassCommonExtendedNegotiation.cpp │ ├── SOPClassCommonExtendedNegotiation.h │ ├── SOPClassExtendedNegotiation.cpp │ ├── SOPClassExtendedNegotiation.h │ ├── UserIdentityAC.cpp │ ├── UserIdentityAC.h │ ├── UserIdentityRQ.cpp │ ├── UserIdentityRQ.h │ ├── UserInformation.cpp │ ├── UserInformation.h │ └── UserInformation.txx │ ├── registry.cpp │ ├── registry.h │ ├── registry_0000.cpp │ ├── registry_0000.h │ ├── registry_0002.cpp │ ├── registry_0002.h │ ├── registry_0004.cpp │ ├── registry_0004.h │ ├── registry_0008.cpp │ ├── registry_0008.h │ ├── registry_0010.cpp │ ├── registry_0010.h │ ├── registry_0012.cpp │ ├── registry_0012.h │ ├── registry_0014.cpp │ ├── registry_0014.h │ ├── registry_0016.cpp │ ├── registry_0016.h │ ├── registry_0018.cpp │ ├── registry_0018.h │ ├── registry_0020.cpp │ ├── registry_0020.h │ ├── registry_0022.cpp │ ├── registry_0022.h │ ├── registry_0024.cpp │ ├── registry_0024.h │ ├── registry_0028.cpp │ ├── registry_0028.h │ ├── registry_0032.cpp │ ├── registry_0032.h │ ├── registry_0034.cpp │ ├── registry_0034.h │ ├── registry_0038.cpp │ ├── registry_0038.h │ ├── registry_003a.cpp │ ├── registry_003a.h │ ├── registry_0040.cpp │ ├── registry_0040.h │ ├── registry_0042.cpp │ ├── registry_0042.h │ ├── registry_0044.cpp │ ├── registry_0044.h │ ├── registry_0046.cpp │ ├── registry_0046.h │ ├── registry_0048.cpp │ ├── registry_0048.h │ ├── registry_0050.cpp │ ├── registry_0050.h │ ├── registry_0052.cpp │ ├── registry_0052.h │ ├── registry_0054.cpp │ ├── registry_0054.h │ ├── registry_0060.cpp │ ├── registry_0060.h │ ├── registry_0062.cpp │ ├── registry_0062.h │ ├── registry_0064.cpp │ ├── registry_0064.h │ ├── registry_0066.cpp │ ├── registry_0066.h │ ├── registry_0068.cpp │ ├── registry_0068.h │ ├── registry_006a.cpp │ ├── registry_006a.h │ ├── registry_0070.cpp │ ├── registry_0070.h │ ├── registry_0072.cpp │ ├── registry_0072.h │ ├── registry_0074.cpp │ ├── registry_0074.h │ ├── registry_0076.cpp │ ├── registry_0076.h │ ├── registry_0078.cpp │ ├── registry_0078.h │ ├── registry_0080.cpp │ ├── registry_0080.h │ ├── registry_0082.cpp │ ├── registry_0082.h │ ├── registry_0088.cpp │ ├── registry_0088.h │ ├── registry_0100.cpp │ ├── registry_0100.h │ ├── registry_0400.cpp │ ├── registry_0400.h │ ├── registry_2000.cpp │ ├── registry_2000.h │ ├── registry_2010.cpp │ ├── registry_2010.h │ ├── registry_2020.cpp │ ├── registry_2020.h │ ├── registry_2030.cpp │ ├── registry_2030.h │ ├── registry_2040.cpp │ ├── registry_2040.h │ ├── registry_2050.cpp │ ├── registry_2050.h │ ├── registry_2100.cpp │ ├── registry_2100.h │ ├── registry_2110.cpp │ ├── registry_2110.h │ ├── registry_2120.cpp │ ├── registry_2120.h │ ├── registry_2130.cpp │ ├── registry_2130.h │ ├── registry_2200.cpp │ ├── registry_2200.h │ ├── registry_3002.cpp │ ├── registry_3002.h │ ├── registry_3004.cpp │ ├── registry_3004.h │ ├── registry_3006.cpp │ ├── registry_3006.h │ ├── registry_3008.cpp │ ├── registry_3008.h │ ├── registry_300a.cpp │ ├── registry_300a.h │ ├── registry_300c.cpp │ ├── registry_300c.h │ ├── registry_300e.cpp │ ├── registry_300e.h │ ├── registry_3010.cpp │ ├── registry_3010.h │ ├── registry_4000.cpp │ ├── registry_4000.h │ ├── registry_4008.cpp │ ├── registry_4008.h │ ├── registry_4010.cpp │ ├── registry_4010.h │ ├── registry_4ffe.cpp │ ├── registry_4ffe.h │ ├── registry_5200.cpp │ ├── registry_5200.h │ ├── registry_5400.cpp │ ├── registry_5400.h │ ├── registry_5600.cpp │ ├── registry_5600.h │ ├── registry_7fe0.cpp │ ├── registry_7fe0.h │ ├── registry_fffa.cpp │ ├── registry_fffa.h │ ├── registry_fffc.cpp │ ├── registry_fffc.h │ ├── registry_fffe.cpp │ ├── registry_fffe.h │ ├── registry_misc.cpp │ ├── registry_misc.h │ ├── uid.cpp │ ├── uid.h │ ├── unicode.cpp │ ├── unicode.h │ ├── webservices │ ├── BulkData.h │ ├── HTTPRequest.cpp │ ├── HTTPRequest.h │ ├── HTTPResponse.cpp │ ├── HTTPResponse.h │ ├── ItemWithParameters.cpp │ ├── ItemWithParameters.h │ ├── Message.cpp │ ├── Message.h │ ├── QIDORSRequest.cpp │ ├── QIDORSRequest.h │ ├── QIDORSResponse.cpp │ ├── QIDORSResponse.h │ ├── STOWRSRequest.cpp │ ├── STOWRSRequest.h │ ├── STOWRSResponse.cpp │ ├── STOWRSResponse.h │ ├── Selector.cpp │ ├── Selector.h │ ├── URL.cpp │ ├── URL.h │ ├── Utils.h │ ├── WADORSRequest.cpp │ ├── WADORSRequest.h │ ├── WADORSResponse.cpp │ ├── WADORSResponse.h │ ├── multipart_related.cpp │ ├── multipart_related.h │ └── multipart_related.txx │ ├── write_ds.cpp │ ├── write_ds.h │ ├── xml_converter.cpp │ └── xml_converter.h ├── tests ├── CMakeLists.txt ├── MessageFixtureBase.h ├── PeerFixtureBase.h ├── code │ ├── Association.cpp │ ├── AssociationAcceptor.cpp │ ├── AssociationParameters.cpp │ ├── BasicDirectoryCreator.cpp │ ├── DataSet.cpp │ ├── DcmtkException.cpp │ ├── EchoSCP.cpp │ ├── EchoSCU.cpp │ ├── Element.cpp │ ├── ElementAccessor.cpp │ ├── Exception.cpp │ ├── FindSCP.cpp │ ├── FindSCU.cpp │ ├── GetSCP.cpp │ ├── GetSCU.cpp │ ├── MoveSCP.cpp │ ├── MoveSCU.cpp │ ├── NCreateSCP.cpp │ ├── Reader.cpp │ ├── SCPDispatcher.cpp │ ├── SCU.cpp │ ├── StoreSCU.cpp │ ├── Tag.cpp │ ├── VR.cpp │ ├── VRFinder.cpp │ ├── Value.cpp │ ├── Writer.cpp │ ├── base64.cpp │ ├── conversion.cpp │ ├── dul │ │ ├── StateMachine.cpp │ │ └── Transport.cpp │ ├── endian.cpp │ ├── json_converter.cpp │ ├── message │ │ ├── CEchoRequest.cpp │ │ ├── CEchoResponse.cpp │ │ ├── CFindRequest.cpp │ │ ├── CFindResponse.cpp │ │ ├── CGetRequest.cpp │ │ ├── CGetResponse.cpp │ │ ├── CMoveRequest.cpp │ │ ├── CMoveResponse.cpp │ │ ├── CStoreRequest.cpp │ │ ├── CStoreResponse.cpp │ │ ├── Cancellation.cpp │ │ ├── Message.cpp │ │ ├── Request.cpp │ │ └── Response.cpp │ ├── pdu │ │ ├── AAbort.cpp │ │ ├── AAssociateAC.cpp │ │ ├── AAssociateRJ.cpp │ │ ├── AAssociateRQ.cpp │ │ ├── AReleaseRP.cpp │ │ ├── AReleaseRQ.cpp │ │ ├── ApplicationContext.cpp │ │ ├── AsynchronousOperationsWindow.cpp │ │ ├── ImplementationClassUID.cpp │ │ ├── ImplementationVersionName.cpp │ │ ├── Item.cpp │ │ ├── MaximumLength.cpp │ │ ├── PDataTF.cpp │ │ ├── PresentationContextAC.cpp │ │ ├── PresentationContextRQ.cpp │ │ ├── RoleSelection.cpp │ │ ├── SOPClassCommonExtendedNegotiation.cpp │ │ ├── SOPClassExtendedNegotiation.cpp │ │ ├── UserIdentityAC.cpp │ │ ├── UserIdentityRQ.cpp │ │ └── UserInformation.cpp │ ├── registry.cpp │ ├── uid.cpp │ ├── unicode.cpp │ ├── webservices │ │ ├── HTTPRequest.cpp │ │ ├── HTTPResponse.cpp │ │ ├── ItemWithParameters.cpp │ │ ├── Message.cpp │ │ ├── QIDORSRequest.cpp │ │ ├── QIDORSResponse.cpp │ │ ├── STOWRSRequest.cpp │ │ ├── STOWRSResponse.cpp │ │ ├── Selector.cpp │ │ ├── URL.cpp │ │ ├── WADORSRequest.cpp │ │ ├── WADORSResponse.cpp │ │ └── multipart_related.cpp │ └── xml_converter.cpp ├── data │ ├── dataset.dcm │ └── dcmqrscp.config ├── peer_fixture_base.py ├── tools │ ├── CMakeLists.txt │ ├── dndefine.h │ ├── getscu.cc │ ├── scu.cc │ └── scu.h └── wrappers │ ├── messages │ ├── __init__.py │ └── test_message.py │ ├── test_association.py │ ├── test_association_parameters.py │ ├── test_basic_directory_creator.py │ ├── test_data_set.py │ ├── test_echo_scp.py │ ├── test_echo_scu.py │ ├── test_element.py │ ├── test_elements_dictionary.py │ ├── test_exception.py │ ├── test_find_scp.py │ ├── test_find_scu.py │ ├── test_get_scp.py │ ├── test_get_scu.py │ ├── test_json_converter.py │ ├── test_move_scp.py │ ├── test_move_scu.py │ ├── test_reader.py │ ├── test_registry.py │ ├── test_scp_dispatcher.py │ ├── test_store_scp.py │ ├── test_store_scu.py │ ├── test_tag.py │ ├── test_uid.py │ ├── test_uids_dictionary.py │ ├── test_value.py │ ├── test_vr.py │ ├── test_vr_finder.py │ ├── test_writer.py │ ├── test_xml_converter.py │ └── webservices │ ├── __init__.py │ ├── test_http_request.py │ ├── test_http_response.py │ ├── test_message.py │ ├── test_qido_rs_request.py │ ├── test_qido_rs_response.py │ ├── test_selector.py │ ├── test_stow_rs_request.py │ ├── test_stow_rs_response.py │ ├── test_url.py │ ├── test_wado_rs_request.py │ └── test_wado_rs_response.py └── wrappers ├── js ├── CMakeLists.txt ├── DataSet.cpp ├── Tag.cpp ├── VR.cpp ├── odil.cpp └── webservices │ ├── HTTPRequest.cpp │ ├── HTTPResponse.cpp │ ├── Message.cpp │ ├── QIDORSRequest.cpp │ ├── QIDORSResponse.cpp │ ├── Selector.cpp │ ├── URL.cpp │ ├── Utils.cpp │ ├── WADORSRequest.cpp │ └── WADORSResponse.cpp └── python ├── Association.cpp ├── AssociationParameters.cpp ├── BasicDirectoryCreator.cpp ├── CMakeLists.txt ├── DataSet.cpp ├── DataSetGeneratorWrapper.h ├── EchoSCP.cpp ├── EchoSCU.cpp ├── Element.cpp ├── ElementsDictionary.cpp ├── Exception.cpp ├── FindSCP.cpp ├── FindSCU.cpp ├── GetSCP.cpp ├── GetSCU.cpp ├── MoveSCP.cpp ├── MoveSCU.cpp ├── NCreateSCP.cpp ├── NSetSCP.cpp ├── NSetSCU.cpp ├── Reader.cpp ├── SCPDispatcher.cpp ├── StoreSCP.cpp ├── StoreSCU.cpp ├── Tag.cpp ├── UIDsDictionary.cpp ├── VR.cpp ├── VRFinder.cpp ├── Value.cpp ├── Value.h ├── Value.txx ├── Writer.cpp ├── __init__.py ├── endian.cpp ├── json_converter.cpp ├── messages ├── CEchoRequest.cpp ├── CEchoResponse.cpp ├── CFindRequest.cpp ├── CFindResponse.cpp ├── CGetRequest.cpp ├── CGetResponse.cpp ├── CMoveRequest.cpp ├── CMoveResponse.cpp ├── CStoreRequest.cpp ├── CStoreResponse.cpp ├── Message.cpp ├── NCreateRequest.cpp ├── NSetRequest.cpp ├── Request.cpp ├── Response.cpp └── messages.cpp ├── odil.cpp ├── opaque_types.h ├── registry.cpp ├── streambuf.cpp ├── streambuf.h ├── type_casters.h ├── uid.cpp ├── unicode.cpp ├── webservices ├── BulkData.cpp ├── HTTPRequest.cpp ├── HTTPResponse.cpp ├── Message.cpp ├── QIDORSRequest.cpp ├── QIDORSResponse.cpp ├── STOWRSRequest.cpp ├── STOWRSResponse.cpp ├── Selector.cpp ├── URL.cpp ├── Utils.cpp ├── WADORSRequest.cpp ├── WADORSResponse.cpp └── webservices.cpp └── xml_converter.cpp /.bumpversion.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | current_version = 0.13.0 3 | commit = True 4 | tag = True 5 | sign_tags = True 6 | 7 | [bumpversion:file:CMakeLists.txt] 8 | 9 | [bumpversion:file:documentation/installation/index.rst] 10 | -------------------------------------------------------------------------------- /.ci/build/apt.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | 4 | os.environ["DEBIAN_FRONTEND"] = "noninteractive" 5 | 6 | subprocess.check_call(["apt-get", "update"]) 7 | 8 | subprocess.check_call([ 9 | "apt-get", "-y", "--no-install-recommends", "install", 10 | "build-essential", "cmake", "ninja-build", "pkg-config", "python3", 11 | "libboost-dev", "libboost-date-time-dev", "libboost-exception-dev", 12 | "libboost-log-dev", "libboost-filesystem-dev", "libboost-regex-dev", 13 | "libdcmtk-dev", "libicu-dev", "libjsoncpp-dev", "libnsl-dev", "zlib1g-dev", 14 | "pybind11-dev", "python3-pybind11", "python3-dev", 15 | "libboost-test-dev", "dcmtk"]) 16 | -------------------------------------------------------------------------------- /.ci/build/build.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | print(f"Building with {sys.executable}") 6 | 7 | workspace = os.environ["WORKSPACE"] 8 | build_dir = os.environ.get("BUILD_DIR", os.path.join(workspace, "build")) 9 | install_dir = os.environ.get("INSTALL_DIR", os.path.join(workspace, "install")) 10 | 11 | for dir in [build_dir, install_dir]: 12 | if not os.path.isdir(dir): 13 | os.makedirs(dir) 14 | 15 | subprocess.check_call( 16 | [ 17 | "cmake", 18 | # NOTE: if Ninja is used as a builder, compiler chain defaults to gcc on 19 | # Windows 20 | *(["-G", "Ninja"] if os.name != "nt" else []), 21 | "-DPython_EXECUTABLE={}".format(sys.executable), 22 | "-DCMAKE_INSTALL_PREFIX={}".format(install_dir), 23 | *([os.environ["CMAKE_OPTIONS"]] if "CMAKE_OPTIONS" in os.environ else []), 24 | workspace], 25 | cwd=build_dir) 26 | 27 | subprocess.check_call( 28 | [ 29 | "cmake", "--build", ".", "--target", "install", "--config", "Release", 30 | "--parallel"], 31 | cwd=build_dir) 32 | -------------------------------------------------------------------------------- /.ci/build/conda.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | conda = sys.argv[1] if len(sys.argv) >= 2 else os.environ.get("MAMBA_EXE", "conda") 6 | 7 | subprocess.check_call([ 8 | conda, "install", "--yes", "-c", "conda-forge", 9 | "boost", "cmake", "dcmtk", "icu", "jsoncpp", "ninja", "pkg-config", 10 | "pybind11", "zlib"]) 11 | -------------------------------------------------------------------------------- /.ci/readthedocs/conda.yml: -------------------------------------------------------------------------------- 1 | name: readthedocs 2 | channels: 3 | - conda-forge 4 | - defaults 5 | dependencies: 6 | - furo 7 | - make 8 | - python=3.11 9 | - sphinx 10 | -------------------------------------------------------------------------------- /.ci/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CI_TYPE=${CI_TYPE:?} 4 | WORKSPACE=${WORKSPACE:?} 5 | 6 | if [ "${RUNNER}" = "docker" ]; then 7 | IMAGE=${IMAGE:?} 8 | CONTAINER=${IMAGE//:/_} 9 | PRE_START="docker run -di -v ${WORKSPACE}:${WORKSPACE} --name ${CONTAINER:?} --rm ${IMAGE}" 10 | RUNNER="docker exec -w ${WORKSPACE} -e WORKSPACE=${WORKSPACE} ${CONTAINER:?}" 11 | POST_END="docker kill ${CONTAINER:?}" 12 | else 13 | PRE_START="" 14 | RUNNER="" 15 | POST_END="" 16 | fi 17 | 18 | ${PRE_START} 19 | 20 | ${RUNNER} ./.ci/${CI_TYPE}/install \ 21 | && ${RUNNER} ./.ci/${CI_TYPE}/build \ 22 | && ${RUNNER} ./.ci/${CI_TYPE}/post_build 23 | 24 | RETURNCODE=$? 25 | 26 | ${POST_END} 27 | 28 | exit ${RETURNCODE} 29 | -------------------------------------------------------------------------------- /.ci/windows/build.cmd: -------------------------------------------------------------------------------- 1 | set BUILD_DIR=%WORKSPACE%\build 2 | set INSTALL_DIR=%WORKSPACE%\install 3 | 4 | mkdir %BUILD_DIR% 5 | mkdir %INSTALL_DIR% 6 | 7 | cd %BUILD_DIR% 8 | 9 | cmake ^ 10 | -G Ninja ^ 11 | -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF ^ 12 | -DWITH_DCMTK=OFF ^ 13 | -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ^ 14 | -DCMAKE_BUILD_TYPE=Release ^ 15 | -DPYTHON_EXECUTABLE=%PYTHON% ^ 16 | ${CMAKE_OPTIONS} ^ 17 | .. 18 | if %errorlevel% neq 0 exit /b %errorlevel% 19 | 20 | cmake --build . --config Release --target install 21 | if %errorlevel% neq 0 exit /b %errorlevel% 22 | 23 | cd %WORKSPACE% 24 | -------------------------------------------------------------------------------- /.ci/windows/install.cmd: -------------------------------------------------------------------------------- 1 | REM WARNING: assume conda is installed 2 | 3 | conda update -y -n base -c defaults conda 4 | conda install -y -c conda-forge boost cmake icu jsoncpp ninja pkg-config pybind11 python 5 | if %errorlevel% neq 0 exit /b %errorlevel% 6 | -------------------------------------------------------------------------------- /.ci/windows/post_build.cmd: -------------------------------------------------------------------------------- 1 | set BUILD_DIR=%WORKSPACE%\build 2 | set INSTALL_DIR=%WORKSPACE%\install 3 | 4 | cd %BUILD_DIR% 5 | 6 | echo %PYTHON% 7 | for /f "tokens=*" %%a in ( '%PYTHON% -c "from distutils.sysconfig import *; print(get_python_lib(True, prefix=\"\"))"' ) do set PYTHONPATH=%INSTALL_DIR%\%%a 8 | if %errorlevel% neq 0 exit /b %errorlevel% 9 | echo %PYTHONPATH% 10 | 11 | set PATH=%PATH%;%INSTALL_DIR%\bin 12 | 13 | echo "WARNING: no DCMTK package is available on Windows; not running tests" 14 | 15 | REM ctest -T Test 16 | REM if %errorlevel% neq 0 exit /b %errorlevel% 17 | REM 18 | REM %PYTHON% -m unittest discover -s %WORKSPACE%/tests/python/ 19 | REM if %errorlevel% neq 0 exit /b %errorlevel% 20 | REM 21 | REM cd %WORKSPACE% 22 | -------------------------------------------------------------------------------- /.ci/windows/python_executable.cmake: -------------------------------------------------------------------------------- 1 | file(READ "CMakeCache.txt" cache) 2 | string(REGEX MATCH "PYTHON_EXECUTABLE:([^=]+)=([^\n\r]+)" _ "${cache}") 3 | message("${CMAKE_MATCH_2}") 4 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | build: 4 | os: ubuntu-22.04 5 | tools: 6 | python: "mambaforge-4.10" 7 | 8 | conda: 9 | environment: .ci/readthedocs/conda.yml 10 | 11 | sphinx: 12 | builder: html 13 | configuration: documentation/conf.py 14 | 15 | -------------------------------------------------------------------------------- /FindJsonCpp.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find JsonCpp 2 | # Once done this will define 3 | # JsonCpp_FOUND - System has JsonCpp 4 | # JsonCpp_INCLUDE_DIRS - The JsonCpp include directories 5 | # JsonCpp_LIBRARIES - The libraries needed to use JsonCpp 6 | # JsonCpp_DEFINITIONS - Compiler switches required for using JsonCpp 7 | 8 | find_package(PkgConfig) 9 | pkg_check_modules(PC_JsonCpp QUIET jsoncpp) 10 | set(JsonCpp_DEFINITIONS ${PC_JsonCpp_CFLAGS_OTHER}) 11 | 12 | find_path(JsonCpp_INCLUDE_DIR "json/json.h" HINTS ${PC_JsonCpp_INCLUDE_DIRS}) 13 | find_library(JsonCpp_LIBRARY NAMES jsoncpp HINTS ${PC_JsonCpp_LIBRARY_DIRS} ) 14 | 15 | set(JsonCpp_LIBRARIES ${JsonCpp_LIBRARY} ) 16 | set(JsonCpp_INCLUDE_DIRS ${JsonCpp_INCLUDE_DIR} ) 17 | 18 | include(FindPackageHandleStandardArgs) 19 | # handle the QUIETLY and REQUIRED arguments and set JsonCpp_FOUND to TRUE 20 | # if all listed variables are TRUE 21 | find_package_handle_standard_args( 22 | JsonCpp DEFAULT_MSG JsonCpp_LIBRARY JsonCpp_INCLUDE_DIR) 23 | 24 | mark_as_advanced(JsonCpp_INCLUDE_DIR JsonCpp_LIBRARY) 25 | 26 | if(JsonCpp_FOUND AND NOT TARGET JsonCpp::JsonCpp) 27 | add_library(JsonCpp::JsonCpp INTERFACE IMPORTED) 28 | set_target_properties(JsonCpp::JsonCpp PROPERTIES 29 | INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIR}" 30 | INTERFACE_LINK_LIBRARIES "${JsonCpp_LIBRARIES}") 31 | endif() 32 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamyj/odil/b4334128e2c693a25f0bd480540da1e79cb4e894/LICENSE.txt -------------------------------------------------------------------------------- /OdilConfig.cmake.in: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | 3 | set(ICU_ROOT @ICU_ROOT@) 4 | 5 | find_dependency(Boost REQUIRED COMPONENTS date_time exception filesystem log) 6 | find_dependency(ICU REQUIRED COMPONENTS uc) 7 | 8 | get_filename_component(ODIL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 9 | list(APPEND CMAKE_MODULE_PATH ${ODIL_CMAKE_DIR}) 10 | find_dependency(JsonCpp REQUIRED COMPONENTS JsonCpp) 11 | list(REMOVE_AT CMAKE_MODULE_PATH -1) 12 | 13 | if("@WITH_DCMTK@") 14 | find_dependency(DCMTK REQUIRED) 15 | endif() 16 | 17 | if(NOT TARGET Odil::Odil) 18 | include("${ODIL_CMAKE_DIR}/OdilTargets.cmake") 19 | endif() 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Odil 2 | 3 | [![Build Status (Travis)](https://travis-ci.com/lamyj/odil.svg?branch=master)](https://travis-ci.com/lamyj/odil) 4 | [![Build Status (Appveyor)](https://ci.appveyor.com/api/projects/status/github/lamyj/odil?svg=true)](https://ci.appveyor.com/project/lamyj/odil) 5 | [![Conda Version](https://img.shields.io/conda/vn/conda-forge/odil.svg)](https://anaconda.org/conda-forge/odil) 6 | 7 | Odil is a [DICOM][] library which provides a user-friendly C++11 and Python API for the different parts of the DICOM standard: 8 | - Reading and writing data sets with any transfer syntax 9 | - Standard JSON and XML representation of datasets 10 | - Clients and servers for the various DICOM protocols (C-FIND, C-GET, C-MOVE, C-STORE) 11 | - Implementation of the DICOM web-services (WADO-RS, QIDO-RS, STOW-RS) 12 | - Conversion to and from [DCMTK][] data structures. 13 | 14 | Packaged versions of Odil are available on [Anaconda][] for Linux, macOS and Windows. Official packages are available for [Debian][] and [Ubuntu][], as well as [unofficial backports][]. 15 | 16 | Installation and usage instructions are available on the [documentation website][]. 17 | 18 | [Anaconda]: https://anaconda.org/conda-forge/odil 19 | [DCMTK]: http://dicom.offis.de/dcmtk.php.en 20 | [Debian]: https://packages.debian.org/search?keywords=odil&searchon=sourcenames&suite=all§ion=all 21 | [DICOM]: http://dicom.nema.org/ 22 | [documentation website]: http://odil.readthedocs.io/ 23 | [Ubuntu]: http://packages.ubuntu.com/search?keywords=odil&searchon=sourcenames&suite=all§ion=all 24 | [unofficial backports]: https://github.com/lamyj/packages 25 | -------------------------------------------------------------------------------- /applications/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(Python COMPONENTS Interpreter Development REQUIRED) 2 | 3 | file(GLOB_RECURSE module_files *.py) 4 | set(python_files ${module_files} odil) 5 | add_custom_target( 6 | PythonFiles ${CMAKE_COMMAND} -E echo "Python files" SOURCES ${python_files}) 7 | set_target_properties(PythonFiles PROPERTIES FOLDER "Examples") 8 | 9 | if(BUILD_PYTHON_WRAPPERS) 10 | execute_process( 11 | COMMAND ${Python_EXECUTABLE} 12 | -c "import os; import sysconfig; \ 13 | scheme = {'posix': 'posix_prefix', 'nt': 'nt'}[os.name]; \ 14 | path = sysconfig.get_path('purelib', scheme, {'base': '.'}); \ 15 | print(path.replace(os.path.sep, '/'))" 16 | OUTPUT_VARIABLE PYTHON_SITE_PACKAGES 17 | OUTPUT_STRIP_TRAILING_WHITESPACE) 18 | 19 | install(DIRECTORY DESTINATION "${PYTHON_SITE_PACKAGES}") 20 | install(FILES ${module_files} DESTINATION "${PYTHON_SITE_PACKAGES}/odil/cli") 21 | configure_file("odil" "${CMAKE_CURRENT_BINARY_DIR}/odil") 22 | install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/odil" DESTINATION bin) 23 | endif() 24 | -------------------------------------------------------------------------------- /applications/cli/__init__.py: -------------------------------------------------------------------------------- 1 | from . import dicomdir 2 | from . import echo 3 | from . import find 4 | from . import get 5 | from . import print_ 6 | from . import store 7 | from . import transcode 8 | -------------------------------------------------------------------------------- /applications/odil: -------------------------------------------------------------------------------- 1 | #!${PYTHON_EXECUTABLE} 2 | 3 | import argparse 4 | import logging 5 | import sys 6 | 7 | import odil.cli 8 | 9 | def main(): 10 | parser = argparse.ArgumentParser() 11 | 12 | subparsers = parser.add_subparsers(help="Sub-commands help") 13 | 14 | modules = [ 15 | "print_", "transcode", "dicomdir", 16 | "echo", "find", "get", "store" 17 | ] 18 | for module in modules: 19 | sub_parser = getattr(odil.cli, module).add_subparser(subparsers) 20 | sub_parser.add_argument( 21 | "--verbosity", "-v", 22 | choices=["warning", "info", "debug"], default="warning") 23 | 24 | arguments = parser.parse_args() 25 | 26 | verbosity = arguments.__dict__.pop("verbosity", "warning") 27 | logging.getLogger().setLevel(verbosity.upper()) 28 | 29 | function = arguments.__dict__.pop("function", None) 30 | if function is not None: 31 | try: 32 | function(**arguments.__dict__) 33 | except Exception as e: 34 | if verbosity == "debug": 35 | raise 36 | else: 37 | parser.error(e) 38 | else: 39 | parser.error("Missing function") 40 | 41 | if __name__ == "__main__": 42 | sys.exit(main()) 43 | -------------------------------------------------------------------------------- /cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") 3 | endif() 4 | 5 | file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | if(NOT "${rm_retval}" STREQUAL 0) 16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 17 | endif() 18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 20 | endif() 21 | endforeach() 22 | -------------------------------------------------------------------------------- /documentation/Doxyfile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME = Odil 2 | PROJECT_BRIEF = "A C++11 library for the DICOM standard" 3 | OUTPUT_DIRECTORY = ./_build/doxygen 4 | EXTRACT_ALL = YES 5 | QUIET = YES 6 | 7 | INPUT = ../src 8 | FILE_PATTERNS = *.h 9 | RECURSIVE = YES 10 | 11 | CASE_SENSE_NAMES = YES 12 | 13 | ENABLE_PREPROCESSING = YES 14 | MACRO_EXPANSION = YES 15 | EXPAND_ONLY_PREDEF = YES 16 | PREDEFINED = "ODIL_API=''" 17 | EXPAND_AS_DEFINED = ODIL_DATASET_ADD \ 18 | ODIL_VALUE_CONSTRUCTORS \ 19 | ODIL_MESSAGE_MANDATORY_FIELD_STRING_MACRO \ 20 | ODIL_MESSAGE_MANDATORY_FIELD_INTEGER_MACRO 21 | 22 | GENERATE_HTML = YES 23 | GENERATE_LATEX = NO 24 | GENERATE_RTF = NO 25 | GENERATE_MAN = NO 26 | GENERATE_DOCBOOK = NO 27 | GENERATE_AUTOGEN_DEF = NO 28 | GENERATE_PERLMOD = NO 29 | GENERATE_XML = NO 30 | -------------------------------------------------------------------------------- /documentation/Doxyfile.breathe: -------------------------------------------------------------------------------- 1 | OUTPUT_DIRECTORY = ./_build/doxygen 2 | EXTRACT_ALL = YES 3 | QUIET = YES 4 | 5 | INPUT = ../src 6 | FILE_PATTERNS = *.h 7 | RECURSIVE = YES 8 | # DCMTK wrappers and registry confuse Breathe 9 | EXCLUDE = ../src/odil/dcmtk ../src/odil/registry.h 10 | 11 | ENABLE_PREPROCESSING = YES 12 | MACRO_EXPANSION = YES 13 | EXPAND_ONLY_PREDEF = YES 14 | PREDEFINED = "ODIL_API=''" 15 | EXPAND_AS_DEFINED = ODIL_VALUE_CONSTRUCTORS \ 16 | ODIL_MESSAGE_MANDATORY_FIELD_STRING_MACRO \ 17 | ODIL_MESSAGE_MANDATORY_FIELD_INTEGER_MACRO 18 | 19 | GENERATE_HTML = NO 20 | GENERATE_LATEX = NO 21 | GENERATE_RTF = NO 22 | GENERATE_MAN = NO 23 | GENERATE_DOCBOOK = NO 24 | GENERATE_AUTOGEN_DEF = NO 25 | GENERATE_PERLMOD = NO 26 | 27 | GENERATE_XML = YES 28 | XML_OUTPUT = xml 29 | 30 | # If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program 31 | # listings (including syntax highlighting and cross-referencing information) to 32 | # the XML output. Note that enabling this will significantly increase the size 33 | # of the XML output. 34 | # The default value is: YES. 35 | # This tag requires that the tag GENERATE_XML is set to YES. 36 | 37 | XML_PROGRAMLISTING = YES 38 | -------------------------------------------------------------------------------- /documentation/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = Odil 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /documentation/conf.py: -------------------------------------------------------------------------------- 1 | import glob 2 | import os 3 | import re 4 | import shutil 5 | import subprocess 6 | 7 | # Make sure Doxygen is up-to-date 8 | if os.environ.get("READTHEDOCS", None) == "True": 9 | if not os.path.isdir(os.path.join("_build", "doxygen")): 10 | os.makedirs(os.path.join("_build", "doxygen")) 11 | subprocess.check_call(["doxygen", "Doxyfile"]) 12 | 13 | if os.path.isdir(os.path.join("_build", "html", "_static", "doxygen")): 14 | shutil.rmtree(os.path.join("_build", "html", "_static", "doxygen")) 15 | os.makedirs(os.path.join("_build", "html", "_static", "doxygen")) 16 | 17 | for entry in glob.glob(os.path.join("_build", "doxygen", "html", "*")): 18 | shutil.move(entry, os.path.join("_build", "html", "_static", "doxygen")) 19 | 20 | project = "Odil" 21 | copyright = "2015-2024, Université de Strasbourg-CNRS" 22 | author = "Julien Lamy" 23 | 24 | # The short X.Y version 25 | here = os.path.abspath(os.path.dirname(__file__)) 26 | with open(os.path.join(here, "..", "CMakeLists.txt")) as fd: 27 | version = re.search(r"""project\("Odil" VERSION (.+?)\)""", fd.read()) 28 | if not version: 29 | raise Exception("Could not get version from CMakeLists.txt") 30 | version = version.group(1) 31 | # The full version, including alpha/beta/rc tags 32 | release = version 33 | 34 | html_theme = "furo" 35 | html_static_path = ["_static"] 36 | html_css_files = ["css/style.css"] 37 | html_title = project 38 | -------------------------------------------------------------------------------- /documentation/developer/cpp/index.rst: -------------------------------------------------------------------------------- 1 | C++ API 2 | ======= 3 | 4 | The primary programming language of Odil is C++11: other languages (as :doc:`Python <../python/index>` or :doc:`Javascript <../javascript/index>`) are wrappers of the C++ code and try to mimic the C++ API. All classes, functions and variables of Odil are declared in the ``odil`` namespace. The include files reflect the classes: the ``odil::DataSet`` class will be declared in the ``odil/DataSet.h``. 5 | 6 | Odil can be included in another project using e.g.: 7 | 8 | :: 9 | 10 | find_package(Odil 0.12.0 REQUIRED) 11 | # Add targets, then for each target call 12 | target_link_libraries(... Odil::libodil) 13 | 14 | Odil_DIR might need to be passed as cmake argument if odil was built from source and was not installed to the default location (CMAKE_INSTALL_PREFIX). For example ``cmake -DOdil_DIR=/opt/odil/install/lib/CMake/Odil``. 15 | 16 | The full Doxygen reference is also `available`_. 17 | 18 | .. toctree:: 19 | :maxdepth: 2 20 | 21 | data_sets 22 | io 23 | association 24 | services-scu 25 | services-scp 26 | webservices 27 | 28 | .. _available: ../../_static/doxygen/index.html 29 | -------------------------------------------------------------------------------- /documentation/developer/index.rst: -------------------------------------------------------------------------------- 1 | Developer documentation 2 | ======================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | cpp/index 8 | python/index 9 | javascript/index 10 | -------------------------------------------------------------------------------- /documentation/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | set SPHINXPROJ=Odil 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 20 | echo.installed, then set the SPHINXBUILD environment variable to point 21 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 22 | echo.may add the Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /documentation/user/echo.rst: -------------------------------------------------------------------------------- 1 | Verifying DICOM communication 2 | ============================= 3 | 4 | Similarly to the ICMP ping, DICOM has a `communication verification service`_ which checks that two peers can communicate at the DICOM level. It is accessible through ``odil echo``: 5 | 6 | .. code-block:: bash 7 | 8 | odil echo www.dicomserver.co.uk 11112 WORKSTATION SERVER 9 | 10 | The first two arguments are the TCP/IP information (respectively the host and port) and the last two arguments are the `name of the DICOM applications`_ (respectively the calling and called AE titles). If the DICOM ping fails, the error is displayed; otherwise the command just returns. 11 | 12 | .. _communication verification service: http://dicom.nema.org/medical/dicom/current/output/chtml/part04/chapter_A.html 13 | .. _name of the DICOM applications: http://dicom.nema.org/medical/dicom/current/output/chtml/part08/chapter_C.html 14 | -------------------------------------------------------------------------------- /documentation/user/index.rst: -------------------------------------------------------------------------------- 1 | User documentation 2 | ================== 3 | 4 | *Odil* (the software package) includes a command-line tool called ``odil`` which gives access to: 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | print 10 | transcode 11 | dicomdir 12 | echo 13 | find 14 | get 15 | store 16 | 17 | .. note:: If Odil was installed from source, the command-line tool requires the Python wrappers. 18 | 19 | Complete usage for each command and for the whole tool can be obtained with the ``-h`` flag: 20 | 21 | .. code-block:: console 22 | 23 | $ odil print -h 24 | usage: odil print [-h] [--print-header] [--decode-uids] 25 | [--verbosity {warning,info,debug}] 26 | FILE [FILE ...] 27 | 28 | positional arguments: 29 | FILE Input files 30 | 31 | optional arguments: 32 | -h, --help show this help message and exit 33 | --print-header, -H Print the header as well as the data set 34 | (default: False) 35 | --decode-uids, -u Print human-friendly name of known UIDs 36 | (default: False) 37 | --verbosity {warning,info,debug}, -v {warning,info,debug} 38 | -------------------------------------------------------------------------------- /documentation/user/store.rst: -------------------------------------------------------------------------------- 1 | Storing DICOM data on a remote server 2 | ===================================== 3 | 4 | Storing DICOM data on a remote server is performed through ``odil store``: 5 | 6 | .. code-block:: bash 7 | 8 | odil store \ 9 | www.dicomserver.co.uk 11112 WORKSTATION SERVER \ 10 | file1.dcm file2.dcm fileN.dcm 11 | 12 | The first four arguments are the TCP/IP information (respectively the host and port) and the `name of the DICOM applications`_ (respectively the calling and called AE titles). The remaining arguments are the paths to the files to be sent to the remote application. 13 | 14 | .. _name of the DICOM applications: http://dicom.nema.org/medical/dicom/current/output/chtml/part08/chapter_C.html 15 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | option(INSTALL_EXAMPLES "Install the examples" OFF) 2 | 3 | add_subdirectory("cpp") 4 | add_subdirectory("python") 5 | add_subdirectory("js") 6 | -------------------------------------------------------------------------------- /examples/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(Boost REQUIRED) 2 | find_package(DCMTK REQUIRED) 3 | find_package(JsonCpp REQUIRED) 4 | 5 | include_directories( 6 | ${CMAKE_SOURCE_DIR}/src ${Boost_INCLUDE_DIRS} ${DCMTK_INCLUDE_DIRS} 7 | ${JsonCpp_INCLUDE_DIRS}) 8 | 9 | add_definitions( 10 | ${DCMTK_DEFINITIONS} 11 | -D ODIL_MAJOR_VERSION=${Odil_VERSION_MAJOR} 12 | ) 13 | if(BUILD_SHARED_LIBS) 14 | add_definitions(-D BOOST_ALL_DYN_LINK) 15 | endif() 16 | 17 | link_directories(${Boost_LIBRARY_DIRS} ${DCMTK_LIBRARY_DIRS}) 18 | 19 | file(GLOB_RECURSE examples *.cpp) 20 | 21 | foreach(example_file ${examples}) 22 | get_filename_component(example ${example_file} NAME_WE) 23 | add_executable(${example} ${example_file}) 24 | target_link_libraries(${example} libodil) 25 | if(INSTALL_EXAMPLES) 26 | install(TARGETS ${example} RUNTIME DESTINATION bin) 27 | endif() 28 | set_target_properties(${example} PROPERTIES FOLDER "Examples") 29 | endforeach() 30 | -------------------------------------------------------------------------------- /examples/cpp/dicomdir.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | int main(int argc, char** argv) 8 | { 9 | std::string const root(argv[1]); 10 | std::vector const files(argv+2, argv+argc); 11 | 12 | odil::BasicDirectoryCreator creator(root, files, 13 | { 14 | {"PATIENT", { {odil::registry::PatientBirthDate, 3} }}, 15 | {"STUDY", { {odil::registry::PatientAge, 3} }}, 16 | {"SERIES", { {odil::registry::SeriesDescription, 3} }}, 17 | {"IMAGE", { {odil::registry::ImageType, 3} }}, 18 | }); 19 | 20 | creator(); 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /examples/cpp/store.cpp: -------------------------------------------------------------------------------- 1 | #include "odil/Association.h" 2 | #include "odil/DataSet.h" 3 | #include "odil/EchoSCU.h" 4 | #include "odil/Reader.h" 5 | #include "odil/StoreSCU.h" 6 | 7 | int main(int argc, char** argv) 8 | { 9 | odil::Association association; 10 | association.set_peer_host("184.73.255.26"); 11 | association.set_peer_port(11112); 12 | association.update_parameters() 13 | .set_calling_ae_title("myself") 14 | .set_called_ae_title("AWSPIXELMEDPUB") 15 | .set_presentation_contexts({ 16 | { 17 | odil::registry::MRImageStorage, 18 | { odil::registry::ImplicitVRLittleEndian }, 19 | odil::AssociationParameters::PresentationContext::Role::SCP 20 | }, 21 | { 22 | odil::registry::Verification, 23 | { odil::registry::ImplicitVRLittleEndian }, 24 | odil::AssociationParameters::PresentationContext::Role::SCU 25 | } 26 | }); 27 | 28 | association.associate(); 29 | 30 | odil::EchoSCU echo_scu(association); 31 | echo_scu.echo(); 32 | 33 | odil::StoreSCU scu(association); 34 | 35 | for(int i=1; i 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/ElementsDictionary.h" 17 | #include "odil/Tag.h" 18 | #include "odil/UIDsDictionary.h" 19 | 20 | {% for group in groups %} 21 | #include "odil/registry_{{ group }}.h" 22 | {% endfor %} 23 | 24 | namespace odil 25 | { 26 | 27 | namespace registry 28 | { 29 | 30 | {% for entry in uids %} 31 | std::string const {{ entry[2] }}("{{ entry[0] }}"); 32 | {% endfor %} 33 | 34 | extern ODIL_API ElementsDictionary public_dictionary; 35 | extern ODIL_API std::map public_tags; 36 | extern ODIL_API UIDsDictionary uids_dictionary; 37 | extern ODIL_API bool const dummy; 38 | } 39 | 40 | } 41 | 42 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9 43 | -------------------------------------------------------------------------------- /registry_group.cpp.tmpl: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_{{ group }}( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | {% for entry in elements_dictionary %} 28 | public_dictionary.emplace({% 29 | if entry[0] is string 30 | %}std::string("{{ entry[0] }}"){% 31 | else %}Tag({{ "0x%04x, 0x%04x"|format(*entry[0]) }}){% 32 | endif %}, ElementsDictionaryEntry("{{ entry[1] }}", "{{ entry[2] }}", "{{ entry[3] }}", "{{ entry[4] }}")); 33 | {% endfor %} 34 | 35 | {% for entry in elements_dictionary %}{% if not entry[0] is string %} 36 | public_tags.emplace("{{ entry[2] }}", Tag({{ "0x%04x, 0x%04x"|format(*entry[0]) }})); 37 | {% endif %}{% endfor %} 38 | } 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /registry_group.h.tmpl: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_{{ group }} 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_{{ group }} 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | {% for entry in elements_dictionary %} 24 | {% if entry[0] is string %} 25 | std::string const {{ entry[2] }}("{{ entry[0] }}"); 26 | {% elif entry[0] is sequence %} 27 | Tag const {{ entry[2] }}({{ "0x%04x, 0x%04x"|format(*entry[0]) }}); 28 | {% endif %} 29 | {% endfor %} 30 | 31 | } 32 | 33 | } 34 | 35 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_{{ group }} 36 | -------------------------------------------------------------------------------- /src/odil/EchoSCU.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _94f3b347_1f95_49ab_83f6_8710f5a3ad67 10 | #define _94f3b347_1f95_49ab_83f6_8710f5a3ad67 11 | 12 | #include "odil/Association.h" 13 | #include "odil/odil.h" 14 | #include "odil/SCU.h" 15 | 16 | namespace odil 17 | { 18 | 19 | /// @brief SCU for the C-ECHO services. 20 | class ODIL_API EchoSCU: public SCU 21 | { 22 | public: 23 | /// @brief Constructor 24 | EchoSCU(Association & association); 25 | 26 | /// @brief Perform DICOM ping 27 | void echo() const; 28 | }; 29 | 30 | } 31 | 32 | #endif // _94f3b347_1f95_49ab_83f6_8710f5a3ad67 33 | 34 | -------------------------------------------------------------------------------- /src/odil/Exception.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/Exception.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace odil 15 | { 16 | 17 | Exception 18 | ::Exception(std::string const & message) 19 | : _message(message) 20 | { 21 | // Nothing else. 22 | } 23 | 24 | Exception 25 | ::~Exception() noexcept 26 | { 27 | // Nothing to do. 28 | } 29 | 30 | char const * 31 | Exception 32 | ::what() const noexcept 33 | { 34 | return this->_message.c_str(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/odil/Exception.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _b9607695_cb3b_4188_8caa_bc8bb051ef28 10 | #define _b9607695_cb3b_4188_8caa_bc8bb051ef28 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | 17 | namespace odil 18 | { 19 | 20 | /// @brief Base class for odil exceptions. 21 | class ODIL_API Exception: public std::exception 22 | { 23 | public: 24 | /// @brief Message string constructor. 25 | Exception(std::string const & message=""); 26 | 27 | /// @brief Destructor. 28 | virtual ~Exception() noexcept; 29 | 30 | /// @brief Return the reason for the exception. 31 | virtual const char* what() const noexcept; 32 | 33 | protected: 34 | /// @brief Message of the exception. 35 | std::string _message; 36 | }; 37 | 38 | } 39 | 40 | #endif // _b9607695_cb3b_4188_8caa_bc8bb051ef28 41 | -------------------------------------------------------------------------------- /src/odil/NSetSCU.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _c80c338c_36d7_4724_9732_c7afed87902b 10 | #define _c80c338c_36d7_4724_9732_c7afed87902b 11 | 12 | #include "odil/Association.h" 13 | #include "odil/DataSet.h" 14 | #include "odil/odil.h" 15 | #include "odil/SCU.h" 16 | 17 | namespace odil 18 | { 19 | 20 | /// @brief SCU for C-Store services. 21 | class ODIL_API NSetSCU: public SCU 22 | { 23 | public: 24 | /// @brief Constructor. 25 | NSetSCU(Association & association); 26 | 27 | /// @brief Set the affected SOP class based on the dataset. 28 | void set_affected_sop_class(std::shared_ptr dataset); 29 | 30 | /// @brief Perform the N-SET. 31 | void set(std::shared_ptr dataset) const; 32 | }; 33 | 34 | } 35 | 36 | #endif // _c80c338c_36d7_4724_9732_c7afed87902b 37 | -------------------------------------------------------------------------------- /src/odil/SCP.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "SCP.h" 10 | 11 | #include "odil/Association.h" 12 | #include "odil/DataSet.h" 13 | #include "odil/message/Message.h" 14 | #include "odil/message/Request.h" 15 | 16 | namespace odil 17 | { 18 | 19 | SCP::DataSetGenerator 20 | ::~DataSetGenerator() 21 | { 22 | // Nothing to do. 23 | } 24 | 25 | SCP::Exception 26 | ::Exception( 27 | std::string const & message, 28 | Value::Integer status, std::shared_ptr status_fields) 29 | : odil::Exception(message), status(status), status_fields(status_fields) 30 | { 31 | // Nothing else. 32 | } 33 | 34 | SCP::Exception 35 | ::~Exception() noexcept 36 | { 37 | // Nothing to do. 38 | } 39 | 40 | SCP 41 | ::SCP(Association & association) 42 | : _association(association) 43 | { 44 | // Nothing else. 45 | } 46 | 47 | void 48 | SCP 49 | ::receive_and_process() 50 | { 51 | auto message = this->_association.receive_message(); 52 | (*this)(message); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/odil/SCU.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/SCU.h" 10 | 11 | #include 12 | 13 | #include "odil/Association.h" 14 | #include "odil/Exception.h" 15 | #include "odil/message/CEchoRequest.h" 16 | #include "odil/message/CEchoResponse.h" 17 | #include "odil/message/Message.h" 18 | #include "odil/registry.h" 19 | 20 | namespace odil 21 | { 22 | 23 | SCU 24 | ::SCU(Association & association) 25 | : _association(association), _affected_sop_class("") 26 | { 27 | // Nothing else. 28 | } 29 | 30 | SCU 31 | ::~SCU() 32 | { 33 | // Nothing to do. 34 | } 35 | 36 | std::string const & 37 | SCU 38 | ::get_affected_sop_class() const 39 | { 40 | return this->_affected_sop_class; 41 | } 42 | 43 | void 44 | SCU 45 | ::set_affected_sop_class(std::string const & sop_class) 46 | { 47 | this->_affected_sop_class = sop_class; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/odil/SCU.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _ba1518e7_8123_46c9_81c0_65439717e40e 10 | #define _ba1518e7_8123_46c9_81c0_65439717e40e 11 | 12 | #include 13 | 14 | #include "odil/Association.h" 15 | #include "odil/odil.h" 16 | 17 | namespace odil 18 | { 19 | 20 | /// @brief Base class for all Service Class Users. 21 | class ODIL_API SCU 22 | { 23 | public: 24 | /// @brief Create a default Service Class User. 25 | SCU(Association & association); 26 | 27 | /// @brief Destructor. 28 | virtual ~SCU(); 29 | 30 | /// @brief Return the affected SOP class. Defaults to "". 31 | std::string const & get_affected_sop_class() const; 32 | /// @brief Set the affected SOP class 33 | void set_affected_sop_class(std::string const & sop_class); 34 | 35 | protected: 36 | /// @brief Association with peer. 37 | Association & _association; 38 | 39 | /// @brief Affected SOP class. 40 | std::string _affected_sop_class; 41 | }; 42 | 43 | } 44 | 45 | #endif // _ba1518e7_8123_46c9_81c0_65439717e40e 46 | -------------------------------------------------------------------------------- /src/odil/StoreSCU.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _1b2f876e_1ad2_464d_9423_28181320aed0 10 | #define _1b2f876e_1ad2_464d_9423_28181320aed0 11 | 12 | #include "odil/Association.h" 13 | #include "odil/DataSet.h" 14 | #include "odil/message/CStoreRequest.h" 15 | #include "odil/odil.h" 16 | #include "odil/SCU.h" 17 | 18 | namespace odil 19 | { 20 | 21 | /// @brief SCU for C-Store services. 22 | class ODIL_API StoreSCU: public SCU 23 | { 24 | public: 25 | /// @brief Constructor. 26 | StoreSCU(Association & association); 27 | 28 | /// @brief Set the affected SOP class based on the dataset. 29 | void set_affected_sop_class(std::shared_ptr dataset); 30 | 31 | using SCU::set_affected_sop_class; 32 | 33 | /// @brief Perform the C-STORE. 34 | void store( 35 | std::shared_ptr dataset, 36 | Value::String const & move_originator_ae_title = "", 37 | Value::Integer move_originator_message_id = -1) const; 38 | private: 39 | void _store(std::shared_ptr request) const; 40 | }; 41 | 42 | } 43 | 44 | #endif // _1b2f876e_1ad2_464d_9423_28181320aed0 45 | -------------------------------------------------------------------------------- /src/odil/StringStream.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _dadc5c51_56d9_417e_9a96_100ed2838c2a 10 | #define _dadc5c51_56d9_417e_9a96_100ed2838c2a 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | namespace odil 19 | { 20 | 21 | /// @brief Source stringstream which does not copy its buffer. 22 | typedef boost::iostreams::stream IStringStream; 23 | 24 | template 25 | T as(std::string const & string) 26 | { 27 | T result; 28 | IStringStream stream(&string[0], string.size()); 29 | stream >> result; 30 | return result; 31 | } 32 | 33 | /// @brief Sink stringstream which does not copy its buffer. 34 | typedef boost::iostreams::stream< 35 | boost::iostreams::back_insert_device 36 | > OStringStream; 37 | 38 | } 39 | 40 | #endif // _dadc5c51_56d9_417e_9a96_100ed2838c2a 41 | -------------------------------------------------------------------------------- /src/odil/UIDsDictionary.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/UIDsDictionary.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace odil 15 | { 16 | 17 | UIDsDictionaryEntry 18 | ::UIDsDictionaryEntry( 19 | std::string const & name, std::string const & keyword, 20 | std::string const & type) 21 | : name(name), keyword(keyword), type(type) 22 | { 23 | // Nothing else. 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/odil/UIDsDictionary.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _7b126e41_bd4d_443f_8873_d2fec52b1019 10 | #define _7b126e41_bd4d_443f_8873_d2fec52b1019 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | 17 | namespace odil 18 | { 19 | 20 | /** 21 | * @brief Entry in a dictionary of DICOM UIDs. 22 | */ 23 | struct ODIL_API UIDsDictionaryEntry 24 | { 25 | /// @brief Full name. 26 | std::string name; 27 | 28 | /// @brief Brief name. 29 | std::string keyword; 30 | 31 | /// @brief Category. 32 | std::string type; 33 | 34 | /// @brief Constructor. 35 | UIDsDictionaryEntry( 36 | std::string const & name="", std::string const & keyword="", 37 | std::string const & type=""); 38 | }; 39 | 40 | typedef std::map UIDsDictionary; 41 | 42 | } 43 | 44 | #endif // _7b126e41_bd4d_443f_8873_d2fec52b1019 45 | -------------------------------------------------------------------------------- /src/odil/base64.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/base64.h" 10 | 11 | #include 12 | 13 | namespace odil 14 | { 15 | 16 | namespace base64 17 | { 18 | 19 | std::string const symbols = 20 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 21 | 22 | // Assume ASCII encoding 23 | std::string const reversed_symbols( 24 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" // Not used: 00-0F 25 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" // Not used: 10-1F 26 | "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3e\x00\x00\x00\x3f" // Not used: 20-2A, 2C-2E 27 | "\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x00\x00\x00\x00\x00\x00" // 0-9 28 | "\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e" // A-O 29 | "\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x00\x00\x00\x00\x00" // P-Z 30 | "\x00\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28" // a-o 31 | "\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x00\x00\x00\x00\x00" // p-z 32 | , 0x80); 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/odil/base64.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _203e7be8_beaa_4d97_94b2_6a0070f158a1 10 | #define _203e7be8_beaa_4d97_94b2_6a0070f158a1 11 | 12 | #include 13 | 14 | #include "odil/odil.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace base64 20 | { 21 | 22 | /// @brief Dictionary of symbols for Base64. 23 | extern ODIL_API std::string const symbols; 24 | 25 | /// @brief Mapping of ASCII characters to values of Base64 symbols. 26 | extern ODIL_API std::string const reversed_symbols; 27 | 28 | /// @brief Encode a sequence of 8 bits data to Base64. 29 | template 30 | void encode( 31 | TInputIterator begin, TInputIterator end, TOutputIterator destination); 32 | 33 | /// @brief Decode a sequence of 8 bits data from Base64. 34 | template 35 | void decode( 36 | TInputIterator begin, TInputIterator end, TOutputIterator destination); 37 | 38 | } 39 | 40 | } 41 | 42 | #include "odil/base64.txx" 43 | 44 | #endif // _203e7be8_beaa_4d97_94b2_6a0070f158a1 45 | -------------------------------------------------------------------------------- /src/odil/dcmtk/ElementAccessor.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/dcmtk/ElementAccessor.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace odil 15 | { 16 | 17 | namespace dcmtk 18 | { 19 | 20 | #define DEFINE_ELEMENT_ACCESSOR(TValueType, getter, setter) \ 21 | template<> \ 22 | ElementAccessor::GetterType const \ 23 | ElementAccessor\ 24 | ::element_get = getter; \ 25 | \ 26 | template<> \ 27 | ElementAccessor::SetterType const \ 28 | ElementAccessor\ 29 | ::element_set = setter; 30 | 31 | DEFINE_ELEMENT_ACCESSOR(std::string, get_string, set_string) 32 | DEFINE_ELEMENT_ACCESSOR(std::vector, get_binary, set_binary) 33 | DEFINE_ELEMENT_ACCESSOR(Float32, get_default, set_default) 34 | DEFINE_ELEMENT_ACCESSOR(Float64, get_default, set_default) 35 | DEFINE_ELEMENT_ACCESSOR(Sint16, get_default, set_default) 36 | DEFINE_ELEMENT_ACCESSOR(Sint32, get_default, set_default) 37 | DEFINE_ELEMENT_ACCESSOR(Uint16, get_default, set_default) 38 | DEFINE_ELEMENT_ACCESSOR(Uint32, get_default, set_default) 39 | 40 | #undef DEFINE_ELEMENT_ACCESSOR 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/odil/dul/EventData.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _350775b8_701f_4069_ab1e_c974a209389c 10 | #define _350775b8_701f_4069_ab1e_c974a209389c 11 | 12 | #include 13 | 14 | #include "odil/AssociationAcceptor.h" 15 | #include "odil/AssociationParameters.h" 16 | #include "odil/dul/Transport.h" 17 | #include "odil/odil.h" 18 | #include "odil/pdu/Object.h" 19 | 20 | namespace odil 21 | { 22 | 23 | namespace dul 24 | { 25 | 26 | /// @brief Data related to events of the DUL state machine. 27 | class ODIL_API EventData 28 | { 29 | public: 30 | Transport::Socket::endpoint_type peer_endpoint; 31 | std::shared_ptr pdu; 32 | AssociationParameters association_parameters; 33 | std::shared_ptr reject; 34 | }; 35 | 36 | } 37 | 38 | } 39 | 40 | #endif // _350775b8_701f_4069_ab1e_c974a209389c 41 | -------------------------------------------------------------------------------- /src/odil/endian.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/endian.h" 10 | 11 | #include 12 | 13 | namespace odil 14 | { 15 | 16 | ByteOrdering get_endianness() 17 | { 18 | uint16_t const word = 0x0201; 19 | uint8_t const * bytes = reinterpret_cast(&word); 20 | return (bytes[0] == 1)?ByteOrdering::LittleEndian:ByteOrdering::BigEndian; 21 | } 22 | 23 | ByteOrdering const byte_ordering{get_endianness()}; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/odil/json_converter.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _6f5dc463_a89a_4f77_a0ed_36dca74b9e59 10 | #define _6f5dc463_a89a_4f77_a0ed_36dca74b9e59 11 | 12 | #include 13 | 14 | #include "odil/DataSet.h" 15 | #include "odil/odil.h" 16 | #include "odil/Value.h" 17 | 18 | namespace odil 19 | { 20 | 21 | /// @brief Convert a data set to its JSON representation. 22 | ODIL_API Json::Value as_json( 23 | std::shared_ptr data_set, 24 | Value::Strings const & specific_character_set={}); 25 | 26 | /// @brief Create a data set from its JSON representation. 27 | ODIL_API std::shared_ptr as_dataset(Json::Value const & json); 28 | 29 | } 30 | 31 | #endif // _6f5dc463_a89a_4f77_a0ed_36dca74b9e59 32 | -------------------------------------------------------------------------------- /src/odil/logging.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/logging.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | 17 | namespace odil 18 | { 19 | 20 | namespace logging 21 | { 22 | 23 | bool configure() 24 | { 25 | boost::log::core::get()->set_filter( 26 | boost::log::trivial::severity >= boost::log::trivial::warning); 27 | 28 | return true; 29 | 30 | 31 | } 32 | 33 | boost::log::sources::severity_logger logger = {}; 34 | 35 | static bool const configured = configure(); 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/odil/logging.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _5382f5e0_e993_4966_9447_542844edb635 10 | #define _5382f5e0_e993_4966_9447_542844edb635 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | 17 | #define ODIL_LOG(level) \ 18 | BOOST_LOG_SEV(odil::logging::logger, boost::log::trivial::level) 19 | 20 | namespace odil 21 | { 22 | namespace logging 23 | { 24 | 25 | extern ODIL_API boost::log::sources::severity_logger logger; 26 | 27 | } 28 | 29 | } 30 | 31 | #endif // _5382f5e0_e993_4966_9447_542844edb635 32 | -------------------------------------------------------------------------------- /src/odil/message/CEchoRequest.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "CEchoRequest.h" 10 | 11 | #include "odil/message/Request.h" 12 | #include "odil/registry.h" 13 | #include "odil/Value.h" 14 | 15 | namespace odil 16 | { 17 | 18 | namespace message 19 | { 20 | 21 | CEchoRequest 22 | ::CEchoRequest( 23 | Value::Integer message_id, Value::String const & affected_sop_class_uid) 24 | : Request(message_id) 25 | { 26 | this->set_command_field(Command::C_ECHO_RQ); 27 | this->set_affected_sop_class_uid(affected_sop_class_uid); 28 | } 29 | 30 | CEchoRequest 31 | ::CEchoRequest(std::shared_ptr message) 32 | : Request(message) 33 | { 34 | if(!message || message->get_command_field() != Command::C_ECHO_RQ) 35 | { 36 | throw Exception("Message is not a C-ECHO-RQ"); 37 | } 38 | this->set_command_field(message->get_command_field()); 39 | 40 | this->set_affected_sop_class_uid( 41 | message->get_command_set()->as_string(registry::AffectedSOPClassUID, 0)); 42 | } 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/odil/message/CEchoRequest.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _aec786b8_0074_4cb2_b9a1_4bf26bbd20fc 10 | #define _aec786b8_0074_4cb2_b9a1_4bf26bbd20fc 11 | 12 | #include "odil/message/Request.h" 13 | #include "odil/odil.h" 14 | #include "odil/registry.h" 15 | #include "odil/Value.h" 16 | 17 | namespace odil 18 | { 19 | 20 | namespace message 21 | { 22 | 23 | /// @brief C-ECHO-RQ message. 24 | class ODIL_API CEchoRequest: public Request 25 | { 26 | public: 27 | /** 28 | * @brief Create an echo request with given Message ID and 29 | * affected SOP class UID. 30 | */ 31 | CEchoRequest( 32 | Value::Integer message_id, 33 | Value::String const & affected_sop_class_uid); 34 | 35 | /** 36 | * @brief Create a C-ECHO-RQ from a generic Message. 37 | * 38 | * Raise an exception if the Message does not contain a C-ECHO-RQ. 39 | */ 40 | CEchoRequest(std::shared_ptr message); 41 | 42 | ODIL_MESSAGE_MANDATORY_FIELD_STRING_MACRO( 43 | affected_sop_class_uid, registry::AffectedSOPClassUID) 44 | }; 45 | 46 | } 47 | 48 | } 49 | 50 | #endif // _aec786b8_0074_4cb2_b9a1_4bf26bbd20fc 51 | -------------------------------------------------------------------------------- /src/odil/message/CEchoResponse.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "CEchoResponse.h" 10 | 11 | #include "odil/Exception.h" 12 | #include "odil/registry.h" 13 | #include "odil/message/Response.h" 14 | #include "odil/Value.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace message 20 | { 21 | 22 | CEchoResponse 23 | ::CEchoResponse( 24 | Value::Integer message_id_being_responded_to, Value::Integer status, 25 | Value::String const & affected_sop_class_uid) 26 | : Response(message_id_being_responded_to, status) 27 | { 28 | this->set_command_field(Command::C_ECHO_RSP); 29 | this->set_affected_sop_class_uid(affected_sop_class_uid); 30 | } 31 | 32 | CEchoResponse 33 | ::CEchoResponse(std::shared_ptr message) 34 | : Response(message) 35 | { 36 | if(!message || message->get_command_field() != Command::C_ECHO_RSP) 37 | { 38 | throw Exception("Message is not a C-ECHO-RSP"); 39 | } 40 | this->set_command_field(message->get_command_field()); 41 | 42 | this->set_affected_sop_class_uid( 43 | message->get_command_set()->as_string(registry::AffectedSOPClassUID, 0)); 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/odil/message/CEchoResponse.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _266252d9_e801_479e_a805_004b101c5250 10 | #define _266252d9_e801_479e_a805_004b101c5250 11 | 12 | #include "odil/odil.h" 13 | #include "odil/registry.h" 14 | #include "odil/message/Response.h" 15 | #include "odil/Value.h" 16 | 17 | namespace odil 18 | { 19 | 20 | namespace message 21 | { 22 | 23 | /// @brief C-ECHO-RSP message. 24 | class ODIL_API CEchoResponse: public Response 25 | { 26 | public: 27 | /** 28 | * @brief Create an echo response with given Message ID and 29 | * affected SOP class UID. 30 | */ 31 | CEchoResponse( 32 | Value::Integer message_id_being_responded_to, Value::Integer status, 33 | Value::String const & affected_sop_class_uid); 34 | 35 | /** 36 | * @brief Create a C-ECHO-RSP from a generic Message. 37 | * 38 | * Raise an exception if the Message does not contain a C-ECHO-RSP. 39 | */ 40 | CEchoResponse(std::shared_ptr message); 41 | 42 | ODIL_MESSAGE_MANDATORY_FIELD_STRING_MACRO( 43 | affected_sop_class_uid, registry::AffectedSOPClassUID) 44 | }; 45 | 46 | } 47 | 48 | } 49 | 50 | #endif // _266252d9_e801_479e_a805_004b101c5250 51 | -------------------------------------------------------------------------------- /src/odil/message/Cancellation.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/message/Cancellation.h" 10 | 11 | #include "odil/Exception.h" 12 | #include "odil/message/Message.h" 13 | #include "odil/registry.h" 14 | #include "odil/Value.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace message 20 | { 21 | 22 | Cancellation 23 | ::Cancellation(uint16_t message_id_being_responded_to) 24 | : Message() 25 | { 26 | this->set_command_field(Command::C_CANCEL_RQ); 27 | this->set_message_id_being_responded_to(message_id_being_responded_to); 28 | } 29 | 30 | Cancellation 31 | ::Cancellation(std::shared_ptr message) 32 | { 33 | if(!message || message->get_command_field() != Command::C_CANCEL_RQ) 34 | { 35 | throw Exception("Message is not a C-CANCEL-RQ"); 36 | } 37 | this->set_command_field(message->get_command_field()); 38 | 39 | this->set_message_id_being_responded_to( 40 | message->get_command_set()->as_int(registry::MessageIDBeingRespondedTo, 0)); 41 | } 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/odil/message/Cancellation.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _97fc1bfc_4cff_40f2_a1ed_4550c71a0bda 10 | #define _97fc1bfc_4cff_40f2_a1ed_4550c71a0bda 11 | 12 | #include "odil/message/Message.h" 13 | #include "odil/odil.h" 14 | #include "odil/registry.h" 15 | #include "odil/Value.h" 16 | 17 | namespace odil 18 | { 19 | 20 | namespace message 21 | { 22 | 23 | /// @brief Base class for cancellation messages. 24 | class ODIL_API Cancellation: public Message 25 | { 26 | public: 27 | /// @brief Create a response with given message id being responded to. 28 | Cancellation(uint16_t message_id_being_responded_to); 29 | 30 | /** 31 | * @brief Create a response from the Message ID Being Responded To. 32 | * 33 | * Raise an exception is this element is missing. 34 | */ 35 | Cancellation(std::shared_ptr message); 36 | 37 | ODIL_MESSAGE_MANDATORY_FIELD_INTEGER_MACRO( 38 | message_id_being_responded_to, registry::MessageIDBeingRespondedTo); 39 | }; 40 | 41 | } 42 | 43 | } 44 | 45 | #endif // _97fc1bfc_4cff_40f2_a1ed_4550c71a0bda 46 | -------------------------------------------------------------------------------- /src/odil/message/Request.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "Request.h" 10 | 11 | #include "odil/message/Message.h" 12 | #include "odil/registry.h" 13 | #include "odil/Value.h" 14 | 15 | namespace odil 16 | { 17 | 18 | namespace message 19 | { 20 | 21 | Request 22 | ::Request(Value::Integer message_id) 23 | : Message() 24 | { 25 | this->set_message_id(message_id); 26 | } 27 | 28 | Request 29 | ::Request(std::shared_ptr message) 30 | : Message() 31 | { 32 | this->set_message_id( 33 | message->get_command_set()->as_int(registry::MessageID, 0)); 34 | } 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/odil/message/Request.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _8d06a300_6aee_4d1f_bf10_ecdf4916ae9f 10 | #define _8d06a300_6aee_4d1f_bf10_ecdf4916ae9f 11 | 12 | #include "odil/message/Message.h" 13 | #include "odil/odil.h" 14 | #include "odil/registry.h" 15 | #include "odil/Value.h" 16 | 17 | namespace odil 18 | { 19 | 20 | namespace message 21 | { 22 | 23 | /// @brief Base class for all DIMSE request messages. 24 | class ODIL_API Request: public Message 25 | { 26 | public: 27 | /// @brief Create a request with given Message ID. 28 | Request(Value::Integer message_id); 29 | 30 | /** 31 | * @brief Create a request from the Message ID stored in the message 32 | * command set. 33 | * 34 | * Raise an exception is either of this element is missing. 35 | */ 36 | Request(std::shared_ptr message); 37 | 38 | ODIL_MESSAGE_MANDATORY_FIELD_INTEGER_MACRO( 39 | message_id, registry::MessageID) 40 | }; 41 | 42 | } 43 | 44 | } 45 | 46 | #endif // _8d06a300_6aee_4d1f_bf10_ecdf4916ae9f 47 | -------------------------------------------------------------------------------- /src/odil/odil.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _b9c5b481_c291_4d87_b721_1e19d577d5e4 10 | #define _b9c5b481_c291_4d87_b721_1e19d577d5e4 11 | 12 | #ifdef WIN32 13 | # define EXPORT_DYNAMIC_LIBRARY __declspec(dllexport) 14 | # define IMPORT_DYNAMIC_LIBRARY __declspec(dllimport) 15 | // disable warning: 'identifier': class 'type' needs to have dll-interface to be 16 | // used by clients of class 'type2' 17 | // disable warning: non - DLL-interface classkey 'identifier' used as base for 18 | // DLL-interface classkey 'identifier' 19 | #pragma warning( disable : 4251 4275 ) 20 | #else // WIN32 21 | # define EXPORT_DYNAMIC_LIBRARY 22 | # define IMPORT_DYNAMIC_LIBRARY 23 | #endif // WIN32 24 | 25 | #ifdef BUILDING_ODIL 26 | # define ODIL_API EXPORT_DYNAMIC_LIBRARY 27 | #else // BUILDING_ODIL 28 | # define ODIL_API IMPORT_DYNAMIC_LIBRARY 29 | #endif // BUILDING_ODIL 30 | 31 | #endif // _b9c5b481_c291_4d87_b721_1e19d577d5e4 32 | -------------------------------------------------------------------------------- /src/odil/pdu/AAbort.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _536f93f0_914e_40ff_8917_36644acbc4b1 10 | #define _536f93f0_914e_40ff_8917_36644acbc4b1 11 | 12 | #include 13 | 14 | #include "odil/odil.h" 15 | #include "odil/pdu/Object.h" 16 | 17 | namespace odil 18 | { 19 | 20 | namespace pdu 21 | { 22 | 23 | /// @brief A-ABORT PDU, cf. PS 3.8, 9.3.8. 24 | class ODIL_API AAbort: public Object 25 | { 26 | public: 27 | /// @brief Constructor. 28 | AAbort(unsigned char source, unsigned char reason); 29 | 30 | /// @brief Constructor for binary data. 31 | AAbort(std::istream & stream); 32 | 33 | /// @brief Return the source. 34 | unsigned char get_source() const; 35 | 36 | /// @brief Set the source, must be 0, 1 or 2. 37 | void set_source(unsigned char source); 38 | 39 | /// @brief Return the reason. 40 | unsigned char get_reason() const; 41 | 42 | /// @brief Set the reason, must be between 0 and 6. 43 | void set_reason(unsigned char reason); 44 | }; 45 | 46 | } 47 | 48 | } 49 | 50 | #endif // _536f93f0_914e_40ff_8917_36644acbc4b1 51 | -------------------------------------------------------------------------------- /src/odil/pdu/AAssociateAC.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _973ae1d9_c41c_4518_9c35_df13b2253369 10 | #define _973ae1d9_c41c_4518_9c35_df13b2253369 11 | 12 | #include 13 | 14 | #include "odil/odil.h" 15 | #include "odil/pdu/AAssociate.h" 16 | #include "odil/pdu/PresentationContextAC.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace pdu 22 | { 23 | 24 | /// @brief A-ASSOCIATE-AC PDU, cf. PS 3.8, 9.3.3. 25 | class ODIL_API AAssociateAC: public AAssociate 26 | { 27 | public: 28 | /// @brief Constructor. 29 | AAssociateAC(); 30 | 31 | /// @brief Constructor for binary data. 32 | AAssociateAC(std::istream & stream); 33 | 34 | /// @brief Destructor. 35 | ~AAssociateAC(); 36 | 37 | /// @brief Return the Presentation Context sub-items. 38 | std::vector get_presentation_contexts() const; 39 | 40 | /// @brief Set the Presentation Context sub-items. 41 | void set_presentation_contexts(std::vector const & value); 42 | }; 43 | 44 | } 45 | 46 | } 47 | 48 | #endif // _973ae1d9_c41c_4518_9c35_df13b2253369 49 | -------------------------------------------------------------------------------- /src/odil/pdu/AAssociateRQ.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _22fc6fe5_f7d1_461b_932f_cedfcae13897 10 | #define _22fc6fe5_f7d1_461b_932f_cedfcae13897 11 | 12 | #include 13 | 14 | #include "odil/odil.h" 15 | #include "odil/pdu/AAssociate.h" 16 | #include "odil/pdu/PresentationContextRQ.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace pdu 22 | { 23 | 24 | /// @brief A-ASSOCIATE-RQ, cf. PS 3.8, 9.3.2 25 | class ODIL_API AAssociateRQ: public AAssociate 26 | { 27 | public: 28 | /// @brief Constructor. 29 | AAssociateRQ(); 30 | 31 | /// @brief Constructor for binary data. 32 | AAssociateRQ(std::istream & stream); 33 | 34 | /// @brief Destructor. 35 | ~AAssociateRQ(); 36 | 37 | /// @brief Return the Presentation Context sub-items. 38 | std::vector get_presentation_contexts() const; 39 | 40 | /// @brief Set the Presentation Context sub-items. 41 | void set_presentation_contexts(std::vector const & value); 42 | }; 43 | 44 | } 45 | 46 | } 47 | 48 | #endif // _22fc6fe5_f7d1_461b_932f_cedfcae13897 49 | -------------------------------------------------------------------------------- /src/odil/pdu/AReleaseRP.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/pdu/AReleaseRP.h" 10 | 11 | #include 12 | #include 13 | 14 | #include "odil/Exception.h" 15 | #include "odil/pdu/Object.h" 16 | 17 | namespace odil 18 | { 19 | 20 | namespace pdu 21 | { 22 | 23 | AReleaseRP 24 | ::AReleaseRP() 25 | { 26 | this->_item.add("PDU-type", uint8_t(0x06)); 27 | this->_item.add("Reserved-1", uint8_t(0)); 28 | this->_item.add("PDU-length", uint32_t(4)); 29 | this->_item.add("Reserved-2", uint32_t(0)); 30 | } 31 | 32 | AReleaseRP 33 | ::AReleaseRP(std::istream & stream) 34 | { 35 | this->_item.read(stream, "PDU-type", Item::Field::Type::unsigned_int_8); 36 | if(this->_item.as_unsigned_int_8("PDU-type") != 0x06) 37 | { 38 | throw Exception("Invalid PDU type"); 39 | } 40 | 41 | this->_item.read(stream, "Reserved-1", Item::Field::Type::unsigned_int_8); 42 | this->_item.read(stream, "PDU-length", Item::Field::Type::unsigned_int_32); 43 | this->_item.read(stream, "Reserved-2", Item::Field::Type::unsigned_int_32); 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/odil/pdu/AReleaseRP.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _a70fb011_8d69_4768_a84d_7f535621c335 10 | #define _a70fb011_8d69_4768_a84d_7f535621c335 11 | 12 | #include 13 | 14 | #include "odil/odil.h" 15 | #include "odil/pdu/Object.h" 16 | 17 | namespace odil 18 | { 19 | 20 | namespace pdu 21 | { 22 | 23 | /// @brief A-RELEASE-RP PDU, cf. PS 3.8, 9.3.7. 24 | class ODIL_API AReleaseRP: public Object 25 | { 26 | public: 27 | /// @brief Constructor. 28 | AReleaseRP(); 29 | 30 | /// @brief Constructor from stream. 31 | AReleaseRP(std::istream & stream); 32 | }; 33 | 34 | } 35 | 36 | } 37 | 38 | #endif // _a70fb011_8d69_4768_a84d_7f535621c335 39 | -------------------------------------------------------------------------------- /src/odil/pdu/AReleaseRQ.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/pdu/AReleaseRQ.h" 10 | 11 | #include 12 | #include 13 | 14 | #include "odil/Exception.h" 15 | #include "odil/pdu/Object.h" 16 | 17 | namespace odil 18 | { 19 | 20 | namespace pdu 21 | { 22 | 23 | AReleaseRQ 24 | ::AReleaseRQ() 25 | { 26 | this->_item.add("PDU-type", uint8_t(0x05)); 27 | this->_item.add("Reserved-1", uint8_t(0)); 28 | this->_item.add("PDU-length", uint32_t(4)); 29 | this->_item.add("Reserved-2", uint32_t(0)); 30 | } 31 | 32 | AReleaseRQ 33 | ::AReleaseRQ(std::istream & stream) 34 | { 35 | this->_item.read(stream, "PDU-type", Item::Field::Type::unsigned_int_8); 36 | if(this->_item.as_unsigned_int_8("PDU-type") != 0x05) 37 | { 38 | throw Exception("Invalid PDU type"); 39 | } 40 | 41 | this->_item.read(stream, "Reserved-1", Item::Field::Type::unsigned_int_8); 42 | this->_item.read(stream, "PDU-length", Item::Field::Type::unsigned_int_32); 43 | this->_item.read(stream, "Reserved-2", Item::Field::Type::unsigned_int_32); 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/odil/pdu/AReleaseRQ.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _87f54a57_5741_4fde_871b_ea9c774795ad 10 | #define _87f54a57_5741_4fde_871b_ea9c774795ad 11 | 12 | #include 13 | 14 | #include "odil/odil.h" 15 | #include "odil/pdu/Object.h" 16 | 17 | namespace odil 18 | { 19 | 20 | namespace pdu 21 | { 22 | 23 | /// @brief A-RELEASE-RQ PDU, cf. PS 3.8, 9.3.6. 24 | class ODIL_API AReleaseRQ: public Object 25 | { 26 | public: 27 | /// @brief Constructor. 28 | AReleaseRQ(); 29 | 30 | /// @brief Constructor from stream. 31 | AReleaseRQ(std::istream & stream); 32 | }; 33 | 34 | } 35 | 36 | } 37 | 38 | #endif // _87f54a57_5741_4fde_871b_ea9c774795ad 39 | -------------------------------------------------------------------------------- /src/odil/pdu/ApplicationContext.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _12bdb8f1_48c2_44d0_957a_bc1fb6f6733a 10 | #define _12bdb8f1_48c2_44d0_957a_bc1fb6f6733a 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/pdu/Object.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace pdu 22 | { 23 | 24 | /** 25 | * @brief Application Context item, (PS 3.8, 9.3.2.1). 26 | */ 27 | class ODIL_API ApplicationContext: public Object 28 | { 29 | public: 30 | /// @brief Create an Application Context. 31 | ApplicationContext(std::string const & name); 32 | 33 | /// @brief Read an Application Context from a stream. 34 | ApplicationContext(std::istream & stream); 35 | 36 | /// @brief Return the name of the Application Context. 37 | std::string get_name() const; 38 | 39 | /// @brief Set the name of the Application Context. 40 | void set_name(std::string const & name); 41 | }; 42 | 43 | } 44 | 45 | } 46 | 47 | #endif // _12bdb8f1_48c2_44d0_957a_bc1fb6f6733a 48 | -------------------------------------------------------------------------------- /src/odil/pdu/ImplementationClassUID.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _6b085e0c_afd5_4ed7_ab4d_6bdb9b28ca67 10 | #define _6b085e0c_afd5_4ed7_ab4d_6bdb9b28ca67 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include "odil/odil.h" 17 | #include "odil/pdu/Object.h" 18 | 19 | namespace odil 20 | { 21 | 22 | namespace pdu 23 | { 24 | 25 | /// @brief Implementation Class UID Sub-Item (PS 3.7, D.3.3.2.1 and D.3.3.2.2). 26 | class ODIL_API ImplementationClassUID: public Object 27 | { 28 | public: 29 | /// @brief Item type. 30 | static uint8_t const type=0x52; 31 | 32 | /// @brief Create a Implementation Class UID item. 33 | ImplementationClassUID(std::string const & implementation_class_uid); 34 | 35 | /// @brief Read a Implementation Class UID item from a stream. 36 | ImplementationClassUID(std::istream & stream); 37 | 38 | /// @brief Return the Implementation Class UID. 39 | std::string get_implementation_class_uid() const; 40 | 41 | /// @brief Set the Implementation Class UID. 42 | void set_implementation_class_uid(std::string const & value); 43 | }; 44 | 45 | } 46 | 47 | } 48 | 49 | #endif // _6b085e0c_afd5_4ed7_ab4d_6bdb9b28ca67 50 | -------------------------------------------------------------------------------- /src/odil/pdu/MaximumLength.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _b2091b0b_1a6e_435c_b927_e5c54aff89c5 10 | #define _b2091b0b_1a6e_435c_b927_e5c54aff89c5 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/pdu/Object.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace pdu 22 | { 23 | 24 | /// @brief Maximum Length Sub-Item Structure (PS 3.8, D.1). 25 | class ODIL_API MaximumLength: public Object 26 | { 27 | public: 28 | /// @brief Item type. 29 | static uint8_t const type=0x51; 30 | 31 | /// @brief Create a Maximum Length item. 32 | MaximumLength(uint32_t maximum_length=0); 33 | 34 | /// @brief Read a Maximum Length item from a stream. 35 | MaximumLength(std::istream & stream); 36 | 37 | /// @brief Return the maximum length. 38 | uint32_t get_maximum_length() const; 39 | 40 | /// @brief Set the maximum length. 41 | void set_maximum_length(uint32_t value); 42 | }; 43 | 44 | } 45 | 46 | } 47 | 48 | #endif // _b2091b0b_1a6e_435c_b927_e5c54aff89c5 49 | -------------------------------------------------------------------------------- /src/odil/pdu/UserIdentityAC.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _1c3d6b3c_09a0_4452_9263_aa010ee1d973 10 | #define _1c3d6b3c_09a0_4452_9263_aa010ee1d973 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/pdu/Object.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace pdu 22 | { 23 | 24 | /// @brief User Identity Sub-Item Structure (A-ASSOCIATE-AC) (PS 3.7, D.3.3.7.2). 25 | class ODIL_API UserIdentityAC: public Object 26 | { 27 | public: 28 | /// @brief Item type. 29 | static uint8_t const type=0x59; 30 | 31 | /// @brief Create an User Identity. 32 | UserIdentityAC(std::string const & server_response=""); 33 | 34 | /// @brief Read an User Identity from a stream. 35 | UserIdentityAC(std::istream & stream); 36 | 37 | /// @brief Return the server response. 38 | std::string const & get_server_response() const; 39 | 40 | /// @brief Set the server response. 41 | void set_server_response(std::string const & value); 42 | }; 43 | 44 | } 45 | 46 | } 47 | 48 | #endif // _1c3d6b3c_09a0_4452_9263_aa010ee1d973 49 | -------------------------------------------------------------------------------- /src/odil/registry_0034.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0034 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0034 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const FlowIdentifierSequence(0x0034, 0x0001); 24 | Tag const FlowIdentifier(0x0034, 0x0002); 25 | Tag const FlowTransferSyntaxUID(0x0034, 0x0003); 26 | Tag const FlowRTPSamplingRate(0x0034, 0x0004); 27 | Tag const SourceIdentifier(0x0034, 0x0005); 28 | Tag const FrameOriginTimestamp(0x0034, 0x0007); 29 | Tag const IncludesImagingSubject(0x0034, 0x0008); 30 | Tag const FrameUsefulnessGroupSequence(0x0034, 0x0009); 31 | Tag const RealTimeBulkDataFlowSequence(0x0034, 0x000a); 32 | Tag const CameraPositionGroupSequence(0x0034, 0x000b); 33 | Tag const IncludesInformation(0x0034, 0x000c); 34 | Tag const TimeOfFrameGroupSequence(0x0034, 0x000d); 35 | 36 | } 37 | 38 | } 39 | 40 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0034 -------------------------------------------------------------------------------- /src/odil/registry_0042.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0042 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0042 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const DocumentTitle(0x0042, 0x0010); 24 | Tag const EncapsulatedDocument(0x0042, 0x0011); 25 | Tag const MIMETypeOfEncapsulatedDocument(0x0042, 0x0012); 26 | Tag const SourceInstanceSequence(0x0042, 0x0013); 27 | Tag const ListOfMIMETypes(0x0042, 0x0014); 28 | Tag const EncapsulatedDocumentLength(0x0042, 0x0015); 29 | 30 | } 31 | 32 | } 33 | 34 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0042 -------------------------------------------------------------------------------- /src/odil/registry_0060.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0060 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0060 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const HistogramSequence(0x0060, 0x3000); 24 | Tag const HistogramNumberOfBins(0x0060, 0x3002); 25 | Tag const HistogramFirstBinValue(0x0060, 0x3004); 26 | Tag const HistogramLastBinValue(0x0060, 0x3006); 27 | Tag const HistogramBinWidth(0x0060, 0x3008); 28 | Tag const HistogramExplanation(0x0060, 0x3010); 29 | Tag const HistogramData(0x0060, 0x3020); 30 | 31 | } 32 | 33 | } 34 | 35 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0060 -------------------------------------------------------------------------------- /src/odil/registry_0064.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0064 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0064 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const DeformableRegistrationSequence(0x0064, 0x0002); 24 | Tag const SourceFrameOfReferenceUID(0x0064, 0x0003); 25 | Tag const DeformableRegistrationGridSequence(0x0064, 0x0005); 26 | Tag const GridDimensions(0x0064, 0x0007); 27 | Tag const GridResolution(0x0064, 0x0008); 28 | Tag const VectorGridData(0x0064, 0x0009); 29 | Tag const PreDeformationMatrixRegistrationSequence(0x0064, 0x000f); 30 | Tag const PostDeformationMatrixRegistrationSequence(0x0064, 0x0010); 31 | 32 | } 33 | 34 | } 35 | 36 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0064 -------------------------------------------------------------------------------- /src/odil/registry_0080.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0080 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0080 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const SurfaceScanAcquisitionTypeCodeSequence(0x0080, 0x0001); 24 | Tag const SurfaceScanModeCodeSequence(0x0080, 0x0002); 25 | Tag const RegistrationMethodCodeSequence(0x0080, 0x0003); 26 | Tag const ShotDurationTime(0x0080, 0x0004); 27 | Tag const ShotOffsetTime(0x0080, 0x0005); 28 | Tag const SurfacePointPresentationValueData(0x0080, 0x0006); 29 | Tag const SurfacePointColorCIELabValueData(0x0080, 0x0007); 30 | Tag const UVMappingSequence(0x0080, 0x0008); 31 | Tag const TextureLabel(0x0080, 0x0009); 32 | Tag const UValueData(0x0080, 0x0010); 33 | Tag const VValueData(0x0080, 0x0011); 34 | Tag const ReferencedTextureSequence(0x0080, 0x0012); 35 | Tag const ReferencedSurfaceDataSequence(0x0080, 0x0013); 36 | 37 | } 38 | 39 | } 40 | 41 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0080 -------------------------------------------------------------------------------- /src/odil/registry_0088.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0088 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0088 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const StorageMediaFileSetID(0x0088, 0x0130); 24 | Tag const StorageMediaFileSetUID(0x0088, 0x0140); 25 | Tag const IconImageSequence(0x0088, 0x0200); 26 | Tag const TopicTitle(0x0088, 0x0904); 27 | Tag const TopicSubject(0x0088, 0x0906); 28 | Tag const TopicAuthor(0x0088, 0x0910); 29 | Tag const TopicKeywords(0x0088, 0x0912); 30 | 31 | } 32 | 33 | } 34 | 35 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0088 -------------------------------------------------------------------------------- /src/odil/registry_0100.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0100 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0100 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const SOPInstanceStatus(0x0100, 0x0410); 24 | Tag const SOPAuthorizationDateTime(0x0100, 0x0420); 25 | Tag const SOPAuthorizationComment(0x0100, 0x0424); 26 | Tag const AuthorizationEquipmentCertificationNumber(0x0100, 0x0426); 27 | 28 | } 29 | 30 | } 31 | 32 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_0100 -------------------------------------------------------------------------------- /src/odil/registry_2020.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2020 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2020 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const ImageBoxPosition(0x2020, 0x0010); 24 | Tag const Polarity(0x2020, 0x0020); 25 | Tag const RequestedImageSize(0x2020, 0x0030); 26 | Tag const RequestedDecimateCropBehavior(0x2020, 0x0040); 27 | Tag const RequestedResolutionID(0x2020, 0x0050); 28 | Tag const RequestedImageSizeFlag(0x2020, 0x00a0); 29 | Tag const DecimateCropResult(0x2020, 0x00a2); 30 | Tag const BasicGrayscaleImageSequence(0x2020, 0x0110); 31 | Tag const BasicColorImageSequence(0x2020, 0x0111); 32 | Tag const ReferencedImageOverlayBoxSequence(0x2020, 0x0130); 33 | Tag const ReferencedVOILUTBoxSequence(0x2020, 0x0140); 34 | 35 | } 36 | 37 | } 38 | 39 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2020 -------------------------------------------------------------------------------- /src/odil/registry_2030.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_2030( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0x2030, 0x0010), ElementsDictionaryEntry("Annotation Position", "AnnotationPosition", "US", "1")); 28 | public_dictionary.emplace(Tag(0x2030, 0x0020), ElementsDictionaryEntry("Text String", "TextString", "LO", "1")); 29 | 30 | public_tags.emplace("AnnotationPosition", Tag(0x2030, 0x0010)); 31 | public_tags.emplace("TextString", Tag(0x2030, 0x0020)); 32 | } 33 | 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/odil/registry_2030.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2030 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2030 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const AnnotationPosition(0x2030, 0x0010); 24 | Tag const TextString(0x2030, 0x0020); 25 | 26 | } 27 | 28 | } 29 | 30 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2030 -------------------------------------------------------------------------------- /src/odil/registry_2040.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2040 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2040 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const ReferencedOverlayPlaneSequence(0x2040, 0x0010); 24 | Tag const ReferencedOverlayPlaneGroups(0x2040, 0x0011); 25 | Tag const OverlayPixelDataSequence(0x2040, 0x0020); 26 | Tag const OverlayMagnificationType(0x2040, 0x0060); 27 | Tag const OverlaySmoothingType(0x2040, 0x0070); 28 | Tag const OverlayOrImageMagnification(0x2040, 0x0072); 29 | Tag const MagnifyToNumberOfColumns(0x2040, 0x0074); 30 | Tag const OverlayForegroundDensity(0x2040, 0x0080); 31 | Tag const OverlayBackgroundDensity(0x2040, 0x0082); 32 | Tag const OverlayMode(0x2040, 0x0090); 33 | Tag const ThresholdDensity(0x2040, 0x0100); 34 | Tag const ReferencedImageBoxSequenceRetired(0x2040, 0x0500); 35 | 36 | } 37 | 38 | } 39 | 40 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2040 -------------------------------------------------------------------------------- /src/odil/registry_2050.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_2050( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0x2050, 0x0010), ElementsDictionaryEntry("Presentation LUT Sequence", "PresentationLUTSequence", "SQ", "1")); 28 | public_dictionary.emplace(Tag(0x2050, 0x0020), ElementsDictionaryEntry("Presentation LUT Shape", "PresentationLUTShape", "CS", "1")); 29 | public_dictionary.emplace(Tag(0x2050, 0x0500), ElementsDictionaryEntry("Referenced Presentation LUT Sequence", "ReferencedPresentationLUTSequence", "SQ", "1")); 30 | 31 | public_tags.emplace("PresentationLUTSequence", Tag(0x2050, 0x0010)); 32 | public_tags.emplace("PresentationLUTShape", Tag(0x2050, 0x0020)); 33 | public_tags.emplace("ReferencedPresentationLUTSequence", Tag(0x2050, 0x0500)); 34 | } 35 | 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /src/odil/registry_2050.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2050 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2050 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const PresentationLUTSequence(0x2050, 0x0010); 24 | Tag const PresentationLUTShape(0x2050, 0x0020); 25 | Tag const ReferencedPresentationLUTSequence(0x2050, 0x0500); 26 | 27 | } 28 | 29 | } 30 | 31 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2050 -------------------------------------------------------------------------------- /src/odil/registry_2100.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2100 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2100 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const PrintJobID(0x2100, 0x0010); 24 | Tag const ExecutionStatus(0x2100, 0x0020); 25 | Tag const ExecutionStatusInfo(0x2100, 0x0030); 26 | Tag const CreationDate(0x2100, 0x0040); 27 | Tag const CreationTime(0x2100, 0x0050); 28 | Tag const Originator(0x2100, 0x0070); 29 | Tag const DestinationAE(0x2100, 0x0140); 30 | Tag const OwnerID(0x2100, 0x0160); 31 | Tag const NumberOfFilms(0x2100, 0x0170); 32 | Tag const ReferencedPrintJobSequencePullStoredPrint(0x2100, 0x0500); 33 | 34 | } 35 | 36 | } 37 | 38 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2100 -------------------------------------------------------------------------------- /src/odil/registry_2110.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_2110( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0x2110, 0x0010), ElementsDictionaryEntry("Printer Status", "PrinterStatus", "CS", "1")); 28 | public_dictionary.emplace(Tag(0x2110, 0x0020), ElementsDictionaryEntry("Printer Status Info", "PrinterStatusInfo", "CS", "1")); 29 | public_dictionary.emplace(Tag(0x2110, 0x0030), ElementsDictionaryEntry("Printer Name", "PrinterName", "LO", "1")); 30 | public_dictionary.emplace(Tag(0x2110, 0x0099), ElementsDictionaryEntry("Print Queue ID", "PrintQueueID", "SH", "1")); 31 | 32 | public_tags.emplace("PrinterStatus", Tag(0x2110, 0x0010)); 33 | public_tags.emplace("PrinterStatusInfo", Tag(0x2110, 0x0020)); 34 | public_tags.emplace("PrinterName", Tag(0x2110, 0x0030)); 35 | public_tags.emplace("PrintQueueID", Tag(0x2110, 0x0099)); 36 | } 37 | 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /src/odil/registry_2110.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2110 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2110 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const PrinterStatus(0x2110, 0x0010); 24 | Tag const PrinterStatusInfo(0x2110, 0x0020); 25 | Tag const PrinterName(0x2110, 0x0030); 26 | Tag const PrintQueueID(0x2110, 0x0099); 27 | 28 | } 29 | 30 | } 31 | 32 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2110 -------------------------------------------------------------------------------- /src/odil/registry_2120.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_2120( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0x2120, 0x0010), ElementsDictionaryEntry("Queue Status", "QueueStatus", "CS", "1")); 28 | public_dictionary.emplace(Tag(0x2120, 0x0050), ElementsDictionaryEntry("Print Job Description Sequence", "PrintJobDescriptionSequence", "SQ", "1")); 29 | public_dictionary.emplace(Tag(0x2120, 0x0070), ElementsDictionaryEntry("Referenced Print Job Sequence", "ReferencedPrintJobSequence", "SQ", "1")); 30 | 31 | public_tags.emplace("QueueStatus", Tag(0x2120, 0x0010)); 32 | public_tags.emplace("PrintJobDescriptionSequence", Tag(0x2120, 0x0050)); 33 | public_tags.emplace("ReferencedPrintJobSequence", Tag(0x2120, 0x0070)); 34 | } 35 | 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /src/odil/registry_2120.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2120 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2120 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const QueueStatus(0x2120, 0x0010); 24 | Tag const PrintJobDescriptionSequence(0x2120, 0x0050); 25 | Tag const ReferencedPrintJobSequence(0x2120, 0x0070); 26 | 27 | } 28 | 29 | } 30 | 31 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2120 -------------------------------------------------------------------------------- /src/odil/registry_2130.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2130 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2130 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const PrintManagementCapabilitiesSequence(0x2130, 0x0010); 24 | Tag const PrinterCharacteristicsSequence(0x2130, 0x0015); 25 | Tag const FilmBoxContentSequence(0x2130, 0x0030); 26 | Tag const ImageBoxContentSequence(0x2130, 0x0040); 27 | Tag const AnnotationContentSequence(0x2130, 0x0050); 28 | Tag const ImageOverlayBoxContentSequence(0x2130, 0x0060); 29 | Tag const PresentationLUTContentSequence(0x2130, 0x0080); 30 | Tag const ProposedStudySequence(0x2130, 0x00a0); 31 | Tag const OriginalImageSequence(0x2130, 0x00c0); 32 | 33 | } 34 | 35 | } 36 | 37 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_2130 -------------------------------------------------------------------------------- /src/odil/registry_300e.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_300e( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0x300e, 0x0002), ElementsDictionaryEntry("Approval Status", "ApprovalStatus", "CS", "1")); 28 | public_dictionary.emplace(Tag(0x300e, 0x0004), ElementsDictionaryEntry("Review Date", "ReviewDate", "DA", "1")); 29 | public_dictionary.emplace(Tag(0x300e, 0x0005), ElementsDictionaryEntry("Review Time", "ReviewTime", "TM", "1")); 30 | public_dictionary.emplace(Tag(0x300e, 0x0008), ElementsDictionaryEntry("Reviewer Name", "ReviewerName", "PN", "1")); 31 | 32 | public_tags.emplace("ApprovalStatus", Tag(0x300e, 0x0002)); 33 | public_tags.emplace("ReviewDate", Tag(0x300e, 0x0004)); 34 | public_tags.emplace("ReviewTime", Tag(0x300e, 0x0005)); 35 | public_tags.emplace("ReviewerName", Tag(0x300e, 0x0008)); 36 | } 37 | 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /src/odil/registry_300e.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_300e 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_300e 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const ApprovalStatus(0x300e, 0x0002); 24 | Tag const ReviewDate(0x300e, 0x0004); 25 | Tag const ReviewTime(0x300e, 0x0005); 26 | Tag const ReviewerName(0x300e, 0x0008); 27 | 28 | } 29 | 30 | } 31 | 32 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_300e -------------------------------------------------------------------------------- /src/odil/registry_4000.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_4000( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0x4000, 0x0010), ElementsDictionaryEntry("Arbitrary", "Arbitrary", "LT", "1")); 28 | public_dictionary.emplace(Tag(0x4000, 0x4000), ElementsDictionaryEntry("Text Comments", "TextComments", "LT", "1")); 29 | 30 | public_tags.emplace("Arbitrary", Tag(0x4000, 0x0010)); 31 | public_tags.emplace("TextComments", Tag(0x4000, 0x4000)); 32 | } 33 | 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/odil/registry_4000.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_4000 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_4000 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const Arbitrary(0x4000, 0x0010); 24 | Tag const TextComments(0x4000, 0x4000); 25 | 26 | } 27 | 28 | } 29 | 30 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_4000 -------------------------------------------------------------------------------- /src/odil/registry_4ffe.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_4ffe( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0x4ffe, 0x0001), ElementsDictionaryEntry("MAC Parameters Sequence", "MACParametersSequence", "SQ", "1")); 28 | 29 | public_tags.emplace("MACParametersSequence", Tag(0x4ffe, 0x0001)); 30 | } 31 | 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/odil/registry_4ffe.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_4ffe 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_4ffe 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const MACParametersSequence(0x4ffe, 0x0001); 24 | 25 | } 26 | 27 | } 28 | 29 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_4ffe -------------------------------------------------------------------------------- /src/odil/registry_5200.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_5200( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0x5200, 0x9229), ElementsDictionaryEntry("Shared Functional Groups Sequence", "SharedFunctionalGroupsSequence", "SQ", "1")); 28 | public_dictionary.emplace(Tag(0x5200, 0x9230), ElementsDictionaryEntry("Per-Frame Functional Groups Sequence", "PerFrameFunctionalGroupsSequence", "SQ", "1")); 29 | 30 | public_tags.emplace("SharedFunctionalGroupsSequence", Tag(0x5200, 0x9229)); 31 | public_tags.emplace("PerFrameFunctionalGroupsSequence", Tag(0x5200, 0x9230)); 32 | } 33 | 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/odil/registry_5200.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_5200 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_5200 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const SharedFunctionalGroupsSequence(0x5200, 0x9229); 24 | Tag const PerFrameFunctionalGroupsSequence(0x5200, 0x9230); 25 | 26 | } 27 | 28 | } 29 | 30 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_5200 -------------------------------------------------------------------------------- /src/odil/registry_5400.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_5400 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_5400 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const WaveformSequence(0x5400, 0x0100); 24 | Tag const ChannelMinimumValue(0x5400, 0x0110); 25 | Tag const ChannelMaximumValue(0x5400, 0x0112); 26 | Tag const WaveformBitsAllocated(0x5400, 0x1004); 27 | Tag const WaveformSampleInterpretation(0x5400, 0x1006); 28 | Tag const WaveformPaddingValue(0x5400, 0x100a); 29 | Tag const WaveformData(0x5400, 0x1010); 30 | 31 | } 32 | 33 | } 34 | 35 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_5400 -------------------------------------------------------------------------------- /src/odil/registry_5600.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_5600( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0x5600, 0x0010), ElementsDictionaryEntry("First Order Phase Correction Angle", "FirstOrderPhaseCorrectionAngle", "OF", "1")); 28 | public_dictionary.emplace(Tag(0x5600, 0x0020), ElementsDictionaryEntry("Spectroscopy Data", "SpectroscopyData", "OF", "1")); 29 | 30 | public_tags.emplace("FirstOrderPhaseCorrectionAngle", Tag(0x5600, 0x0010)); 31 | public_tags.emplace("SpectroscopyData", Tag(0x5600, 0x0020)); 32 | } 33 | 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/odil/registry_5600.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_5600 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_5600 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const FirstOrderPhaseCorrectionAngle(0x5600, 0x0010); 24 | Tag const SpectroscopyData(0x5600, 0x0020); 25 | 26 | } 27 | 28 | } 29 | 30 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_5600 -------------------------------------------------------------------------------- /src/odil/registry_7fe0.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_7fe0 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_7fe0 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const ExtendedOffsetTable(0x7fe0, 0x0001); 24 | Tag const ExtendedOffsetTableLengths(0x7fe0, 0x0002); 25 | Tag const EncapsulatedPixelDataValueTotalLength(0x7fe0, 0x0003); 26 | Tag const FloatPixelData(0x7fe0, 0x0008); 27 | Tag const DoubleFloatPixelData(0x7fe0, 0x0009); 28 | Tag const PixelData(0x7fe0, 0x0010); 29 | Tag const CoefficientsSDVN(0x7fe0, 0x0020); 30 | Tag const CoefficientsSDHN(0x7fe0, 0x0030); 31 | Tag const CoefficientsSDDN(0x7fe0, 0x0040); 32 | 33 | } 34 | 35 | } 36 | 37 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_7fe0 -------------------------------------------------------------------------------- /src/odil/registry_fffa.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_fffa( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0xfffa, 0xfffa), ElementsDictionaryEntry("Digital Signatures Sequence", "DigitalSignaturesSequence", "SQ", "1")); 28 | 29 | public_tags.emplace("DigitalSignaturesSequence", Tag(0xfffa, 0xfffa)); 30 | } 31 | 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/odil/registry_fffa.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_fffa 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_fffa 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const DigitalSignaturesSequence(0xfffa, 0xfffa); 24 | 25 | } 26 | 27 | } 28 | 29 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_fffa -------------------------------------------------------------------------------- /src/odil/registry_fffc.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_fffc( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0xfffc, 0xfffc), ElementsDictionaryEntry("Data Set Trailing Padding", "DataSetTrailingPadding", "OB", "1")); 28 | 29 | public_tags.emplace("DataSetTrailingPadding", Tag(0xfffc, 0xfffc)); 30 | } 31 | 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/odil/registry_fffc.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_fffc 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_fffc 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const DataSetTrailingPadding(0xfffc, 0xfffc); 24 | 25 | } 26 | 27 | } 28 | 29 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_fffc -------------------------------------------------------------------------------- /src/odil/registry_fffe.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "odil/ElementsDictionary.h" 14 | #include "odil/Tag.h" 15 | 16 | namespace odil 17 | { 18 | 19 | namespace registry 20 | { 21 | 22 | void update_fffe( 23 | ElementsDictionary & public_dictionary, 24 | std::map & public_tags) 25 | { 26 | 27 | public_dictionary.emplace(Tag(0xfffe, 0xe000), ElementsDictionaryEntry("Item", "Item", "See Note", "1")); 28 | public_dictionary.emplace(Tag(0xfffe, 0xe00d), ElementsDictionaryEntry("Item Delimitation Item", "ItemDelimitationItem", "See Note", "1")); 29 | public_dictionary.emplace(Tag(0xfffe, 0xe0dd), ElementsDictionaryEntry("Sequence Delimitation Item", "SequenceDelimitationItem", "See Note", "1")); 30 | 31 | public_tags.emplace("Item", Tag(0xfffe, 0xe000)); 32 | public_tags.emplace("ItemDelimitationItem", Tag(0xfffe, 0xe00d)); 33 | public_tags.emplace("SequenceDelimitationItem", Tag(0xfffe, 0xe0dd)); 34 | } 35 | 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /src/odil/registry_fffe.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_fffe 10 | #define _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_fffe 11 | 12 | #include 13 | #include 14 | 15 | #include "odil/odil.h" 16 | #include "odil/Tag.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace registry 22 | { 23 | Tag const Item(0xfffe, 0xe000); 24 | Tag const ItemDelimitationItem(0xfffe, 0xe00d); 25 | Tag const SequenceDelimitationItem(0xfffe, 0xe0dd); 26 | 27 | } 28 | 29 | } 30 | 31 | #endif // _afc7b2d7_0869_4fea_9a9b_7fe6228baca9_fffe -------------------------------------------------------------------------------- /src/odil/uid.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include "odil/uid.h" 10 | 11 | #include 12 | #include 13 | 14 | #include "odil/Exception.h" 15 | 16 | #define ODIL_STRINGIFY_HELPER(s) #s 17 | #define ODIL_STRINGIFY(s) ODIL_STRINGIFY_HELPER(s) 18 | 19 | namespace odil 20 | { 21 | 22 | #ifdef ODIL_VERSION_MAJOR 23 | std::string implementation_class_uid=uid_prefix+"0." ODIL_STRINGIFY(ODIL_VERSION_MAJOR); 24 | std::string implementation_version_name="Odil " ODIL_STRINGIFY(ODIL_VERSION_MAJOR); 25 | #else 26 | #error ODIL_VERSION_MAJOR must be defined 27 | #endif 28 | 29 | std::string generate_uid() 30 | { 31 | static std::random_device generator; 32 | std::uniform_int_distribution<> non_zero(1, 9); 33 | std::uniform_int_distribution<> digits(0, 9); 34 | 35 | std::string result = uid_prefix + "." + std::to_string(non_zero(generator)); 36 | while(result.size()<64) 37 | { 38 | result += std::to_string(digits(generator)); 39 | } 40 | return result; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/odil/uid.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _d8ae0008_075b_4a28_a241_1c6fb1a6c79b 10 | #define _d8ae0008_075b_4a28_a241_1c6fb1a6c79b 11 | 12 | #include 13 | 14 | #include "odil/odil.h" 15 | 16 | namespace odil 17 | { 18 | 19 | /// @brief UID prefix of Odil. 20 | std::string const uid_prefix="1.2.826.0.1.3680043.9.5560"; 21 | 22 | /// @brief Implementation class UID of Odil. 23 | extern ODIL_API std::string implementation_class_uid; 24 | 25 | /// @brief Implementation version name of Odil. 26 | extern ODIL_API std::string implementation_version_name; 27 | 28 | /// @brief Generate a UID under the UID prefix. 29 | std::string ODIL_API generate_uid(); 30 | 31 | } 32 | 33 | #endif // _d8ae0008_075b_4a28_a241_1c6fb1a6c79b 34 | -------------------------------------------------------------------------------- /src/odil/unicode.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _4a178325_e3d6_4f6f_9a18_ba6a983ee396 10 | #define _4a178325_e3d6_4f6f_9a18_ba6a983ee396 11 | 12 | #include 13 | 14 | #include "odil/odil.h" 15 | #include "odil/Value.h" 16 | 17 | namespace odil 18 | { 19 | 20 | /// @brief Convert a string to its UTF-8 representation 21 | ODIL_API std::string as_utf8( 22 | std::string const & input, Value::Strings const & specific_character_set, 23 | bool is_pn=false); 24 | 25 | /// @brief Convert an UTF-8 string to a specific representation 26 | ODIL_API std::string as_specific_character_set( 27 | std::string const & input, Value::Strings const & specific_character_set, 28 | bool is_pn=false); 29 | 30 | } 31 | 32 | #endif // _4a178325_e3d6_4f6f_9a18_ba6a983ee396 33 | -------------------------------------------------------------------------------- /src/odil/webservices/BulkData.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _a63ad009_f45b_4e22_b750_ad1b12ba7f13 10 | #define _a63ad009_f45b_4e22_b750_ad1b12ba7f13 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace odil 17 | { 18 | 19 | namespace webservices 20 | { 21 | 22 | /// @brief Bulk data transmitted by web services (WADO-RS, STOW, etc.) 23 | struct BulkData 24 | { 25 | std::vector data; 26 | std::string type; 27 | std::string location; 28 | }; 29 | 30 | } 31 | 32 | } 33 | 34 | #endif // _a63ad009_f45b_4e22_b750_ad1b12ba7f13 35 | -------------------------------------------------------------------------------- /src/odil/webservices/URL.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _37346dec_0ab4_46d2_a54f_e349e79cd27d 10 | #define _37346dec_0ab4_46d2_a54f_e349e79cd27d 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include "odil/odil.h" 17 | 18 | namespace odil 19 | { 20 | 21 | namespace webservices 22 | { 23 | 24 | /// @brief Uniform resource locator 25 | struct ODIL_API URL 26 | { 27 | std::string scheme; 28 | std::string authority; 29 | std::string path; 30 | std::string query; 31 | std::string fragment; 32 | 33 | bool operator==(URL const & other) const; 34 | bool operator!=(URL const & other) const; 35 | 36 | /// @brief Recompose the components. 37 | operator std::string() const; 38 | 39 | /// @brief Parse attribute-value pairs in query string 40 | std::vector> 41 | parse_query(std::string const & separator="&") const; 42 | 43 | /// @brief Parse an URL into its five components. 44 | static URL parse(std::string const & string); 45 | }; 46 | 47 | } 48 | 49 | } 50 | 51 | #endif // _37346dec_0ab4_46d2_a54f_e349e79cd27d 52 | -------------------------------------------------------------------------------- /src/odil/webservices/Utils.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _6df14dad_16fc_486d_b7e0_728127e7c579 10 | #define _6df14dad_16fc_486d_b7e0_728127e7c579 11 | 12 | namespace odil 13 | { 14 | 15 | namespace webservices 16 | { 17 | 18 | /** 19 | * @brief Type of the request or response (use for WADO & QIDO). 20 | * 21 | * DICOM means DICOM data, either in binary, XML or JSON format; bulk data 22 | * is large (application-defined) data in binary format; pixel data is 23 | * the pixel data stored in instances or frames, either in uncompressed or 24 | * compressed format. 25 | */ 26 | enum class Type 27 | { 28 | None, 29 | DICOM, 30 | BulkData, 31 | PixelData, 32 | }; 33 | 34 | /// @brief Data representation for DICOM requests and responses. 35 | enum class Representation 36 | { 37 | DICOM, 38 | DICOM_XML, 39 | DICOM_JSON, 40 | }; 41 | 42 | 43 | } 44 | 45 | } 46 | 47 | #endif // _6df14dad_16fc_486d_b7e0_728127e7c579 48 | 49 | -------------------------------------------------------------------------------- /src/odil/write_ds.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _1fe89041_9f3b_4536_a55a_81f045984a62 10 | #define _1fe89041_9f3b_4536_a55a_81f045984a62 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "odil/odil.h" 18 | 19 | namespace odil 20 | { 21 | 22 | /// @brief Write a double as a DS to the buffer. 23 | ODIL_API void write_ds(double f, char * buffer, int size=16); 24 | 25 | } 26 | 27 | #endif // _1fe89041_9f3b_4536_a55a_81f045984a62 28 | -------------------------------------------------------------------------------- /src/odil/xml_converter.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #ifndef _61eb6ed2_447a_43b5_a6ba_ca7c2a5fb492 10 | #define _61eb6ed2_447a_43b5_a6ba_ca7c2a5fb492 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #include "odil/DataSet.h" 18 | 19 | #include "odil/odil.h" 20 | 21 | namespace odil 22 | { 23 | 24 | typedef 25 | std::function< 26 | std::pair( 27 | std::shared_ptr, Tag const &) 28 | > 29 | BulkDataCreator; 30 | 31 | /// @brief Convert a data set to its XML representation. 32 | ODIL_API boost::property_tree::ptree as_xml( 33 | std::shared_ptr data_set, 34 | BulkDataCreator const & bulk_data_creator={}); 35 | 36 | /// @brief Create a data set from its XML representation. 37 | ODIL_API std::shared_ptr as_dataset(boost::property_tree::ptree const & xml); 38 | 39 | } // namespace odil 40 | 41 | #endif // _61eb6ed2_447a_43b5_a6ba_ca7c2a5fb492 42 | -------------------------------------------------------------------------------- /tests/code/AssociationAcceptor.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE AssociationAcceptor 2 | #include 3 | 4 | #include "odil/AssociationAcceptor.h" 5 | 6 | BOOST_AUTO_TEST_CASE(AssociationRejected) 7 | { 8 | odil::AssociationRejected const exception(1, 2, 3, "foo"); 9 | BOOST_REQUIRE_EQUAL(exception.get_result(), 1); 10 | BOOST_REQUIRE_EQUAL(exception.get_source(), 2); 11 | BOOST_REQUIRE_EQUAL(exception.get_reason(), 3); 12 | BOOST_REQUIRE_EQUAL(exception.what(), "foo"); 13 | } 14 | -------------------------------------------------------------------------------- /tests/code/DcmtkException.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE DcmtkException 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "odil/dcmtk/Exception.h" 8 | 9 | BOOST_AUTO_TEST_CASE(StringConstructor) 10 | { 11 | odil::dcmtk::Exception const exception("foo"); 12 | BOOST_REQUIRE( 13 | exception.get_source() == odil::dcmtk::Exception::Source::Message); 14 | BOOST_REQUIRE_EQUAL(exception.what(), "foo"); 15 | BOOST_REQUIRE_THROW(exception.get_condition(), odil::dcmtk::Exception); 16 | } 17 | 18 | BOOST_AUTO_TEST_CASE(ConditionConstructor) 19 | { 20 | odil::dcmtk::Exception const exception(EC_IllegalParameter); 21 | BOOST_REQUIRE( 22 | exception.get_source() == odil::dcmtk::Exception::Source::Condition); 23 | BOOST_REQUIRE_EQUAL( 24 | exception.what(), OFCondition(EC_IllegalParameter).text()); 25 | BOOST_REQUIRE(exception.get_condition() == EC_IllegalParameter); 26 | } 27 | -------------------------------------------------------------------------------- /tests/code/EchoSCU.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE EchoSCU 2 | #include 3 | 4 | #include "odil/EchoSCU.h" 5 | #include "odil/registry.h" 6 | 7 | #include "../PeerFixtureBase.h" 8 | 9 | struct Fixture: public PeerFixtureBase 10 | { 11 | Fixture() 12 | : PeerFixtureBase({ 13 | { 14 | 1, odil::registry::Verification, 15 | {odil::registry::ImplicitVRLittleEndian}, 16 | odil::AssociationParameters::PresentationContext::Role::SCU 17 | } 18 | }) 19 | { 20 | // Nothing else 21 | } 22 | }; 23 | 24 | BOOST_FIXTURE_TEST_CASE(Echo, Fixture) 25 | { 26 | odil::EchoSCU scu(this->association); 27 | scu.echo(); 28 | } 29 | -------------------------------------------------------------------------------- /tests/code/Exception.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE Exception 2 | #include 3 | 4 | #include "odil/Exception.h" 5 | 6 | BOOST_AUTO_TEST_CASE(Exception) 7 | { 8 | odil::Exception const exception("foo"); 9 | BOOST_REQUIRE_EQUAL(exception.what(), "foo"); 10 | } 11 | -------------------------------------------------------------------------------- /tests/code/SCU.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE SCU 2 | #include 3 | 4 | #include "odil/SCU.h" 5 | #include "odil/registry.h" 6 | 7 | #include "../PeerFixtureBase.h" 8 | 9 | struct Fixture: public PeerFixtureBase 10 | { 11 | Fixture() 12 | : PeerFixtureBase({ 13 | { 14 | 1, odil::registry::Verification, 15 | {odil::registry::ImplicitVRLittleEndian}, 16 | odil::AssociationParameters::PresentationContext::Role::SCU 17 | } 18 | }) 19 | { 20 | // Nothing else 21 | } 22 | }; 23 | 24 | BOOST_FIXTURE_TEST_CASE(DefaultConstructor, Fixture) 25 | { 26 | odil::SCU const scu(this->association); 27 | BOOST_CHECK_EQUAL(scu.get_affected_sop_class(), ""); 28 | } 29 | 30 | BOOST_FIXTURE_TEST_CASE(AffectedSOPClassUID, Fixture) 31 | { 32 | odil::SCU scu(this->association); 33 | scu.set_affected_sop_class("1.2.3"); 34 | BOOST_CHECK_EQUAL(scu.get_affected_sop_class(), "1.2.3"); 35 | } 36 | -------------------------------------------------------------------------------- /tests/code/VR.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE VR 2 | #include 3 | 4 | #include "odil/Exception.h" 5 | #include "odil/VR.h" 6 | 7 | BOOST_AUTO_TEST_CASE(as_string) 8 | { 9 | odil::VR const vr(odil::VR::AT); 10 | std::string const string = odil::as_string(vr); 11 | BOOST_CHECK_EQUAL(string, "AT"); 12 | } 13 | 14 | BOOST_AUTO_TEST_CASE(as_string_invalid) 15 | { 16 | odil::VR const vr(odil::VR::INVALID); 17 | BOOST_CHECK_THROW(odil::as_string(vr), odil::Exception); 18 | } 19 | 20 | BOOST_AUTO_TEST_CASE(as_vr) 21 | { 22 | std::string const string("AT"); 23 | odil::VR const vr = odil::as_vr(string); 24 | BOOST_CHECK(vr == odil::VR::AT); 25 | } 26 | 27 | BOOST_AUTO_TEST_CASE(as_vr_wrong) 28 | { 29 | std::string const string("XX"); 30 | BOOST_CHECK_THROW(odil::as_vr(string), odil::Exception); 31 | } 32 | -------------------------------------------------------------------------------- /tests/code/dul/StateMachine.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE StateMachine 2 | #include 3 | 4 | #include "odil/Exception.h" 5 | #include "odil/dul/EventData.h" 6 | #include "odil/dul/StateMachine.h" 7 | 8 | BOOST_AUTO_TEST_CASE(Constructor) 9 | { 10 | odil::dul::StateMachine state_machine; 11 | BOOST_REQUIRE( 12 | state_machine.get_state() == odil::dul::StateMachine::State::Sta1); 13 | } 14 | 15 | BOOST_AUTO_TEST_CASE(WrongTransition) 16 | { 17 | odil::dul::StateMachine state_machine; 18 | odil::dul::EventData data; 19 | BOOST_REQUIRE_THROW( 20 | state_machine.transition(odil::dul::StateMachine::Event::None, data), 21 | odil::Exception); 22 | } 23 | -------------------------------------------------------------------------------- /tests/code/dul/Transport.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE Transport 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "odil/Exception.h" 8 | #include "odil/dul/Transport.h" 9 | 10 | BOOST_AUTO_TEST_CASE(Constructor) 11 | { 12 | odil::dul::Transport transport; 13 | BOOST_REQUIRE(!transport.is_open()); 14 | } 15 | 16 | BOOST_AUTO_TEST_CASE(Connect) 17 | { 18 | odil::dul::Transport transport; 19 | 20 | boost::asio::ip::tcp::resolver resolver(transport.get_service()); 21 | boost::asio::ip::tcp::resolver::query const query( 22 | odil::dul::Transport::Socket::protocol_type::v4(), 23 | "www.example.com", "80"); 24 | auto const endpoint_it = resolver.resolve(query); 25 | 26 | transport.connect(*endpoint_it); 27 | BOOST_REQUIRE(transport.is_open()); 28 | 29 | transport.write("HEAD / HTTP/1.1\r\nHost: www.example.com\r\n\r\n"); 30 | 31 | auto const response = transport.read(128); 32 | BOOST_REQUIRE(!response.empty()); 33 | 34 | transport.close(); 35 | BOOST_REQUIRE(!transport.is_open()); 36 | } 37 | 38 | BOOST_AUTO_TEST_CASE(NotConnected) 39 | { 40 | odil::dul::Transport transport; 41 | 42 | BOOST_REQUIRE_THROW(transport.write("..."), odil::Exception); 43 | BOOST_REQUIRE_THROW(transport.read(1), odil::Exception); 44 | } 45 | -------------------------------------------------------------------------------- /tests/code/message/Cancellation.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE Cancellation 2 | #include 3 | 4 | #include "odil/DataSet.h" 5 | #include "odil/message/Cancellation.h" 6 | 7 | #include "../../MessageFixtureBase.h" 8 | 9 | struct Fixture: public MessageFixtureBase 10 | { 11 | std::shared_ptr command_set; 12 | 13 | Fixture() 14 | : command_set(std::make_shared()) 15 | { 16 | this->command_set->add( 17 | "CommandField", {odil::message::Message::Command::C_CANCEL_RQ}); 18 | this->command_set->add("MessageIDBeingRespondedTo", {1234}); 19 | } 20 | 21 | void check(odil::message::Cancellation const & message) 22 | { 23 | BOOST_CHECK_EQUAL( 24 | message.get_command_field(), 25 | odil::message::Message::Command::C_CANCEL_RQ); 26 | BOOST_CHECK_EQUAL(message.get_message_id_being_responded_to(), 1234); 27 | } 28 | }; 29 | 30 | BOOST_FIXTURE_TEST_CASE(Constructor, Fixture) 31 | { 32 | odil::message::Cancellation const message(1234); 33 | this->check(message); 34 | } 35 | 36 | BOOST_FIXTURE_TEST_CASE(MessageConstructor, Fixture) 37 | { 38 | this->check_message_constructor(this->command_set); 39 | } 40 | 41 | BOOST_FIXTURE_TEST_CASE(MessageConstructorWrongCommandField, Fixture) 42 | { 43 | this->command_set->as_int("CommandField") = { 44 | odil::message::Message::Command::C_ECHO_RQ}; 45 | this->check_message_constructor_throw(this->command_set); 46 | } 47 | -------------------------------------------------------------------------------- /tests/code/message/Request.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE Request 2 | #include 3 | 4 | #include "odil/DataSet.h" 5 | #include "odil/message/Message.h" 6 | #include "odil/message/Request.h" 7 | 8 | BOOST_AUTO_TEST_CASE(Constructor) 9 | { 10 | odil::message::Request const message(1234); 11 | 12 | BOOST_CHECK_EQUAL(message.get_message_id(), 1234); 13 | } 14 | 15 | BOOST_AUTO_TEST_CASE(MessageConstructor) 16 | { 17 | auto const command_set = std::make_shared(); 18 | command_set->add("MessageID", {1234}); 19 | auto generic_message = std::make_shared( 20 | command_set); 21 | 22 | odil::message::Request const message(generic_message); 23 | 24 | BOOST_CHECK_EQUAL(message.get_message_id(), 1234); 25 | BOOST_CHECK(!message.has_data_set()); 26 | } 27 | -------------------------------------------------------------------------------- /tests/code/pdu/AAbort.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE pdu::AAbort 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "odil/pdu/AAbort.h" 8 | #include "odil/Exception.h" 9 | 10 | std::string const data = { 11 | 0x07, 0x00, 12 | 0x00, 0x00, 0x00, 0x04, 13 | 0x00, 0x00, 14 | 0x01, 0x02 15 | }; 16 | 17 | BOOST_AUTO_TEST_CASE(ConstructorFields) 18 | { 19 | odil::pdu::AAbort const pdu(1, 2); 20 | BOOST_REQUIRE_EQUAL(pdu.get_source(), 1); 21 | BOOST_REQUIRE_EQUAL(pdu.get_reason(), 2); 22 | } 23 | 24 | BOOST_AUTO_TEST_CASE(ConstructorStream) 25 | { 26 | std::istringstream stream(data); 27 | odil::pdu::AAbort const pdu(stream); 28 | BOOST_REQUIRE_EQUAL(pdu.get_source(), 1); 29 | BOOST_REQUIRE_EQUAL(pdu.get_reason(), 2); 30 | } 31 | 32 | BOOST_AUTO_TEST_CASE(Write) 33 | { 34 | odil::pdu::AAbort const pdu(1, 2); 35 | std::ostringstream stream; 36 | stream << pdu; 37 | 38 | BOOST_REQUIRE(stream.str() == data); 39 | } 40 | 41 | BOOST_AUTO_TEST_CASE(WrongSource) 42 | { 43 | odil::pdu::AAbort pdu(1, 2); 44 | BOOST_REQUIRE_THROW(pdu.set_source(3), odil::Exception); 45 | } 46 | 47 | BOOST_AUTO_TEST_CASE(WrongReason) 48 | { 49 | odil::pdu::AAbort pdu(1, 2); 50 | BOOST_REQUIRE_THROW(pdu.set_reason(9), odil::Exception); 51 | } 52 | -------------------------------------------------------------------------------- /tests/code/pdu/AReleaseRP.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE AReleaseRPPDU 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "odil/pdu/AReleaseRP.h" 8 | 9 | std::string const data = { 10 | 0x06, 0x00, 11 | 0x00, 0x00, 0x00, 0x04, 12 | 0x00, 0x00, 13 | 0x00, 0x00 14 | }; 15 | 16 | BOOST_AUTO_TEST_CASE(ConstructorFields) 17 | { 18 | odil::pdu::AReleaseRP const pdu; 19 | } 20 | 21 | BOOST_AUTO_TEST_CASE(ConstructorStream) 22 | { 23 | std::istringstream stream(data); 24 | odil::pdu::AReleaseRP const pdu(stream); 25 | } 26 | 27 | 28 | BOOST_AUTO_TEST_CASE(Write) 29 | { 30 | odil::pdu::AReleaseRP const pdu; 31 | std::ostringstream stream; 32 | stream << pdu; 33 | BOOST_REQUIRE(stream.str() == data); 34 | } 35 | -------------------------------------------------------------------------------- /tests/code/pdu/AReleaseRQ.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE AReleaseRPPDU 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "odil/pdu/AReleaseRQ.h" 8 | 9 | std::string const data = { 10 | 0x05, 0x00, 11 | 0x00, 0x00, 0x00, 0x04, 12 | 0x00, 0x00, 13 | 0x00, 0x00 14 | }; 15 | 16 | BOOST_AUTO_TEST_CASE(ConstructorFields) 17 | { 18 | odil::pdu::AReleaseRQ const pdu; 19 | } 20 | 21 | BOOST_AUTO_TEST_CASE(ConstructorStream) 22 | { 23 | std::istringstream stream(data); 24 | odil::pdu::AReleaseRQ const pdu(stream); 25 | } 26 | 27 | 28 | BOOST_AUTO_TEST_CASE(Write) 29 | { 30 | odil::pdu::AReleaseRQ const pdu; 31 | std::ostringstream stream; 32 | stream << pdu; 33 | BOOST_REQUIRE(stream.str() == data); 34 | } 35 | -------------------------------------------------------------------------------- /tests/code/pdu/ApplicationContext.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE ApplicationContext 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "odil/Exception.h" 8 | #include "odil/pdu/ApplicationContext.h" 9 | 10 | std::string const data( 11 | "\x10\x00\x00\x03" 12 | "foo", 13 | 7 14 | ); 15 | 16 | BOOST_AUTO_TEST_CASE(FromString) 17 | { 18 | odil::pdu::ApplicationContext const context("foo"); 19 | BOOST_REQUIRE_EQUAL(context.get_name(), "foo"); 20 | } 21 | 22 | BOOST_AUTO_TEST_CASE(FromStream) 23 | { 24 | std::istringstream stream(data); 25 | 26 | odil::pdu::ApplicationContext const context(stream); 27 | BOOST_REQUIRE_EQUAL(context.get_name(), "foo"); 28 | } 29 | 30 | BOOST_AUTO_TEST_CASE(Name) 31 | { 32 | odil::pdu::ApplicationContext context("foo"); 33 | context.set_name("other"); 34 | BOOST_REQUIRE_EQUAL(context.get_name(), "other"); 35 | } 36 | 37 | BOOST_AUTO_TEST_CASE(Write) 38 | { 39 | odil::pdu::ApplicationContext const context("foo"); 40 | std::ostringstream stream; 41 | stream << context; 42 | 43 | BOOST_REQUIRE_EQUAL(stream.str(), data); 44 | } 45 | -------------------------------------------------------------------------------- /tests/code/pdu/ImplementationClassUID.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE ImplementationClassUID 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "odil/pdu/ImplementationClassUID.h" 8 | 9 | std::string const data( 10 | "\x52\x00\x00\x03" 11 | "foo", 12 | 7 13 | ); 14 | 15 | BOOST_AUTO_TEST_CASE(Constructor) 16 | { 17 | odil::pdu::ImplementationClassUID const item("foo"); 18 | BOOST_REQUIRE_EQUAL(item.get_implementation_class_uid(), "foo"); 19 | } 20 | 21 | BOOST_AUTO_TEST_CASE(FromStream) 22 | { 23 | std::istringstream stream(data); 24 | odil::pdu::ImplementationClassUID const item(stream); 25 | 26 | BOOST_REQUIRE_EQUAL(item.get_implementation_class_uid(), "foo"); 27 | } 28 | 29 | BOOST_AUTO_TEST_CASE(ImplementationClassUID) 30 | { 31 | odil::pdu::ImplementationClassUID item("foo"); 32 | item.set_implementation_class_uid("bar"); 33 | BOOST_REQUIRE_EQUAL(item.get_implementation_class_uid(), "bar"); 34 | } 35 | 36 | BOOST_AUTO_TEST_CASE(Write) 37 | { 38 | odil::pdu::ImplementationClassUID const item("foo"); 39 | std::ostringstream stream; 40 | stream << item; 41 | 42 | BOOST_REQUIRE_EQUAL(stream.str(), data); 43 | } 44 | -------------------------------------------------------------------------------- /tests/code/pdu/MaximumLength.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE MaximumLength 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "odil/Exception.h" 8 | #include "odil/pdu/MaximumLength.h" 9 | 10 | BOOST_AUTO_TEST_CASE(ConstructorDefault) 11 | { 12 | odil::pdu::MaximumLength const maximum_length; 13 | BOOST_REQUIRE_EQUAL(maximum_length.get_maximum_length(), 0); 14 | } 15 | 16 | BOOST_AUTO_TEST_CASE(ConstructorInt) 17 | { 18 | odil::pdu::MaximumLength const maximum_length(123); 19 | BOOST_REQUIRE_EQUAL(maximum_length.get_maximum_length(), 123); 20 | } 21 | 22 | BOOST_AUTO_TEST_CASE(FromStream) 23 | { 24 | std::string const data( 25 | "\x51\x00\x00\x04" 26 | "\x12\x34\x56\x78", 27 | 8 28 | ); 29 | std::istringstream stream(data); 30 | 31 | odil::pdu::MaximumLength const maximum_length(stream); 32 | 33 | BOOST_REQUIRE_EQUAL(maximum_length.get_maximum_length(), 0x12345678); 34 | } 35 | 36 | BOOST_AUTO_TEST_CASE(MaximumLength) 37 | { 38 | odil::pdu::MaximumLength maximum_length; 39 | maximum_length.set_maximum_length(123); 40 | BOOST_REQUIRE_EQUAL(maximum_length.get_maximum_length(), 123); 41 | } 42 | 43 | BOOST_AUTO_TEST_CASE(Write) 44 | { 45 | odil::pdu::MaximumLength const maximum_length(0x12345678); 46 | std::ostringstream data; 47 | data << maximum_length; 48 | 49 | std::string const expected( 50 | "\x51\x00\x00\x04" 51 | "\x12\x34\x56\x78", 52 | 8 53 | ); 54 | 55 | BOOST_REQUIRE_EQUAL(data.str(), expected); 56 | } 57 | -------------------------------------------------------------------------------- /tests/code/pdu/UserIdentityAC.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE UserIdentityAC 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "odil/Exception.h" 8 | #include "odil/pdu/UserIdentityAC.h" 9 | 10 | BOOST_AUTO_TEST_CASE(ConstructorDefault) 11 | { 12 | odil::pdu::UserIdentityAC const user_identity; 13 | BOOST_REQUIRE_EQUAL(user_identity.get_server_response(), ""); 14 | } 15 | 16 | BOOST_AUTO_TEST_CASE(ConstructorString) 17 | { 18 | odil::pdu::UserIdentityAC const user_identity("foo"); 19 | BOOST_REQUIRE_EQUAL(user_identity.get_server_response(), "foo"); 20 | } 21 | 22 | BOOST_AUTO_TEST_CASE(FromStream) 23 | { 24 | std::string const data( 25 | "\x59\x00\x00\x05" 26 | "\x00\x03" "foo", 27 | 9 28 | ); 29 | std::istringstream stream(data); 30 | 31 | odil::pdu::UserIdentityAC const user_identity(stream); 32 | 33 | BOOST_REQUIRE_EQUAL(user_identity.get_server_response(), "foo"); 34 | } 35 | 36 | BOOST_AUTO_TEST_CASE(Type) 37 | { 38 | odil::pdu::UserIdentityAC user_identity; 39 | user_identity.set_server_response("foo"); 40 | BOOST_REQUIRE_EQUAL(user_identity.get_server_response(), "foo"); 41 | } 42 | 43 | BOOST_AUTO_TEST_CASE(Write) 44 | { 45 | odil::pdu::UserIdentityAC user_identity; 46 | user_identity.set_server_response("foo"); 47 | 48 | std::ostringstream data; 49 | data << user_identity; 50 | 51 | std::string const expected( 52 | "\x59\x00\x00\x05" 53 | "\x00\x03" "foo", 54 | 9 55 | ); 56 | 57 | BOOST_REQUIRE_EQUAL(data.str(), expected); 58 | } 59 | -------------------------------------------------------------------------------- /tests/code/uid.cpp: -------------------------------------------------------------------------------- 1 | #define BOOST_TEST_MODULE UID 2 | #include 3 | 4 | #include "odil/uid.h" 5 | 6 | BOOST_AUTO_TEST_CASE(generate) 7 | { 8 | std::string const uid = odil::generate_uid(); 9 | BOOST_REQUIRE_LE(uid.size(), 64); 10 | for(auto const & c: uid) 11 | { 12 | BOOST_REQUIRE((c>='0' && c<='9') || c == '.'); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/data/dataset.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamyj/odil/b4334128e2c693a25f0bd480540da1e79cb4e894/tests/data/dataset.dcm -------------------------------------------------------------------------------- /tests/data/dcmqrscp.config: -------------------------------------------------------------------------------- 1 | HostTable BEGIN 2 | remote = (REMOTE, 127.0.0.1, 11112) 3 | local = (LOCAL, 127.0.0.1, 11113) 4 | HostTable END 5 | 6 | AETable BEGIN 7 | REMOTE . RW (500, 1024mb) ANY 8 | AETable END 9 | -------------------------------------------------------------------------------- /tests/peer_fixture_base.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | 4 | import odil 5 | 6 | class PeerFixtureBase(unittest.TestCase): 7 | def setUp(self, contexts): 8 | self.association = odil.Association() 9 | self.association.set_peer_host(os.environ["ODIL_PEER_HOST_NAME"]) 10 | self.association.set_peer_port(int(os.environ["ODIL_PEER_PORT"])) 11 | self.association.update_parameters()\ 12 | .set_calling_ae_title(os.environ["ODIL_OWN_AET"])\ 13 | .set_called_ae_title(os.environ["ODIL_PEER_AET"]) \ 14 | .set_presentation_contexts(contexts) 15 | self.association.associate() 16 | 17 | def tearDown(self): 18 | self.association.release() 19 | -------------------------------------------------------------------------------- /tests/tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(DCMTK REQUIRED) 2 | find_package(ZLIB REQUIRED) 3 | 4 | file(GLOB headers *.h) 5 | file(GLOB files "*.cc") 6 | 7 | if(USE_BUILTIN_DCMTK_GETSCU) 8 | add_executable(dcmtk_getscu ${files} ${headers}) 9 | target_link_libraries(dcmtk_getscu DCMTK::DCMTK ZLIB::ZLIB) 10 | set_target_properties(dcmtk_getscu PROPERTIES OUTPUT_NAME getscu) 11 | endif() 12 | -------------------------------------------------------------------------------- /tests/wrappers/messages/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamyj/odil/b4334128e2c693a25f0bd480540da1e79cb4e894/tests/wrappers/messages/__init__.py -------------------------------------------------------------------------------- /tests/wrappers/messages/test_message.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import odil 4 | 5 | class TestMessage(unittest.TestCase): 6 | def test_commands(self): 7 | self.assertEqual(odil.messages.Message.Command.C_FIND_RSP, 0x8020) 8 | 9 | if __name__ == "__main__": 10 | unittest.main() 11 | -------------------------------------------------------------------------------- /tests/wrappers/test_echo_scu.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import unittest 4 | 5 | import odil 6 | 7 | sys.path.append(os.path.dirname(os.path.dirname(__file__))) 8 | from peer_fixture_base import PeerFixtureBase 9 | 10 | class TestEchoSCU(PeerFixtureBase): 11 | def setUp(self): 12 | PeerFixtureBase.setUp( 13 | self, 14 | [ 15 | odil.AssociationParameters.PresentationContext( 16 | 3, odil.registry.Verification, 17 | [ odil.registry.ImplicitVRLittleEndian ], 18 | odil.AssociationParameters.PresentationContext.Role.SCU) 19 | ] 20 | ) 21 | 22 | def test_echo(self): 23 | echo = odil.EchoSCU(self.association) 24 | echo.echo() 25 | 26 | if __name__ == "__main__": 27 | unittest.main() 28 | -------------------------------------------------------------------------------- /tests/wrappers/test_exception.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import odil 4 | 5 | class TestException(unittest.TestCase): 6 | def test_python_generic(self): 7 | with self.assertRaises(Exception): 8 | raise odil.Exception() 9 | 10 | def test_python_specific(self): 11 | with self.assertRaises(odil.Exception): 12 | raise odil.Exception() 13 | 14 | def test_cpp_generic(self): 15 | tag = odil.Tag(0xdead, 0xbeef) 16 | with self.assertRaises(Exception): 17 | tag.get_name() 18 | 19 | def test_cpp_specific(self): 20 | tag = odil.Tag(0xdead, 0xbeef) 21 | with self.assertRaises(odil.Exception): 22 | tag.get_name() 23 | 24 | if __name__ == "__main__": 25 | unittest.main() 26 | -------------------------------------------------------------------------------- /tests/wrappers/test_json_converter.py: -------------------------------------------------------------------------------- 1 | import re 2 | import unittest 3 | 4 | import odil 5 | 6 | class TestJSONConverter(unittest.TestCase): 7 | def setUp(self): 8 | self.data_set = odil.DataSet() 9 | self.data_set.add("PatientName", ["Foo^Bar"]) 10 | 11 | self.json = """{"00100010":{"Value":[{"Alphabetic":"Foo^Bar"}],"vr":"PN"}}""" 12 | 13 | def test_ugly_print(self): 14 | serialized = odil.as_json(self.data_set, False) 15 | self.assertEqual(re.sub(r"\s+", "", serialized), self.json) 16 | 17 | def test_pretty_print(self): 18 | serialized = odil.as_json(self.data_set, True) 19 | self.assertEqual(re.sub(r"\s+", "", serialized), self.json) 20 | 21 | def test_as_dataset(self): 22 | data_set = odil.from_json(self.json) 23 | self.assertTrue(data_set == self.data_set) 24 | 25 | if __name__ == "__main__": 26 | unittest.main() 27 | -------------------------------------------------------------------------------- /tests/wrappers/test_registry.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import odil 4 | 5 | class TestRegistry(unittest.TestCase): 6 | def test_attribute(self): 7 | tag = odil.registry.PatientID 8 | self.assertEqual(tag.group, 0x0010) 9 | self.assertEqual(tag.element, 0x0020) 10 | 11 | def test_public_dictionary_tag(self): 12 | tag = odil.registry.PatientID 13 | self.assertTrue(tag in odil.registry.public_dictionary) 14 | entry = odil.registry.public_dictionary[tag] 15 | self.assertEqual(entry.name, "Patient ID") 16 | self.assertEqual(entry.keyword, "PatientID") 17 | self.assertEqual(entry.vr, "LO") 18 | self.assertEqual(entry.vm, "1") 19 | 20 | def test_public_dictionary_string(self): 21 | string = "60xx0010" 22 | self.assertTrue(string in odil.registry.public_dictionary) 23 | entry = odil.registry.public_dictionary[string] 24 | self.assertEqual(entry.name, "Overlay Rows") 25 | self.assertEqual(entry.keyword, "OverlayRows") 26 | self.assertEqual(entry.vr, "US") 27 | self.assertEqual(entry.vm, "1") 28 | 29 | def test_uids_dictionary(self): 30 | uid = "1.2.840.10008.1.2.1" 31 | self.assertTrue(uid in odil.registry.uids_dictionary) 32 | entry = odil.registry.uids_dictionary[uid] 33 | self.assertEqual(entry.name, "Explicit VR Little Endian") 34 | self.assertEqual(entry.keyword, "ExplicitVRLittleEndian") 35 | self.assertEqual(entry.type, "Transfer Syntax") 36 | 37 | if __name__ == "__main__": 38 | unittest.main() 39 | -------------------------------------------------------------------------------- /tests/wrappers/test_uid.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import odil 4 | 5 | class TestUID(unittest.TestCase): 6 | def test_uid_prefix(self): 7 | self.assertEqual(odil.uid_prefix, "1.2.826.0.1.3680043.9.5560") 8 | 9 | def test_uid_prefix(self): 10 | uid = odil.generate_uid() 11 | self.assertEqual(uid[:len(odil.uid_prefix)], odil.uid_prefix) 12 | 13 | if __name__ == "__main__": 14 | unittest.main() 15 | -------------------------------------------------------------------------------- /tests/wrappers/test_uids_dictionary.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import odil 4 | 5 | class TestUIDsDictionaryEntry(unittest.TestCase): 6 | def test_constructor(self): 7 | entry = odil.UIDsDictionaryEntry( 8 | "MR Image Storage", "MRImageStorage", "SOP Class") 9 | self.assertEqual(entry.name, "MR Image Storage") 10 | self.assertEqual(entry.keyword, "MRImageStorage") 11 | self.assertEqual(entry.type, "SOP Class") 12 | 13 | class TestUIDsDictionary(unittest.TestCase): 14 | def test_get_item(self): 15 | entry = odil.registry.uids_dictionary["1.2.840.10008.5.1.4.1.1.4"] 16 | self.assertEqual(entry.name, "MR Image Storage") 17 | self.assertEqual(entry.keyword, "MRImageStorage") 18 | self.assertEqual(entry.type, "SOP Class") 19 | 20 | if __name__ == "__main__": 21 | unittest.main() 22 | -------------------------------------------------------------------------------- /tests/wrappers/test_vr.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | import unittest 3 | 4 | import odil 5 | 6 | class TestVR(unittest.TestCase): 7 | def test_bytes_constructor(self): 8 | vr = odil.VR(b"UT") 9 | self.assertEqual(vr, odil.VR.UT) 10 | 11 | def test_unicode_constructor(self): 12 | vr = odil.VR(u"UT") 13 | self.assertEqual(vr, odil.VR.UT) 14 | 15 | def test_invalid_bytes_constructor(self): 16 | with self.assertRaises(Exception): 17 | odil.VR(b"XX") 18 | 19 | def test_invalid_unicode_constructor(self): 20 | with self.assertRaises(Exception): 21 | odil.VR(u"XX") 22 | 23 | def test_string(self): 24 | vr = odil.VR.AE 25 | self.assertEqual(str(vr), "AE") 26 | 27 | def test_pickle(self): 28 | self.assertEqual(pickle.loads(pickle.dumps(odil.VR.AE)), odil.VR.AE) 29 | 30 | if __name__ == "__main__": 31 | unittest.main() 32 | -------------------------------------------------------------------------------- /tests/wrappers/test_vr_finder.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import odil 4 | 5 | class TestVRFinder(unittest.TestCase): 6 | def test_default_finder(self): 7 | finder = odil.VRFinder() 8 | data_set = odil.DataSet() 9 | data_set.add(odil.registry.BitsAllocated, [8]) 10 | vr = finder( 11 | odil.Tag(0x7fe0, 0x0010), data_set, 12 | odil.registry.ExplicitVRLittleEndian) 13 | self.assertEqual(vr, odil.VR.OB) 14 | 15 | if __name__ == "__main__": 16 | unittest.main() 17 | -------------------------------------------------------------------------------- /tests/wrappers/test_xml_converter.py: -------------------------------------------------------------------------------- 1 | import re 2 | import unittest 3 | 4 | import odil 5 | 6 | class TestXMLConverter(unittest.TestCase): 7 | def setUp(self): 8 | self.data_set = odil.DataSet() 9 | self.data_set.add("PatientName", ["Foo^Bar"]) 10 | 11 | self.xml = ( 12 | """""" 13 | "" 14 | """""" 15 | """""" 16 | "" 17 | "Foo" 18 | "Bar" 19 | "" 20 | "" 21 | "" 22 | "" 23 | ) 24 | 25 | def test_ugly_print(self): 26 | serialized = odil.as_xml(self.data_set, False) 27 | self.assertEqual(re.sub(r"\n+", "", serialized), self.xml) 28 | 29 | def test_pretty_print(self): 30 | serialized = odil.as_xml(self.data_set, True) 31 | serialized = re.sub(r"\n\s+", "\n", serialized, re.M) 32 | serialized = re.sub(r"\n", "", serialized) 33 | self.assertEqual(serialized, self.xml) 34 | 35 | def test_as_dataset(self): 36 | data_set = odil.from_xml(self.xml) 37 | self.assertTrue(data_set == self.data_set) 38 | 39 | if __name__ == "__main__": 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/wrappers/webservices/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lamyj/odil/b4334128e2c693a25f0bd480540da1e79cb4e894/tests/wrappers/webservices/__init__.py -------------------------------------------------------------------------------- /tests/wrappers/webservices/test_url.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import odil 4 | 5 | class TestURL(unittest.TestCase): 6 | def test_parse(self): 7 | url = odil.webservices.URL.parse("http://foo.com/bar?plip=plop#here") 8 | self.assertEqual(url.scheme, "http") 9 | self.assertEqual(url.authority, "foo.com") 10 | self.assertEqual(url.path, "/bar") 11 | self.assertEqual(url.query, "plip=plop") 12 | self.assertEqual(url.fragment, "here") 13 | 14 | def test_default_arguments(self): 15 | url = odil.webservices.URL("http", "foo.com", "/bar", fragment="here") 16 | self.assertEqual(url.scheme, "http") 17 | self.assertEqual(url.authority, "foo.com") 18 | self.assertEqual(url.path, "/bar") 19 | self.assertEqual(url.query, "") 20 | self.assertEqual(url.fragment, "here") 21 | 22 | def test_serialize(self): 23 | url = odil.webservices.URL("http", "foo.com", "/bar", "plip=plop", "here") 24 | self.assertEqual(str(url), "http://foo.com/bar?plip=plop#here") 25 | 26 | if __name__ == "__main__": 27 | unittest.main() 28 | -------------------------------------------------------------------------------- /wrappers/js/Tag.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/Tag.h" 12 | 13 | void wrap_Tag() 14 | { 15 | using namespace emscripten; 16 | using namespace odil; 17 | 18 | class_("Tag") 19 | .constructor() 20 | .property("group", &Tag::group) 21 | .property("element", &Tag::element) 22 | .function("is_private", &Tag::is_private) 23 | .function("get_name", &Tag::get_name) 24 | .function("equal", &Tag::operator==) 25 | .function("notEqual", &Tag::operator!=) 26 | .function("less", &Tag::operator<) 27 | .function("greater", &Tag::operator>) 28 | .function("lessEqual", &Tag::operator<=) 29 | .function("greaterEqual", &Tag::operator>=) 30 | .function("toString", &Tag::operator std::string) 31 | ; 32 | } 33 | -------------------------------------------------------------------------------- /wrappers/js/webservices/HTTPRequest.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | #include "odil/webservices/HTTPRequest.h" 13 | #include "odil/webservices/Message.h" 14 | 15 | void wrap_webservices_HTTPRequest() 16 | { 17 | using namespace emscripten; 18 | using namespace odil::webservices; 19 | 20 | class_>("webservices_HTTPRequest") 21 | .constructor< 22 | std::string, URL, std::string, std::map, 23 | std::string>() 24 | .function("get_method", &HTTPRequest::get_method) 25 | .function("set_method", &HTTPRequest::set_method) 26 | .function("get_target", &HTTPRequest::get_target) 27 | .function("set_target", &HTTPRequest::set_target) 28 | .function("get_http_version", &HTTPRequest::get_http_version) 29 | .function("set_http_version", &HTTPRequest::set_http_version) 30 | ; 31 | 32 | EM_ASM( 33 | Module['webservices']['HTTPRequest'] = 34 | Module['webservices_HTTPRequest']; 35 | delete Module['webservices_HTTPRequest']; 36 | ); 37 | } 38 | -------------------------------------------------------------------------------- /wrappers/js/webservices/HTTPResponse.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | #include "odil/webservices/HTTPResponse.h" 13 | #include "odil/webservices/Message.h" 14 | 15 | void wrap_webservices_HTTPResponse() 16 | { 17 | using namespace emscripten; 18 | using namespace odil::webservices; 19 | 20 | class_>("webservices_HTTPResponse") 21 | .constructor< 22 | std::string, int, std::string, std::map, 23 | std::string>() 24 | .function("get_http_version", &HTTPResponse::get_http_version) 25 | .function("set_http_version", &HTTPResponse::set_http_version) 26 | .function("get_status", &HTTPResponse::get_status) 27 | .function("set_status", &HTTPResponse::set_status) 28 | .function("get_reason", &HTTPResponse::get_reason) 29 | .function("set_reason", &HTTPResponse::set_reason) 30 | ; 31 | 32 | EM_ASM( 33 | Module['webservices']['HTTPResponse'] = 34 | Module['webservices_HTTPResponse']; 35 | delete Module['webservices_HTTPResponse']; 36 | ); 37 | } 38 | -------------------------------------------------------------------------------- /wrappers/js/webservices/Message.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | #include "odil/webservices/Message.h" 13 | 14 | void wrap_webservices_Message() 15 | { 16 | using namespace emscripten; 17 | using namespace odil::webservices; 18 | 19 | class_("webservices_Message") 20 | .constructor, std::string>() 21 | .function("get_headers", &Message::get_headers) 22 | .function("set_headers", &Message::set_headers) 23 | .function("has_header", &Message::has_header) 24 | .function("get_header", &Message::get_header) 25 | .function("set_header", &Message::set_header) 26 | .function("get_body", &Message::get_body) 27 | .function("set_body", &Message::set_body) 28 | ; 29 | 30 | EM_ASM( 31 | Module['webservices']['Message'] = Module['webservices_Message']; 32 | delete Module['webservices_Message']; 33 | ); 34 | } 35 | -------------------------------------------------------------------------------- /wrappers/js/webservices/URL.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | #include "odil/webservices/URL.h" 13 | 14 | void wrap_webservices_URL() 15 | { 16 | using namespace emscripten; 17 | using namespace odil::webservices; 18 | 19 | class_("webservices_URL") 20 | .constructor<>() 21 | .property("scheme", &URL::scheme) 22 | .property("authority", &URL::authority) 23 | .property("path", &URL::path) 24 | .property("query", &URL::query) 25 | .property("fragment", &URL::fragment) 26 | .function("equal", &URL::operator==) 27 | .function("notEqual", &URL::operator!=) 28 | .function("toString", &URL::operator std::string) 29 | .class_function("parse", &URL::parse) 30 | ; 31 | 32 | EM_ASM( 33 | Module['webservices']['URL'] = Module['webservices_URL']; 34 | delete Module['webservices_URL']; 35 | ); 36 | } 37 | -------------------------------------------------------------------------------- /wrappers/js/webservices/Utils.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | #include "odil/webservices/Utils.h" 13 | 14 | void wrap_webservices_Utils() 15 | { 16 | using namespace emscripten; 17 | using namespace odil::webservices; 18 | 19 | enum_("webservices_Utils_Type") 20 | .value("None", Type::None) 21 | .value("DICOM", Type::DICOM) 22 | .value("BulkData", Type::BulkData) 23 | .value("PixelData", Type::PixelData) 24 | ; 25 | 26 | enum_("webservices_Utils_Representation") 27 | .value("DICOM", Representation::DICOM) 28 | .value("DICOM_XML", Representation::DICOM_XML) 29 | .value("DICOM_JSON", Representation::DICOM_JSON) 30 | ; 31 | 32 | EM_ASM( 33 | Module['webservices']['Utils'] = {}; 34 | 35 | Module['webservices']['Utils']['Type'] = 36 | Module['webservices_Utils_Type']; 37 | delete Module['webservices_Utils_Type']; 38 | 39 | Module['webservices']['Utils']['Representation'] = 40 | Module['webservices_Utils_Representation']; 41 | delete Module['webservices_Utils_Representation']; 42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /wrappers/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_package(JsonCpp REQUIRED) 2 | find_package(Python COMPONENTS Interpreter Development REQUIRED) 3 | find_package(pybind11 REQUIRED) 4 | 5 | file(GLOB_RECURSE Header_Files "*.h") 6 | file(GLOB_RECURSE Source_Files "*.cpp") 7 | set(Python_Files "__init__.py") 8 | 9 | list(SORT Header_Files) 10 | list(SORT Source_Files) 11 | list(SORT Python_Files) 12 | 13 | pybind11_add_module(pyodil ${Source_Files} ${Header_Files}) 14 | 15 | target_compile_definitions( 16 | pyodil PRIVATE $<$:BOOST_ALL_DYN_LINK>) 17 | 18 | target_include_directories( 19 | pyodil 20 | PRIVATE $ ${PYTHON_INCLUDE_DIRS}) 21 | 22 | target_link_libraries(pyodil PRIVATE JsonCpp::JsonCpp libodil) 23 | 24 | set_target_properties( 25 | pyodil PROPERTIES 26 | OUTPUT_NAME _odil 27 | FOLDER "Wrappers" 28 | $<$:SUFFIX .so>) 29 | 30 | execute_process( 31 | COMMAND ${Python_EXECUTABLE} 32 | -c "import os; import sysconfig; \ 33 | scheme = {'posix': 'posix_prefix', 'nt': 'nt'}[os.name]; \ 34 | path = sysconfig.get_path('purelib', scheme, {'base': '.'}); \ 35 | print(path.replace(os.path.sep, '/'))" 36 | OUTPUT_VARIABLE PYTHON_SITE_PACKAGES 37 | OUTPUT_STRIP_TRAILING_WHITESPACE) 38 | 39 | install(TARGETS pyodil DESTINATION "${PYTHON_SITE_PACKAGES}/odil") 40 | install(FILES ${Python_Files} DESTINATION "${PYTHON_SITE_PACKAGES}/odil") 41 | 42 | if(WIN32) 43 | install(TARGETS libodil RUNTIME DESTINATION "${PYTHON_SITE_PACKAGES}/odil") 44 | endif() 45 | -------------------------------------------------------------------------------- /wrappers/python/EchoSCP.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | #include "odil/EchoSCP.h" 13 | 14 | #include "opaque_types.h" 15 | #include "type_casters.h" 16 | 17 | namespace 18 | { 19 | 20 | void 21 | set_callback(odil::EchoSCP& scp, pybind11::object const& f) 22 | { 23 | scp.set_callback( 24 | [f](std::shared_ptr message) 25 | { 26 | return f(message).cast(); 27 | }); 28 | } 29 | 30 | } 31 | 32 | void wrap_EchoSCP(pybind11::module & m) 33 | { 34 | using namespace pybind11; 35 | using namespace odil; 36 | 37 | class_(m, "EchoSCP") 38 | .def(init()) 39 | .def("set_callback", &set_callback) 40 | .def( 41 | "__call__", 42 | static_cast< 43 | void (EchoSCP::*)(std::shared_ptr) 44 | >(&EchoSCP::operator())) 45 | ; 46 | } 47 | -------------------------------------------------------------------------------- /wrappers/python/EchoSCU.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/EchoSCU.h" 12 | 13 | #include "opaque_types.h" 14 | #include "type_casters.h" 15 | 16 | void wrap_EchoSCU(pybind11::module & m) 17 | { 18 | using namespace pybind11; 19 | using namespace odil; 20 | 21 | class_(m, "EchoSCU") 22 | .def(init()) 23 | .def( 24 | "get_affected_sop_class", 25 | &EchoSCU::get_affected_sop_class, 26 | return_value_policy::copy) 27 | .def("set_affected_sop_class", &EchoSCU::set_affected_sop_class) 28 | .def("echo", &EchoSCU::echo) 29 | ; 30 | } 31 | -------------------------------------------------------------------------------- /wrappers/python/Exception.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include "odil/Exception.h" 14 | 15 | #include "opaque_types.h" 16 | #include "type_casters.h" 17 | 18 | void wrap_Exception(pybind11::module & m) 19 | { 20 | pybind11::register_exception(m, "Exception"); 21 | } 22 | -------------------------------------------------------------------------------- /wrappers/python/FindSCU.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/FindSCU.h" 12 | 13 | #include "opaque_types.h" 14 | #include "type_casters.h" 15 | 16 | namespace 17 | { 18 | 19 | void 20 | find_with_python_callback( 21 | odil::FindSCU const & scu, 22 | std::shared_ptr query, pybind11::object const & f) 23 | { 24 | scu.find( 25 | query, 26 | [f](std::shared_ptr data_set) 27 | { 28 | f(data_set); 29 | } 30 | ); 31 | } 32 | 33 | } 34 | 35 | void wrap_FindSCU(pybind11::module & m) 36 | { 37 | using namespace pybind11; 38 | using namespace odil; 39 | 40 | class_(m, "FindSCU") 41 | .def(init()) 42 | .def( 43 | "find", 44 | &find_with_python_callback 45 | ) 46 | .def( 47 | "find", 48 | static_cast< 49 | Value::DataSets (FindSCU::*)(std::shared_ptr) const 50 | >(&FindSCU::find) 51 | ) 52 | .def("set_affected_sop_class", &FindSCU::set_affected_sop_class) 53 | ; 54 | } 55 | -------------------------------------------------------------------------------- /wrappers/python/NCreateSCP.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/NCreateSCP.h" 12 | 13 | #include "opaque_types.h" 14 | #include "type_casters.h" 15 | 16 | namespace 17 | { 18 | 19 | void 20 | set_callback(odil::NCreateSCP & scp, pybind11::object const & f) 21 | { 22 | scp.set_callback( 23 | [f](std::shared_ptr message) 24 | { 25 | return f(message).cast(); 26 | } 27 | ); 28 | } 29 | 30 | } 31 | 32 | void wrap_NCreateSCP(pybind11::module & m) 33 | { 34 | using namespace pybind11; 35 | using namespace odil; 36 | 37 | class_(m, "NCreateSCP") 38 | .def(init()) 39 | .def("set_callback", &set_callback) 40 | .def( 41 | "__call__", 42 | static_cast< 43 | void (NCreateSCP::*)(std::shared_ptr) 44 | >(&NCreateSCP::operator()) 45 | ) 46 | ; 47 | } 48 | -------------------------------------------------------------------------------- /wrappers/python/NSetSCP.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/NSetSCP.h" 12 | 13 | #include "opaque_types.h" 14 | #include "type_casters.h" 15 | 16 | namespace 17 | { 18 | 19 | void 20 | set_callback(odil::NSetSCP& scp, pybind11::object const& f) 21 | { 22 | scp.set_callback( 23 | [f](std::shared_ptr message) 24 | { 25 | return f(message).cast(); 26 | }); 27 | } 28 | 29 | } 30 | 31 | void wrap_NSetSCP(pybind11::module & m) 32 | { 33 | using namespace pybind11; 34 | using namespace odil; 35 | 36 | class_(m, "NSetSCP") 37 | .def(init()) 38 | .def (init()) 39 | .def("set_callback", &set_callback) 40 | .def( 41 | "__call__", 42 | static_cast< 43 | void (NSetSCP::*)(std::shared_ptr) 44 | >(&NSetSCP::operator()) 45 | ) 46 | ; 47 | } 48 | -------------------------------------------------------------------------------- /wrappers/python/NSetSCU.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/NSetSCU.h" 12 | 13 | #include "opaque_types.h" 14 | #include "type_casters.h" 15 | 16 | void wrap_NSetSCU(pybind11::module & m) 17 | { 18 | using namespace pybind11; 19 | using namespace odil; 20 | 21 | class_(m, "NSetSCU") 22 | .def(init()) 23 | .def( 24 | "get_affected_sop_class", &NSetSCU::get_affected_sop_class, 25 | return_value_policy::copy) 26 | .def( 27 | "set_affected_sop_class", 28 | static_cast)>( 29 | &NSetSCU::set_affected_sop_class) 30 | ) 31 | .def("set", &NSetSCU::set) 32 | ; 33 | } 34 | -------------------------------------------------------------------------------- /wrappers/python/StoreSCP.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | #include "odil/StoreSCP.h" 12 | 13 | #include "opaque_types.h" 14 | #include "type_casters.h" 15 | 16 | namespace 17 | { 18 | using namespace std; 19 | void 20 | set_callback(odil::StoreSCP& scp, pybind11::object const& f) 21 | { 22 | scp.set_callback( 23 | [f](std::shared_ptr message) 24 | { 25 | auto result = f(message); 26 | return result.cast(); 27 | }); 28 | } 29 | 30 | } 31 | 32 | void wrap_StoreSCP(pybind11::module & m) 33 | { 34 | using namespace pybind11; 35 | using namespace odil; 36 | 37 | class_(m, "StoreSCP") 38 | .def(init()) 39 | .def(init()) 40 | .def("set_callback", &set_callback) 41 | .def( 42 | "__call__", 43 | static_cast< 44 | void (StoreSCP::*)(std::shared_ptr) 45 | >(&StoreSCP::operator())) 46 | ; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /wrappers/python/UIDsDictionary.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | #include "opaque_types.h" 15 | #include "type_casters.h" 16 | 17 | void wrap_UIDsDictionary(pybind11::module & m) 18 | { 19 | using namespace pybind11; 20 | using namespace odil; 21 | 22 | class_(m, "UIDsDictionaryEntry") 23 | .def(init()) 24 | .def_readwrite("name", &UIDsDictionaryEntry::name) 25 | .def_readwrite("keyword", &UIDsDictionaryEntry::keyword) 26 | .def_readwrite("type", &UIDsDictionaryEntry::type) 27 | ; 28 | 29 | bind_map(m, "UIDsDictionary"); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /wrappers/python/VRFinder.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/VRFinder.h" 12 | 13 | #include "opaque_types.h" 14 | #include "type_casters.h" 15 | 16 | void wrap_VRFinder(pybind11::module & m) 17 | { 18 | using namespace pybind11; 19 | using namespace odil; 20 | 21 | class_(m, "VRFinder") 22 | .def(init<>()) 23 | .def("__call__", &VRFinder::operator()) 24 | ; 25 | } 26 | -------------------------------------------------------------------------------- /wrappers/python/__init__.py: -------------------------------------------------------------------------------- 1 | import contextlib 2 | import warnings 3 | 4 | from ._odil import * 5 | 6 | _open = open 7 | 8 | @contextlib.contextmanager 9 | def open(path, mode="rb"): 10 | fd = _open(path, mode) 11 | stream = iostream(fd) 12 | try: 13 | yield stream 14 | finally: 15 | fd.close() 16 | 17 | def read(path, keep_group_length=False, halt_condition=None): 18 | warnings.warn("odil.read is deprecated. Use odil.open instead") 19 | with open(path) as stream: 20 | return Reader.read_file(stream, keep_group_length, halt_condition) 21 | 22 | def write( 23 | data_set, path, meta_information=DataSet(), 24 | transfer_syntax=registry.ExplicitVRLittleEndian, 25 | item_encoding=Writer.ItemEncoding.ExplicitLength, 26 | use_group_length=False): 27 | warnings.warn("odil.write is deprecated. Use odil.open instead") 28 | with open(path, "wb") as stream: 29 | Writer.write_file( 30 | data_set, stream, meta_information, transfer_syntax, item_encoding, 31 | use_group_length) 32 | -------------------------------------------------------------------------------- /wrappers/python/endian.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include "opaque_types.h" 14 | #include "type_casters.h" 15 | 16 | void wrap_endian(pybind11::module & m) 17 | { 18 | using namespace pybind11; 19 | using namespace odil; 20 | 21 | enum_(m, "ByteOrdering") 22 | .value("LittleEndian", ByteOrdering::LittleEndian) 23 | .value("BigEndian", ByteOrdering::BigEndian) 24 | ; 25 | } 26 | -------------------------------------------------------------------------------- /wrappers/python/messages/CEchoRequest.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/message/CEchoRequest.h" 12 | 13 | void wrap_CEchoRequest(pybind11::module & m) 14 | { 15 | using namespace pybind11; 16 | using namespace odil; 17 | using namespace odil::message; 18 | 19 | class_, Request>(m, "CEchoRequest") 20 | .def(init()) 21 | .def(init>()) 22 | .def( 23 | "get_affected_sop_class_uid", 24 | &CEchoRequest::get_affected_sop_class_uid, 25 | return_value_policy::copy) 26 | .def( 27 | "set_affected_sop_class_uid", 28 | &CEchoRequest::set_affected_sop_class_uid) 29 | ; 30 | } 31 | -------------------------------------------------------------------------------- /wrappers/python/messages/CEchoResponse.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/message/CEchoResponse.h" 12 | 13 | void wrap_CEchoResponse(pybind11::module & m) 14 | { 15 | using namespace pybind11; 16 | using namespace odil; 17 | using namespace odil::message; 18 | 19 | class_, Response>(m, "CEchoResponse") 20 | .def(init()) 21 | .def(init>()) 22 | .def( 23 | "get_affected_sop_class_uid", 24 | &CEchoResponse::get_affected_sop_class_uid, 25 | return_value_policy::copy) 26 | .def( 27 | "set_affected_sop_class_uid", 28 | &CEchoResponse::set_affected_sop_class_uid) 29 | ; 30 | } 31 | -------------------------------------------------------------------------------- /wrappers/python/messages/CFindRequest.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/message/CFindRequest.h" 12 | 13 | void wrap_CFindRequest(pybind11::module & m) 14 | { 15 | using namespace pybind11; 16 | using namespace odil; 17 | using namespace odil::message; 18 | 19 | class_, Request>(m, "CFindRequest") 20 | .def(init< 21 | Value::Integer, Value::String const &, Value::Integer, 22 | std::shared_ptr 23 | >()) 24 | .def(init>()) 25 | .def( 26 | "get_affected_sop_class_uid", 27 | &CFindRequest::get_affected_sop_class_uid, 28 | return_value_policy::copy) 29 | .def( 30 | "set_affected_sop_class_uid", 31 | &CFindRequest::set_affected_sop_class_uid) 32 | .def( 33 | "get_priority", &CFindRequest::get_priority, 34 | return_value_policy::copy) 35 | .def("set_priority", &CFindRequest::set_priority) 36 | ; 37 | } 38 | -------------------------------------------------------------------------------- /wrappers/python/messages/CFindResponse.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/message/CFindResponse.h" 12 | 13 | void wrap_CFindResponse(pybind11::module & m) 14 | { 15 | using namespace pybind11; 16 | using namespace odil; 17 | using namespace odil::message; 18 | 19 | class_, Response>(m, "CFindResponse") 20 | .def(init()) 21 | .def(init>()) 22 | .def(init>()) 23 | .def( 24 | "get_message_id", &CFindResponse::get_message_id, 25 | return_value_policy::copy) 26 | .def("set_message_id", &CFindResponse::set_message_id) 27 | .def( 28 | "get_affected_sop_class_uid", 29 | &CFindResponse::get_affected_sop_class_uid, 30 | return_value_policy::copy) 31 | .def( 32 | "set_affected_sop_class_uid", 33 | &CFindResponse::set_affected_sop_class_uid) 34 | ; 35 | } 36 | -------------------------------------------------------------------------------- /wrappers/python/messages/CGetRequest.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/message/CGetRequest.h" 12 | 13 | void wrap_CGetRequest(pybind11::module & m) 14 | { 15 | using namespace pybind11; 16 | using namespace odil; 17 | using namespace odil::message; 18 | 19 | class_, Request>(m, "CGetRequest") 20 | .def(init< 21 | Value::Integer, Value::String const &, Value::Integer, 22 | std::shared_ptr 23 | >()) 24 | .def(init>()) 25 | .def( 26 | "get_affected_sop_class_uid", 27 | &CGetRequest::get_affected_sop_class_uid, 28 | return_value_policy::copy) 29 | .def( 30 | "set_affected_sop_class_uid", 31 | &CGetRequest::set_affected_sop_class_uid) 32 | .def( 33 | "get_priority", &CGetRequest::get_priority, 34 | return_value_policy::copy) 35 | .def("set_priority", &CGetRequest::set_priority) 36 | ; 37 | } 38 | -------------------------------------------------------------------------------- /wrappers/python/messages/Request.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/message/Request.h" 12 | 13 | void wrap_Request(pybind11::module & m) 14 | { 15 | using namespace pybind11; 16 | using namespace odil; 17 | using namespace odil::message; 18 | 19 | class_, Message>(m, "Request") 20 | .def(init()) 21 | .def(init>()) 22 | .def( 23 | "get_message_id", &Request::get_message_id, 24 | return_value_policy::copy) 25 | .def("set_message_id", &Request::set_message_id) 26 | ; 27 | } 28 | -------------------------------------------------------------------------------- /wrappers/python/registry.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/registry.h" 12 | 13 | #include "opaque_types.h" 14 | #include "type_casters.h" 15 | 16 | void wrap_registry(pybind11::module & m) 17 | { 18 | using namespace pybind11; 19 | using namespace odil; 20 | 21 | auto registry_ = m.def_submodule("registry"); 22 | 23 | for(auto const & entry: registry::public_dictionary) 24 | { 25 | if(entry.first.get_type() == ElementsDictionaryKey::Type::Tag) 26 | { 27 | registry_.attr(entry.second.keyword.c_str()) = entry.first.get_tag(); 28 | } 29 | } 30 | 31 | for(auto const & entry: registry::uids_dictionary) 32 | { 33 | registry_.attr(entry.second.keyword.c_str()) = bytes(entry.first); 34 | } 35 | 36 | registry_.attr("public_dictionary") = registry::public_dictionary; 37 | registry_.attr("uids_dictionary") = registry::uids_dictionary; 38 | } 39 | -------------------------------------------------------------------------------- /wrappers/python/uid.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include 12 | 13 | #include "opaque_types.h" 14 | #include "type_casters.h" 15 | 16 | void wrap_uid(pybind11::module & m) 17 | { 18 | using namespace pybind11; 19 | using namespace odil; 20 | 21 | m.attr("uid_prefix") = uid_prefix; 22 | m.attr("implementation_class_uid") = implementation_class_uid; 23 | m.attr("implementation_version_name") = implementation_version_name; 24 | m.def("generate_uid", generate_uid); 25 | } 26 | -------------------------------------------------------------------------------- /wrappers/python/webservices/BulkData.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/Value.h" 12 | #include "odil/webservices/BulkData.h" 13 | 14 | namespace 15 | { 16 | 17 | odil::webservices::BulkData 18 | constructor( 19 | odil::Value::Binary::value_type const & data = odil::Value::Binary::value_type(), 20 | std::string const & type = "", std::string const & location = "") 21 | { 22 | odil::webservices::BulkData bulk_data; 23 | bulk_data.data = data; 24 | bulk_data.type = type; 25 | bulk_data.location = location; 26 | 27 | return bulk_data; 28 | } 29 | 30 | } 31 | 32 | void wrap_webservices_BulkData(pybind11::module & m) 33 | { 34 | using namespace pybind11; 35 | using namespace odil::webservices; 36 | 37 | class_(m, "BulkData") 38 | .def( 39 | init(&constructor), "", 40 | arg("data") = odil::Value::Binary::value_type(), arg("type")="", 41 | arg("location")="") 42 | .def_readwrite("data", &BulkData::data) 43 | .def_readwrite("type", &BulkData::type) 44 | .def_readwrite("location", &BulkData::location) 45 | ; 46 | } 47 | -------------------------------------------------------------------------------- /wrappers/python/webservices/HTTPRequest.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | #include "odil/webservices/HTTPRequest.h" 13 | 14 | void wrap_webservices_HTTPRequest(pybind11::module & m) 15 | { 16 | using namespace pybind11; 17 | using namespace odil::webservices; 18 | 19 | class_(m, "HTTPRequest") 20 | .def( 21 | init(), 22 | "", 23 | arg("method")="", arg("target")=URL(), 24 | arg("http_version")="HTTP/1.0", arg("headers")=Message::Headers(), 25 | arg("body")="") 26 | .def("get_method", &HTTPRequest::get_method, return_value_policy::copy) 27 | .def("set_method", &HTTPRequest::set_method) 28 | .def( "get_target", &HTTPRequest::get_target, return_value_policy::copy) 29 | .def("set_target", &HTTPRequest::set_target) 30 | .def( 31 | "get_http_version", &HTTPRequest::get_http_version, 32 | return_value_policy::copy) 33 | .def("set_http_version", &HTTPRequest::set_http_version) 34 | ; 35 | } 36 | -------------------------------------------------------------------------------- /wrappers/python/webservices/HTTPResponse.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | #include "odil/webservices/HTTPResponse.h" 13 | 14 | void wrap_webservices_HTTPResponse(pybind11::module & m) 15 | { 16 | using namespace pybind11; 17 | using namespace odil::webservices; 18 | 19 | class_(m, "HTTPResponse") 20 | .def( 21 | init(), 22 | "", 23 | arg("http_version")="", arg("status")=0, arg("reason")="", 24 | arg("headers")=dict(), arg("body")=std::string()) 25 | .def( 26 | "get_http_version", &HTTPResponse::get_http_version, 27 | return_value_policy::copy) 28 | .def("set_http_version", &HTTPResponse::set_http_version) 29 | .def("get_status", &HTTPResponse::get_status) 30 | .def("set_status", &HTTPResponse::set_status) 31 | .def("get_reason", &HTTPResponse::get_reason, return_value_policy::copy) 32 | .def("set_reason", &HTTPResponse::set_reason) 33 | 34 | ; 35 | } 36 | -------------------------------------------------------------------------------- /wrappers/python/webservices/Message.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | #include 11 | 12 | #include "odil/webservices/Message.h" 13 | 14 | void wrap_webservices_Message(pybind11::module & m) 15 | { 16 | using namespace pybind11; 17 | using namespace odil::webservices; 18 | 19 | class_(m, "Message") 20 | .def( 21 | init(), 22 | "Constructor. By default, headers and body will be empty.", 23 | arg("headers")=Message::Headers(), arg("body")="") 24 | .def("get_headers", &Message::get_headers, return_value_policy::copy) 25 | .def("set_headers", &Message::set_headers) 26 | .def("has_header", &Message::has_header) 27 | .def("get_header", &Message::get_header, return_value_policy::copy) 28 | .def("set_header", &Message::set_header) 29 | .def("get_body", [](Message const & m) { return bytes(m.get_body()); }) 30 | .def("set_body", &Message::set_body) 31 | ; 32 | } 33 | -------------------------------------------------------------------------------- /wrappers/python/webservices/Utils.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * odil - Copyright (C) Universite de Strasbourg 3 | * Distributed under the terms of the CeCILL-B license, as published by 4 | * the CEA-CNRS-INRIA. Refer to the LICENSE file or to 5 | * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 6 | * for details. 7 | ************************************************************************/ 8 | 9 | #include 10 | 11 | #include "odil/webservices/Utils.h" 12 | 13 | void wrap_webservices_Utils(pybind11::module & m) 14 | { 15 | using namespace pybind11; 16 | using namespace odil::webservices; 17 | 18 | auto utils = m.def_submodule("Utils"); 19 | 20 | enum_(utils, "Type") 21 | .value("None_", Type::None) 22 | .value("DICOM", Type::DICOM) 23 | .value("BulkData", Type::BulkData) 24 | .value("PixelData", Type::PixelData) 25 | ; 26 | 27 | enum_(utils, "Representation") 28 | .value("DICOM", Representation::DICOM) 29 | .value("DICOM_XML", Representation::DICOM_XML) 30 | .value("DICOM_JSON", Representation::DICOM_JSON) 31 | ; 32 | } 33 | --------------------------------------------------------------------------------