GithubHelp home page GithubHelp logo

biomedia / mirtk Goto Github PK

View Code? Open in Web Editor NEW
181.0 181.0 71.0 6.83 MB

The Medical Image Registration ToolKit (MIRTK), the successor of the IRTK, contains common CMake build configuration files, core libraries, and basic command-line tools. Extension packages are hosted by the MIRTK GitHub group at

Home Page: https://github.com/MIRTK

License: Apache License 2.0

CMake 7.65% Python 1.41% Shell 0.17% C++ 90.46% C 0.26% Batchfile 0.01% Dockerfile 0.04%
ffd free-form-deformation image-processing image-registration medical-imaging toolkit

mirtk's People

Contributors

amakropoulos avatar aschuh-hf avatar baiwenjia avatar bkainz avatar ghisvail avatar gitter-badger avatar jcupitt avatar lisurui6 avatar probonopd avatar schuhschuh avatar stefanpsz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mirtk's Issues

Add function to parse common point set command options

Common options for commands that write point sets to VTK files:

    if (OPTION("-ascii" ) || OPTION("-nobinary")) ascii = true;
    else if (OPTION("-binary") || OPTION("-noascii" )) ascii = false;
    else if (OPTION("-compress"))   compress = true;
    else if (OPTION("-nocompress")) compress = false;

Could be added to mirtkPointSetUtils.h as the boolean ascii and compress flags are passed on to WritePointSet or WritePolyData, respectively.

Corresponding help output code for copy-and-paste later:

  cout << "  -ascii/-binary   Write legacy VTK in ASCII or binary format. (default: binary)" << endl;
  cout << "  -[no]compress    Write XML VTK file with or without compression. (default: compress)" << endl;

"mirtk" script configuration cache out of date

When CMake variables are changed after the first build, the MIRTK_BINARY_DIR/CMakeFiles/mirtk.dir/cache.cmake file is not updated with the new values from MIRTK_BINARY_DIR/CMakeFiles/mirtk.dir/cache.cmake.in. This can result in incorrect paths in the mirtk script. See also this BASIS issue.

Wrong argument parsing in convert-image.cc

Hi

I was having problems rescaling images using mirtk-convert-image. On close inspection I found out that, for some reason the option parsing looks like this

if (OPTION("-char") == 0) do something

changing them to

if (OPTION("-char")) do something

solved all my problems

CMake error and warning in Windows

I'm trying to compile MIRTK in Windows and I get the following error and warning in CMake:

CMake Error at CMake/Settings.cmake:50 (set_property):
set_property could not find CACHE variable CMAKE_BUILD_TYPE. Perhaps it
has not yet been created.
Call Stack (most recent call first):
CMake/Basis/ProjectTools.cmake:1895 (include)
CMake/Basis/ProjectTools.cmake:2303 (basis_initialize_settings)
CMakeLists.txt:74 (basis_project_begin)

CMake Warning at CMakeLists.txt:84 (message):
MIRTK wrapper script not implemented for Windows

but the process continues until the end. Subsequently pressing "Generate" just replicates the same behaviour and does not produce any MSVS Solution as output.

Document build of FLANN

Building FLANN 1.8.4 with Visual Studio 2015 (and apparently also earlier versions, including the minimum required version to build MIRTK itself, i.e., VS 2013) produces a compiler error. The solution can be found in this SO thread. The following few lines have to be added to src\cpp\flann\util\serialization.h:92:

#ifdef _MSC_VER
BASIC_TYPE_SERIALIZER(unsigned __int64);
#endif

Add support for NIfTI-2

Enable the NiftiImageReader to read NIfTI-2 files. Possibly modify the NiftiImageWriter to use NIfTI-2 when the image is larger in one dimension than the maximum short value allows. The MIRTK has a limit imposed by the maximum int value, which can (must) be assumed to be less than the int64_t range supported by NIfTI-2.

