2022-09-01 17:49:38 +00:00
|
|
|
{ version, rev, sourceSha256 }:
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, makeWrapper
|
2021-11-03 19:16:40 +00:00
|
|
|
, pkg-config, libX11, libuuid, xz, vtk, Cocoa }:
|
2010-03-01 23:31:35 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-13 15:08:04 +00:00
|
|
|
pname = "itk";
|
2022-09-01 17:49:38 +00:00
|
|
|
inherit version;
|
2010-03-01 23:31:35 +00:00
|
|
|
|
itk: enable additional modules
Enable MGHIO, GenericLabelInterpolator, and AdaptiveDenoising ITK modules,
which are required by current versions of ANTs (e.g. 2.3.5 and 2.4.0);
see, e.g., https://github.com/ANTsX/ANTs/issues/1353#issuecomment-1117462739,
the Gentoo ANTs package, or the ANTs SuperBuild itself.
Updating ANTs will, in particular, allow removal of itk4 and vtk_7 from Nixpkgs.
Unfortunately, these ANTs releases do not build against the version of ITK (5.2.1)
current in tree, so we need to either add another ITK 5.x version or wait until ITK
is bumped to 5.3.x (currently still in beta) in Nixpkgs.
2022-08-15 03:29:02 +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=";
|
|
|
|
};
|
|
|
|
|
2019-08-13 15:08:04 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "InsightSoftwareConsortium";
|
|
|
|
repo = "ITK";
|
2022-09-01 17:49:38 +00:00
|
|
|
inherit rev;
|
|
|
|
sha256 = sourceSha256;
|
2010-03-01 23:31:35 +00:00
|
|
|
};
|
|
|
|
|
2020-10-15 23:12:18 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace CMake/ITKSetStandardCompilerFlags.cmake \
|
|
|
|
--replace "-march=corei7" "" \
|
|
|
|
--replace "-mtune=native" ""
|
itk: enable additional modules
Enable MGHIO, GenericLabelInterpolator, and AdaptiveDenoising ITK modules,
which are required by current versions of ANTs (e.g. 2.3.5 and 2.4.0);
see, e.g., https://github.com/ANTsX/ANTs/issues/1353#issuecomment-1117462739,
the Gentoo ANTs package, or the ANTs SuperBuild itself.
Updating ANTs will, in particular, allow removal of itk4 and vtk_7 from Nixpkgs.
Unfortunately, these ANTs releases do not build against the version of ITK (5.2.1)
current in tree, so we need to either add another ITK 5.x version or wait until ITK
is bumped to 5.3.x (currently still in beta) in Nixpkgs.
2022-08-15 03:29:02 +00:00
|
|
|
ln -sr ${itkGenericLabelInterpolatorSrc} Modules/External/ITKGenericLabelInterpolator
|
|
|
|
ln -sr ${itkAdaptiveDenoisingSrc} Modules/External/ITKAdaptiveDenoising
|
2020-10-15 23:12:18 +00:00
|
|
|
'';
|
|
|
|
|
2014-03-15 00:18:17 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_EXAMPLES=OFF"
|
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
itk: enable additional modules
Enable MGHIO, GenericLabelInterpolator, and AdaptiveDenoising ITK modules,
which are required by current versions of ANTs (e.g. 2.3.5 and 2.4.0);
see, e.g., https://github.com/ANTsX/ANTs/issues/1353#issuecomment-1117462739,
the Gentoo ANTs package, or the ANTs SuperBuild itself.
Updating ANTs will, in particular, allow removal of itk4 and vtk_7 from Nixpkgs.
Unfortunately, these ANTs releases do not build against the version of ITK (5.2.1)
current in tree, so we need to either add another ITK 5.x version or wait until ITK
is bumped to 5.3.x (currently still in beta) in Nixpkgs.
2022-08-15 03:29:02 +00:00
|
|
|
"-DITK_FORBID_DOWNLOADS=ON"
|
2017-09-26 21:59:53 +00:00
|
|
|
"-DModule_ITKMINC=ON"
|
2017-03-02 01:55:42 +00:00
|
|
|
"-DModule_ITKIOMINC=ON"
|
2017-09-26 21:59:53 +00:00
|
|
|
"-DModule_ITKIOTransformMINC=ON"
|
2017-03-02 01:55:42 +00:00
|
|
|
"-DModule_ITKVtkGlue=ON"
|
|
|
|
"-DModule_ITKReview=ON"
|
itk: enable additional modules
Enable MGHIO, GenericLabelInterpolator, and AdaptiveDenoising ITK modules,
which are required by current versions of ANTs (e.g. 2.3.5 and 2.4.0);
see, e.g., https://github.com/ANTsX/ANTs/issues/1353#issuecomment-1117462739,
the Gentoo ANTs package, or the ANTs SuperBuild itself.
Updating ANTs will, in particular, allow removal of itk4 and vtk_7 from Nixpkgs.
Unfortunately, these ANTs releases do not build against the version of ITK (5.2.1)
current in tree, so we need to either add another ITK 5.x version or wait until ITK
is bumped to 5.3.x (currently still in beta) in Nixpkgs.
2022-08-15 03:29:02 +00:00
|
|
|
"-DModule_MGHIO=ON"
|
|
|
|
"-DModule_AdaptiveDenoising=ON"
|
|
|
|
"-DModule_GenericLabelInterpolator=ON"
|
2014-03-14 22:28:49 +00:00
|
|
|
];
|
2010-03-01 23:31:35 +00:00
|
|
|
|
2020-04-27 17:28:48 +00:00
|
|
|
nativeBuildInputs = [ cmake xz makeWrapper ];
|
2021-11-03 19:16:40 +00:00
|
|
|
buildInputs = [ libX11 libuuid vtk ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];
|
2020-04-27 17:28:48 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
2021-01-19 06:50:56 +00:00
|
|
|
wrapProgram "$out/bin/h5c++" --prefix PATH ":" "${pkg-config}/bin"
|
2020-04-27 17:28:48 +00:00
|
|
|
'';
|
2010-03-01 23:31:35 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Insight Segmentation and Registration Toolkit";
|
2020-04-27 17:28:48 +00:00
|
|
|
homepage = "https://www.itk.org/";
|
2021-01-21 17:00:13 +00:00
|
|
|
license = lib.licenses.asl20;
|
|
|
|
maintainers = with lib.maintainers; [viric];
|
2010-03-01 23:31:35 +00:00
|
|
|
};
|
|
|
|
}
|