ENH: Adding libminc and updating MINC IO support.

Added libminc library inside Modules/ThirdParty/MINC to compile withing ITK.
Also rewrote MINC IO from Modules/Nonunit/Review/  to work correctly,
also added extensive testing to the module.

ENH: Modified UseITK.cmake to include automatic MINCIO initialization

BUG: MINC2 Metadata reading and writing is now supported and compatible with ITK standard

BUG: Dimension order and step sign is now preserved

BUG: Run uncrustify on all source code to satisfy ITK style requirements

BUG: Fixed error with wrong order of dimensions

BUG: Reduced number of tests

BUG: Fixed error in interslice normalization when reading floating point volumes
     in libminc, so updated GIT TAG

BUG: Made libminc to compile statically always and with itk_ prefix to avoid
     potential conflict with already installed libminc

BUG: Fixed a bug in underlying libminc library, updated GIT tag

BUG: Fixed a bug while reading vector images or time-series with zero time step

ENH: Updated to latest version of libminc

ENH: Making more tests

BUG: Fixed logical error when reading files with global normalization

BUG: Added tests for 4D Dti data and Labels

BUG: Forgot to change libminc git id

BUG: Reduced number of tests

BUG: Updated to latest version of libminc

BUG: Fixed a bug in libminc which affected building MINC2 module

BUG: Addded ability to store floating point data in a MINC2 volume with integer data type

BUG: Updated to latest version of libminc

BUG: Re-enabled test for rounding errors in case of storing floating point data in storage with integer data type

BUG: Fix warnings about unused or uninitialized values.  Add brackets for style consistency.

BUG: Fix uninitialized variable warnings and remove README

ENH: Added IO adapter for MINC style transformations (.xfm files)

ENH: Updated to latest version of libminc and fixed the way libmind is called to make .xfm files

BUG: Fixed errors in building on MacOSX

BUG: Fixed build on Windows

BUG: Second attempt to fix build on Windows

BUG: Suppressed CRT SECURE Warnings on Windows, fixed typo

BUG: Removed more warnings in Windows build

BUG: Fixed integer overflow in libminc

ENH: Rebased to the latest master

BUG: Trying to make build possible

BUG: Fixed bug while building with GCC

ENH: Rebased to current master

BUG: Updated copyright notice

Change-Id: Ie9ed4151dca83d5854cc713536a9594dc520c15a
BUG: initialize InverseCovariance size with degenerate matrix

This patch fixes a segfault with VectorConfidenceConnected when used
with VectorImages and only one initial seed. This was caused by an
inverse matrix not being initialized correctly for variable length
measurement vectors.

Change-Id: I81bd2c9afe35f726d552c08849dd3c80710bca05
Merge topic 'VectorConfidenceConnectedInvCovarSegfault'

b07b051 BUG: initialize InverseCovariance size with degenerate matrix
BUG: Fix InverseDisplacementFieldImageFilter bug

