Git Product home page Git Product logo

ants's Introduction

ci-docker Docker Pulls Downloads Anaconda-Server Badge PubMed Contributor Covenant

ants template

Advanced Normalization Tools (ANTs) is a C++ library available through the command line that computes high-dimensional mappings to capture the statistics of brain structure and function. It allows one to organize, visualize and statistically explore large biomedical image sets. Additionally, it integrates imaging modalities in space + time and works across species or organ systems with minimal customization.

The ANTs library is considered a state-of-the-art medical image registration and segmentation toolkit which depends on the Insight ToolKit, a widely used medical image processing library to which ANTs developers contribute. ANTs-related tools have also won several international, unbiased competitions such as MICCAI, BRATS, and STACOM.

It is possible to use ANTs in R (ANTsR) and Python (ANTsPy), with additional functionality for deep learning in R (ANTsRNet) and Python (ANTsPyNet). These libraries help integrate ANTs with the broader R / Python ecosystem.


Installation

Quick links: download binaries | build from source | docker | conda.

Pre-compiled binaries

The easiest way to install ANTs is by downloading the latest binaries on the Releases page. Download the latest release under the "Assets" section, then unzip the archive. Next, add the ANTs library to your PATH:

export PATH=/path/to/ants/bin:$PATH

You can check that this worked by running a command to find the path to any ANTs function:

which antsRegistration

If that works, you should be able to use the full functionality of ANTs from the command line or bash. You may wish to control multi-threading by setting the environment variable ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS.

Building from source

When necessary, you can also build ANTs from the latest source code. A minimal example on Linux / Mac looks like this:

workingDir=${PWD}
git clone https://github.com/ANTsX/ANTs.git
mkdir build install
cd build
cmake \
    -DCMAKE_INSTALL_PREFIX=${workingDir}/install \
    ../ANTs 2>&1 | tee cmake.log
make -j 4 2>&1 | tee build.log
cd ANTS-build
make install 2>&1 | tee install.log

More details and a full downloadable installation script can be found in the Linux/MacOS Guide. Building from source will generally work on Windows as well with some additional steps explained in the Windows Guide. Alternatively, it is also possible to install ANTs via Docker or Conda.


Code examples

ANTs is a flexible library that can be used for a variety of applications and areas. Below is a collection of example scripts that - with a little effort - can be adapted to fit your specific needs. Some examples also include code for ANTsR or ANTsPy.

Registration

  • Basic registration [Link]
  • Basic registration with mask [Link]
  • Large deformation [Link]
  • Asymmetry [Link]
  • Automobile registration [Link]
  • Point-set mapping [Link]
  • Global optimization [Link]

Template construction

  • Brain template [Link]
  • Single subject template [Link]
  • "Cooking" tissue priors for templates [Link]

Cortical thickness

  • Basic cortical thickness [Link]
  • Chimpanzee example [Link]

Segmentation

  • N4 bias correction + Atropos [Link]
  • Brain tumor segmentation [Link]

Brain

  • Basic brain mapping [Link]
  • Brain extraction [Link]
  • Multi-atlas joint label/intensity fusion [Link, Link] (credit: @chsasank)
  • fMRI or Motion Correction [Link]
  • fMRI reproducibility [Link]
  • Partial EPI slab to T1 image registration [Link]

See also our pre-built ANTs templates with spatial priors available for download [General, MNI].

Lung

  • CT lung registration [Link]
  • Lung mask registration [Link]
  • Lung and lobe estimation [Link]
  • Lung ventilation-based segmentation [Link]

Cardiac

  • Basic example [Link]

Other

  • Patch-based super-resolution [Link]
  • Image denoising [Link]
  • Morphing [Link]

Learning resources

There are many different resources for learning about how to use ANTs functions and the methodology behind them. A selected list of useful resources is provided here.

  • ANTs Wiki [Link]
  • ANTs Documentation [Link]
  • ANTs Tutorials [Link]

Some commonly visited tutorials for specific ANTs functions are also presented below.

  • Using antsRegistration [Link]
  • Applying warps with antsApplyTransforms [Link]
  • Using antsCorticalThickness [Link]
  • Using N4BiasFieldCorrection [Link]
  • Multi-modality Presentation [Link]

Contributing

If you have a question, feature request, or bug report the best way to get help is by posting an issue on the GitHub page. Please remember that it is difficult to provide any help if you do not provide enough information to reproduce your issue or environment.

We welcome any new contributions and ideas to improve ANTs. If you want to contribute code, the best way to get started is by reading through the Wiki to get an understanding of the project or by posting an issue.


Team

Development of ANTs is led by Brian B. Avants (Creator, Algorithm Design, Implementation), Nicholas J. Tustison (Compeller, Algorithm Design, Implementation Guru), Hans J. Johnson (Large-Scale Application, Testing, Software design), Gang Song (Originator), Philip A. Cook, Jeffrey T. Duda (DTI), Ben M. Kandel (Perfusion, multivariate analysis), and Nick Cullen (Python, R).


References

A large collection of journal articles have been published using ANTs software and can be found by searching Google Scholar or PubMed. Below, we provide a curated list of the most relevant articles to be used as a guide for better understanding or citing ANTs.

Image Registration

Symmetric diffeomorphic image registration with cross-correlation: evaluating automated labeling of elderly and neurodegenerative brain. Med Image Anal (2008). [Link]

Evaluation of 14 nonlinear deformation algorithms applied to human brain MRI registration. Neuroimage (2009). [Link]

Evaluation of registration methods on thoracic CT: the EMPIRE10 challenge. IEEE Trans Med Imaging (2011). [Link]

A reproducible evaluation of ANTs similarity metric performance in brain image registration. Neuroimage (2011). [Link]

Templates

The optimal template effect in hippocampus studies of diseased populations. Neuroimage (2010). [Link]

Image Segmentation

An open source multivariate framework for n-tissue segmentation with evaluation on public data. Neuroinformatics (2011). [Link]

Multi-atlas segmentation with joint label fusion and corrective learning—an open source implementation. Front Neuroinform (2013). [Link]

Bias Correction

N4ITK: improved N3 bias correction. IEEE Trans Med Imaging (2010). [Link]

Cortical Thickness

Registration based cortical thickness measurement. Neuroimage (2009). [Link]

Large-scale evaluation of ANTs and FreeSurfer cortical thickness measurements. Neuroimage (2014). [Link]

Regional and hemispheric variation in cortical thickness in chimpanzees. J Neurosci (2013). [Link]

Longitudinal Mapping of Cortical Thickness Measurements: An Alzheimer's Disease Neuroimaging Initiative-Based Evaluation Study. J Alzheimers Dis (2019). [Link]

Eigenanatomy

Eigenanatomy improves detection power for longitudinal cortical change. Med Image Comput Comput Assist Interv (2012). [Link]

White matter imaging helps dissociate tau from TDP-43 in frontotemporal lobar degeneration. J Neurol Neurosurg Psychiatry (2013). [Link]

Software

The ANTsX ecosystem for quantitative biological and medical imaging. Scientific Reports (2021). [Link]

ANTsX neuroimaging-derived structural phenotypes of UK Biobank. Scientific Reports (2024). [Link]

Funding

Current support comes from R01-EB031722. Previous support includes R01-EB006266-01 and K01-ES025432-01.

ants's People

Contributors

adrienkaiser avatar aghayoor avatar andife avatar armaneshaghi avatar baowu avatar bkandel avatar br-cpvc avatar celstark avatar cgschwarzmayo avatar chrisgorgo avatar cookpa avatar dzenanz avatar gdevenyi avatar ghisvail avatar hjmjohnson avatar ignatenkobrain avatar jeffduda avatar jennydaman avatar mattcieslak avatar muschellij2 avatar ntraut avatar ntustison avatar nvstrien avatar paramveerdhillon avatar rbarnard avatar songgang avatar spinicist avatar stnava avatar vfonov avatar yarikoptic 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  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

ants's Issues

antsMotionCorr time-shift error

