1{
2 lib,
3 stdenv,
4 bzip2,
5 cmake,
6 fetchurl,
7 fftw,
8 llvmPackages,
9 zlib,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "cmtk";
14 version = "3.3.2";
15
16 src = fetchurl {
17 name = "cmtk-source.tar.gz";
18 url = "https://www.nitrc.org/frs/download.php/13188/CMTK-${finalAttrs.version}-Source.tar.gz//?i_agree=1&download_now=1";
19 hash = "sha256-iE164NCOSOypZLLZfZy9RTyrS+YnY9ECqfb4QhlsMS4=";
20 };
21
22 postPatch = ''
23 substituteInPlace apps/vtkxform.cxx --replace-fail \
24 "float xyzFloat[3] = { xyz[0], xyz[1], xyz[2] };" \
25 "float xyzFloat[3] = { (float)xyz[0], (float)xyz[1], (float)xyz[2] };"
26 '';
27
28 nativeBuildInputs = [ cmake ];
29
30 buildInputs = [
31 bzip2
32 fftw
33 zlib
34 ]
35 ++ lib.optionals stdenv.cc.isClang [
36 llvmPackages.openmp
37 ];
38
39 cmakeFlags = [
40 (lib.cmakeFeature "CMAKE_CXX_STANDARD" "14")
41 ]
42 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
43 (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-Dfinite=isfinite")
44 ];
45
46 meta = with lib; {
47 description = "Computational Morphometry Toolkit";
48 mainProgram = "cmtk";
49 longDescription = ''
50 A software toolkit for computational morphometry of
51 biomedical images, CMTK comprises a set of command line tools and a
52 back-end general-purpose library for processing and I/O
53 '';
54 maintainers = with maintainers; [ tbenst ];
55 platforms = platforms.all;
56 license = licenses.gpl3Plus;
57 homepage = "https://www.nitrc.org/projects/cmtk/";
58 };
59})