2021-06-28 23:13:55 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, enableVTK ? true
|
2023-04-29 16:46:19 +00:00
|
|
|
, vtk
|
2021-06-28 23:13:55 +00:00
|
|
|
, ApplicationServices
|
|
|
|
, Cocoa
|
2023-04-29 16:46:19 +00:00
|
|
|
, libiconv
|
2021-06-28 23:13:55 +00:00
|
|
|
, enablePython ? false
|
2021-08-05 21:33:18 +00:00
|
|
|
, python ? null
|
2023-11-16 04:20:00 +00:00
|
|
|
, swig4
|
|
|
|
, expat
|
|
|
|
, libuuid
|
|
|
|
, openjpeg
|
|
|
|
, zlib
|
|
|
|
, pkg-config
|
2021-06-28 23:13:55 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gdcm";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "3.0.24";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "malaterre";
|
|
|
|
repo = "GDCM";
|
2023-04-29 16:46:19 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-Zlb6UCP4aFZOJJNhFQBBrwzst+f37gs1zaCBMTOUgZE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DGDCM_BUILD_APPLICATIONS=ON"
|
|
|
|
"-DGDCM_BUILD_SHARED_LIBS=ON"
|
2023-05-24 13:37:59 +00:00
|
|
|
"-DGDCM_BUILD_TESTING=ON"
|
2023-11-16 04:20:00 +00:00
|
|
|
"-DGDCM_USE_SYSTEM_EXPAT=ON"
|
|
|
|
"-DGDCM_USE_SYSTEM_ZLIB=ON"
|
|
|
|
"-DGDCM_USE_SYSTEM_UUID=ON"
|
|
|
|
"-DGDCM_USE_SYSTEM_OPENJPEG=ON"
|
2023-04-29 16:46:19 +00:00
|
|
|
# hack around usual "`RUNTIME_DESTINATION` must not be an absolute path" issue:
|
|
|
|
"-DCMAKE_INSTALL_LIBDIR=lib"
|
|
|
|
"-DCMAKE_INSTALL_BINDIR=bin"
|
|
|
|
"-DCMAKE_INSTALL_INCLUDEDIR=include"
|
2021-06-28 23:13:55 +00:00
|
|
|
] ++ lib.optionals enableVTK [
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DGDCM_USE_VTK=ON"
|
2021-06-28 23:13:55 +00:00
|
|
|
] ++ lib.optionals enablePython [
|
2020-07-18 16:06:22 +00:00
|
|
|
"-DGDCM_WRAP_PYTHON:BOOL=ON"
|
|
|
|
"-DGDCM_INSTALL_PYTHONMODULE_DIR=${placeholder "out"}/${python.sitePackages}"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
buildInputs = [
|
|
|
|
expat
|
|
|
|
libuuid
|
|
|
|
openjpeg
|
|
|
|
zlib
|
|
|
|
] ++ lib.optionals enableVTK [
|
2023-04-29 16:46:19 +00:00
|
|
|
vtk
|
2021-06-28 23:13:55 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
ApplicationServices
|
|
|
|
Cocoa
|
2023-04-29 16:46:19 +00:00
|
|
|
libiconv
|
2023-11-16 04:20:00 +00:00
|
|
|
] ++ lib.optionals enablePython [ swig4 python ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
disabledTests = [
|
|
|
|
# require networking:
|
|
|
|
"TestEcho"
|
|
|
|
"TestFind"
|
|
|
|
"gdcmscu-echo-dicomserver"
|
|
|
|
"gdcmscu-find-dicomserver"
|
|
|
|
# seemingly ought to be be disabled when the test data submodule is not present:
|
|
|
|
"TestvtkGDCMImageReader2_3"
|
|
|
|
"TestSCUValidation"
|
|
|
|
# errors because 3 classes not wrapped:
|
|
|
|
"TestWrapPython"
|
2024-01-02 11:29:13 +00:00
|
|
|
] ++ lib.optionals (stdenv.isAarch64 && stdenv.isLinux) [
|
|
|
|
"TestRescaler2"
|
2023-05-24 13:37:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
ctest --exclude-regex '^(${lib.concatStringsSep "|" disabledTests})$'
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
doCheck = true;
|
|
|
|
# note that when the test data is available to the build via `fetchSubmodules = true`,
|
|
|
|
# a number of additional but much slower tests are enabled
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "The grassroots cross-platform DICOM implementation";
|
|
|
|
longDescription = ''
|
|
|
|
Grassroots DICOM (GDCM) is an implementation of the DICOM standard designed to be open source so that researchers may access clinical data directly.
|
|
|
|
GDCM includes a file format definition and a network communications protocol, both of which should be extended to provide a full set of tools for a researcher or small medical imaging vendor to interface with an existing medical database.
|
|
|
|
'';
|
2023-02-02 18:25:31 +00:00
|
|
|
homepage = "https://gdcm.sourceforge.net/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = with licenses; [ bsd3 asl20 ];
|
2021-06-28 23:13:55 +00:00
|
|
|
maintainers = with maintainers; [ tfmoraes ];
|
2023-04-29 16:46:19 +00:00
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|