2022-09-09 14:08:57 +00:00
|
|
|
{ version, rev, sourceSha256 }:
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, makeWrapper
|
2021-12-06 16:07:01 +00:00
|
|
|
, pkg-config, libX11, libuuid, xz, vtk, Cocoa }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
let
|
2022-09-09 14:08:57 +00:00
|
|
|
itkGenericLabelInterpolatorSrc = fetchFromGitHub {
|
|
|
|
owner = "InsightSoftwareConsortium";
|
|
|
|
repo = "ITKGenericLabelInterpolator";
|
|
|
|
rev = "2f3768110ffe160c00c533a1450a49a16f4452d9";
|
|
|
|
hash = "sha256-Cm3jg14MMnbr/sP+gqR2Rh25xJjoRvpmY/jP/DKH978=";
|
|
|
|
};
|
|
|
|
|
|
|
|
itkAdaptiveDenoisingSrc = fetchFromGitHub {
|
|
|
|
owner = "ntustison";
|
|
|
|
repo = "ITKAdaptiveDenoising";
|
|
|
|
rev = "24825c8d246e941334f47968553f0ae388851f0c";
|
|
|
|
hash = "sha256-deJbza36c0Ohf9oKpO2T4po37pkyI+2wCSeGL4r17Go=";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
itkSimpleITKFiltersSrc = fetchFromGitHub {
|
|
|
|
owner = "InsightSoftwareConsortium";
|
|
|
|
repo = "ITKSimpleITKFilters";
|
|
|
|
rev = "bb896868fc6480835495d0da4356d5db009592a6";
|
|
|
|
hash = "sha256-MfaIA0xxA/pzUBSwnAevr17iR23Bo5iQO2cSyknS3o4=";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "itk";
|
|
|
|
inherit version;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "InsightSoftwareConsortium";
|
|
|
|
repo = "ITK";
|
2022-09-09 14:08:57 +00:00
|
|
|
inherit rev;
|
|
|
|
sha256 = sourceSha256;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace CMake/ITKSetStandardCompilerFlags.cmake \
|
|
|
|
--replace "-march=corei7" "" \
|
|
|
|
--replace "-mtune=native" ""
|
2022-12-28 21:21:41 +00:00
|
|
|
substituteInPlace Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/src/lib/openjp2/libopenjp2.pc.cmake.in \
|
|
|
|
--replace "@OPENJPEG_INSTALL_LIB_DIR@" "@OPENJPEG_INSTALL_FULL_LIB_DIR@"
|
2022-09-09 14:08:57 +00:00
|
|
|
ln -sr ${itkGenericLabelInterpolatorSrc} Modules/External/ITKGenericLabelInterpolator
|
|
|
|
ln -sr ${itkAdaptiveDenoisingSrc} Modules/External/ITKAdaptiveDenoising
|
2023-04-12 12:48:02 +00:00
|
|
|
ln -sr ${itkSimpleITKFiltersSrc} Modules/External/ITKSimpleITKFilters
|
2020-10-16 20:44:37 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_EXAMPLES=OFF"
|
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
2022-09-09 14:08:57 +00:00
|
|
|
"-DITK_FORBID_DOWNLOADS=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DModule_ITKMINC=ON"
|
|
|
|
"-DModule_ITKIOMINC=ON"
|
|
|
|
"-DModule_ITKIOTransformMINC=ON"
|
2023-04-12 12:48:02 +00:00
|
|
|
"-DModule_SimpleITKFilters=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DModule_ITKVtkGlue=ON"
|
|
|
|
"-DModule_ITKReview=ON"
|
2022-09-09 14:08:57 +00:00
|
|
|
"-DModule_MGHIO=ON"
|
|
|
|
"-DModule_AdaptiveDenoising=ON"
|
|
|
|
"-DModule_GenericLabelInterpolator=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
nativeBuildInputs = [ cmake xz makeWrapper ];
|
2021-12-06 16:07:01 +00:00
|
|
|
buildInputs = [ libX11 libuuid vtk ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
|
2023-02-02 18:25:31 +00:00
|
|
|
# Due to ITKVtkGlue=ON and the additional dependencies needed to configure VTK 9
|
|
|
|
# (specifically libGL and libX11 on Linux),
|
|
|
|
# it's now seemingly necessary for packages that configure ITK to
|
|
|
|
# also include configuration deps of VTK, even if VTK is not required or available.
|
|
|
|
# These deps were propagated from VTK 9 in https://github.com/NixOS/nixpkgs/pull/206935,
|
|
|
|
# so we simply propagate them again from ITK.
|
|
|
|
# This admittedly is a hack and seems like an issue with VTK 9's CMake configuration.
|
|
|
|
propagatedBuildInputs = vtk.propagatedBuildInputs;
|
2020-05-15 21:57:56 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
2021-02-05 17:12:51 +00:00
|
|
|
wrapProgram "$out/bin/h5c++" --prefix PATH ":" "${pkg-config}/bin"
|
2020-05-15 21:57:56 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Insight Segmentation and Registration Toolkit";
|
2023-04-12 12:48:02 +00:00
|
|
|
homepage = "https://www.itk.org";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.asl20;
|
|
|
|
maintainers = with lib.maintainers; [viric];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|