2020-05-15 21:57:56 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2022-09-09 14:08:57 +00:00
|
|
|
, pythonOlder
|
|
|
|
, pytestCheckHook
|
2020-05-15 21:57:56 +00:00
|
|
|
, gdcm
|
|
|
|
, nibabel
|
|
|
|
, numpy
|
|
|
|
, pydicom
|
|
|
|
, scipy
|
2021-02-24 18:30:23 +00:00
|
|
|
, setuptools
|
2020-05-15 21:57:56 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "dicom2nifti";
|
2022-09-09 14:08:57 +00:00
|
|
|
version = "2.4.3";
|
|
|
|
disabled = pythonOlder "3.6";
|
2020-05-15 21:57:56 +00:00
|
|
|
|
|
|
|
# no tests in PyPI dist
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "icometrix";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2022-09-09 14:08:57 +00:00
|
|
|
hash = "sha256-za2+HdnUhPu3+p29JsF4iL1lyPQVmEv3fam0Yf1oeMQ=";
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
propagatedBuildInputs = [ gdcm nibabel numpy pydicom scipy setuptools ];
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
# 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"
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "dicom2nifti" ];
|
2020-05-15 21:57:56 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/icometrix/dicom2nifti";
|
|
|
|
description = "Library for converting dicom files to nifti";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ bcdarwin ];
|
|
|
|
};
|
|
|
|
}
|