mitk-python 2026.12rc1__cp314-cp314-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mitk/MitkCore/MitkDICOMImageIO.dll +0 -0
- mitk/MitkCore/MitkDICOMPMIO.dll +0 -0
- mitk/MitkCore/MitkDICOMRTIO.dll +0 -0
- mitk/MitkCore/MitkDICOMSegIO.dll +0 -0
- mitk/MitkCore/MitkIOExt.dll +0 -0
- mitk/MitkCore/MitkModelFitIOServices.dll +0 -0
- mitk/MitkCore/MitkMultilabelIO.dll +0 -0
- mitk/MitkCore/MitkPlanarFigureIO.dll +0 -0
- mitk/MitkCore/MitkROIIO.dll +0 -0
- mitk/MitkCore/MitkSceneSerializationIO.dll +0 -0
- mitk/MitkCore/MitkSegmentationIO.dll +0 -0
- mitk/MitkDICOM/MitkCESTIO.dll +0 -0
- mitk/MitkModelFit/MitkModelFitModelsServices.dll +0 -0
- mitk/MitkModelFit/MitkPharmacokineticModelsServices.dll +0 -0
- mitk/__init__.py +78 -0
- mitk/mitk.cp314-win_amd64.pyd +0 -0
- mitk/mxn/__init__.py +17 -0
- mitk/mxn/layout/__init__.py +115 -0
- mitk/mxn/layout/_builders.py +239 -0
- mitk/mxn/layout/_io.py +66 -0
- mitk/mxn/layout/_model.py +1204 -0
- mitk/mxn/layout/_presets.py +93 -0
- mitk/mxn/layout/_repr.py +205 -0
- mitk/mxn/layout/_selector.py +363 -0
- mitk/mxn/layout/_validation.py +348 -0
- mitk/mxn/layout/_vocabulary.py +100 -0
- mitk/property_view.py +123 -0
- mitk_python-2026.12rc1.dist-info/DELVEWHEEL +2 -0
- mitk_python-2026.12rc1.dist-info/METADATA +67 -0
- mitk_python-2026.12rc1.dist-info/RECORD +193 -0
- mitk_python-2026.12rc1.dist-info/WHEEL +4 -0
- mitk_python-2026.12rc1.dist-info/top_level.txt +1 -0
- mitk_python.libs/ITKCommon-5.4.dll +0 -0
- mitk_python.libs/ITKIOBMP-5.4.dll +0 -0
- mitk_python.libs/ITKIOBioRad-5.4.dll +0 -0
- mitk_python.libs/ITKIOBruker-5.4.dll +0 -0
- mitk_python.libs/ITKIOGDCM-5.4.dll +0 -0
- mitk_python.libs/ITKIOGE-5.4.dll +0 -0
- mitk_python.libs/ITKIOGIPL-5.4.dll +0 -0
- mitk_python.libs/ITKIOHDF5-5.4.dll +0 -0
- mitk_python.libs/ITKIOIPL-5.4.dll +0 -0
- mitk_python.libs/ITKIOImageBase-5.4.dll +0 -0
- mitk_python.libs/ITKIOJPEG-5.4.dll +0 -0
- mitk_python.libs/ITKIOJPEG2000-5.4.dll +0 -0
- mitk_python.libs/ITKIOLSM-5.4.dll +0 -0
- mitk_python.libs/ITKIOMINC-5.4.dll +0 -0
- mitk_python.libs/ITKIOMRC-5.4.dll +0 -0
- mitk_python.libs/ITKIOMeta-5.4.dll +0 -0
- mitk_python.libs/ITKIONIFTI-5.4.dll +0 -0
- mitk_python.libs/ITKIONRRD-5.4.dll +0 -0
- mitk_python.libs/ITKIOPNG-5.4.dll +0 -0
- mitk_python.libs/ITKIOStimulate-5.4.dll +0 -0
- mitk_python.libs/ITKIOTIFF-5.4.dll +0 -0
- mitk_python.libs/ITKIOVTK-5.4.dll +0 -0
- mitk_python.libs/ITKLabelMap-5.4.dll +0 -0
- mitk_python.libs/ITKOptimizers-5.4.dll +0 -0
- mitk_python.libs/ITKQuadEdgeMesh-5.4.dll +0 -0
- mitk_python.libs/ITKRegionGrowing-5.4.dll +0 -0
- mitk_python.libs/ITKSmoothing-5.4.dll +0 -0
- mitk_python.libs/ITKStatistics-5.4.dll +0 -0
- mitk_python.libs/ITKTransform-5.4.dll +0 -0
- mitk_python.libs/MitkAlgorithmsExt.dll +0 -0
- mitk_python.libs/MitkCEST.dll +0 -0
- mitk_python.libs/MitkContourModel.dll +0 -0
- mitk_python.libs/MitkCore.dll +0 -0
- mitk_python.libs/MitkCppMicroServices.dll +0 -0
- mitk_python.libs/MitkDICOM.dll +0 -0
- mitk_python.libs/MitkDICOMPM.dll +0 -0
- mitk_python.libs/MitkDICOMQI.dll +0 -0
- mitk_python.libs/MitkDataTypesExt.dll +0 -0
- mitk_python.libs/MitkLog.dll +0 -0
- mitk_python.libs/MitkMapperExt.dll +0 -0
- mitk_python.libs/MitkModelFit.dll +0 -0
- mitk_python.libs/MitkMultilabel.dll +0 -0
- mitk_python.libs/MitkPharmacokinetics.dll +0 -0
- mitk_python.libs/MitkPlanarFigure.dll +0 -0
- mitk_python.libs/MitkROI.dll +0 -0
- mitk_python.libs/MitkRT.dll +0 -0
- mitk_python.libs/MitkSceneSerialization.dll +0 -0
- mitk_python.libs/MitkSceneSerializationBase.dll +0 -0
- mitk_python.libs/MitkSegmentation.dll +0 -0
- mitk_python.libs/MitkSurfaceInterpolation.dll +0 -0
- mitk_python.libs/MitkVolumeVisualization.dll +0 -0
- mitk_python.libs/PocoFoundation.dll +0 -0
- mitk_python.libs/PocoZip.dll +0 -0
- mitk_python.libs/ann.dll +0 -0
- mitk_python.libs/dcmdata.dll +0 -0
- mitk_python.libs/dcmfg.dll +0 -0
- mitk_python.libs/dcmimage.dll +0 -0
- mitk_python.libs/dcmimgle.dll +0 -0
- mitk_python.libs/dcmiod.dll +0 -0
- mitk_python.libs/dcmpmap.dll +0 -0
- mitk_python.libs/dcmrt.dll +0 -0
- mitk_python.libs/dcmseg.dll +0 -0
- mitk_python.libs/dcmsr.dll +0 -0
- mitk_python.libs/gdcmCommon.dll +0 -0
- mitk_python.libs/gdcmDICT.dll +0 -0
- mitk_python.libs/gdcmDSED.dll +0 -0
- mitk_python.libs/gdcmIOD.dll +0 -0
- mitk_python.libs/gdcmMSFF.dll +0 -0
- mitk_python.libs/gdcmcharls.dll +0 -0
- mitk_python.libs/gdcmexpat.dll +0 -0
- mitk_python.libs/gdcmjpeg12.dll +0 -0
- mitk_python.libs/gdcmjpeg16.dll +0 -0
- mitk_python.libs/gdcmjpeg8.dll +0 -0
- mitk_python.libs/gdcmopenjp2.dll +0 -0
- mitk_python.libs/gdcmzlib.dll +0 -0
- mitk_python.libs/itkGrowCut-5.4.dll +0 -0
- mitk_python.libs/itkhdf5-shared-5.4.dll +0 -0
- mitk_python.libs/itkhdf5_cpp-shared-5.4.dll +0 -0
- mitk_python.libs/lz4.dll +0 -0
- mitk_python.libs/msvcp140.dll +0 -0
- mitk_python.libs/oficonv.dll +0 -0
- mitk_python.libs/oflog.dll +0 -0
- mitk_python.libs/ofstd.dll +0 -0
- mitk_python.libs/tbb12.dll +0 -0
- mitk_python.libs/vcomp140.dll +0 -0
- mitk_python.libs/vtkCommonCache-9.7.dll +0 -0
- mitk_python.libs/vtkCommonColor-9.7.dll +0 -0
- mitk_python.libs/vtkCommonComputationalGeometry-9.7.dll +0 -0
- mitk_python.libs/vtkCommonCore-9.7.dll +4 -0
- mitk_python.libs/vtkCommonDataModel-9.7.dll +0 -0
- mitk_python.libs/vtkCommonExecutionModel-9.7.dll +0 -0
- mitk_python.libs/vtkCommonMath-9.7.dll +0 -0
- mitk_python.libs/vtkCommonMisc-9.7.dll +0 -0
- mitk_python.libs/vtkCommonSystem-9.7.dll +0 -0
- mitk_python.libs/vtkCommonTransforms-9.7.dll +0 -0
- mitk_python.libs/vtkDICOMParser-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersCellGrid-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersCore-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersExtraction-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersGeneral-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersGeneric-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersGeometry-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersHybrid-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersHyperTree-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersModeling-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersParallel-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersReduction-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersSources-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersStatistics-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersTexture-9.7.dll +0 -0
- mitk_python.libs/vtkFiltersVerdict-9.7.dll +0 -0
- mitk_python.libs/vtkIOCellGrid-9.7.dll +0 -0
- mitk_python.libs/vtkIOCore-9.7.dll +0 -0
- mitk_python.libs/vtkIOGeometry-9.7.dll +0 -0
- mitk_python.libs/vtkIOHDF-9.7.dll +0 -0
- mitk_python.libs/vtkIOImage-9.7.dll +0 -0
- mitk_python.libs/vtkIOLegacy-9.7.dll +0 -0
- mitk_python.libs/vtkIOPLY-9.7.dll +0 -0
- mitk_python.libs/vtkIOXML-9.7.dll +0 -0
- mitk_python.libs/vtkIOXMLParser-9.7.dll +0 -0
- mitk_python.libs/vtkImagingColor-9.7.dll +0 -0
- mitk_python.libs/vtkImagingCore-9.7.dll +0 -0
- mitk_python.libs/vtkImagingGeneral-9.7.dll +0 -0
- mitk_python.libs/vtkImagingMath-9.7.dll +0 -0
- mitk_python.libs/vtkImagingSources-9.7.dll +0 -0
- mitk_python.libs/vtkImagingStencil-9.7.dll +0 -0
- mitk_python.libs/vtkInteractionStyle-9.7.dll +0 -0
- mitk_python.libs/vtkParallelCore-9.7.dll +0 -0
- mitk_python.libs/vtkParallelDIY-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingAnnotation-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingContext2D-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingContextOpenGL2-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingCore-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingFreeType-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingHyperTreeGrid-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingLabel-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingOpenGL2-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingUI-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingVolume-9.7.dll +0 -0
- mitk_python.libs/vtkRenderingVolumeOpenGL2-9.7.dll +0 -0
- mitk_python.libs/vtkexpat-9.7.dll +0 -0
- mitk_python.libs/vtkfmt-9.7.dll +0 -0
- mitk_python.libs/vtkfreetype-9.7.dll +0 -0
- mitk_python.libs/vtkglad-9.7.dll +0 -0
- mitk_python.libs/vtkhdf5-9.7.dll +0 -0
- mitk_python.libs/vtkhdf5_hl-9.7.dll +0 -0
- mitk_python.libs/vtkjpeg-9.7.dll +0 -0
- mitk_python.libs/vtkjsoncpp-9.7.dll +0 -0
- mitk_python.libs/vtkkissfft-9.7.dll +0 -0
- mitk_python.libs/vtkloguru-9.7.dll +0 -0
- mitk_python.libs/vtklz4-9.7.dll +0 -0
- mitk_python.libs/vtklzma-9.7.dll +0 -0
- mitk_python.libs/vtkmetaio-9.7.dll +0 -0
- mitk_python.libs/vtkpng-9.7.dll +0 -0
- mitk_python.libs/vtkpugixml-9.7.dll +0 -0
- mitk_python.libs/vtkscn-9.7.dll +0 -0
- mitk_python.libs/vtksys-9.7.dll +0 -0
- mitk_python.libs/vtktiff-9.7.dll +0 -0
- mitk_python.libs/vtktoken-9.7.dll +0 -0
- mitk_python.libs/vtkverdict-9.7.dll +0 -0
- mitk_python.libs/vtkzlib-9.7.dll +0 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
#
|
|
3
|
+
# The Medical Imaging Interaction Toolkit (MITK)
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) German Cancer Research Center (DKFZ)
|
|
6
|
+
# All rights reserved.
|
|
7
|
+
#
|
|
8
|
+
# Use of this source code is governed by a 3-clause BSD license that can be
|
|
9
|
+
# found in the LICENSE file.
|
|
10
|
+
#
|
|
11
|
+
# ============================================================================
|
|
12
|
+
|
|
13
|
+
"""Per-field validation rule helpers.
|
|
14
|
+
|
|
15
|
+
These helpers operate on primitive values; they have no knowledge of the
|
|
16
|
+
dataclass model. Cross-document rules (id uniqueness, group resolution, the
|
|
17
|
+
orientation-group rule) live on `MxNLayoutDocument.validate()` since they
|
|
18
|
+
need access to the whole tree.
|
|
19
|
+
|
|
20
|
+
The rules are the v3.0 schema's, but for one leniency taken from the C++
|
|
21
|
+
loader (`QmitkMxNMultiWidget::ApplyLayout`): a link target that names the
|
|
22
|
+
reserved group in any spelling is accepted where the dimension takes the
|
|
23
|
+
reserved group, and stored as `global`. Where the loader is stricter than
|
|
24
|
+
the schema, the rules are the loader's, so a document the DSL accepts is
|
|
25
|
+
one the editor loads, provided its window ids carry that editor's name as
|
|
26
|
+
prefix: the DSL knows no editor and cannot check that. Where the loader
|
|
27
|
+
would load a value but change it, the DSL refuses it: a slice offset
|
|
28
|
+
outside the C++ int range, which the loader wraps, and a group colour too
|
|
29
|
+
close to the reserved group's, which it ignores.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
from __future__ import annotations
|
|
33
|
+
|
|
34
|
+
import math
|
|
35
|
+
import numbers
|
|
36
|
+
import re
|
|
37
|
+
from collections.abc import Iterable, Mapping
|
|
38
|
+
from typing import Final
|
|
39
|
+
|
|
40
|
+
from ._vocabulary import (
|
|
41
|
+
DEFAULT_GROUP_NAME,
|
|
42
|
+
GLOBAL_GROUP_NAME,
|
|
43
|
+
GROUP_COLOR_PATTERN,
|
|
44
|
+
GROUP_NAME_PATTERN,
|
|
45
|
+
LinkDimension,
|
|
46
|
+
RenderMode,
|
|
47
|
+
ViewDirection,
|
|
48
|
+
WINDOW_ID_PATTERN,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
_WINDOW_ID_RE: Final = re.compile(WINDOW_ID_PATTERN)
|
|
53
|
+
_GROUP_NAME_RE: Final = re.compile(GROUP_NAME_PATTERN)
|
|
54
|
+
_GROUP_COLOR_RE: Final = re.compile(GROUP_COLOR_PATTERN)
|
|
55
|
+
_VIEW_DIRECTION_VALUES: Final = frozenset(v.value for v in ViewDirection)
|
|
56
|
+
_DIMENSION_KEYS: Final = tuple(d.value for d in LinkDimension)
|
|
57
|
+
|
|
58
|
+
# The versions `MxNLayoutDocument.from_json` reads. It writes LAYOUT_VERSION.
|
|
59
|
+
ACCEPTED_INPUT_VERSIONS: Final = frozenset({"2.0", "3.0"})
|
|
60
|
+
|
|
61
|
+
# The loader reads a child's `size` and a slice offset into a C++ int. It
|
|
62
|
+
# refuses a size beyond that range but wraps an offset into it, which loads
|
|
63
|
+
# a different hanging, so the DSL refuses both although the schema's
|
|
64
|
+
# integer has no bound.
|
|
65
|
+
_INT_MIN: Final[int] = -(2**31)
|
|
66
|
+
_INT_MAX: Final[int] = 2**31 - 1
|
|
67
|
+
|
|
68
|
+
# The dimensions on the application's position, and time, accept the reserved
|
|
69
|
+
# group as a link target; time accepts nothing else.
|
|
70
|
+
DIMENSIONS_ACCEPTING_GLOBAL: Final = frozenset(
|
|
71
|
+
{LinkDimension.TIME.value, LinkDimension.SLICE.value, LinkDimension.CROSSHAIR.value}
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# The reserved group's colours, the Dark style's icon colour and the Light
|
|
75
|
+
# style's. The editor ignores a group colour closer (CIE76) than this to
|
|
76
|
+
# either, as it could not be told apart from the reserved group.
|
|
77
|
+
_RESERVED_GROUP_COLORS: Final = ("#c7c7c7", "#000000")
|
|
78
|
+
_RESERVED_COLOR_DISTANCE: Final = 15.0
|
|
79
|
+
|
|
80
|
+
# The offset each dimension accepts, in the schema's terms; the dimensions not
|
|
81
|
+
# listed accept none.
|
|
82
|
+
OFFSET_TYPES: Final[Mapping[str, str]] = {
|
|
83
|
+
LinkDimension.SLICE.value: "integer",
|
|
84
|
+
LinkDimension.ZOOM.value: "positive number",
|
|
85
|
+
LinkDimension.PAN.value: "two numbers",
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def validate_window_id(value: str) -> None:
|
|
90
|
+
"""Reject anything that does not match the qualified-id pattern."""
|
|
91
|
+
if not isinstance(value, str):
|
|
92
|
+
raise ValueError(f"window id must be a string, got {type(value).__name__}")
|
|
93
|
+
if not _WINDOW_ID_RE.fullmatch(value):
|
|
94
|
+
raise ValueError(
|
|
95
|
+
f"window id {value!r} does not match qualified-id pattern "
|
|
96
|
+
f"{WINDOW_ID_PATTERN!r}; expected '<editor_name>__<bare_id>'"
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def validate_window_name(value: str | None) -> None:
|
|
101
|
+
"""Display name: optional; when set, must be a non-empty string."""
|
|
102
|
+
if value is None:
|
|
103
|
+
return
|
|
104
|
+
if not isinstance(value, str):
|
|
105
|
+
raise ValueError(f"window name must be a string or None, got {type(value).__name__}")
|
|
106
|
+
if len(value) < 1:
|
|
107
|
+
raise ValueError("window name must be a non-empty string when set; pass None to omit")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def names_global_group(value: object) -> bool:
|
|
111
|
+
"""Whether ``value`` is the reserved group's id in any spelling."""
|
|
112
|
+
return isinstance(value, str) and value.lower() == GLOBAL_GROUP_NAME
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def validate_group_name(value: str) -> None:
|
|
116
|
+
"""Group name: must match the URL-segment-safe pattern and must not be
|
|
117
|
+
the reserved group id in any spelling."""
|
|
118
|
+
if not isinstance(value, str):
|
|
119
|
+
raise ValueError(f"group name must be a string, got {type(value).__name__}")
|
|
120
|
+
if not _GROUP_NAME_RE.fullmatch(value):
|
|
121
|
+
raise ValueError(
|
|
122
|
+
f"group name {value!r} does not match pattern {GROUP_NAME_PATTERN!r}"
|
|
123
|
+
)
|
|
124
|
+
if names_global_group(value):
|
|
125
|
+
raise ValueError(
|
|
126
|
+
f"group name {value!r} is the reserved group {GLOBAL_GROUP_NAME!r}, "
|
|
127
|
+
f"which is reserved in every spelling; rename the group"
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def validate_view_direction(value: object) -> None:
|
|
132
|
+
"""Accept either a `ViewDirection` enum member or its string value."""
|
|
133
|
+
if isinstance(value, ViewDirection):
|
|
134
|
+
return
|
|
135
|
+
if isinstance(value, str) and value in _VIEW_DIRECTION_VALUES:
|
|
136
|
+
return
|
|
137
|
+
raise ValueError(
|
|
138
|
+
f"view_direction must be one of {sorted(_VIEW_DIRECTION_VALUES)}, "
|
|
139
|
+
f"got {value!r}"
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def validate_view_for_render_mode(
|
|
144
|
+
window_id: str, view_direction: ViewDirection, render_mode: RenderMode
|
|
145
|
+
) -> None:
|
|
146
|
+
"""``free`` keeps a rotation only a 3D camera has."""
|
|
147
|
+
if view_direction is ViewDirection.FREE and render_mode is not RenderMode.THREE_D:
|
|
148
|
+
raise ValueError(
|
|
149
|
+
f"window {window_id!r} has view_direction 'free', which only "
|
|
150
|
+
f"render_mode '3d' allows"
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def validate_size(value: int) -> None:
|
|
155
|
+
"""Splitter weight: integer in [1, 2**31 - 1]; bool is rejected."""
|
|
156
|
+
# bool is a subclass of int -- rule that out explicitly so True/False
|
|
157
|
+
# don't masquerade as a valid weight.
|
|
158
|
+
if isinstance(value, bool) or not isinstance(value, int):
|
|
159
|
+
raise ValueError(f"size must be an int, got {type(value).__name__}")
|
|
160
|
+
if value < 1:
|
|
161
|
+
raise ValueError(f"size must be >= 1, got {value}")
|
|
162
|
+
if value > _INT_MAX:
|
|
163
|
+
raise ValueError(f"size must be <= {_INT_MAX}, got {value}")
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def validate_dimension_key(value: object) -> str:
|
|
167
|
+
"""Coerce a dimension key to its string form; reject anything that is
|
|
168
|
+
not a `LinkDimension` value."""
|
|
169
|
+
if isinstance(value, LinkDimension):
|
|
170
|
+
return value.value
|
|
171
|
+
if isinstance(value, str) and value in _DIMENSION_KEYS:
|
|
172
|
+
return value
|
|
173
|
+
raise ValueError(
|
|
174
|
+
f"unknown link key {value!r}; the link keys are {', '.join(_DIMENSION_KEYS)}"
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def validate_unlinkable_dimension(value: object) -> str:
|
|
179
|
+
"""The key of a dimension a window may be unlinked on; ``selection`` and
|
|
180
|
+
``time`` are refused, since every window links them."""
|
|
181
|
+
key = validate_dimension_key(value)
|
|
182
|
+
if key == LinkDimension.SELECTION.value:
|
|
183
|
+
raise ValueError(
|
|
184
|
+
f"'links.selection' cannot be removed: every window links a selection group; "
|
|
185
|
+
f"link it to another one, e.g. {DEFAULT_GROUP_NAME!r}"
|
|
186
|
+
)
|
|
187
|
+
if key == LinkDimension.TIME.value:
|
|
188
|
+
raise ValueError(
|
|
189
|
+
f"'links.time' cannot be removed: every window follows the application's time, "
|
|
190
|
+
f"linked as time: {GLOBAL_GROUP_NAME!r}"
|
|
191
|
+
)
|
|
192
|
+
return key
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def validate_link_target(dimension: str, target: object) -> str:
|
|
196
|
+
"""The target to store for a link on ``dimension``: a group name, or the
|
|
197
|
+
reserved group, written ``global`` whatever its spelling, where the
|
|
198
|
+
dimension accepts it."""
|
|
199
|
+
if not isinstance(target, str):
|
|
200
|
+
raise ValueError(
|
|
201
|
+
f"'links.{dimension}' target must be a group name string, got {type(target).__name__}"
|
|
202
|
+
)
|
|
203
|
+
if names_global_group(target):
|
|
204
|
+
if dimension not in DIMENSIONS_ACCEPTING_GLOBAL:
|
|
205
|
+
accepting = ", ".join(f"'links.{d}'" for d in _DIMENSION_KEYS if d in DIMENSIONS_ACCEPTING_GLOBAL)
|
|
206
|
+
raise ValueError(
|
|
207
|
+
f"'links.{dimension}' targets the reserved group {target!r}, which is "
|
|
208
|
+
f"accepted only on {accepting}"
|
|
209
|
+
)
|
|
210
|
+
return GLOBAL_GROUP_NAME
|
|
211
|
+
if dimension == LinkDimension.TIME.value:
|
|
212
|
+
raise ValueError(
|
|
213
|
+
f"'links.time' targets group {target!r}, but time supports only the reserved "
|
|
214
|
+
f"group {GLOBAL_GROUP_NAME!r}"
|
|
215
|
+
)
|
|
216
|
+
validate_group_name(target)
|
|
217
|
+
return target
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def _finite_number(dimension: str, value: object) -> float:
|
|
221
|
+
if isinstance(value, bool) or not isinstance(value, numbers.Real):
|
|
222
|
+
raise ValueError(
|
|
223
|
+
f"'links.{dimension}' offset must be made of numbers, got {value!r}"
|
|
224
|
+
)
|
|
225
|
+
try:
|
|
226
|
+
result = float(value)
|
|
227
|
+
except OverflowError:
|
|
228
|
+
raise ValueError(f"'links.{dimension}' offset is too large for a double") from None
|
|
229
|
+
if not math.isfinite(result):
|
|
230
|
+
raise ValueError(f"'links.{dimension}' offset must be finite, got {value!r}")
|
|
231
|
+
return result
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def validate_offset(
|
|
235
|
+
dimension: str, offset: object
|
|
236
|
+
) -> int | float | tuple[float, float] | None:
|
|
237
|
+
"""The offset to store for a link on ``dimension``: a built-in ``int``,
|
|
238
|
+
``float`` or pair of floats, or ``None`` for no offset or the identity
|
|
239
|
+
(slice 0, zoom 1, pan (0, 0)), which the format writes as the string
|
|
240
|
+
shorthand."""
|
|
241
|
+
if offset is None:
|
|
242
|
+
return None
|
|
243
|
+
offset_type = OFFSET_TYPES.get(dimension)
|
|
244
|
+
if offset_type is None:
|
|
245
|
+
accepting = ", ".join(f"'links.{d}'" for d in _DIMENSION_KEYS if d in OFFSET_TYPES)
|
|
246
|
+
raise ValueError(
|
|
247
|
+
f"'links.{dimension}' accepts no offset; offsets exist on {accepting}"
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
if offset_type == "integer":
|
|
251
|
+
# The loader takes only JSON integers, so 2.0 is refused although it
|
|
252
|
+
# names a whole slice.
|
|
253
|
+
if isinstance(offset, bool) or not isinstance(offset, numbers.Integral):
|
|
254
|
+
raise ValueError(
|
|
255
|
+
f"'links.slice' offset must be an integer (displayed slices), got {offset!r}"
|
|
256
|
+
)
|
|
257
|
+
value = int(offset)
|
|
258
|
+
if not _INT_MIN <= value <= _INT_MAX:
|
|
259
|
+
raise ValueError(
|
|
260
|
+
f"'links.slice' offset must lie in [{_INT_MIN}, {_INT_MAX}], got {value}"
|
|
261
|
+
)
|
|
262
|
+
return None if value == 0 else value
|
|
263
|
+
|
|
264
|
+
if offset_type == "positive number":
|
|
265
|
+
factor = _finite_number(dimension, offset)
|
|
266
|
+
if factor <= 0.0:
|
|
267
|
+
raise ValueError(
|
|
268
|
+
f"'links.zoom' offset must be a number > 0 (multiplicative factor), got {offset!r}"
|
|
269
|
+
)
|
|
270
|
+
return None if factor == 1.0 else factor
|
|
271
|
+
|
|
272
|
+
if isinstance(offset, (str, bytes, Mapping)) or not isinstance(offset, Iterable):
|
|
273
|
+
raise ValueError(
|
|
274
|
+
f"'links.pan' offset must be two numbers (in-plane world mm), got {offset!r}"
|
|
275
|
+
)
|
|
276
|
+
items = tuple(offset)
|
|
277
|
+
if len(items) != 2:
|
|
278
|
+
raise ValueError(
|
|
279
|
+
f"'links.pan' offset must be two numbers (in-plane world mm), got {len(items)} values"
|
|
280
|
+
)
|
|
281
|
+
pan = (_finite_number(dimension, items[0]), _finite_number(dimension, items[1]))
|
|
282
|
+
return None if pan == (0.0, 0.0) else pan
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def _lab(color: str) -> tuple[float, float, float]:
|
|
286
|
+
"""CIELAB of ``#RRGGBB`` as ``vtkMath::RGBToLab`` computes it, with its
|
|
287
|
+
rounded sRGB matrix and D65 white point, so that the band's edge is the
|
|
288
|
+
editor's."""
|
|
289
|
+
|
|
290
|
+
def linear(channel: int) -> float:
|
|
291
|
+
c = channel / 255.0
|
|
292
|
+
return ((c + 0.055) / 1.055) ** 2.4 if c > 0.04045 else c / 12.92
|
|
293
|
+
|
|
294
|
+
def f(t: float) -> float:
|
|
295
|
+
return t ** (1.0 / 3.0) if t > 0.008856 else 7.787 * t + 16.0 / 116.0
|
|
296
|
+
|
|
297
|
+
r, g, b = (linear(int(color[i:i + 2], 16)) for i in (1, 3, 5))
|
|
298
|
+
fx = f((0.4124 * r + 0.3576 * g + 0.1805 * b) / 0.9505)
|
|
299
|
+
fy = f(0.2126 * r + 0.7152 * g + 0.0722 * b)
|
|
300
|
+
fz = f((0.0193 * r + 0.1192 * g + 0.9505 * b) / 1.089)
|
|
301
|
+
return 116.0 * fy - 16.0, 500.0 * (fx - fy), 200.0 * (fy - fz)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def _in_reserved_color_band(color: str) -> bool:
|
|
305
|
+
lab = _lab(color)
|
|
306
|
+
return any(math.dist(lab, _lab(reserved)) < _RESERVED_COLOR_DISTANCE for reserved in _RESERVED_GROUP_COLORS)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def validate_group_entry(
|
|
310
|
+
name: str,
|
|
311
|
+
select_all: object,
|
|
312
|
+
color: object,
|
|
313
|
+
display_name: object,
|
|
314
|
+
) -> None:
|
|
315
|
+
"""The properties of the group entry ``name``; ``None`` means absent."""
|
|
316
|
+
if select_all is not None and not isinstance(select_all, bool):
|
|
317
|
+
raise ValueError(
|
|
318
|
+
f"groups[{name!r}].select_all must be a boolean, got {type(select_all).__name__}"
|
|
319
|
+
)
|
|
320
|
+
if color is not None and not (isinstance(color, str) and _GROUP_COLOR_RE.fullmatch(color)):
|
|
321
|
+
raise ValueError(
|
|
322
|
+
f"groups[{name!r}].color {color!r} does not match pattern {GROUP_COLOR_PATTERN!r}"
|
|
323
|
+
)
|
|
324
|
+
if color is not None and _in_reserved_color_band(color):
|
|
325
|
+
raise ValueError(
|
|
326
|
+
f"groups[{name!r}].color {color!r} is too close to the colours of the reserved group "
|
|
327
|
+
f"{GLOBAL_GROUP_NAME!r} (CIE76 distance below {_RESERVED_COLOR_DISTANCE:g} to "
|
|
328
|
+
f"{' or '.join(_RESERVED_GROUP_COLORS)}); the editor would ignore it"
|
|
329
|
+
)
|
|
330
|
+
if display_name is None:
|
|
331
|
+
return
|
|
332
|
+
if not isinstance(display_name, str) or len(display_name) < 1:
|
|
333
|
+
raise ValueError(
|
|
334
|
+
f"groups[{name!r}].name must be a non-empty string when set, got {display_name!r}"
|
|
335
|
+
)
|
|
336
|
+
if names_global_group(display_name.strip()):
|
|
337
|
+
raise ValueError(
|
|
338
|
+
f"groups[{name!r}].name {display_name!r} is the reserved group's display name"
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def validate_layout_version(value: object) -> None:
|
|
343
|
+
"""A version `MxNLayoutDocument.from_json` reads."""
|
|
344
|
+
if not isinstance(value, str) or value not in ACCEPTED_INPUT_VERSIONS:
|
|
345
|
+
raise ValueError(
|
|
346
|
+
f"document is version {value!r}; the DSL reads versions "
|
|
347
|
+
f"{', '.join(sorted(ACCEPTED_INPUT_VERSIONS))}"
|
|
348
|
+
)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
#
|
|
3
|
+
# The Medical Imaging Interaction Toolkit (MITK)
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) German Cancer Research Center (DKFZ)
|
|
6
|
+
# All rights reserved.
|
|
7
|
+
#
|
|
8
|
+
# Use of this source code is governed by a 3-clause BSD license that can be
|
|
9
|
+
# found in the LICENSE file.
|
|
10
|
+
#
|
|
11
|
+
# ============================================================================
|
|
12
|
+
|
|
13
|
+
"""Vocabulary for the `mitk.mxn.layout` DSL.
|
|
14
|
+
|
|
15
|
+
Enums, constants, and regex patterns mirroring the v3.0 schema
|
|
16
|
+
(`Modules/QtWidgets/resource/mxn-layout-v3.schema.json`), the version the DSL
|
|
17
|
+
writes. The whole package imports from here so the schema-derived strings
|
|
18
|
+
live in exactly one place.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
from enum import Enum
|
|
24
|
+
from typing import Final
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
#: The layout version the DSL writes. It also reads "2.0" documents, which it
|
|
28
|
+
#: upgrades to this version.
|
|
29
|
+
LAYOUT_VERSION: Final[str] = "3.0"
|
|
30
|
+
|
|
31
|
+
#: The selection group a window links to unless told otherwise.
|
|
32
|
+
DEFAULT_GROUP_NAME: Final[str] = "main"
|
|
33
|
+
|
|
34
|
+
#: The editor-name segment of the window ids the builders synthesise.
|
|
35
|
+
DEFAULT_EDITOR_NAME: Final[str] = "mxn"
|
|
36
|
+
|
|
37
|
+
#: Separates the editor name from the bare id in a qualified window id.
|
|
38
|
+
NAMESPACE_DELIMITER: Final[str] = "__"
|
|
39
|
+
|
|
40
|
+
#: The schema's `window.id` pattern: the qualified form
|
|
41
|
+
#: ``<editor_name>__<bare_id>``.
|
|
42
|
+
WINDOW_ID_PATTERN: Final[str] = r"^[A-Za-z][A-Za-z0-9.-]*__[A-Za-z0-9_.-]+$"
|
|
43
|
+
|
|
44
|
+
#: The schema's group-name pattern. Necessary but not sufficient: the schema
|
|
45
|
+
#: also excludes :data:`GLOBAL_GROUP_NAME` in every spelling.
|
|
46
|
+
GROUP_NAME_PATTERN: Final[str] = r"^[A-Za-z0-9_.-]+$"
|
|
47
|
+
|
|
48
|
+
#: The schema's pattern for the ``color`` of a group entry: a hex RGB string.
|
|
49
|
+
GROUP_COLOR_PATTERN: Final[str] = r"^#[0-9A-Fa-f]{6}$"
|
|
50
|
+
|
|
51
|
+
#: The reserved group, whose members follow the application's value instead
|
|
52
|
+
#: of a value of their own. It is reserved in every spelling, is never a key
|
|
53
|
+
#: of a document's groups, and is the only target of a ``time`` link; ``slice``
|
|
54
|
+
#: and ``crosshair`` links accept it besides group names.
|
|
55
|
+
GLOBAL_GROUP_NAME: Final[str] = "global"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class LinkDimension(str, Enum):
|
|
59
|
+
"""Synchronization dimension keys of a window's ``links``.
|
|
60
|
+
|
|
61
|
+
Every window links ``selection`` and ``time``; any other dimension is
|
|
62
|
+
optional, and a window without it is unlinked on that dimension. The set
|
|
63
|
+
is closed: no other key is accepted. APIs that take a dimension accept a
|
|
64
|
+
``LinkDimension`` or its string value.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
# Declared in the slot order of the MxN synchronization surfaces (the
|
|
68
|
+
# window plates and barcodes, QmitkMxNSyncAxis): how the window looks at
|
|
69
|
+
# its data, where in the data, what is shown. The DSL writes links in
|
|
70
|
+
# this order; a document may list them in any order.
|
|
71
|
+
ORIENTATION = "orientation"
|
|
72
|
+
PAN = "pan"
|
|
73
|
+
ZOOM = "zoom"
|
|
74
|
+
SLICE = "slice"
|
|
75
|
+
TIME = "time"
|
|
76
|
+
CROSSHAIR = "crosshair"
|
|
77
|
+
SELECTION = "selection"
|
|
78
|
+
WINDOWING = "windowing"
|
|
79
|
+
LUT = "lut"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class ViewDirection(str, Enum):
|
|
83
|
+
"""The direction a render window looks from. Lowercase string values
|
|
84
|
+
matching the schema's `view_direction` enum and the rest of the
|
|
85
|
+
rendering REST surface.
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
AXIAL = "axial"
|
|
89
|
+
SAGITTAL = "sagittal"
|
|
90
|
+
CORONAL = "coronal"
|
|
91
|
+
ORIGINAL = "original"
|
|
92
|
+
#: Only for 3D windows: the camera keeps the rotation the user gives it.
|
|
93
|
+
FREE = "free"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class RenderMode(str, Enum):
|
|
97
|
+
"""Whether a render window shows a 2D slice or a 3D view of the data."""
|
|
98
|
+
|
|
99
|
+
TWO_D = "2d"
|
|
100
|
+
THREE_D = "3d"
|
mitk/property_view.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
#
|
|
3
|
+
# The Medical Imaging Interaction Toolkit (MITK)
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) German Cancer Research Center (DKFZ)
|
|
6
|
+
# All rights reserved.
|
|
7
|
+
#
|
|
8
|
+
# Use of this source code is governed by a 3-clause BSD license that can be
|
|
9
|
+
# found in the LICENSE file.
|
|
10
|
+
#
|
|
11
|
+
# ============================================================================
|
|
12
|
+
|
|
13
|
+
# property_view.py: PropertyView implementation for MITK
|
|
14
|
+
# Part of WP-15: Property Interface Bindings
|
|
15
|
+
|
|
16
|
+
from collections.abc import MutableMapping, Iterator
|
|
17
|
+
from typing import Any
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class PropertyView(MutableMapping):
|
|
21
|
+
"""Live, lazy view over an object's properties.
|
|
22
|
+
|
|
23
|
+
A ``MutableMapping`` that delegates every operation to the wrapped
|
|
24
|
+
``IPropertyOwner`` (typically an :py:class:`mitk.Image` or
|
|
25
|
+
:py:class:`mitk.MultiLabelSegmentation`). It is not a snapshot: the
|
|
26
|
+
view always reflects the current state of the underlying C++ object.
|
|
27
|
+
|
|
28
|
+
Notes:
|
|
29
|
+
Reading (``view[key]``, iteration, ``in``) works for all
|
|
30
|
+
properties, both owned and provided. Writing (``view[key] =
|
|
31
|
+
val``, ``del view[key]``) only works for *owned* properties and
|
|
32
|
+
raises :py:class:`mitk.PropertyNotOwnedError` for read-only
|
|
33
|
+
(provided but not owned) properties. Use
|
|
34
|
+
``obj.property_is_owned(key)`` to check before writing.
|
|
35
|
+
|
|
36
|
+
``PropertyView`` provides no synchronization. If properties are
|
|
37
|
+
modified concurrently (for example from a C++ background
|
|
38
|
+
thread), keys obtained during iteration may become stale before
|
|
39
|
+
they are used. Callers that need a consistent snapshot should
|
|
40
|
+
copy the view into a dict: ``snapshot = dict(view.items())``.
|
|
41
|
+
|
|
42
|
+
Examples:
|
|
43
|
+
>>> img.properties["DICOM.PatientName"] = "Doe^John"
|
|
44
|
+
>>> "DICOM.PatientName" in img.properties
|
|
45
|
+
True
|
|
46
|
+
>>> for key, value in img.properties.items():
|
|
47
|
+
... print(key, value)
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
__slots__ = ("_owner",)
|
|
51
|
+
|
|
52
|
+
def __init__(self, owner: Any) -> None:
|
|
53
|
+
"""Wrap an object implementing the property-owner interface.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
owner: An object exposing ``get_property``, ``set_property``,
|
|
57
|
+
``remove_property``, and ``property_keys``.
|
|
58
|
+
"""
|
|
59
|
+
self._owner = owner
|
|
60
|
+
|
|
61
|
+
def __getitem__(self, key: str) -> Any:
|
|
62
|
+
"""Return the coerced Python value for *key*.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
key: Property name.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
``str``, ``bool``, ``int``, ``float``, an ``(r, g, b)`` tuple
|
|
69
|
+
for color properties, or a :py:class:`mitk.BaseProperty` for
|
|
70
|
+
types without a known Python equivalent.
|
|
71
|
+
|
|
72
|
+
Raises:
|
|
73
|
+
KeyError: If *key* is not set on the underlying object.
|
|
74
|
+
"""
|
|
75
|
+
prop = self._owner.get_property(key)
|
|
76
|
+
if prop is None:
|
|
77
|
+
raise KeyError(key)
|
|
78
|
+
return prop
|
|
79
|
+
|
|
80
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
81
|
+
"""Set *key* to *value* on the underlying object.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
key: Property name.
|
|
85
|
+
value: Value to store. Auto-wrapped into the appropriate
|
|
86
|
+
``BaseProperty`` subtype.
|
|
87
|
+
|
|
88
|
+
Raises:
|
|
89
|
+
PropertyNotOwnedError: If the property is provided read-only
|
|
90
|
+
(not owned) by the underlying object.
|
|
91
|
+
"""
|
|
92
|
+
self._owner.set_property(key, value)
|
|
93
|
+
|
|
94
|
+
def __delitem__(self, key: str) -> None:
|
|
95
|
+
"""Remove *key* from the underlying object.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
key: Property name.
|
|
99
|
+
|
|
100
|
+
Raises:
|
|
101
|
+
KeyError: If *key* is not set.
|
|
102
|
+
PropertyNotOwnedError: If the property is provided read-only.
|
|
103
|
+
"""
|
|
104
|
+
if self._owner.get_property(key) is None:
|
|
105
|
+
raise KeyError(key)
|
|
106
|
+
self._owner.remove_property(key)
|
|
107
|
+
|
|
108
|
+
def __contains__(self, key: object) -> bool:
|
|
109
|
+
if not isinstance(key, str):
|
|
110
|
+
return False
|
|
111
|
+
return self._owner.get_property(key) is not None
|
|
112
|
+
|
|
113
|
+
def __iter__(self) -> Iterator[str]:
|
|
114
|
+
return iter(self._owner.property_keys)
|
|
115
|
+
|
|
116
|
+
def __len__(self) -> int:
|
|
117
|
+
return len(self._owner.property_keys)
|
|
118
|
+
|
|
119
|
+
def __repr__(self) -> str:
|
|
120
|
+
keys = self._owner.property_keys
|
|
121
|
+
if len(keys) <= 5:
|
|
122
|
+
return f"PropertyView({{{', '.join(repr(k) for k in keys)}}})"
|
|
123
|
+
return f"PropertyView({len(keys)} properties)"
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Version: 1.12.0
|
|
2
|
+
Arguments: ['C:\\Users\\Stefan\\AppData\\Roaming\\Python\\Python312\\site-packages\\delvewheel\\__main__.py', 'repair', 'C:\\Users\\Stefan\\AppData\\Local\\Temp\\tmpitvefdoq\\raw\\mitk_python-2026.12rc1-cp314-cp314-win_amd64.whl', '--add-path', 'D:\\MITK-py-sb\\MITK-build\\Wrapping\\wheel\\cp314\\mitk;D:\\MITK-py-sb\\MITK-build\\bin\\Release;D:\\MITK-py-sb\\MITK-build\\lib;D:\\MITK-py-sb\\ep\\lib;D:\\MITK-py-sb\\ep\\bin;D:\\MITK-py-sb\\MITK-build\\python;D:\\MITK-py-sb\\MITK-build\\python\\Lib\\site-packages\\mitk', '--no-mangle-all', '--analyze-existing', '--exclude', 'python314.dll', '--wheel-dir', 'D:\\MITK-py-sb\\MITK-build']
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mitk-python
|
|
3
|
+
Version: 2026.12rc1
|
|
4
|
+
Summary: Python bindings for the Medical Imaging Interaction Toolkit (MITK)
|
|
5
|
+
Author: German Cancer Research Center (DKFZ)
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
17
|
+
Requires-Python: >=3.14
|
|
18
|
+
Requires-Dist: numpy>=2.0
|
|
19
|
+
Project-URL: Homepage, https://www.mitk.org
|
|
20
|
+
Project-URL: Documentation, https://mitk-python.readthedocs.io/en/latest/
|
|
21
|
+
Project-URL: Repository, https://github.com/MITK/MITK
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# mitk: Python bindings for MITK
|
|
25
|
+
|
|
26
|
+
The `mitk` package exposes the data structures and core utilities of the
|
|
27
|
+
[Medical Imaging Interaction Toolkit (MITK)](https://www.mitk.org) to Python.
|
|
28
|
+
It ships as a self-contained wheel that bundles the compiled MITK runtime
|
|
29
|
+
together with its native dependencies like ITK, VTK, and DCMTK, so
|
|
30
|
+
you can `pip install` it and start working with medical images without
|
|
31
|
+
building MITK from source.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
pip install mitk-python
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The PyPI distribution is named `mitk-python`; the import name is `mitk`.
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import mitk
|
|
45
|
+
import numpy as np
|
|
46
|
+
|
|
47
|
+
img = mitk.Image(np.zeros((64, 64, 64), dtype=np.float32), spacing=(1.0, 1.0, 2.5))
|
|
48
|
+
img.save("output.nrrd")
|
|
49
|
+
|
|
50
|
+
loaded = mitk.Image("output.nrrd")
|
|
51
|
+
print(loaded.shape, loaded.spacing, loaded.origin)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Documentation
|
|
55
|
+
|
|
56
|
+
The Python API (classes, functions, NumPy interop, file I/O, geometry,
|
|
57
|
+
properties) is documented at
|
|
58
|
+
[mitk-python.readthedocs.io/en/latest/](https://mitk-python.readthedocs.io/en/latest/).
|
|
59
|
+
|
|
60
|
+
The wider MITK stack (C++ modules, plugins, the application framework) is
|
|
61
|
+
documented at
|
|
62
|
+
[docs.mitk.org/latest/](https://docs.mitk.org/latest/).
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
MITK is available under a 3-clause BSD license.
|
|
67
|
+
Copyright (c) German Cancer Research Center (DKFZ). All rights reserved.
|