Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/anonymizer/anonymizer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import faulthandler
import ctypes
import json
import logging
import os
Expand Down Expand Up @@ -40,13 +41,21 @@
from anonymizer.view.settings.settings_dialog import SettingsDialog
from anonymizer.view.welcome import WelcomeView


# Enable DPI awareness for Windows (improves scaling on high-DPI/4K monitors)
try:
ctypes.windll.shcore.SetProcessDpiAwareness(1)
except Exception:
pass

faulthandler.enable()

logger = logging.getLogger() # ROOT logger


class Anonymizer(ctk.CTk):
THEME_FILE = "assets/themes/rsna_theme.json"
DARK_THEME_FILE = "assets/themes/rsna_theme_dark.json"

project_open_startup_dwell_time = 100 # milliseconds
metrics_loop_interval = 1000 # milliseconds
Expand All @@ -60,13 +69,20 @@ def get_app_state_path(self) -> Path:
def __init__(self, logs_dir: Path):
super().__init__()
self.logs_dir: Path = logs_dir

ctk.set_appearance_mode("System") # Modes: "System" (standard), "Dark", "Light"
theme = self.THEME_FILE
appearance_mode = ctk.get_appearance_mode()
if appearance_mode == "Light":
theme = self.THEME_FILE
else:
theme = self.DARK_THEME_FILE

if not os.path.exists(theme):
logger.error(f"Theme file not found: {theme}, reverting to dark-blue theme")
theme = "dark-blue"
ctk.set_default_color_theme(theme)
ctk.deactivate_automatic_dpi_awareness() # TODO: implement dpi awareness for all views for Windows OS
# DPI awareness is now enabled globally for Windows above; do not deactivate here
# ctk.deactivate_automatic_dpi_awareness() # Removed for proper DPI scaling
logging.info(f"ctk.ThemeManager.theme:\n{pformat(ThemeManager.theme)}")
self.mono_font = self._init_mono_font()

Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/de/html/1_übersicht.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
see https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<h2>Einführung</h2>
<p>
Der RSNA DICOM Anonymizer ist ein plattformübergreifendes, eigenständiges De-Identifikations-Werkzeug.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
siehe https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F;font-size: 14px;">
<div style="color: THEME_COLOR;font-size: 14px;">

<h3>DICOM Standard zur De-Identifikation</h3>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
siehe https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F;font-size: 14px;">
<div style="color: THEME_COLOR;font-size: 14px;">

<h2>Verwaltung von Anonymisierungsprojekten</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
siehe https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">RSNA DICOM Anonymizer Project Settings</h1> -->

<h2>Projekteinstellungen</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/de/html/5_bedienung.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
siehe https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">

<h2>Dateien importieren</h2>

Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/de/html/6_lizenz.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<h3>Lizenz</h3>
Die RSNA DICOM Anonymizer-Software wird unter der
<a href="http://mirc.rsna.org/rsnapubliclicense.pdf">RSNA Public License</a> veröffentlicht.
Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/en_US/html/1_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
see https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">RSNA DICOM Anonymizer Overview</h1> -->

<h2>Introduction</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
see https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F;font-size: 14px;">
<div style="color: THEME_COLOR;font-size: 14px;">

<h3>DICOM Standard De-identification Protocol</h3>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
see https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F;font-size: 14px;">
<div style="color: THEME_COLOR;font-size: 14px;">

<h2>Managing Anonymization Projects</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
see https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">RSNA DICOM Anonymizer Project Settings</h1> -->

<h2>Project Settings</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/en_US/html/5_operation.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
see https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">RSNA DICOM Anonymizer Operation</h1> -->

