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