There appears to be a problem in antsMotionCorr that causes the data from the first time-point to disappear while data from the last time point appears twice. So for an image of time-points [1,2,3,4,5,6] the output is [2,3,4,5,6,6]. The last two output time-points images aren't identical suggesting that different transforms are being used but applied to the same input image.

remove boost dependency

Can we remove the boost dependency?

It was introduced for ANTsR but i've managed to remove the need for it and all references to antscout.

Does anything else depend on boost and, if not, what is the right way to remove it from our super build?

cmake doesn't find system fftw

The build system uses find_package to search for fftw, but neither cmake nor ANTS do provide the needed FFTWconfig.cmake or fftw-config.cmake.

I would suggest to use pkg-config instead:

--- a/ANTS.cmake
+++ b/ANTS.cmake
@@ -48,8 +48,9 @@ option(ITK_USE_FFTWF "Use single precision fftw if found" OFF)
 option(ITK_USE_SYSTEM_FFTW "Use an installed version of fftw" OFF)
 if (ITK_USE_FFTWD OR ITK_USE_FFTWF)
   if(ITK_USE_SYSTEM_FFTW)
-      find_package( FFTW )
-      link_directories(${FFTW_LIBDIR})
+      Find_Package(PkgConfig)
+      pkg_check_modules(FFTWD fftw3 REQUIRED)
+      link_directories(${FFTWD_LIBRARY_DIRS})
   else(ITK_USE_SYSTEM_FFTW)
       link_directories(${ITK_DIR}/fftw/lib)
       include_directories(${ITK_DIR}/fftw/include)

Is Boost really necessary?

Building Boost is a significant percentage of the time required to build ANTs, and yet Boost is only used in one place: ANTs/Temporary/antscout.hxx

Furthermore the class ants_Sink is only used to define a single boost::iostream::stream, which is used for output.

Honestly this looks as though it could be re-implemented without Boost fairly simply, which would simplify building ANTs.

Is there any reason to keep Boost hanging around, like if there was some future plan to use a more substantive feature of boost?

Register 2D images via translation

I'm struggling to find the right set of parameters to register 2 2D images with a translation. After many iterations I have something like this now:

antsRegistration -d 2 -m "MeanSquares[$fixed,$moving]" -t Translation[0.2] -c "[10000x111110x11110,1.e-8,30]" -s 4x2x1 -f 6x4x2 -l 1 -o "[$pre,$nifti,$nifti_inverse]"

This fails (no points found to overlap), however replacing it with Affine works but gives an incorrect result.

Any hints or suggestions on how to do this correctly?

Thanks!
Ryan

Could NOT find zlib??

Hi, I am a noob trying to compile ANTs using cmake and the compiler says I am missing ZLIB_LIBRARY. I have pasted the log below.
-- SuperBuild - ANTS => Requires ITKv4,
-- SuperBuild - ITKv4[OK]
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindZLIB.cmake:85 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
SuperBuild/External_ITKv4.cmake:105 (find_package)
CMake/SlicerMacroCheckExternalProjectDependency.cmake:69 (include)
SuperBuild.cmake:200 (SlicerMacroCheckExternalProjectDependency)
CMakeLists.txt:51 (include)

-- Configuring incomplete, errors occurred!
CMake Error: Unable to open check cache file for write. /home/mig128gb1/Desktop/antsbin/CMakeFiles/cmake.check_cache

Could you please help on this?

rigid registration with rotation restricted to single axis

Dear ANTS developer,

I would like to rigidly register two 3D images, where the rotation could be restricted to a single axis (say the x-axis). I would appreciate it if you can direct me to the source code which handles that so I can try to modify the code.
Thanks in advance !!

Best Regards,
YIYU

2.0.0 FTBFS now -- sample data file is N/A from www.itk.org/files any longer

[ 92%] Generating /tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/ExternalData/TestData/Data/r16slice.nii.gz
cd /tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/Examples/TestSuite && /usr/bin/cmake -Drelative_top=/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu -Dfile=/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/ExternalData/TestData/Data/r16slice.nii.gz -Dname=/tmp/buildd/ants-2.0.0/TestData/Data/r16slice.nii.gz -Dext=.md5 -DExternalData_ACTION=fetch -DExternalData_CONFIG=/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/Examples/TestSuite/ANTSFetchData_config.cmake -P /tmp/buildd/ants-2.0.0/BuildScripts/ExternalData.cmake
-- Fetching "file:////tmp/buildd/ants-2.0.0/.ExternalData/MD5/37aaa33029410941bf4affff0479fa18"
-- Fetching "http://slicer.kitware.com/midas3/api/rest?method=midas.bitstream.download&checksum=37aaa33029410941bf4affff0479fa18"
-- Fetching "http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=37aaa33029410941bf4affff0479fa18&algorithm=MD5"
-- Fetching "http://www.itk.org/files/ExternalData/MD5/37aaa33029410941bf4affff0479fa18"
CMake Error at /tmp/buildd/ants-2.0.0/BuildScripts/ExternalData.cmake:666 (message):
  Object MD5=37aaa33029410941bf4affff0479fa18 not found at:

    file:////tmp/buildd/ants-2.0.0/.ExternalData/MD5/37aaa33029410941bf4affff0479fa18 ("Couldn't read a file:// file")
    http://slicer.kitware.com/midas3/api/rest?method=midas.bitstream.download&checksum=37aaa33029410941bf4affff0479fa18 ("Couldn't connect to server")
    http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=37aaa33029410941bf4affff0479fa18&algorithm=MD5 ("Couldn't connect to server")
    http://www.itk.org/files/ExternalData/MD5/37aaa33029410941bf4affff0479fa18 ("Couldn't connect to server")
Call Stack (most recent call first):
  /tmp/buildd/ants-2.0.0/BuildScripts/ExternalData.cmake:688 (_ExternalData_download_object)


