projects/guix·blob python-team · refs

447 lines · 17.5 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Ricardo Wurmus <[email protected]>
3;;; Copyright © 2017 Quiliro <[email protected]>
4;;; Copyright © 2022 Petr Hodina <[email protected]>
5;;; Copyright © 2025 Jake Forster <[email protected]>
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages medical)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix build-system cmake)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system pyproject)
27 #:use-module (guix build-system qt)
28 #:use-module (guix download)
29 #:use-module (guix gexp)
30 #:use-module (guix git-download)
31 #:use-module (guix hg-download)
32 #:use-module (guix packages)
33 #:use-module (guix utils)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages bash) ; wrap-program
36 #:use-module (gnu packages boost)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages curl)
40 #:use-module (gnu packages databases)
41 #:use-module (gnu packages documentation)
42 #:use-module (gnu packages glib)
43 #:use-module (gnu packages gtk)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages image-processing)
46 #:use-module (gnu packages kde-frameworks) ; kirigami
47 #:use-module (gnu packages linux)
48 #:use-module (gnu packages lua)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages protobuf)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages python-build)
53 #:use-module (gnu packages python-crypto)
54 #:use-module (gnu packages python-web)
55 #:use-module (gnu packages python-xyz)
56 #:use-module (gnu packages qt)
57 #:use-module (gnu packages serialization)
58 #:use-module (gnu packages sqlite)
59 #:use-module (gnu packages tls)
60 #:use-module (gnu packages web)
61 #:use-module (gnu packages xml))
62
63(define-public mygnuhealth
64 (package
65 (name "mygnuhealth")
66 (version "2.2.1")
67 (source
68 (origin
69 (method url-fetch)
70 (uri (pypi-uri "MyGNUHealth" version))
71 (sha256
72 (base32 "1jcrriccqzb4jx7zayhiqmpvi3cvfy3bbf9zr3m83878f94yww8j"))))
73 (build-system pyproject-build-system)
74 (arguments
75 (list
76 #:tests? #f ; no tests.
77 #:imported-modules
78 `(,@%pyproject-build-system-modules
79 ,@%qt-build-system-modules)
80 #:modules
81 `(((guix build qt-build-system) #:prefix qt:)
82 (guix build pyproject-build-system)
83 (guix build utils))
84 #:phases
85 #~(modify-phases %standard-phases
86 (add-after 'install 'qt-wrap
87 (assoc-ref qt:%standard-phases 'qt-wrap))
88 (add-before 'check 'env-setup
89 (lambda _
90 (mkdir-p "/tmp/mygh/")
91 (setenv "HOME" "/tmp"))))))
92 (native-inputs (list python-pyside-6 python-setuptools))
93 (inputs (list bash-minimal
94 kirigami-5
95 python
96 python-bcrypt
97 python-matplotlib
98 python-requests
99 python-tinydb
100 qtbase-5
101 qtdeclarative-5
102 qtgraphicaleffects
103 qtquickcontrols-5
104 qtquickcontrols2-5
105 qtsvg-5))
106 (home-page "https://www.gnuhealth.org")
107 (synopsis "The GNU Health Personal Health Record")
108 (description
109 "This package provides GNUHealth Personal Health Record
110application for desktop and mobile devices that integrates with the GNU
111Health Federation.")
112 (license license:gpl3+)))
113
114(define-public orthanc
115 (package
116 (name "orthanc")
117 (version "1.12.10")
118 (source
119 (origin
120 (method hg-fetch)
121 (uri (hg-reference (url "https://orthanc.uclouvain.be/hg/orthanc")
122 (changeset "8628c32729cf")))
123 (file-name (hg-file-name name version))
124 (sha256
125 (base32 "16xkbs6amhx81yvn7avkg8nwha6sj55l6vipa5290yf0rgygyadr"))))
126 (build-system cmake-build-system)
127 (arguments
128 (list
129 #:configure-flags
130 #~(list (string-append "-DDCMTK_DICTIONARY_DIR="
131 #$(this-package-input "dcmtk") "/share/dcmtk-"
132 #$(package-version (this-package-input "dcmtk")))
133 ;; Building Connectivity Checks plugin requires the network.
134 "-DBUILD_CONNECTIVITY_CHECKS=OFF"
135 ;; Disable 4 tests that require the network.
136 "-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=OFF")
137 #:phases
138 #~(modify-phases %standard-phases
139 (add-after 'unpack 'chdir
140 (lambda _
141 ;; The OrthancServer/ subdirectory contains the root
142 ;; CMakeLists.txt file.
143 (chdir "OrthancServer")))
144 (add-after 'unpack 'remove-localtime-requirement
145 (lambda _
146 ;; /etc/localtime is not present in the build container;
147 ;; don't let that stop the build.
148 (substitute* "OrthancFramework/Sources/Toolbox.cpp"
149 (("if \\(!boost::filesystem::exists\\(LOCALTIME\\)\\)")
150 "if (false)"))))
151 ;; There is no test target; simply run the binary.
152 (replace 'check
153 (lambda* (#:key tests? #:allow-other-keys)
154 (when tests?
155 (invoke "./UnitTests")))))))
156 (native-inputs (list doxygen
157 glibc-utf8-locales ;for one test
158 googletest
159 python))
160 (inputs (list boost
161 civetweb
162 curl
163 dcmtk
164 jsoncpp
165 libjpeg-turbo
166 libpng
167 lua
168 openssl
169 protobuf
170 pugixml
171 `(,util-linux "lib") ;for uuid.h
172 sqlite
173 unzip))
174 (home-page "https://orthanc-server.com")
175 (synopsis
176 "Standalone @acronym{DICOM, Digital Imaging and Communications in
177Medicine} server")
178 (description
179 "Orthanc is a standalone @acronym{DICOM, Digital Imaging and
180Communications in Medicine} server with a RESTful API and plugin
181mechanism for extending its functionality.")
182 (license license:gpl3+)))
183
184(define-public orthanc-postgresql
185 ;; No tags provided.
186 (let ((changeset "81d837d7d20d")
187 (revision "0"))
188 (package
189 (name "orthanc-postgresql")
190 (version (git-version "10.0" revision changeset))
191 (source
192 (origin
193 (method hg-fetch)
194 (uri (hg-reference
195 (url "https://orthanc.uclouvain.be/hg/orthanc-databases")
196 (changeset changeset)))
197 (file-name (hg-file-name name version))
198 (sha256
199 (base32 "1ijxa8hlpxjcrcp0b54fzmxf01lqb9741bff4ak1nw24sn9z96ai"))))
200 (build-system cmake-build-system)
201 (arguments
202 (list
203 #:configure-flags
204 #~(list
205 ;; Don't try to download the Orthanc source code.
206 "-DORTHANC_FRAMEWORK_SOURCE=path"
207 (string-append "-DORTHANC_FRAMEWORK_ROOT="
208 #$(package-source (this-package-input "orthanc"))
209 "/OrthancFramework/Sources"))
210 #:phases
211 #~(modify-phases %standard-phases
212 (add-after 'unpack 'chdir
213 (lambda _
214 ;; The PostgreSQL/ subdirectory contains the root
215 ;; CMakeLists.txt file.
216 (chdir "PostgreSQL")))
217 ;; There is no test target; simply run the binary.
218 (replace 'check
219 (lambda* (#:key tests? #:allow-other-keys)
220 (when tests?
221 ;; The tests rely on a PostgreSQL test server
222 ;; being available.
223 (let ((pgdata "/tmp/pgdata")
224 (host "/tmp")
225 (port "5432")
226 ;; This username is hard-coded in tests.
227 (username "postgres")
228 (password "")
229 (database "orthanctest"))
230 (invoke "initdb" pgdata)
231 (invoke "pg_ctl" "-D" pgdata
232 "-o" (string-append "-k " host)
233 "start")
234 (invoke "createdb" "-h" host database)
235 (invoke "createuser" "-h" host username)
236 ;; The tests include managing Large Objects.
237 (invoke "psql" "-h" host "-d" database "-c"
238 (string-append "ALTER ROLE " username
239 " WITH SUPERUSER;"))
240 (invoke "./UnitTests" host port username password
241 database))))))))
242 (native-inputs
243 (list googletest
244 python))
245 (inputs
246 (list boost-1.83
247 jsoncpp
248 openssl
249 orthanc
250 postgresql
251 protobuf
252 unzip
253 (list util-linux "lib") ; <uuid.h>
254 zlib))
255 (home-page "https://orthanc-server.com")
256 (synopsis "PostgreSQL plugins for Orthanc")
257 (description
258 "This package provides plugins to use PostgreSQL as the database
259backend of an Orthanc @acronym{DICOM, Digital Imaging and Communications in
260Medicine} server instead of SQLite.")
261 (license license:agpl3+))))
262
263(define-public orthanc-mysql
264 ;; No tags provided.
265 (let ((changeset "a6300ccf6683")
266 (revision "0"))
267 (package
268 (name "orthanc-mysql")
269 (version (git-version "5.2" revision changeset))
270 (source
271 (origin
272 (method hg-fetch)
273 (uri (hg-reference
274 (url "https://orthanc.uclouvain.be/hg/orthanc-databases")
275 (changeset changeset)))
276 (file-name (hg-file-name name version))
277 (sha256
278 (base32 "0hi3bawj117lk7lrxpa6h7vq4hx9jwqb3m5pwn3726hnf4kmp4jc"))))
279 (build-system cmake-build-system)
280 (arguments
281 (list
282 #:configure-flags
283 #~(list
284 ;; Don't try to download the Orthanc source code.
285 "-DORTHANC_FRAMEWORK_SOURCE=path"
286 (string-append "-DORTHANC_FRAMEWORK_ROOT="
287 #$(package-source (this-package-input "orthanc"))
288 "/OrthancFramework/Sources"))
289 #:phases
290 #~(modify-phases %standard-phases
291 (add-after 'unpack 'chdir
292 (lambda _
293 ;; The MySQL/ subdirectory contains the root CMakeLists.txt
294 ;; file.
295 (chdir "MySQL")))
296 (add-after 'unpack 'fix-mysql-include-path
297 (lambda* (#:key inputs #:allow-other-keys)
298 ;; Help it find mysql.h, either from mysql in this package or
299 ;; from mariadb:dev in orthanc-mariadb.
300 (substitute* "Resources/CMake/MariaDBConfiguration.cmake"
301 (("/usr/include/mysql")
302 (search-input-directory inputs "include/mysql")))))
303 ;; There is no test target; simply run the binary.
304 (replace 'check
305 (lambda* (#:key tests? #:allow-other-keys)
306 (when tests?
307 ;; The tests rely on a MySQL or MariaDB test server
308 ;; being available.
309 (let ((datadir "/tmp/mysql")
310 (socket "/tmp/mysql/mysqld.sock")
311 (username "root")
312 (password "")
313 (database "orthanctest"))
314 (invoke "mysqld" "--initialize-insecure"
315 (string-append "--datadir=" datadir))
316 (spawn "mysqld"
317 (list
318 "mysqld"
319 ;; Respect '--datadir'.
320 "--no-defaults"
321 (string-append "--datadir=" datadir)
322 (string-append "--socket=" socket)
323 ;; For one test.
324 "--max_allowed_packet=32m"))
325 (sleep 1)
326 (invoke "mysql"
327 (string-append "--socket=" socket)
328 "-u" username
329 "-e" "CREATE DATABASE orthanctest;")
330 (invoke "./UnitTests" socket username password
331 database))))))))
332 (native-inputs
333 (list googletest
334 python))
335 (inputs
336 (list boost-1.83
337 curl
338 jsoncpp
339 mysql
340 openssl
341 orthanc
342 protobuf
343 unzip
344 (list util-linux "lib") ; <uuid.h>
345 zlib))
346 (home-page "https://orthanc-server.com")
347 (synopsis "MySQL plugins for Orthanc")
348 (description
349 "This package provides plugins to use MySQL or MariaDB as the database
350backend of an Orthanc @acronym{DICOM, Digital Imaging and Communications in
351Medicine} server instead of SQLite.")
352 (license license:agpl3+))))
353
354;; Provide this variant without MySQL to save MariaDB users ~340 MiB
355;; of disk space.
356(define-public orthanc-mariadb
357 (package/inherit orthanc-mysql
358 (name "orthanc-mariadb")
359 (arguments
360 (substitute-keyword-arguments arguments
361 ((#:phases phases)
362 #~(modify-phases #$phases
363 (replace 'check
364 (lambda* (#:key tests? #:allow-other-keys)
365 (when tests?
366 ;; The tests rely on a MySQL or MariaDB test server
367 ;; being available.
368 (let ((datadir "/tmp/mysql")
369 (socket "/tmp/mysql/mysqld.sock")
370 (username "root")
371 (password "")
372 (database "orthanctest"))
373 (invoke "mariadb-install-db"
374 (string-append "--datadir=" datadir)
375 "--auth-root-authentication-method=normal")
376 (spawn "mysqld"
377 (list
378 "mysqld"
379 ;; Respect '--datadir'.
380 "--no-defaults"
381 (string-append "--datadir=" datadir)
382 (string-append "--socket=" socket)
383 ;; For one test.
384 "--max-allowed-packet=32m"))
385 (sleep 1)
386 (invoke "mysql"
387 (string-append "--socket=" socket)
388 "-u" username
389 "-e" "CREATE DATABASE orthanctest;")
390 (invoke "./UnitTests" socket username password
391 database)))))))))
392 (native-inputs (modify-inputs native-inputs
393 (prepend mariadb))) ;for tests
394 (inputs (modify-inputs inputs
395 (delete "mysql")
396 (prepend `(,mariadb "dev")
397 `(,mariadb "lib"))))
398 (synopsis "MariaDB plugins for Orthanc")))
399
400(define-public xmedcon
401 (package
402 (name "xmedcon")
403 (version "0.26.1")
404 (source
405 (origin
406 (method git-fetch)
407 (uri (git-reference
408 (url "git://git.code.sf.net/p/xmedcon/code")
409 (commit (string-append "Version-"
410 (string-replace-substring version "." "_")))))
411 (file-name (git-file-name name version))
412 (sha256
413 (base32 "0vgq5jckvfjiq22041irzz85dvc986gbynz6dzl240fwy2xxqz6w"))))
414 (build-system gnu-build-system)
415 (arguments
416 (list
417 #:configure-flags
418 #~(list "--disable-static"
419 (string-append "--with-nifti-prefix="
420 #$(this-package-input "nifticlib")))))
421 (inputs (list glib gtk+ libpng nifticlib))
422 (native-inputs (list pkg-config))
423 (home-page "https://xmedcon.sourceforge.io")
424 (synopsis "Medical image conversion utility")
425 (description
426 "@acronym{(X)MedCon, Medical Image Conversion} can be used to convert
427between different file formats used in medical imaging. The supported formats
428are @acronym{ACR, American College of Radiology}-@acronym{NEMA, National
429Electrical Manufacturers Association} 2.0, Analyze (@acronym{SPM, Statistical
430Parametric Mapping}), Concorde/μPET, @acronym{DICOM, Digital Imaging and
431Communications in Medicine} 3.0, CTI ECAT 6/7, @acronym{NIfTI, Neuroimaging
432Informatics Technology Initiative}-1, Interfile 3.3, @acronym{PNG, Portable
433Network Graphics}, and @acronym{GIF, Graphics Interchange Format}87a/89a.
434This package includes a command-line utility (@code{medcon}) and a GTK+ based
435GUI application (@code{xmedcon}).")
436 (license license:lgpl2.0+)))
437
438(define-public xmedcon-minimal
439 (package/inherit xmedcon
440 (name "xmedcon-minimal")
441 (arguments
442 (substitute-keyword-arguments arguments
443 ((#:configure-flags flags #~'())
444 #~(append (list "--disable-glib" "--disable-gui") #$flags))))
445 (inputs (modify-inputs inputs
446 (delete "glib" "gtk+")))
447 (synopsis "Medical image conversion utility (variant with CLI only)")))