about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/dicom2nifti/default.nix
blob: 8c716135a104f867bce04e80b513c6df9917cead (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, pytestCheckHook
, gdcm
, nibabel
, numpy
, pydicom
, scipy
, setuptools
}:

buildPythonPackage rec {
  pname = "dicom2nifti";
  version = "2.4.8";
  format = "setuptools";
  disabled = pythonOlder "3.6";

  # no tests in PyPI dist
  src = fetchFromGitHub {
    owner = "icometrix";
    repo = pname;
    rev = version;
    hash = "sha256-2Pspxdeu3pHwXpbjS6bQQnvdeMuITRwYarPuLlmNcv8";
  };

  propagatedBuildInputs = [ gdcm nibabel numpy pydicom scipy setuptools ];

  # python-gdcm just builds the python interface provided by the "gdcm" package, so
  # we should be able to replace "python-gdcm" with "gdcm" but this doesn't work
  # (similar to https://github.com/NixOS/nixpkgs/issues/84774)
  postPatch = ''
    substituteInPlace setup.py --replace "python-gdcm" ""
    substituteInPlace tests/test_generic.py --replace "from common" "from dicom2nifti.common"
  '';

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "dicom2nifti" ];

  meta = with lib; {
    homepage = "https://github.com/icometrix/dicom2nifti";
    description = "Library for converting dicom files to nifti";
    license = licenses.mit;
    maintainers = with maintainers; [ bcdarwin ];
  };
}