When making this change, recognise when a file is CIFTI instead (cf. #150). The NiftiCLib possibly already cannot read CIFTI because these are not NIfTI-1 files.

Add further options (-binarize, -percentile-threshold) to calculate command

The calculate command already provides a good set of operations and statistics, but a few that might be useful are missing, for example, to threshold the data using a percentile value. Also, binarizing a sequence is not intuitive with the current mask/threshold/inside/outside options.

  • Intuitive option to binarize a data sequence
  • Percentile threshold
  • Option to select segmentation labels
  • Reset mask
  • Considering renaming the current -threshold* options to -clamp* ?
  • -threshold-outside 0 100 keeps only values in [0 100], and -threshold-outside 100 0 keeps only values not inside this interval, i.e., those inside the "inverse" interval [-inf 0] union [100 +inf].

Extend convert-dof

The convert-dofcommand should be able to convert from/to the following formats:

  • FSL
  • ITK / image
  • FreeSurfer (affine, .xfm)
  • Write transformation (FFD) to CSV table for import in STAR-CCM+ GUI.
  • Convert to SV or TD FFD.

Add evaluate-similarity command

This command evaluates the similarity of two, optionally transformed, intensity images. It is the equivalent of the IRTK evaluation tool. Move SI computation from evaluate-overlap to evaluate-similarity. The evaluate-overlap command is for comparison of (registered) segmentation masks only.

Download and build zlib when not available

The zlib code is in a GitHub repository with CMakeLists.txt files. Thus, it should be easy to optionally download the files and build them as part of MIRTK when not available on the system. Further, do not include zlib.h in any MIRTK header file, only use it internally. This is currently not the case for mirtkCifstream.h and mirtkCofstream.h.

Document patch of GnuWin32 ZLIB zconf.h header, unistd.h

The zconf.h header file of the ZLIB library installed from the GnuWin32 project on Windows includes unistd.h even when it is not available on Windows. There exists a bug report that hasn't been taken care of for many years. The header file can be edited as administrator at line 287 as follows:

#if defined(HAVE_UNISTD_H) && HAVE_UNISTD_H
#  include <sys/types.h>
#  include <unistd.h>
// ...
#endif

Automated Docker image build

The automated Docker image build yet fails on Docker Hub. I have submitted a support request and will update this issue if there is any news. Until this issue is resolved, I pushed a Docker image created from the current develop branch HEAD commit 0d4a071 to schuhschuh/mirtk. It can be used instead of biomedia/mirtk until the automated build issue is resolved.

One of the problems could be that the build of VTK is extremely slow with only a single thread. Also for the CI with Travis it would be good to have a binary VTK package in a PPA for installation on Ubuntu 14.04 compiled with C++11. I looked into the Ubuntu vtk6 source package and think it could be used as basis for such package with just the addition of the compiler flag (CMAKE_CXX_FLAGS=-std=c++11) to the CMake command in debian/rules. In the meantime, it might be easier to just pack the libraries in an archive file and upload them somewhere such as to bintray.com.

Extend and simplify installation instructions

Comments from @ledigchr by email:

The installation page is currently a bit less clear. Perhaps it would be good to provide an example of how to build mirtk without understanding cmake?

E.g. cmake ..; make -j 8; worked for me on Linux.

A user might not know how to run the cmake gui? On my Mac there is no command line command ‘cmake’, here I need to download cmake and run it from the applications.

How to discover VTK version >= 6 without VTKConfigVersion.cmake issues

The VTKConfigVersion.cmake file requires since version 6 that the major version number matches exactly the requested (minimum) version. This is very uncommon behavior and changes the meaning of the VERSION argument of find_package. So far, it was a "minimum required" version. Now it is more like a "exact major version" match. IMHO, that's a mistake on VTK's end. When somebody has VTK 7 already, they are now seeing still an error when setting DEPENDS_VTK_DIR that version 6 is required. Version 7 is not accepted by CMake because it is marked as not compatible with version 6 by VTKConfigVersion.cmake. One solution is to not request any particular VTK version in the CMake files of MIRTK, but only mention the minimum required version in the documentation.

Applications must initialise required object factories (when build statically)

In the main function of each command, the following functions defined in mirtkInitialization.h have to be called before the respective object factories are used:

  // Initialize object factories
  RegisterImageReaders();
  RegisterImageWriters();
  RegisterImageSimilarities();
  RegisterPointSetForces();
  RegisterPointSetDistances();
  RegisterTransformationConstraints();
  RegisterOptimizers();

Ensure that all applications initialise their respectively used factories. These function calls do nothing when the libraries were linked dynamically. But the library providing the object types must be listed as link dependency.

Do not read .nii CIFTI-2 file as NIfTI-2 image

A CIFTI-2 file has an intent code in the range 3000-3099 and an extension with code name NIFTI_ECODE_CIFTI and value 32. Moreover, dimensions 1-4 are not used by CIFTI as these are for space and time. Such .nii file should not be read as normal NIfTI image. As long as CIFTI is not supported, we will simply have no reader for these files.

Add SDM tools to MIRTK

Hi

Since the new release of MIRTK supports registration using SDMs, I though it might be useful that it provides the tool that, given an irtkMatrix and an irtkVector files, generates an SDM file in the format that ireg needs to perform such type of registration. The attached file contains the .cc file I wrote for that purpose, unfortunately it has the old-style handling of command line input parameters, let me know if you need help writing the translation. Additionally, I included some MATLAB scripts for reading/writing of irtkMatrix and irtkVector files to/from MATLAB matrices and vectors in case you might want to include them as well, it is up to you.

SDM.zip

Rename or change WINDOWS define in ```mirtkConfig.h```

The WINDOWS macro defined in mirtkConfig.h differs from the more commonly used WINDOWS define when building libraries on Windows. See for example zconf.h (cf. #142). Either we change it from:

#ifndef WINDOWS
#  define WINDOWS defined(_WINDOWS) || defined(_WIN32) || defined(_WIN64) || defined(WIN32)
#define 

// use
#if WINDOWS
  // Windows code
#else
  // Unix code
#endif

to the more common (similar to the compiler define _WINDOWS):

#ifndef WINDOWS
#  if defined(_WINDOWS) || defined(_WIN32) || defined(_WIN64) || defined(WIN32)
#    define WINDOWS
#  endif
#endif

// use
#ifdef WINDOWS
  // Windows code
#else
  // Unix code
#endif

or prefix the macro name with MIRTK_SYSTEM_IS_ or something similar:

#ifndef MIRTK_SYSTEM_IS_WINDOWS
#  define MIRTK_SYSTEM_IS_WINDOWS defined(_WINDOWS) || defined(_WIN32) || defined(_WIN64) || defined(WIN32)
#define 

// use
#if MIRTK_SYSTEM_IS_WINDOWS
  // Windows code
#else
  // Unix code
#endif

Add citation of Daniel's TMI 2003 paper

Add to section related to statistical FFD:

[1] Rueckert et al., Automatic construction of 3-D statistical deformation
    models of the brain using nonrigid registration, IEEE TMI, 22(8), 1014–25 (2003)

Fix tests

The following tests require input data that is currently not set up:

  • Modules/Image/test/testConvolutionFunction.cc
  • Modules/Image/test/testDownsampling.cc
  • Modules/PointSet/test/testEdgeTable.cc

Consider use of Git LFS for storage of test data files

The following tests have to be rewritten to use gtest:

  • Modules/Image/test/testInterpolateExtrapolateImageFunction.cc

The following tests fail:

  • Modules/Numerics/test/testPolynomial.cc

Add files of Documentation module to top-level project

Now that the HTML files are in a separate MIRTK/mirtk.github.io repository, the .rst source files can be added directly to the top-level project. No need to keep the documentation in a separate repository. Should make the maintenance easier.

Document usage of "mirtk" script

Add a section describing the usage of the MIRTK commands by means of executing the mirtk script. Also explain how the Bash completions are being enabled.

Extend FindTBB CMake BASIS module

The current module doesn't find the TBB libraries on Windows by itself. There is also a nicer and presumably better module available in one of the Kitware GitHub organisation's repositories. See also this post to the cmake-developers mailing list. Possibly improve the script in a way that allows upstream contribution to CMake itself (CMake BASIS in the meantime).

Install and optionally include BASIS Modules in CMakeLists.txt of packages

The CMake BASIS Modules are required by the MIRTK Packages. It should be possible to build these packages separately by only pointing CMake to an existing MIRTK installation without the need of a separate CMake BASIS installation in this case. This installation must then also contain the BASIS Modules as another component of the MIRTK installation. The top-level CMakeLists.txt of a MIRTK Package would then be:

cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)

if (NOT COMMAND basis_project_impl)
  find_package(MIRTK COMPONENTS BASIS)
endif ()

basis_project_impl()

where the MIRTKConfig.cmake file includes the required CMake BASIS Modules when the BASIS component is requested (explicitly). When the MIRTK Package is included in the MIRTK source tree (i.e., under the Packages/ directory), the find_package call is skipped because the CMake BASIS Modules were already included by the root CMakeLists.txt of the MIRTK project. Other dependencies of the MIRTK Package, such as other MIRTK modules, are declared in the BasisProject.cmake file and discovered during the basis_project_impl call.

missing break

Modules\Registration\src\mirtkNormalizedIntensityCrossCorrelation.cc

line 1139 - 1141: case without break

LocalOptimizer::New segfault

When the factory returns a nullptr, the LocalOptimizer::New function segfaults. It should raise an error when this happens.

Segmentation fault in GenericRegistrationFilter::InitializePyramid

Hi,

I am trying to get mirtk work under my ubuntu 64bit machine. I was able to compile the source. But when I run the register command I get a "segmentation fault" error. This is what I run

mirtk register image0.nii image1.nii -parin a.par -dofout out.txt

I tracked the error down to a tbb function call
parallel_for(pyramid, resample);
at line 2393 of
Modules/Registration/src/mirtkGenericRegistrationFilter.cc

I recompiled with the WITH_TBB config option, but the issue persisted.

Can anyone help me?
Thanks.

"mirtk help commands" to list available commands with brief description

The mirtk help commands output could contain an overview of available commands with a brief description similar to the information on the overview page of the online documentation. A text file could be installed with this information which is then simply read and printed by the mirtk help commands command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.