<h2>Importing files</h2>
Expand Down
20 changes: 10 additions & 10 deletions src/anonymizer/assets/locales/en_US/html/6_license.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<h3>License</h3>
The RSNA DICOM Anonymizer software is released under the
<a href="http://mirc.rsna.org/rsnapubliclicense.pdf">RSNA Public License.</a>
Expand All @@ -16,16 +16,16 @@ <h3>Dependencies</h3>
<li><a href="https://github.com/boto/boto3">boto3</a></li>
<li><a href="https://github.com/theorchard/openpyxl">openpyxl</a></li>
<li><a href="https://github.com/giampaolo/psutil">psutil</a></li>
<li><a href="https://github.com/pydicom/pylibjpeg">pylibjpeg</a><li>
<li><a href="https://github.com/pydicom/pylibjpeg">pylibjpeg</a></li>
<li><a href="https://github.com/numpy/numpy">numpy</a></li>
<li><a href="https://github.com/opencv/opencv-python">opencv-python-headless</a><li></li>
<li><a href="https://github.com/JaidedAI/EasyOCR">easyocr</a><li></li>
<li><a href="https://github.com/pyca/cryptography">cryptography</a><li></li>
<li><a href="https://github.com/psf/requests">requests</a><li></li>
<li><a href="https://github.com/requests/requests-oauthlib">requests-oauthlib</a><li></li>
<li><a href="https://github.com/toml-lang/toml">toml</a><li></li>
<li><a href="https://github.com/pallets/click">click</a><li></li>
<li><a href="khttps://github.com/lidatong/dataclasses-json">dataclasses-json</a><li></li>
<li><a href="https://github.com/opencv/opencv-python">opencv-python-headless</a></li>
<li><a href="https://github.com/JaidedAI/EasyOCR">easyocr</a></li>
<li><a href="https://github.com/pyca/cryptography">cryptography</a></li>
<li><a href="https://github.com/psf/requests">requests</a></li>
<li><a href="https://github.com/requests/requests-oauthlib">requests-oauthlib</a></li>
<li><a href="https://github.com/toml-lang/toml">toml</a></li>
<li><a href="https://github.com/pallets/click">click</a></li>
<li><a href="khttps://github.com/lidatong/dataclasses-json">dataclasses-json</a></li>
</ol>
<h3>Dependencies open source licenses</h3>
The software above, included in the RSNA DICOM Anonymizer, is released under the following licenses:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ver https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">Visión general del Anonimizador DICOM de RSNA</h1> -->

<h2>Introducción</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ver https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F;font-size: 14px;">
<div style="color: THEME_COLOR;font-size: 14px;">

<h3>Protocolo Estándar DICOM para De-Identificación</h3>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
vea https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F;font-size: 14px;">
<div style="color: THEME_COLOR;font-size: 14px;">

<h2>Gestión de Proyectos de Anonimización</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ver https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">Configuración del Proyecto Anonimizador DICOM RSNA</h1> -->

<h2>Configuración del Proyecto</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/es/html/5_operación.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ver https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">RSNA DICOM Anonymizer Operation</h1> -->

<h2>Importar archivos</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/es/html/6_licencia.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<h3>Licencia</h3>
El software RSNA DICOM Anonymizer se publica bajo la
<a href="http://mirc.rsna.org/rsnapubliclicense.pdf">Licencia Pública de RSNA.</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ver https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">Visión general del Anonimizador DICOM de RSNA</h1> -->

<h2>Introducción</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ver https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F;font-size: 14px;">
<div style="color: THEME_COLOR;font-size: 14px;">

<h3>Protocolo Estándar DICOM para De-Identificación</h3>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ver https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F;font-size: 14px;">
<div style="color: THEME_COLOR;font-size: 14px;">

<h3>Protocolo estándar de desidentificación DICOM</h3>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ver https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">Configuración del Proyecto Anonimizador DICOM RSNA</h1> -->

<h2>Configuración del Proyecto</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ver https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">RSNA DICOM Anonymizer Operation</h1> -->

<h2>Importar archivos</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/es/html_bak/6_licencia.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<h3>Licencia</h3>
El software RSNA DICOM Anonymizer se publica bajo la
<a href="http://mirc.rsna.org/rsnapubliclicense.pdf">Licencia Pública de RSNA.</a>
Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/fr/html/1_aperçu.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
voir https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">Présentation de l'Anonymiseur DICOM de la RSNA</h1> -->

<h2>Introduction</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
voir https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F;font-size: 14px;">
<div style="color: THEME_COLOR;font-size: 14px;">

<h3>Protocole de Dé-identification Standard DICOM</h3>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
voir https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F;font-size: 14px;">
<div style="color: THEME_COLOR;font-size: 14px;">

<h2>Gestion des Projets d'Anonymisation</h2>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
voir https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">Paramètres du projet RSNA DICOM Anonymiseur</h1> -->

<h2>Paramètres du Projet</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/fr/html/5_opération.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
voir https://github.com/bauripalash/tkhtmlview?tab=readme-ov-file#html-support -->
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<!-- <h1 style="text-align: center;">RSNA DICOM Anonymizer Operation</h1> -->

<h2>Importer des fichiers</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/anonymizer/assets/locales/fr/html/6_licence.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<body>
<div style="color: #014F8F; font-size: 14px;">
<div style="color: THEME_COLOR; font-size: 14px;">
<h3>Licence</h3>
Le logiciel RSNA DICOM Anonymizer est publié sous la
<a href="http://mirc.rsna.org/rsnapubliclicense.pdf">Licence Publique de la RSNA.</a>
Expand Down
Loading
Loading