2022-03-23 18:38:03 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2018-01-15 06:19:20 +01:00
|
|
|
, fetchFromGitHub
|
2022-04-04 16:40:40 +02:00
|
|
|
, substituteAll
|
2018-01-15 06:19:20 +01:00
|
|
|
, cmake
|
2022-03-23 18:38:03 +01:00
|
|
|
, openjpeg
|
|
|
|
, libyamlcpp
|
|
|
|
, batchVersion ? false
|
|
|
|
, withJpegLs ? true
|
|
|
|
, withOpenJpeg ? true
|
2022-04-04 16:40:40 +02:00
|
|
|
, withCloudflareZlib ? true
|
2018-01-15 06:19:20 +01:00
|
|
|
}:
|
|
|
|
|
2022-04-04 16:40:40 +02:00
|
|
|
let
|
|
|
|
cloudflareZlib = fetchFromGitHub {
|
|
|
|
owner = "ningfei";
|
|
|
|
repo = "zlib";
|
|
|
|
# HEAD revision of the gcc.amd64 branch on 2022-04-14. Reminder to update
|
|
|
|
# whenever bumping package version.
|
|
|
|
rev = "fda61188d1d4dcd21545c34c2a2f5cc9b0f5db4b";
|
|
|
|
sha256 = "sha256-qySFwY0VI2BQLO2XoCZeYshXEDnHh6SmJ3MvcBUROWU=";
|
|
|
|
};
|
|
|
|
in
|
2018-01-15 07:53:28 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2021-10-29 11:34:20 +02:00
|
|
|
version = "1.0.20211006";
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "dcm2niix";
|
2018-01-15 06:19:20 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rordenlab";
|
|
|
|
repo = "dcm2niix";
|
2018-01-15 07:53:28 +01:00
|
|
|
rev = "v${version}";
|
2021-10-29 11:34:20 +02:00
|
|
|
sha256 = "sha256-fQAVOzynMdSLDfhcYWcaXkFW/mnv4zySGLVJNE7ql/c=";
|
2018-01-15 06:19:20 +01:00
|
|
|
};
|
|
|
|
|
2022-04-04 16:40:40 +02:00
|
|
|
patches = lib.optionals withCloudflareZlib [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./dont-fetch-external-libs.patch;
|
|
|
|
inherit cloudflareZlib;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
2022-03-23 18:38:03 +01:00
|
|
|
buildInputs = lib.optionals batchVersion [ libyamlcpp ]
|
2022-04-04 16:40:40 +02:00
|
|
|
++ lib.optionals withOpenJpeg [ openjpeg openjpeg.dev ];
|
2022-03-23 18:38:03 +01:00
|
|
|
|
|
|
|
cmakeFlags = lib.optionals batchVersion [
|
2022-04-04 16:40:40 +02:00
|
|
|
"-DBATCH_VERSION=ON"
|
|
|
|
"-DYAML-CPP_DIR=${libyamlcpp}/lib/cmake/yaml-cpp"
|
|
|
|
] ++ lib.optionals withJpegLs [
|
|
|
|
"-DUSE_JPEGLS=ON"
|
|
|
|
] ++ lib.optionals withOpenJpeg [
|
|
|
|
"-DUSE_OPENJPEG=ON"
|
|
|
|
"-DOpenJPEG_DIR=${openjpeg}/lib/${openjpeg.pname}-${lib.versions.majorMinor openjpeg.version}"
|
|
|
|
] ++ lib.optionals withCloudflareZlib [
|
|
|
|
"-DZLIB_IMPLEMENTATION=Cloudflare"
|
|
|
|
];
|
2018-01-15 06:19:20 +01:00
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-10-26 05:08:40 +01:00
|
|
|
description = "DICOM to NIfTI converter";
|
2018-01-15 06:19:20 +01:00
|
|
|
longDescription = ''
|
2022-04-04 17:10:38 +02:00
|
|
|
dcm2niix is designed to convert neuroimaging data from the DICOM format to the NIfTI format.
|
2018-01-15 06:19:20 +01:00
|
|
|
'';
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.nitrc.org/projects/dcm2nii";
|
2018-01-15 07:53:28 +01:00
|
|
|
license = licenses.bsd3;
|
2022-04-04 17:10:38 +02:00
|
|
|
maintainers = with maintainers; [ ashgillman rbreslow ];
|
2018-01-15 07:53:28 +01:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
2018-01-15 06:19:20 +01:00
|
|
|
}
|