2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonOlder,
|
|
|
|
pythonAtLeast,
|
|
|
|
ninja,
|
|
|
|
ignite,
|
|
|
|
numpy,
|
|
|
|
pybind11,
|
|
|
|
torch,
|
|
|
|
which,
|
2022-08-21 13:32:41 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "monai";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "1.3.1";
|
|
|
|
pyproject = true;
|
|
|
|
# upper bound due to use of `distutils`; remove after next release:
|
|
|
|
disabled = pythonOlder "3.8" || pythonAtLeast "3.12";
|
2022-08-21 13:32:41 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Project-MONAI";
|
|
|
|
repo = "MONAI";
|
2022-10-06 18:32:54 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-YjEJbDM9+PiC3Kse8NA/b/yJBsReaK6yIyEB9uktiEc=";
|
2022-08-21 13:32:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export MAX_JOBS=$NIX_BUILD_CORES;
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
ninja
|
|
|
|
which
|
|
|
|
];
|
2022-08-21 13:32:41 +00:00
|
|
|
buildInputs = [ pybind11 ];
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
torch
|
|
|
|
ignite
|
|
|
|
];
|
2022-08-21 13:32:41 +00:00
|
|
|
|
|
|
|
BUILD_MONAI = 1;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
doCheck = false; # takes too long; tries to download data
|
2022-08-21 13:32:41 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"monai"
|
|
|
|
"monai.apps"
|
|
|
|
"monai.data"
|
|
|
|
"monai.engines"
|
|
|
|
"monai.handlers"
|
|
|
|
"monai.inferers"
|
|
|
|
"monai.losses"
|
|
|
|
"monai.metrics"
|
|
|
|
"monai.optimizers"
|
|
|
|
"monai.networks"
|
|
|
|
"monai.transforms"
|
|
|
|
"monai.utils"
|
|
|
|
"monai.visualize"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Pytorch framework (based on Ignite) for deep learning in medical imaging";
|
|
|
|
homepage = "https://github.com/Project-MONAI/MONAI";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/Project-MONAI/MONAI/releases/tag/${version}";
|
2022-08-21 13:32:41 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.bcdarwin ];
|
|
|
|
};
|
|
|
|
}
|