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