Further description can be found in jira issue (#3009).

A displacement field represent the displacement required to move from image1 to image2 :

image2_position = f(image1_position) + image1_position

Inverting such a field consist in estimating f^-1 such that
image1_position = f^-1(image2_position) + image2_position

at each location of image2 grid, while we in fact know f^-1 only at f(image1_position) + image1_position, which are most likely off image2 grid.

To do so, the InverseDisplacementFieldImageFilter makes use of Splines function, which will interpolate the displacement at image2 grid positions.

The spline transform is given source and target points from the function to estimate, which is f^-1. for each grid position in image1 :

    source point should be f(image1_position) + image1_position
    target point should be image1-image2 = -f(image1)

But in the filter code before this patch, we can read that source point given to the spline is only image1_position, not f(image1_position) + image1_position.

As a result, the inverse function estimated by the spline transform is wrong.

As asked in the review, the filter test has been modified to show the improper behaviour before the patch and the correct behaviour after the patch. Please note that the previous version of the test did not test for output validity, but only for correct execution (no regression testing on algorithm output).

As asked by the last review, I slightly rewrote the filter code to enhance readibility by avoiding confusion between landmarks and displacements.

Change-Id: Iddfb0a4332f12212feaec8a3e54f48c7ce41e272
Merge topic 'fix-inversedisplacementfield'

2b9fca5 BUG: Fix InverseDisplacementFieldImageFilter bug
COMP: Further changes to the use of std::copy_n

1. Add preprocessor test for condition (detected by David
Doria) where ITK was configured & built with a compiler that
supports C++11 std::copy_n, but a user program was not.

2. Small changes suggested by Bradley Lowencamp that didn't
make it into the last patch.

Change-Id: I1635cccc52b2dbf3621b896db9a139f33cda4fe2
COMP: Fix project linking against ITK that does not use VtkGlue.

The problem:

ITK is built with the ITKVtkGlue or ITKLevelSetsv4Visualization module enabled.
A project that uses ITK, but does not use VTK, does a

find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

but if the VTK_DIR that was specified for ITKVtkGlue is at a build tree
location, CMake does not know where to find the VTK libraries.

The solution:

In the per-VTK-module export code, we should include VTKTargets.cmake so CMake
knows where to find the VTK libraries.  To do so, run find_package(VTK_DIR
NO_MODULE REQUIRED) with the VTK_DIR used during ITK configuration.

Change-Id: I6c74891f97da80c1b1ac352b8f7495439c80d610
Merge topic 'LinkVTKGlueNotUsed'

4371df2 COMP: Fix project linking against ITK that does not use VtkGlue.
ENH: Adding numeric_traits specializations for "long long"

This patch applies commits r34558 and r36873 from VXL upstream
authored by Brad King.

Change-Id: Ie233754645f3d4fc434578b5eb0871d3dd74c860
ENH: instantiate vnl types with "long long" on all platforms

This works toward portable instantiation of images with int64_t
types.

Change-Id: Id228cbd38794336898b0b0df06cf9524641d01b0
ENH: Move the ClampImageFilter to the ImageIntensity module (#3016).

With the new feature allowing the ClampImageFilter to use
custom bounds, it makes more sense to have it in the
ImageIntensity module.

Change-Id: I411f36d19b64b2149b6cdcb6b0017397b848bd7b
Merge topic 'AddVnlNumericTraits_long_long'

02db47b ENH: instantiate vnl types with "long long" on all platforms
35cd28d ENH: Adding numeric_traits specializations for "long long"
Revert "ENH: Use named inputs in BinaryReconstruction filters."

The reverted patch broke the method
ProcessObject::SetInput. Previously, filter->SetInput() would work for
setting the input images, it no longer does. SimpleITK uses this
method to set filter inputs. These filter silently compile and give a
run-time exception with the prior patch applied.

This reverts commit 285f3ac2d50c54803657458ee529a7c8ce602150.

Change-Id: I99fd84cbfc2da8714dbbb1343e3b8faf55ad4f29
Merge topic 'RefineStdCopyNUsage'

137b5c3 COMP: Further changes to the use of std::copy_n
Merge topic 'NamedInputNotBackwardsCompatible'

32b4659 Revert "ENH: Use named inputs in BinaryReconstruction filters."
COMP: Add preprocessor symbols to double-conversion for OS X PPC

The powerpc preprocessor definitions did not include the ones
actually found on Mac OS X on PPC. Added these flags to utils.h

Change-Id: Ifd5e83295c7e5372616c1fc5a51280658f9d6abe
COMP: Fix project linking against ITK that does not use VtkGlue.

The problem:

ITK is built with the ITKVtkGlue or ITKLevelSetsv4Visualization module enabled.
A project that uses ITK, but does not use VTK, does a

find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

but if the VTK_DIR that was specified for ITKVtkGlue is at a build tree
location, CMake does not know where to find the VTK libraries.

The solution:

In the per-VTK-module export code, we should include VTKTargets.cmake so CMake
knows where to find the VTK libraries.  To do so, run find_package(VTK_DIR
NO_MODULE REQUIRED) with the VTK_DIR used during ITK configuration.

Change-Id: I6c74891f97da80c1b1ac352b8f7495439c80d610
BUG: initialize InverseCovariance size with degenerate matrix

This patch fixes a segfault with VectorConfidenceConnected when used
with VectorImages and only one initial seed. This was caused by an
inverse matrix not being initialized correctly for variable length
measurement vectors.

Change-Id: I81bd2c9afe35f726d552c08849dd3c80710bca05
BUG: Using CMake variable in external builds with autoconf environment

Previously, the external projects of FFTW, SWIG and PCRE were affected
by environmental variable such as CC, CXX, CFLAGS etc. The could be
tested by setting CXX=/dev/null in the environment. Additionally,
these setting could change from when cmake was first run to when the
external project was (re)configured and compiled.

Now, the environment variable which effect the autoconf are not set in
via the "env" command before configuration.

Change-Id: Ie2d4f43c10d40186062a2e2917eff26b03b9815c
BUG: Memory leak after failed RegisterFactory

If a RegisterFactory fails, the opened library was not closed. This
resulted in a memory leak.

This patch closes factories that fail to load.

Also, RegisterFactory now returns true if the factory loads and false
if it does not load.

Change-Id: If8cc37469b5d760d453b818d1c6a35058ab4d1ea