1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 pytestCheckHook,
7 numpy,
8 pillow,
9 pydicom,
10 pylibjpeg,
11 pylibjpeg-libjpeg,
12 pylibjpeg-openjpeg,
13 setuptools,
14 typing-extensions,
15}:
16
17let
18 test_data = fetchFromGitHub {
19 owner = "pydicom";
20 repo = "pydicom-data";
21 rev = "cbb9b2148bccf0f550e3758c07aca3d0e328e768";
22 hash = "sha256-nF/j7pfcEpWHjjsqqTtIkW8hCEbuQ3J4IxpRk0qc1CQ=";
23 };
24in
25buildPythonPackage rec {
26 pname = "highdicom";
27 version = "0.26.1";
28 pyproject = true;
29
30 disabled = pythonOlder "3.10";
31
32 src = fetchFromGitHub {
33 owner = "MGHComputationalPathology";
34 repo = "highdicom";
35 tag = "v${version}";
36 hash = "sha256-zaa0daGMQHktYkG56JA2a7s5UZSv8AbinO5roe9rWQc=";
37 };
38
39 build-system = [
40 setuptools
41 ];
42
43 dependencies = [
44 numpy
45 pillow
46 pydicom
47 typing-extensions
48 ];
49
50 optional-dependencies = {
51 libjpeg = [
52 pylibjpeg
53 pylibjpeg-libjpeg
54 pylibjpeg-openjpeg
55 ];
56 };
57
58 pythonRemoveDeps = [
59 "pyjpegls" # not directly used
60 ];
61
62 nativeCheckInputs = [ pytestCheckHook ] ++ optional-dependencies.libjpeg;
63 preCheck = ''
64 export HOME=$TMP/test-home
65 mkdir -p $HOME/.pydicom/
66 ln -s ${test_data}/data_store/data $HOME/.pydicom/data
67 '';
68
69 disabledTests = [
70 # require pyjpegls
71 "test_construction_10"
72 "test_jpegls_monochrome"
73 "test_jpegls_rgb"
74 "test_jpeglsnearlossless_monochrome"
75 "test_jpeglsnearlossless_rgb"
76 "test_multi_frame_sm_image_ushort_encapsulated_jpegls"
77 "test_monochrome_jpegls"
78 "test_monochrome_jpegls_near_lossless"
79 "test_rgb_jpegls"
80 "test_construction_autotile"
81 "test_pixel_types_fractional"
82 "test_pixel_types_labelmap"
83 ];
84
85 pythonImportsCheck = [
86 "highdicom"
87 "highdicom.legacy"
88 "highdicom.ann"
89 "highdicom.ko"
90 "highdicom.pm"
91 "highdicom.pr"
92 "highdicom.seg"
93 "highdicom.sr"
94 "highdicom.sc"
95 ];
96
97 # updates the wrong fetcher
98 passthru.skipBulkUpdate = true;
99
100 meta = {
101 description = "High-level DICOM abstractions for Python";
102 homepage = "https://highdicom.readthedocs.io";
103 changelog = "https://github.com/ImagingDataCommons/highdicom/releases/tag/v${version}";
104 license = lib.licenses.mit;
105 maintainers = with lib.maintainers; [ bcdarwin ];
106 };
107}