1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 hatchling,
9
10 # dependencies
11 deprecated,
12 einops,
13 matplotlib,
14 nibabel,
15 numpy,
16 packaging,
17 rich,
18 scipy,
19 simpleitk,
20 torch,
21 tqdm,
22 typer,
23
24 # tests
25 humanize,
26 parameterized,
27 pytestCheckHook,
28}:
29
30buildPythonPackage rec {
31 pname = "torchio";
32 version = "0.20.17";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "TorchIO-project";
37 repo = "torchio";
38 tag = "v${version}";
39 hash = "sha256-kZCbQGIkWmlXl25UviPrSDo0swCjWnvTTkBnxGI0Y7U=";
40 };
41
42 build-system = [
43 hatchling
44 ];
45
46 dependencies = [
47 deprecated
48 einops
49 humanize
50 nibabel
51 numpy
52 packaging
53 rich
54 scipy
55 simpleitk
56 torch
57 tqdm
58 typer
59 ];
60
61 nativeCheckInputs = [
62 matplotlib
63 parameterized
64 pytestCheckHook
65 ];
66
67 disabledTests = [
68 # tries to download models:
69 "test_load_all"
70 ]
71 ++ lib.optionals stdenv.hostPlatform.isAarch64 [
72 # RuntimeError: DataLoader worker (pid(s) <...>) exited unexpectedly
73 "test_queue_multiprocessing"
74 ];
75
76 pythonImportsCheck = [
77 "torchio"
78 "torchio.data"
79 ];
80
81 meta = {
82 description = "Medical imaging toolkit for deep learning";
83 homepage = "https://torchio.readthedocs.io";
84 changelog = "https://github.com/TorchIO-project/torchio/blob/${src.tag}/CHANGELOG.md";
85 license = lib.licenses.asl20;
86 maintainers = [ lib.maintainers.bcdarwin ];
87 };
88}