1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 gdcm,
11 nibabel,
12 numpy,
13 pydicom,
14 scipy,
15
16 # tests
17 pillow,
18 pylibjpeg,
19 pylibjpeg-libjpeg,
20 pytestCheckHook,
21}:
22
23buildPythonPackage rec {
24 pname = "dicom2nifti";
25 version = "2.6.2";
26 pyproject = true;
27
28 # no tests in PyPI dist
29 src = fetchFromGitHub {
30 owner = "icometrix";
31 repo = "dicom2nifti";
32 tag = version;
33 hash = "sha256-VS1ad7sAgVWkFkTPLxzloj0dvweW5wqBlQpFqD9uZLs=";
34 };
35
36 postPatch = ''
37 substituteInPlace tests/test_generic.py --replace-fail "from common" "from dicom2nifti.common"
38 substituteInPlace tests/test_ge.py --replace-fail "import convert_generic" "import dicom2nifti.convert_generic as convert_generic"
39 '';
40
41 build-system = [ setuptools ];
42
43 dependencies = [
44 gdcm
45 nibabel
46 numpy
47 pydicom
48 scipy
49 ];
50
51 pythonImportsCheck = [ "dicom2nifti" ];
52
53 nativeCheckInputs = [
54 pillow
55 pylibjpeg
56 pylibjpeg-libjpeg
57 pytestCheckHook
58 ];
59
60 disabledTests = [
61 # OverflowError: Python integer -1024 out of bounds for uint16
62 "test_not_a_volume"
63 "test_resampling"
64 "test_validate_orthogonal_disabled"
65
66 # RuntimeError: Unable to decompress 'JPEG 2000 Image Compression (Lossless O...
67 "test_anatomical"
68 "test_compressed_j2k"
69 "test_main_function"
70 "test_rgb"
71
72 # Missing script 'dicom2nifti_scrip'
73 "test_gantry_option"
74 "test_gantry_resampling"
75 ];
76
77 meta = {
78 homepage = "https://github.com/icometrix/dicom2nifti";
79 description = "Library for converting dicom files to nifti";
80 mainProgram = "dicom2nifti";
81 license = lib.licenses.mit;
82 maintainers = with lib.maintainers; [ bcdarwin ];
83 };
84}