From 26a32ab5c8a8cd0caa958c28ba80aa7778cc3d68 Mon Sep 17 00:00:00 2001 From: Evgeny Kurnevsky Date: Wed, 5 Jun 2024 04:27:23 +0200 Subject: [PATCH] vtk: add vtk-dicom module --- pkgs/development/libraries/vtk/generic.nix | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pkgs/development/libraries/vtk/generic.nix b/pkgs/development/libraries/vtk/generic.nix index c67b4b843aad2e..a682d79e955423 100644 --- a/pkgs/development/libraries/vtk/generic.nix +++ b/pkgs/development/libraries/vtk/generic.nix @@ -16,7 +16,9 @@ libXt, libpng, libtiff, + gdcm, fetchpatch, + fetchFromGitHub, enableQt ? false, qtx11extras, qttools, @@ -25,6 +27,7 @@ enablePython ? false, python ? throw "vtk: Python support requested, but no python interpreter was given.", enableEgl ? false, + enableVtkDicom ? true, }: let @@ -43,6 +46,20 @@ 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 = @@ -64,6 +81,9 @@ stdenv.mkDerivation { ] ++ optionals enablePython [ python + ] + ++ optionals enableVtkDicom [ + (gdcm.override { enableVTK = false; }) ]; propagatedBuildInputs = optionals stdenv.hostPlatform.isLinux [ libX11 @@ -117,6 +137,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 {