MCPcopy Index your code
hub / github.com/OsiriX-Foundation/karnak

github.com/OsiriX-Foundation/karnak @v1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.0 ↗ · + Follow
3,113 symbols 9,630 edges 408 files 415 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

License License Maven build

Sonar Sonar Sonar Sonar Sonar

Karnak is a DICOM gateway designed for data de-identification and DICOM attribute normalization. It manages continuous DICOM data streams, functioning as a DICOM listener for input and supporting both DICOM and DICOMWeb formats for output.

For detailed usage instructions, refer to the Karnak User Guide.

Application Features

Gateway

  • Allow to have multiple destinations for one source.
  • A destination can be DICOM or DICOMWeb.
  • Provides filtering options for image providers by AE Title and/or hostname to ensure source authenticity.
  • Provides filtering options for SOP Class UID to send only specific SOP Class UIDs.
  • Use expressions to filter images from the DICOM tag values.

De-identification

  • Each destination can be configured with a specific de-identification profile
  • Build your own de-identification profile
  • Import and export the de-identification profiles to share them with other users.

Build Karnak

Prerequisites: - JDK 21 - Maven 3

Karnak

Execute the maven command mvn clean install -P production in the root directory of the project.

Note: When the tests are not skipped, it requires to run locally the cache, see below Run locally the database and the cache with docker.

Run Karnak

To configure and run Karnak with docker, see karnak-docker.

Debug Karnak

Debug in IntelliJ

  • Launch the components needed by Karnak (see below "Configure Postgres database with docker")
  • Enable Spring and Spring Boot for the project
  • Create a Spring Boot launcher from main of StartApplication.java
    • Working Directory must be the mvc directory
    • In VM Options:
    • Add -Djava.library.path="/tmp/dicom-opencv". Note: the tmp folder must be adapted according to your system and dicom-opencv is mandatory as the last folder.
    • Optional: Add -Dvaadin.productionMode=true to enable production mode
    • In Environment variables, add the following values. The following values work with our default configuration define with docker used for the development (see: "Configure locally Postgres database with docker") :
      • Mandatory:
        • ENVIRONMENT=DEV
      • Optional:
        • DB_PASSWORD=5!KAnN@%98%d
        • DB_PORT=5433
        • DB_USER=karnak
        • DB_NAME=karnak
        • DB_HOST=localhost
        • KARNAK_ADMIN=admin
        • KARNAK_PASSWORD=admin
        • KARNAK_LOGS_MAX_FILE_SIZE=100MB
        • KARNAK_LOGS_MIN_INDEX=1
        • KARNAK_LOGS_MAX_INDEX=10
        • KARNAK_CLINICAL_LOGS_MAX_FILE_SIZE=100MB
        • KARNAK_CLINICAL_LOGS_MIN_INDEX=1
        • KARNAK_CLINICAL_LOGS_MAX_INDEX=10
        • IDP=undefined
        • OIDC_CLIENT_ID=undefined
        • OIDC_CLIENT_SECRET=undefined
        • OIDC_ISSUER_URI=undefined

Run locally the database and the cache with docker

  • Go in the docker folder located in the root project folder.
  • To configure third-party components used by karnak, please refer to these links:
  • Adapt the values if necessary (copy .env.example into .env and modify it)
  • Execute command:
    • start: docker compose up -d
    • show the logs: docker compose logs -f
    • stop: docker compose down

Docker

Minimum docker version: 20.10

Build with Dockerfile

Go on the root folder and launch the following command:

  • Full independent build: docker build -t local/karnak:latest -f Dockerfile .
  • Build from compile package:
    • mvn clean install -P production
    • docker build -t local/karnak:latest -f src/main/docker/Dockerfile .

Run image from Docker Hub

See karnak-docker

Docker environment variables

See all the environment variables

Architecture

This project is divided in two parts:

  • backend: spring data (entities, repositories, converters, validators), enums, spring configurations, spring security, cache, spring services, models...
  • frontend : Vaadin components: logic services, graphic components, views

Identity provider

An OpenID Connect identity provider can be configured by using the environment variables: - IDP: when this environment variable has the value 'oidc', the following environment variables will configure the OpenID Connect identity provider. Any other value will load the in memory user configuration. - OIDC_CLIENT_ID: client id of the identity provider - OIDC_CLIENT_SECRET: client secret of the identity provider - OIDC_ISSUER_URI: issuer URI of the identity provider

Documentation for API/Endpoints

Workflow

Workflow

Pipeline

Workflow

Extension points exported contracts — how you extend this code

ExpressionItem (Interface)
(no doc) [2 implementers]
src/main/java/org/karnak/backend/model/expression/ExpressionItem.java
ProfileItem (Interface)
(no doc) [1 implementers]
src/main/java/org/karnak/backend/model/profiles/ProfileItem.java
ActionItem (Interface)
(no doc) [1 implementers]
src/main/java/org/karnak/backend/model/action/ActionItem.java
UIS (Interface)
(no doc)
src/main/java/org/karnak/frontend/util/UIS.java
DestinationDicomGroup (Interface)
(no doc)
src/main/java/org/karnak/backend/data/validator/DestinationGroupSequenceProvider.java

Core symbols most depended-on inside this repo

add
called by 398
src/main/java/org/karnak/frontend/Menu.java
set
called by 216
src/main/java/org/karnak/frontend/authentication/CurrentUser.java
get
called by 162
src/main/java/org/karnak/backend/cache/PatientClient.java
getString
called by 145
src/main/java/org/karnak/backend/model/expression/ExprAction.java
getValue
called by 132
src/main/java/org/karnak/frontend/kheops/SwitchingAlbumsView.java
isEmpty
called by 116
src/main/java/org/karnak/backend/model/Study.java
getId
called by 115
src/main/java/org/karnak/backend/model/standard/Module.java
setWidthFull
called by 107
src/main/java/org/karnak/frontend/util/UIS.java

Shape

Method 2,700
Class 378
Interface 20
Enum 15

Languages

Java100%

Modules by API surface

src/main/java/org/karnak/backend/data/entity/DestinationEntity.java88 symbols
src/main/java/org/karnak/backend/data/entity/TransferStatusEntity.java64 symbols
src/main/java/org/karnak/frontend/dicom/mwl/DicomWorkListView.java38 symbols
src/main/java/org/karnak/frontend/forwardnode/edit/LayoutEditForwardNode.java36 symbols
src/main/java/org/karnak/backend/service/gateway/GatewaySetUpService.java34 symbols
src/main/java/org/karnak/frontend/forwardnode/edit/destination/component/NotificationComponent.java32 symbols
src/main/java/org/karnak/backend/data/entity/ProfileElementEntity.java29 symbols
src/test/java/org/karnak/profilepipe/utils/HMACTest.java28 symbols
src/main/java/org/karnak/backend/cache/Patient.java28 symbols
src/main/java/org/karnak/backend/model/dicom/WorkListQueryData.java27 symbols
src/main/java/org/karnak/frontend/dicom/echo/DicomEchoView.java25 symbols
src/main/java/org/karnak/backend/model/notification/TransferMonitoringNotification.java25 symbols

For agents

$ claude mcp add karnak \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page