1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, pytestCheckHook
6, gdcm
7, nibabel
8, numpy
9, pydicom
10, scipy
11, setuptools
12}:
13
14buildPythonPackage rec {
15 pname = "dicom2nifti";
16 version = "2.4.8";
17 disabled = pythonOlder "3.6";
18
19 # no tests in PyPI dist
20 src = fetchFromGitHub {
21 owner = "icometrix";
22 repo = pname;
23 rev = version;
24 hash = "sha256-2Pspxdeu3pHwXpbjS6bQQnvdeMuITRwYarPuLlmNcv8";
25 };
26
27 propagatedBuildInputs = [ gdcm nibabel numpy pydicom scipy setuptools ];
28
29 # python-gdcm just builds the python interface provided by the "gdcm" package, so
30 # we should be able to replace "python-gdcm" with "gdcm" but this doesn't work
31 # (similar to https://github.com/NixOS/nixpkgs/issues/84774)
32 postPatch = ''
33 substituteInPlace setup.py --replace "python-gdcm" ""
34 substituteInPlace tests/test_generic.py --replace "from common" "from dicom2nifti.common"
35 '';
36
37 nativeCheckInputs = [ pytestCheckHook ];
38
39 pythonImportsCheck = [ "dicom2nifti" ];
40
41 meta = with lib; {
42 homepage = "https://github.com/icometrix/dicom2nifti";
43 description = "Library for converting dicom files to nifti";
44 license = licenses.mit;
45 maintainers = with maintainers; [ bcdarwin ];
46 };
47}