Skip to content

Commit

Permalink
vtk: add vtk-dicom module
Browse files Browse the repository at this point in the history
  • Loading branch information
kurnevsky committed Dec 15, 2024
1 parent ee9eb08 commit 0bd079b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkgs/development/libraries/vtk/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
libXt,
libpng,
libtiff,
gdcm,
fetchpatch,
fetchFromGitHub,
enableQt ? false,
qtx11extras,
qttools,
Expand All @@ -25,6 +27,7 @@
enablePython ? false,
python ? throw "vtk: Python support requested, but no python interpreter was given.",
enableEgl ? false,
enableVtkDicom ? true
}:

let
Expand All @@ -43,6 +46,18 @@ stdenv.mkDerivation {
sha256 = sourceSha256;
};

preConfigure = let
vtk-dicom = fetchFromGitHub {
owner = "dgobbi";
repo = "vtk-dicom";
rev = "v0.8.17";
sha256 = "sha256-1lI2qsV4gymWqjeouEHZ5FRlmlh9vimH7J5rzA+eOds=";
};
in ''
cp -r ${vtk-dicom} ./Remote/vtkDICOM
chmod -R +w ./Remote/vtkDICOM
'';

nativeBuildInputs = [ cmake ];

buildInputs =
Expand All @@ -64,6 +79,8 @@ stdenv.mkDerivation {
]
++ optionals enablePython [
python
] ++ optionals enableVtkDicom [
(gdcm.override { enableVTK = false; })
];
propagatedBuildInputs = optionals stdenv.hostPlatform.isLinux [
libX11
Expand Down Expand Up @@ -117,6 +134,11 @@ stdenv.mkDerivation {
++ optionals enablePython [
"-DVTK_WRAP_PYTHON:BOOL=ON"
"-DVTK_PYTHON_VERSION:STRING=${pythonMajor}"
]
++ optionals enableVtkDicom [
# Allows to read compressed dicom files:
# https://dgobbi.github.io/vtk-dicom/doc/api/installation.html
"-DUSE_GDCM=ON"
];

env = lib.optionalAttrs stdenv.cc.isClang {
Expand Down

0 comments on commit 0bd079b

Please sign in to comment.