make[4]: *** [ExternalData/TestData/Data/r16slice.nii.gz.md5-stamp] Error 1
make[4]: Leaving directory `/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu'
make[3]: *** [Examples/TestSuite/CMakeFiles/ANTSFetchData.dir/all] Error 2
make[3]: Leaving directory `/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu'
dh_auto_build: make -j1 returned exit code 2
make[1]: *** [override_dh_auto_build] Error 2
make[1]: Leaving directory `/tmp/buildd/ants-2.0.0'
make: *** [binary] Error 2
root@head2:~/ants-2.0.0# wget http://www.itk.org/files/ExternalData/MD5/37aaa33029410941bf4affff0479fa18
--2013-12-29 01:08:36--  http://www.itk.org/files/ExternalData/MD5/37aaa33029410941bf4affff0479fa18
Resolving www.itk.org (www.itk.org)... 66.194.253.19
Connecting to www.itk.org (www.itk.org)|66.194.253.19|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-12-29 01:08:36 ERROR 404: Not Found.

root@head2:~/ants-2.0.0# wget -O- http://www.itk.org/files/ExternalData/MD5/ | head
--2013-12-29 01:08:46--  http://www.itk.org/files/ExternalData/MD5/
Resolving www.itk.org (www.itk.org)... 66.194.253.19
Connecting to www.itk.org (www.itk.org)|66.194.253.19|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'STDOUT'

    [<=>                                                                 ] 0           --.-K/s              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
 <head>
  <title>Index of /files/ExternalData/MD5</title>
 </head>
 <body>
<h1>Index of /files/ExternalData/MD5</h1>
<table><tr><th><img src="/icons/blank.gif" alt="[ICO]"></th><th><a href="?C=N;O=D">Name</a></th><th><a href="?C=M;O=A">Last modified</a></th><th><a href="?C=S;O=A">Size</a></th><th><a href="?C=D;O=A">Description</a></th></tr><tr><th colspan="5"><hr></th></tr>

which reveals the fragility of not having data reliably available... I wonder -- if there is a cmake target which would fetch all needed data (for a given release/tag) so I could package it separately -- are you expecting testing data change (more files used etc) much between releases of ANTs?

2.0.0: test data for some tests neither present nor fetched

ants-2.0.0/obj-x86_64-linux-gnu# ctest --force-new-ctest-process -R "ANTS_SYN_JPG$" --verbose
UpdateCTestConfiguration  from :/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/DartConfiguration.tcl
Parse Config file:/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/DartConfiguration.tcl
 Add coverage exclude regular expressions.
 Add coverage exclude: .*Temporary/.*
 Add coverage exclude: .*boost.*
 Add coverage exclude: /CMakeFiles/CMakeTmp/
 Add coverage exclude: .*/moc_.*
 Add coverage exclude: .*/ui_.*
 Add coverage exclude: .*/qrc_.*
 Add coverage exclude: .*/Testing/.*
 Add coverage exclude: .*Python.cxx
 Add coverage exclude: .*PythonInit.cxx
 Add coverage exclude: .*/DesignerPlugins/.*
 Add coverage exclude: .*/generated_cpp/.*
 Add coverage glob: Source/.*/*.h
 Add coverage glob: Source/.*/*.txx
 Add coverage glob: Source/.*/*.cxx
UpdateCTestConfiguration  from :/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/DartConfiguration.tcl
Parse Config file:/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/DartConfiguration.tcl
Test project /tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 222
    Start 222: ANTS_SYN_JPG

222: Test command: /tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/bin/ConvertToJpg "/tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/ANTS_SYN_warped.nii.gz" "ANTS_SYN.jpg"
222: Test timeout computed to be: 1500
1/1 Test #222: ANTS_SYN_JPG .....................***Exception: SegFault  0.07 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   3.12 sec

The following tests FAILED:
        222 - ANTS_SYN_JPG (SEGFAULT)
Errors while running CTest
ants-2.0.0/obj-x86_64-linux-gnu# ls -l /tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/ANTS_SYN_warped.nii.gz
ls: cannot access /tmp/buildd/ants-2.0.0/obj-x86_64-linux-gnu/ANTS_SYN_warped.nii.gz: No such file or directory

may be this was resolved already after release? then I would appreciate a pointer to the commit.

antsApplyTransforms with c3d-converted affine: itk::ERROR: TxtTransformIOTemplate(0x2912350): Could not create an instance of MatrixOffsetTransformBase_double_3_3

Hello,

I am trying to run antsApplyTransforms where one of the transforms is a c3d-converted affine from FSL FLIRT (.mat -> .txt). When I run the command I get this error (the final --transform, affine.txt is the one in question):

antsApplyTransforms --default-value 0 --dimensionality 4 --input /home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/_scan_rest_1_rest/_csf_threshold_0.98/_gm_threshold_0.7/_wm_threshold_0.98/_compcor_ncomponents_5_selector_pc10.linear1.wm0.global0.motion1.quadratic0.gm0.compcor1.csf0/_bandpass_freqs_0.009.0.1/frequency_filter_0/bandpassed_demeaned_filtered.nii.gz --interpolation Gaussian --output bandpassed_demeaned_filtered_antswarp.nii.gz --reference-image /home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/anat_preproc_0/anat_brain_only/mprage_resample_calc.nii.gz --transform /home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/anat_mni_ants_register_0/calculate_ants_warp/transform2Warp.nii.gz --transform /home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/anat_mni_ants_register_0/calculate_ants_warp/transform1Affine.mat --transform /home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/fsl_to_itk_func_mni_4d_0/_scan_rest_1_rest/fsl_reg_2_itk/affine.txt

Using double precision for computations.
Input scalar image: /home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/_scan_rest_1_rest/_csf_threshold_0.98/_gm_threshold_0.7/_wm_threshold_0.98/_compcor_ncomponents_5_selector_pc10.linear1.wm0.global0.motion1.quadratic0.gm0.compcor1.csf0/_bandpass_freqs_0.009.0.1/frequency_filter_0/bandpassed_demeaned_filtered.nii.gz
Reference image: /home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/anat_preproc_0/anat_brain_only/mprage_resample_calc.nii.gz
Transform reader for /home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/fsl_to_itk_func_mni_4d_0/_scan_rest_1_rest/fsl_reg_2_itk/affine.txt caught an ITK exception:

itk::ExceptionObject (0x2912c10)
Location: "unknown"
File: /home/likewise-open/CHILDMIND/steven.giavasis/antsbin_NEW/ITKv4/Modules/IO/TransformBase/include/itkTransformIOBase.hxx
Line: 70
Description: itk::ERROR: TxtTransformIOTemplate(0x2912350): Could not create an instance of MatrixOffsetTransformBase_double_3_3
The usual cause of this error is not registering the transform with TransformFactory
Currently registered Transforms:
"AffineTransform_double_2_2"
"AffineTransform_double_3_3"
"AffineTransform_double_4_4"
"AffineTransform_double_5_5"
"AffineTransform_double_6_6"
"AffineTransform_double_7_7"
"AffineTransform_double_8_8"
"AffineTransform_double_9_9"
"AffineTransform_float_2_2"
"AffineTransform_float_3_3"
"AffineTransform_float_4_4"
"AffineTransform_float_5_5"
"AffineTransform_float_6_6"
"AffineTransform_float_7_7"
"AffineTransform_float_8_8"
"AffineTransform_float_9_9"
"BSplineDeformableTransform_double_2_2"
"BSplineDeformableTransform_double_3_3"
"BSplineDeformableTransform_float_2_2"
"BSplineDeformableTransform_float_3_3"
"BSplineSmoothingOnUpdateDisplacementFieldTransform_double_2_2"
"BSplineSmoothingOnUpdateDisplacementFieldTransform_double_3_3"
"BSplineSmoothingOnUpdateDisplacementFieldTransform_float_2_2"
"BSplineSmoothingOnUpdateDisplacementFieldTransform_float_3_3"
"BSplineTransform_double_2_2"
"BSplineTransform_double_3_3"
"BSplineTransform_float_2_2"
"BSplineTransform_float_3_3"
"CenteredAffineTransform_double_2_2"
"CenteredAffineTransform_double_3_3"
"CenteredAffineTransform_float_2_2"
"CenteredAffineTransform_float_3_3"
"CenteredEuler3DTransform_double_3_3"
"CenteredEuler3DTransform_float_3_3"
"CenteredRigid2DTransform_double_2_2"
"CenteredRigid2DTransform_float_2_2"
"CenteredSimilarity2DTransform_double_2_2"
"CenteredSimilarity2DTransform_float_2_2"
"CompositeTransform_double_2_2"
"CompositeTransform_double_3_3"
"CompositeTransform_double_4_4"
"CompositeTransform_double_5_5"
"CompositeTransform_double_6_6"
"CompositeTransform_double_7_7"
"CompositeTransform_double_8_8"
"CompositeTransform_double_9_9"
"CompositeTransform_float_2_2"
"CompositeTransform_float_3_3"
"CompositeTransform_float_4_4"
"CompositeTransform_float_5_5"
"CompositeTransform_float_6_6"
"CompositeTransform_float_7_7"
"CompositeTransform_float_8_8"
"CompositeTransform_float_9_9"
"ConstantVelocityFieldTransform_double_2_2"
"ConstantVelocityFieldTransform_double_3_3"
"ConstantVelocityFieldTransform_float_2_2"
"ConstantVelocityFieldTransform_float_3_3"
"DisplacementFieldTransform_double_2_2"
"DisplacementFieldTransform_double_3_3"
"DisplacementFieldTransform_float_2_2"
"DisplacementFieldTransform_float_3_3"
"Euler2DTransform_double_2_2"
"Euler2DTransform_float_2_2"
"Euler3DTransform_double_3_3"
"Euler3DTransform_float_3_3"
"FixedCenterOfRotationAffineTransform_double_3_3"
"FixedCenterOfRotationAffineTransform_float_3_3"
"GaussianExponentialDiffeomorphicTransform_double_2_2"
"GaussianExponentialDiffeomorphicTransform_double_3_3"
"GaussianExponentialDiffeomorphicTransform_float_2_2"
"GaussianExponentialDiffeomorphicTransform_float_3_3"
"GaussianSmoothingOnUpdateDisplacementFieldTransform_double_2_2"
"GaussianSmoothingOnUpdateDisplacementFieldTransform_double_3_3"
"GaussianSmoothingOnUpdateDisplacementFieldTransform_float_2_2"
"GaussianSmoothingOnUpdateDisplacementFieldTransform_float_3_3"
"GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform_double_2_2"
"GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform_double_3_3"
"GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform_float_2_2"
"GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform_float_3_3"
"IdentityTransform_double_2_2"
"IdentityTransform_double_3_3"
"IdentityTransform_double_4_4"
"IdentityTransform_double_5_5"
"IdentityTransform_double_6_6"
"IdentityTransform_double_7_7"
"IdentityTransform_double_8_8"
"IdentityTransform_double_9_9"
"IdentityTransform_float_2_2"
"IdentityTransform_float_3_3"
"IdentityTransform_float_4_4"
"IdentityTransform_float_5_5"
"IdentityTransform_float_6_6"
"IdentityTransform_float_7_7"
"IdentityTransform_float_8_8"
"IdentityTransform_float_9_9"
"MatrixOffsetTransformBase_double_4_4"
"MatrixOffsetTransformBase_double_4_4"
"QuaternionRigidTransform_double_3_3"
"QuaternionRigidTransform_float_3_3"
"Rigid2DTransform_double_2_2"
"Rigid2DTransform_float_2_2"
"Rigid3DPerspectiveTransform_double_3_2"
"Rigid3DPerspectiveTransform_float_3_2"
"Rigid3DTransform_double_3_3"
"Rigid3DTransform_float_3_3"
"ScalableAffineTransform_double_3_3"
"ScalableAffineTransform_float_3_3"
"ScaleLogarithmicTransform_double_3_3"
"ScaleLogarithmicTransform_float_3_3"
"ScaleSkewVersor3DTransform_double_3_3"
"ScaleSkewVersor3DTransform_float_3_3"
"ScaleTransform_double_2_2"
"ScaleTransform_double_3_3"
"ScaleTransform_double_4_4"
"ScaleTransform_float_2_2"
"ScaleTransform_float_3_3"
"ScaleTransform_float_4_4"
"ScaleVersor3DTransform_double_3_3"
"ScaleVersor3DTransform_float_3_3"
"Similarity2DTransform_double_2_2"
"Similarity2DTransform_float_2_2"
"Similarity3DTransform_double_3_3"
"Similarity3DTransform_float_3_3"
"TimeVaryingBSplineVelocityFieldTransform_double_2_2"
"TimeVaryingBSplineVelocityFieldTransform_double_3_3"
"TimeVaryingBSplineVelocityFieldTransform_float_2_2"
"TimeVaryingBSplineVelocityFieldTransform_float_3_3"
"TimeVaryingVelocityFieldTransform_double_2_2"
"TimeVaryingVelocityFieldTransform_double_3_3"
"TimeVaryingVelocityFieldTransform_float_2_2"
"TimeVaryingVelocityFieldTransform_float_3_3"
"TranslationTransform_double_2_2"
"TranslationTransform_double_3_3"
"TranslationTransform_double_4_4"
"TranslationTransform_double_5_5"
"TranslationTransform_double_6_6"
"TranslationTransform_double_7_7"
"TranslationTransform_double_8_8"
"TranslationTransform_double_9_9"
"TranslationTransform_float_2_2"
"TranslationTransform_float_3_3"
"TranslationTransform_float_4_4"
"TranslationTransform_float_5_5"
"TranslationTransform_float_6_6"
"TranslationTransform_float_7_7"
"TranslationTransform_float_8_8"
"TranslationTransform_float_9_9"
"VelocityFieldTransform_double_2_2"
"VelocityFieldTransform_double_3_3"
"VelocityFieldTransform_float_2_2"
"VelocityFieldTransform_float_3_3"
"VersorRigid3DTransform_double_3_3"
"VersorRigid3DTransform_float_3_3"
"VersorTransform_double_3_3"
"VersorTransform_float_3_3"

Can't read initial transform /home/likewise-open/CHILDMIND/steven.giavasis/run/035/035_bug/w2/resting_preproc_2014113/fsl_to_itk_func_mni_4d_0/_scan_rest_1_rest/fsl_reg_2_itk/affine.txt

The file that the c3d_affine_tool created, affine.txt, contains this:

Insight Transform File V1.0

Transform 0

Transform: MatrixOffsetTransformBase_double_3_3
Parameters: 0.999937 0.00118774 -0.0111388 -0.00188052 0.99805 -0.0623922 0.011043 0.0624092 0.99799 -1.25486 -30.7644 -31.7582
FixedParameters: 0 0 0

So c3d_affine_tool is creating a type of transform which is not included in that list which the antsApplyTransforms error message provided. At first we thought this may be a c3d_affine_tool version or ITK-SNAP version issue, but even with the nightly build version of c3d this still happens.

Any help would be appreciated. Thank you!

Wishlist: Create a unified "proxy" command line utility (ants?) to execute the plethora of ANTS commands

Now that you are in git world, you must be familiar with e.g. "git commit", "git add" being gatewayed into calling actual "git-commit" and "git-add" command lines shipped in private directory (e.g. /usr/lib/git-core/ on Debian systems). ATM ANTs provides ~80 command line tools, which either need to be in the PATH (but having such generic names as sa, bl, PrintHeader forbids that) or relying on user adjusting their PATHs to once again possibly shadowing other utilities available within their PATH space (what I currently do in Debian package shipping them under /usr/lib/ants).

Thus I recommend to unify command line interface to have a single user-visible command line utility which would proxy calls to underlying specialized command line tools. I know that you already have "ANTS" command line tool, thus the unified proxy command names "ants" would collide on case insensitive file system (and you do support Windows, right?). But may be such cmdline API breakage would be worth it for the name "ants" being taking for the proxy cmd.

Among related projects, you might look at CMTK (http://www.nitrc.org/projects/cmtk/) where similar approach was adopted a year or so ago -- it looks wonderful. "cmtk --help" provides outline of existing "commands", while "cmtk COMMAND --help" provides help for the corresponding tool.

VTK compilation

had to do the following to get vtk-dependent executables to build:

export CMAKE_PREFIX_PATH=/Users/stnava/code/ants-src/bin/VTK-install/lib/cmake/vtk-6.1

seems like this should not be necessary when compiling with USE_VTK ON

this is so we can get applications like GetMeshAndTopology .....

antsApplyTransformationsToPoints and CSV file coordinates are an exercise in obfuscation

in trying to debug this issue in mindboggle: nipy/mindboggle#39

i created a very simple test following brian's chicken example (https://github.com/stnava/chicken).

A - brain
B - 3 labels drawn on A (shares the same voxel to world mapping)
C - Template
T - Transform A -> C using antsRegistration
D - CSV from B via ImageMath

E - T(A)
F - T(B)
G - T^{-1}(D) via antsApplyTransformationsToPoints using an inverse transform
H - CSV from F via ImageMath

G ~ H (this matches - woohoo! but --- read on)

however, when i took the xyz coordinates from D and put it into my viewers, the LR and AP dimensions were flipped. i.e. the coordinates were not respecting the voxel to world mapping of A/B.

Points for discussion:

  1. D should reflect the voxel to world mapping of A/B (in 2d this can be identity)
  2. the fact antsApplyTransformationsToPoints requires the inverse transform from antsApplyTransformations should be noted or preferably changed. it doesn't make any sense to have two semantically similar operations (antsApplyTransformations and antsApplyTransformationsToPoints) to require inverse transforms.
  3. antsApplyTransformationsToPoints does not like the inverse composite transform provided by antsRegistration (this should be a separate issue)

itk::MemoryAllocationError when running antsCorticalThickness

I occasionally get the following error message when I run antsCorticalThickness script. It doesn't always occur, only sometimes:

Current level = 4 of 4
number of iterations = 20
shrink factors = [1, 1, 1]
smoothing sigmas = 0.0000e+00 vox
required fixed parameters = [216, 256, 291, 0, 293, 0, 1, 1, 1, 1, 0, 0, 0, 0, -1, 0, -1, 0]
Exception caught:
itk::MemoryAllocationError (0x2b4e14000a40)
Location: "unknown"
File: /share/apps/ants-1.9/antsbin/ITKv4-install/include/ITK-4.6/itkImportImageContainer.hxx
Line: 192
Description: Failed to allocate memory for image.

ERROR: command exited with nonzero status 1
Command: /share/apps/ants-2014-05-01//bin/antsRegistration -d 3 -u 1 -w [0.01,0.99] -o /home/njhunsak/images/368/2RO62LR/antsCorticalThickness/SubjectToTemplate -r [/home/njhunsak/template/OASIS-30_Atropos_template/T_template0_BrainCerebellum.nii.gz,/home/njhunsak/images/368/2RO62LR/antsCorticalThickness/ExtractedBrain0N4.nii.gz,1] --float 0 -m MI[/home/njhunsak/template/OASIS-30_Atropos_template/T_template0_BrainCerebellum.nii.gz,/home/njhunsak/images/368/2RO62LR/antsCorticalThickness/ExtractedBrain0N4.nii.gz,1,32,Regular,0.25] -c [1000x500x250x100,1e-8,10] -t Rigid[0.1] -f 8x4x2x1 -s 3x2x1x0 -m MI[/home/njhunsak/template/OASIS-30_Atropos_template/T_template0_BrainCerebellum.nii.gz,/home/njhunsak/images/368/2RO62LR/antsCorticalThickness/ExtractedBrain0N4.nii.gz,1,32,Regular,0.25] -c [1000x500x250x100,1e-8,10] -t Affine[0.1] -f 8x4x2x1 -s 3x2x1x0 -m CC[/home/njhunsak/template/OASIS-30_Atropos_template/T_template0_BrainCerebellum.nii.gz,/home/njhunsak/images/368/2RO62LR/antsCorticalThickness/ExtractedBrain0N4.nii.gz,1,4] -c [100x100x70x20,1e-9,15] -t SyN[0.1,3,0] -f 6x4x2x1 -s 3x2x1x0

What might be causing this error to occur?

Thanks

Naomi

BSplineSyn parameterization without integers results in parsing error

this form of parameterization

antsRegistration ... --transform BSplineSyN[ 0.1, 26.0, 0.0, 3.0 ] ...

results in an error while this doesn't:

antsRegistration ... --transform BSplineSyN[ 0.1, 26, 0, 3 ] ...

also this error didn't happen on this version (bf3730d):

error:

Exception Object caught: 

itk::ExceptionObject (0x2efcee0)
Location: "unknown" 
File: /software/src/ANTs/Examples/../Utilities/antsCommandLineParser.h
Line: 121
Description: itk::ERROR: CommandLineParser(0x2eeaa70): ERROR: Parse error occured during command line argument processing
ERROR: Unable to convert 3.0       to type j

current master build failing

cmake 2.8.11.1 on ubuntu 12.04

hash: stnava:ANTs@2e98f6a

$ ccmake defaults + enable vtk
$ make
[ 23%] Built target Boost
[ 26%] get rid of obsolete C/CXX flags
CMake Error: Error processing file:/software/src/ANTs/SuperBuild/VTKPatch.cmake
make[2]: *** [VTK-prefix/src/VTK-stamp/VTK-VTKPatch] Error 1
make[1]: *** [CMakeFiles/VTK.dir/all] Error 2
make: *** [all] Error 2

Consider to ass a SO version to the libraries (at least on linux)

Please consider adding version information to the shared libraries that get installed into /usr/lib. A patch to add SO version 2 and library version 2.0.0 would be:

--- ants-2.0.0.orig/CMakeLists.txt
+++ ants-2.0.0/CMakeLists.txt
@@ -1,6 +1,8 @@
 cmake_minimum_required(VERSION 2.8.5)
 cmake_policy(VERSION 2.8.5)

+set(LIBRARY_SOVERSION_INFO 2)
+set(LIBRARY_VERSION_INFO 2.0.0)
 set(LOCAL_PROJECT_NAME ANTS)
 INCLUDE(InstallRequiredSystemLibraries)
 ## NOTE THERE SHOULD BE NO PROJECT STATEMENT HERE!
--- ants-2.0.0.orig/Examples/CMakeLists.txt
+++ ants-2.0.0/Examples/CMakeLists.txt
@@ -27,6 +27,10 @@ macro(STANDARD_ANTS_BUILD ANTS_FUNCTION_
   set( ANTS_FUNCTION_NAME ${ANTS_FUNCTION_NAME} )

   add_library(l_${ANTS_FUNCTION_NAME} ${ANTS_FUNCTION_NAME}.cxx ${UI_SOURCES})
+  SET_TARGET_PROPERTIES(l_${ANTS_FUNCTION_NAME} PROPERTIES 
+    SOVERSION ${LIBRARY_SOVERSION_INFO}  VERSION ${LIBRARY_VERSION_INFO})
+
+
   message(STATUS "${ANTS_FUNCTION_NAME} ${EXTRA_LIBS}")
   target_link_libraries(l_${ANTS_FUNCTION_NAME} antsUtilities ${ITK_LIBRARIES} ${EXTRA_LIBS} )
   configure_file( template_for_executables.cxx.in cli_${ANTS_FUNCTION_NAME}.cxx )

Q: asymmetry.sh

Dear ANTS developers,

I'm playing with the script "asymmetry.sh", but I got the following error message:
.................
inputs: symmetric_template.nii 4692251_MPRAGE_axial.nii 4692251 3
cannot find operation : ReflectionMatrix
Using double precision for computations.
Input scalar image: 4692251_MPRAGE_axial.nii
Reference image: 4692251_MPRAGE_axial.nii
Transform file does not exist: 4692251_reflection.mat
Can't read initial transform 4692251_reflection.mat
.................
Any suggestions would be appreciated !!
Thanks !!

YIYU

antsCorticalThickness transforms

There has been some variation of the years in the decision of which image to use for fixed vs. moving in the registration components of antsCorticalThickness.sh. For a long time we had

PREFIX_TemplateToSubject0GenericAffine.mat
PREFIX_TemplateToSubject1Warp.nii.gz
PREFIX_TempateToSubject2InverseWarp.nii.gz

Now we seem to have switched to SubjectToTemplate. Would it be reasonable to instead require the following outputs?

PREFIX_TemplateToSubject0GenericAffine.mat
PREFIX_TemplateToSubject1Warp.nii.gz
PREFIX_SubjectToTemplate0GenericAffine.mat
PREFIX_SubjectToTemplate1Warp.nii.gz

This only requires 1 small additional .mat file, makes it clearer for end-users who want to warp between the two spaces, and ensures that future switches will have no consequences for post-processing scripts (ok, reduced consequences).

Multi-stage registration with non-matching shrink-factors yields an ITK Exception

I'm getting an ITK exception in an ImageToImageFilter at the end of the optimization.

The exception arises when I run a two-stage SyN-based registration where the shrink factor of the last level of the first stage has a different value than the shrink factor of the first level of the second stage.

A simple example that yields this exception is the following,

antsRegistration -d 3 --output antsOut --transform "SyN[0.9,3.0,0.0]" --metric MSQ[fixed.nii.gz,moving.nii.gz,1,32,Random,0.01] --convergence [5,1e-6,2] --shrink-factors 8 --smoothing-sigmas 8 --transform "SyN[0.9,1.0,0.0]" --metric MSQ[fixed.nii.gz,moving.nii.gz,1,32,Random,0.001] --convergence [5,1e-6,2] --shrink-factors 1 --smoothing-sigmas 1

I expected that functionality to work based on the following website

https://www.icts.uiowa.edu/confluence/display/BRAINSPUBLIC/ANTS+conversion+to+antsRegistration+for+same+data+set

Regards,

Cleanup merge conflicts leftovers in Scripts/unbiased_pairwise_registration_with_aux_images.sh

as originally spotted by lintian:
http://lintian.debian.org/maintainer/[email protected]#ants

$> git grep -2 '^>>>'
Scripts/unbiased_pairwise_registration_with_aux_images.sh-fi
Scripts/unbiased_pairwise_registration_with_aux_images.sh-if [[ -s $G ]] && [[ -s $N ]] && [[ ! -s ${nm}_fadiff.nii.gz  ]] ; then
Scripts/unbiased_pairwise_registration_with_aux_images.sh:>>>>>>> dafbbbc56dace03666e61a8eceb654d97d7293a8
Scripts/unbiased_pairwise_registration_with_aux_images.sh-  echo deal with auxiliary images ... here DTI
Scripts/unbiased_pairwise_registration_with_aux_images.sh-  ffa=${nm}_ffa.nii.gz

converting a composite transform to nii

i don't know if this is possible, but getting an error presently with the following command.

$ ConvertTransformFile 3 output_Composite.h5 output_Composite.nii.gz
Transform reader for output_Composite.h5 caught an ITK exception:

itk::ExceptionObject (0x7faa8390f858)
Location: "unknown" 
File: /software/builds/ANTs/ITKv4/Modules/IO/TransformBase/include/itkTransformIOBase.hxx
Line: 70
Description: itk::ERROR: HDF5TransformIOTemplate(0x7faa83909330): Could not create an instance of BSplineSmoothingOnUpdateDisplacementFieldTransform_double_2_2
The usual cause of this error is not registering the transform with TransformFactory
Currently registered Transforms: 
    "AffineTransform_double_2_2"
    "AffineTransform_double_3_3"
    "AffineTransform_double_4_4"
    "AffineTransform_double_5_5"
    "AffineTransform_double_6_6"
    "AffineTransform_double_7_7"
    "AffineTransform_double_8_8"
    "AffineTransform_double_9_9"
    "AffineTransform_float_2_2"
    "AffineTransform_float_3_3"
    "AffineTransform_float_4_4"
    "AffineTransform_float_5_5"
    "AffineTransform_float_6_6"
    "AffineTransform_float_7_7"
    "AffineTransform_float_8_8"
    "AffineTransform_float_9_9"
    "BSplineDeformableTransform_double_2_2"
    "BSplineDeformableTransform_double_3_3"
    "BSplineDeformableTransform_float_2_2"
    "BSplineDeformableTransform_float_3_3"
    "BSplineTransform_double_2_2"
    "BSplineTransform_double_3_3"
    "BSplineTransform_float_2_2"
    "BSplineTransform_float_3_3"
    "CenteredAffineTransform_double_2_2"
    "CenteredAffineTransform_double_3_3"
    "CenteredAffineTransform_float_2_2"
    "CenteredAffineTransform_float_3_3"
    "CenteredEuler3DTransform_double_3_3"
    "CenteredEuler3DTransform_float_3_3"
    "CenteredRigid2DTransform_double_2_2"
    "CenteredRigid2DTransform_float_2_2"
    "CenteredSimilarity2DTransform_double_2_2"
    "CenteredSimilarity2DTransform_float_2_2"
    "CompositeTransform_double_2_2"
    "CompositeTransform_double_3_3"
    "CompositeTransform_double_4_4"
    "CompositeTransform_double_5_5"
    "CompositeTransform_double_6_6"
    "CompositeTransform_double_7_7"
    "CompositeTransform_double_8_8"
    "CompositeTransform_double_9_9"
    "CompositeTransform_float_2_2"
    "CompositeTransform_float_3_3"
    "CompositeTransform_float_4_4"
    "CompositeTransform_float_5_5"
    "CompositeTransform_float_6_6"
    "CompositeTransform_float_7_7"
    "CompositeTransform_float_8_8"
    "CompositeTransform_float_9_9"
    "DisplacementFieldTransform_double_2_2"
    "DisplacementFieldTransform_double_3_3"
    "DisplacementFieldTransform_float_2_2"
    "DisplacementFieldTransform_float_3_3"
    "Euler2DTransform_double_2_2"
    "Euler2DTransform_float_2_2"
    "Euler3DTransform_double_3_3"
    "Euler3DTransform_float_3_3"
    "FixedCenterOfRotationAffineTransform_double_3_3"
    "FixedCenterOfRotationAffineTransform_float_3_3"
    "IdentityTransform_double_2_2"
    "IdentityTransform_double_3_3"
    "IdentityTransform_double_4_4"
    "IdentityTransform_double_5_5"
    "IdentityTransform_double_6_6"
    "IdentityTransform_double_7_7"
    "IdentityTransform_double_8_8"
    "IdentityTransform_double_9_9"
    "IdentityTransform_float_2_2"
    "IdentityTransform_float_3_3"
    "IdentityTransform_float_4_4"
    "IdentityTransform_float_5_5"
    "IdentityTransform_float_6_6"
    "IdentityTransform_float_7_7"
    "IdentityTransform_float_8_8"
    "IdentityTransform_float_9_9"
    "MatrixOffsetTransformBase_double_3_3"
    "QuaternionRigidTransform_double_3_3"
    "QuaternionRigidTransform_float_3_3"
    "Rigid2DTransform_double_2_2"
    "Rigid2DTransform_float_2_2"
    "Rigid3DPerspectiveTransform_double_3_2"
    "Rigid3DPerspectiveTransform_float_3_2"
    "Rigid3DTransform_double_3_3"
    "Rigid3DTransform_float_3_3"
    "ScalableAffineTransform_double_3_3"
    "ScalableAffineTransform_float_3_3"
    "ScaleLogarithmicTransform_double_3_3"
    "ScaleLogarithmicTransform_float_3_3"
    "ScaleSkewVersor3DTransform_double_3_3"
    "ScaleSkewVersor3DTransform_float_3_3"
    "ScaleTransform_double_2_2"
    "ScaleTransform_double_3_3"
    "ScaleTransform_double_4_4"
    "ScaleTransform_float_2_2"
    "ScaleTransform_float_3_3"
    "ScaleTransform_float_4_4"
    "ScaleVersor3DTransform_double_3_3"
    "ScaleVersor3DTransform_float_3_3"
    "Similarity2DTransform_double_2_2"
    "Similarity2DTransform_float_2_2"
    "Similarity3DTransform_double_3_3"
    "Similarity3DTransform_float_3_3"
    "TranslationTransform_double_2_2"
    "TranslationTransform_double_3_3"
    "TranslationTransform_double_4_4"
    "TranslationTransform_double_5_5"
    "TranslationTransform_double_6_6"
    "TranslationTransform_double_7_7"
    "TranslationTransform_double_8_8"
    "TranslationTransform_double_9_9"
    "TranslationTransform_float_2_2"
    "TranslationTransform_float_3_3"
    "TranslationTransform_float_4_4"
    "TranslationTransform_float_5_5"
    "TranslationTransform_float_6_6"
    "TranslationTransform_float_7_7"
    "TranslationTransform_float_8_8"
    "TranslationTransform_float_9_9"
    "VersorRigid3DTransform_double_3_3"
    "VersorRigid3DTransform_float_3_3"
    "VersorTransform_double_3_3"
    "VersorTransform_float_3_3"


Error while reading transform file. Did you specify the correct dimension?

inverse transform error with antsApplyTransformsToPoints

re: inverse transform:

$ antsApplyTransformsToPoints -d 3 -i in.csv -o out.csv -t reg/transformInverseComposite.h5 
Input csv file: in.csv
Transform reader for reg/transformInverseComposite.h5 caught an ITK exception:

itk::ExceptionObject (0x7fd2dc0150d8)
Location: "unknown" 
File: /software/builds/ANTs/ITKv4/Modules/Core/Transform/include/itkRigid3DTransform.hxx
Line: 127
Description: itk::ERROR: Rigid3DTransform(0x7fd2dc013c50): Attempting to set a non-orthogonal rotation matrix

Can't read initial transform reg/transformInverseComposite.h5

itk::ERROR: ImageToImageFilter(0x352ff90): Inputs do not occupy the same physical space!

I'm getting an error when running a registration as part of antsCorticalThickness. It happens in the segmentation warp at the deformable stage.

To check that it wasn't bad initialization, I ran the affine part separately, then the deformable part. The affine initialization looks good. When I run the deformable part,

'''
antsRegistration -d 3 -u 1 -w [0.01,0.99] -o inputprefix_BrainSegmentationPriorDeformableOnly --float 1 -r [inputprefix_BrainExtractionPrior0GenericAffine.mat] -x [inputprefix_BrainSegmentationMaskDilated.nii.gz] -m CC[inputprefix_BrainExtractionBrain.nii.gz,inputprefix_ExtractedTemplateBrain.nii.gz,1,4] -c [100x100x70x20,1e-9,15] -t SyN[0.1,3,0] -f 6x4x2x1 -s 3x2x1x0
'''

It finishes the first level and then says

'''
Current level = 2 of 4
number of iterations = 100
shrink factors = [4, 4, 1]
smoothing sigmas = 2.0000e+00 vox
required fixed parameters = [128, 128, 96, 95.32296, -112.5134, -134.74442, 1.875, 1.875, 1.6999999, -0.05405264, -0.059213325, -0.9967809, 0.9985381, -0.0032052274, -0.053957522, -9.497458e-8, 0.99824023, -0.05930001]
Exception caught:
itk::ExceptionObject (0x352e7f0)
Location: "unknown"
File: /home/pcook/bin/ants/ITKv4-install/include/ITK-4.6/itkImageToImageFilter.hxx
Line: 248
Description: itk::ERROR: ImageToImageFilter(0x352ff90): Inputs do not occupy the same physical space!
InputImage Origin: [9.5322963e+01, -1.1251340e+02, -1.3474442e+02], InputImage_1 Origin: [9.5322960e+01, -1.1251340e+02, -1.3474442e+02]
Tolerance: 1.8750000e-06
'''

The difference in the origins appears to be less than the stated tolerance. I'm also confused why this would happen at this point after the affine and first level registration complete successfully.

General instructions

Just got ANTs downloaded and compiled, looks quite promising so far!

However, the onboard parameter explanations given when I type "antsregistration --help" aren't always enough to give me a clear understanding of what each parameter does. For instance, I am fairly new to image registration, and so am unfamiliar with the term "shrink factor." Though I would suspect it has something to do with multiresolution voxel averaging I'd really rather be more confident going forward knowing the consequences my parameter inputs.

Is there a more comprehensive source for what exactly each of these parameters means?

Thanks,

-Stan

crash with mattes and translation

i'm running a about 400 registrations and don't want to tune for specific pairs. any suggestion of a global fix?

the error message says translate - which is precisely what i'm doing. would you recommend a different metric for that stage?

the parameters i'm using are taken from:
https://github.com/stnava/ANTs/blob/master/Scripts/newAntsExample.sh
and nipype-ified here:
https://gist.github.com/satra/8439778

details:

images: showing displacement and crop differences

https://www.dropbox.com/s/6apux9fy1ae24pz/Screenshot%202014-01-15%2019.32.54.png

and then i get a crash.

*** Running translation registration ***



  Current level = 1 of 3

...

  Current level = 2 of 3

    number of iterations = 111110

    shrink factors = [4, 4, 4]

    smoothing sigmas = 2.0000e+00 vox

    required fixed parameters = []

DIAGNOSTIC,Iteration,metricValue,convergenceValue,ITERATION_TIME_INDEX,SINCE_LAST

 2DIAGNOSTIC,     1, -4.250583052635e-02, inf, 1.1020e+01, 3.1377e+00, 

 2DIAGNOSTIC,     2, -4.263344034553e-02, inf, 1.1163e+01, 1.4356e-01, 

 2DIAGNOSTIC,     3, -4.278108850121e-02, inf, 1.1315e+01, 1.5223e-01, 

 2DIAGNOSTIC,     4, -4.303957521915e-02, inf, 1.1453e+01, 1.3716e-01, 

 2DIAGNOSTIC,     5, -4.338129237294e-02, inf, 1.1582e+01, 1.2937e-01, 

 2DIAGNOSTIC,     6, -4.504288360476e-02, inf, 1.1711e+01, 1.2884e-01, 

 2DIAGNOSTIC,     7, -4.969913512468e-02, inf, 1.1836e+01, 1.2556e-01, 

 2DIAGNOSTIC,     8, -6.139770522714e-02, inf, 1.1979e+01, 1.4273e-01, 

Exception caught: 

itk::ExceptionObject (0xc6a0220)

Location: "unknown" 

File: /data/software/build/ITKv4-install/include/ITK-4.6/itkMattesMutualInformationImageToImageMetricv4.hxx

Line: 225

Description: itk::ERROR: MattesMutualInformationImageToImageMetricv4(0x3006780): 
Too many samples map outside moving image buffer. There are only 1158 valid points
 out of 37486 total points. The images do not sufficiently overlap. They need to be
 initialized to have more overlap before this metric will work. For instance, you can
 align the image centers by translation.

Name conflict

Hi,

Fedora has ants of a game in package database, and I'd like to package ANTs into Fedora, not sure about the name.

Can you shed some lights here?

Thanks.

NSLOTS in ANTS

i'm trying to ask antsRegistration to use 4 threads/procs via the NSLOTS parameter, which is respected in ITK, but it doesn't seem to want to use more than 2 processes. have any of you come across this before?

N4BiasFieldCorrection returns 0 but does not output

Nothing in the output of N4BiasFieldCorrection --help indicates that this behavior is intended.

$ N4BiasFieldCorrection -d 3 -i $subj.orig.nii.gz -s 2 -c "[50x50x50x50,.000001]" -b "[200]" -o "[$subj.unbiased.nii.gz]"

Running N4 for 3-dimensional images.

Mask not read.  Creating Otsu mask.
Current level = 1
  Iteration 1 (of 50).   Current convergence value = 0.000291983 (threshold = 1e-06)
...
  Iteration 50 (of 50).   Current convergence value = 0.000520154 (threshold = 1e-06)
   N4BiasFieldCorrectionImageFilter (0x2f4e2e0)
     RTTI typeinfo:   itk::N4BiasFieldCorrectionImageFilter<itk::Image<float, 3u>, itk::Image<float, 3u>, itk::Image<float, 3u> >
     Reference Count: 1
     Modified Time: 608
     Debug: Off
     Observers: 
       IterationEvent(Command)
     Inputs: 
       Primary: (0x2f5c580) *
       IndexedDataObject1: (0x2f5dca0)
     Required Input Names: Primary
     Outputs: 
       Primary: (0x2f43490)
     NumberOfIndexedInputs: 2
     NumberOfRequiredInputs: 1
     NumberOfIndexedOutputs: 1
     NumberOfRequiredOutputs: 1
     Number Of Threads: 12
     ReleaseDataFlag: Off
     ReleaseDataBeforeUpdateFlag: Off
     AbortGenerateData: Off
     Progress: 0
     Multithreader: 
       RTTI typeinfo:   itk::MultiThreader
       Reference Count: 1
       Modified Time: 116
       Debug: Off
       Observers: 
         none
       Thread Count: 12
       Global Maximum Number Of Threads: 128
       Global Default Number Of Threads: 12
     CoordinateTolerance: 1e-06
     DirectionTolerance: 1e-06
     Mask label: 1
     Number of histogram bins: 200
     Wiener filter noise: 0.01
     Bias field FWHM: 0.15
     Maximum number of iterations: [50, 50, 50, 50]
     Convergence threshold: 1e-06
     Spline order: 3
     Number of fitting levels: [4, 4, 4]
     Number of control points: [5, 5, 4]
     CurrentConvergenceMeasurement: 0.000520154
     CurrentLevel: 4
     ElapsedIterations: 51
     LogBiasFieldControlPointLattice: Image (0x2f56e10)
  RTTI typeinfo:   itk::Image<itk::Vector<float, 1u>, 3u>
  Reference Count: 2
  Modified Time: 463276021
  Debug: Off
  Observers: 
    none
  Source: (none)
  Source output name: (none)
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  PipelineMTime: 0
  UpdateMTime: 0
  RealTimeStamp: 0 seconds 
  LargestPossibleRegion: 
    Dimension: 3
    Index: [0, 0, 0]
    Size: [19, 19, 11]
  BufferedRegion: 
    Dimension: 3
    Index: [0, 0, 0]
    Size: [19, 19, 11]
  RequestedRegion: 
    Dimension: 3
    Index: [0, 0, 0]
    Size: [19, 19, 11]
  Spacing: [24.875, 24.875, 24.75]
  Origin: [-24.875, -24.875, -24.75]
  Direction: 
1 0 0
0 1 0
0 0 1

  IndexToPointMatrix: 
  24.875 0 0
0 24.875 0
0 0 24.75

  PointToIndexMatrix: 
  0.040201 0 0
0 0.040201 0
0 0 0.040404

  Inverse Direction: 
  1 0 0
0 1 0
0 0 1

  PixelContainer: 
    ImportImageContainer (0x2f5d200)
      RTTI typeinfo:   itk::ImportImageContainer<unsigned long, itk::Vector<float, 1u> >
      Reference Count: 1
      Modified Time: 463276022
      Debug: Off
      Observers: 
        none
      Pointer: 0xc801fe0
      Container manages memory: true
      Size: 3971
      Capacity: 3971

Elapsed time: 283.154
$ echo $?
0
$ ls $subj.unbiased*
ls: cannot access 005-ex.unbiased*: No such file or directory
$ echo $ANTSPATH
/apps/ANTS-1.9.v4/x86_64_sci6/bin/

Compiler warning about array subscript out of bounds

/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx: In function ‘void ants::CorrectImageTensorDirection(TensorImageType_, ImageType_) [with TensorImageType = itk::Image<itk::SymmetricSecondRankTensor<double, 2u>, 2u>, ImageType = itk::Image<double, 2u>]’:
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:51: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:52: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:53: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:60: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:61: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:62: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx: In function ‘void ants::CorrectImageTensorDirection(TensorImageType_, ImageType_) [with TensorImageType = itk::Image<itk::SymmetricSecondRankTensor<float, 2u>, 2u>, ImageType = itk::Image<float, 2u>]’:
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:51: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:52: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:53: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:60: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:61: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:62: warning: array subscript is above array bounds
In file included from /Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/itkLogTensorImageFilter.h:24,
from /Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Utilities/ReadWriteImage.h:21,
from /Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/itkantsRegistrationHelper.h:21,
from /Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/antsApplyTransforms.cxx:3:
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h: In function ‘void EigenAnalysis(TensorType, MatrixType&, MatrixType&) [with TensorType = itk::SymmetricSecondRankTensor<double, 2u>, MatrixType = itk::VariableSizeMatrix]’:
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h:25: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h:26: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h:27: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h: In function ‘TensorType TensorLogAndExp(TensorType, bool, bool&) [with TensorType = itk::SymmetricSecondRankTensor<double, 2u>]’:
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h:113: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h:51: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h:52: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h:53: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h:102: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h:102: warning: array subscript is above array bounds
/Shared/sinapse/sharedopt/20130601/RHEL6/DTIPrep/BRAINSTools-build/ANTS/Examples/../Tensor/TensorFunctions.h:102: warning: array subscript is above array bounds

AlternatingValue...ImageFilter classes have a problem in GenerateInputRequestedRegion

This applies to itk::AlternatingValuesDifferenceImageFilter and itk::AlternatingValuesSimpleSubtractionImageFilter

These lines are the problem:
IndexValueType begin = outputRegion.GetIndex(InputImageDimension);
IndexValueType end = begin + outputRegion.GetSize(InputImageDimension);

This is clearly wrong, since the size of the Index & Size arrays is InputImageDimension, and only numbers up to InputImageDimension-1 are valid subscripts for them.

I would just fix this, but I honestly don't understand what this implementation of GenerateInputRequestedRegion is trying to do.

Merge leftovers in script

The script unbiased_pairwise_registration_with_aux_images.sh has leftovers from a merge in it

  • line 250: ======
  • line 285: >>>>

It is not clear if the part between these two lines should be deleted or retained.

fails to build with ITK 4.4

Compile error:

In file included from ANTs/Examples/CompositeTransformUtil.cxx:12:0:
ANTs/Examples/../Utilities/itkantsReadWriteTransform.h: In function 'typename itk::Transform<TScalar, NDimensions, NDimensions>::Pointer itk::ants::ReadTransform(const string&, bool)':
ANTs/Examples/../Utilities/itkantsReadWriteTransform.h:70:19: error: 'TransformFileReaderTemplate' in namespace 'itk' does not name a type

memory consumption and parameters

/software/ANTS/versions/130123/antsRegistration --collapse-linear-transforms-to-fixed-image-header 0 --collapse-output-transforms 0 --dimensionality 3 --interpolation Linear --output [ transform, output_warped_image.nii.gz ] --transform Affine[ 2.0 ] --metric Mattes[ human_2_anatomy.nii, human_1_anatomy.nii, 1, 32 ,Random,0.05 ] --convergence [ 1500x200, 1e-08, 20 ] --smoothing-sigmas 1x0 --shrink-factors 2x1 --use-estimate-learning-rate-once 1 --use-histogram-matching 1 --transform SyN[ 0.25, 3.0, 0.0 ] --metric Mattes[ human_2_anatomy.nii, human_1_anatomy.nii, 1, 32 ] --convergence [ 100x50x30, 1e-09, 20 ] --smoothing-sigmas 2x1x0 --shrink-factors 3x2x1 --use-estimate-learning-rate-once 1 --use-histogram-matching 1 --winsorize-image-intensities [ 0.0, 1.0 ] --write-composite-transform 1

the above command takes up over 6GB of ram when NSLOTS is set to 2.

this is trying to simply do a registration between two heads (no skullstripping) with an intent to get the cerebellums as well lined as possible.

the parameters were simply chosen based on an example that hans had created, not particular to this problem.

would there be a set of default parameters you would recommend for the problem?

[note] ants preliminary performance on a pair of images focused on the cerebellum

this is more of a note for someone browsing this than an issue.

i've now tried the cerebellar alignment with about 3 different parameter sets. i have not had the ability to run this on the full dataset yet, but here are some numbers using the parameter sets from for registration from antsExample and antsCorticalThickness:

Runtime

antsExample ~ 16hrs
antsCorticalThickness ~ 6hrs
hans' parameters ~ 24 hrs (very similar numbers as antsExample)

Jaccard of the whole cerebellum (dice is at .94 and .93)

antsExample: 0.8851301018640427
antsCorticalThickness: 0.868421959244139

Jaccard indices of sub parcels

lobule_index antsExample antsCorticalThickness
1 0.548081069426 0.548447383554
2 0.580211831568 0.586220682303
3 0.508809442354 0.491869918699
4 0.425504943801 0.444931322154
5 0.498556921432 0.501663937457
6 0.548482919584 0.541675370796
7 0.414662147387 0.416328767123
8 0.686404794476 0.673484295106
9 0.332142857143 0.309069212411
10 0.68324082124 0.67453362544
11 0.697536347062 0.665020499441
12 0.409926470588 0.381665107577
13 0.650078740157 0.63015130174
14 0.576870863737 0.551261894911
15 0.306485355649 0.291585127202
16 0.198522381573 0.205511004948
17 0.529573275369 0.455043859649
18 0.552008608321 0.521858864028
19 0.162546641791 0.183551753904
20 0.562954545455 0.517845192951
21 0.201219512195 0.188811188811
22 0.240916079955 0.206433637285
23 0.637620258764 0.626712328767
24 0.466586151369 0.446421350586
25 0.554145145759 0.511740331492
26 0.563997262149 0.511821974965
27 0.44847605225 0.43993993994
28 0.49279757392 0.44395280236

Installed executables should follow some common naming scheme

Ants installs a lot of executables. Some of those are prefixed by ANTS others by ants, others carry no prefix. Some names are descriptive, others are just two-letter commands.

If would be nice to prefix all executables and scripts with e.g. "ants", and CamelCase would be used consistently with descriptive names for all executables.

In addition, man pages would be nice.

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.