BUG: LabelGeometry cropped images with non-unit spacing incorrectly

The itkLabelGeometryImageFilter previously cropped object images
incorrectly when the input image had non-unit spacing.  This was
corrected by simply including spacing in the resampler.  This patch
also includes a rewritten test that is simpler and clearer.  The test
now includes image regression tests.  It also includes feature values
regression tests by writing and reading the features values as CSV
files.  It tests both 2D images and 3D volumes.

Change-Id: I6767489993b30c187ae41b3a6c904bc3dd68d67e
COMP: Fix ambiguous specialization of GDCM Element

To disable certain combinations of template arguments to GDCM's
Element class, ambiguous declarations where added with no
definition. These combintations are causing compilations warnings such
as:

gdcmElement.h(611): warning #889: this partial specialization would
have made the instantiation of class "gdcm::Element<4096, 218367>"
ambiguous
  template <int TVM> class Element<VR::OB, TVM>;

While simply removing ambiguous declarations, would remove the
warnings this would not preserve the authors original intent to
prevent instantiation. To achieve a additional class was added with a
concept like check, to prevent instantiation.

Change-Id: I01c7d3f663a2e97804a465fb460d964542c6bf2d
COMP: OpenJPEG #ifdef WIN32 not reliable ITK-3101.

It appears that in Modules/ThirdParty/OpenJEPEG/src/openjpeg/opj_malloc.h in
line 67 the '#ifdef WIN32' results in 0 on my system, Vista x64, VS9. As a
result the linker expects posix_memalign. This causes multiple build errors.

Suggested-by: Constantine Zakkaroff <mnkz@leeds.ac.uk>

Prefer to use the _WIN32 preprocessor definition defined intrinsically by the
compiler as opposed to "WIN32" defined by the SDKs.

Change-Id: Idd94085cdad4fccd302deef57975c305d3c85d22
BUG: enable return value optimzation for VS debug mode

The GetPixel methods require return value optimization to disable a
copy constructor so that the return and used VariableLengthVectors are
internally a reference to the VectorImage's data.

This patch resolve outstanding Interpolator test failures on Visual
Studio debug builds.

Change-Id: I188f589abdcbb230a8217f8850550b6bd50aceed
BUG: increase the image tolerance for deformable test 5

Change-Id: I8d0667e05ad8a7741b43cad3aa9792660049ba56
BUG: ProgressAccumulator reports incorrectly for streamed filters

This patch addresses a limitation in the ProgressAccumulator
mini-pipeline functionality that does not enable correct progress
reporting when filters are processed using the
itkStreamingImageFilter. The progress information is incorrect because
each filter in the mini-pipeline is executed multiple times for
different regions, but the overall progress is not captured and
stored. Instead, the ProgressAccumulator only reports the sum of the
current progress of each filter in the mini-pipeline ignoring previous
progress of each filter. For example, the progress of
itkDiscreteGaussianImage does not increase monotonically and does not
reach a final progress of 1. In fact, the final progress value it
reaches depends on the number of streams that are used.

This has now been fixed by including a starting event observer that
adds the progress of the filter to the accumulated progress before
resetting the filter's progress to 0 for the next run. This is
especially helpful when streaming is used since the filter is
restarted multiple times for different regions of the input. By
capturing the start event, it is no longer necessary for filters that
use the ProgressAccumulator to explicitly call
ResetFilterProgressAndKeepAccumulatedProgress() as is done, for
example, in itkLaplacianRecursiveGaussianImageFilter and
itkGradientRecursiveGaussianImageFilter. In fact, that method is no
longer needed and has been marked as deprecated.
Thus, this patch also
simplifies the use of the ProgressAccumulator.
Also, when that method was called, it caused the
filters to re-run even if they have not changed.  This is because a
call to SetProgress(0) is made on every filter inside of the
ResetFilterProgressAndKeepAccumulatedProgress() method.
Thus this patch enables filters not to re-run unless they
have to, which will lead to time savings in some cases.

The method ResetProgress has been deprecated because it served no
purpose.  This functionality has been moved to the constructor where
it belongs.

Because ResetProgress and
ResetFilterProgressAndKeepAccumulatedProgress were deprecated, all
calls to these methods in other ITK filters have been removed after
verifying their correctness.
The tests of those filters have also been updated to include a call to
itkSimpleFilterWatcher to write out the filter progress.

This addresses the problem that was described in
http://www.itk.org/Bug/print_bug_page.php?bug_id=9887 and
https://itk.icts.uiowa.edu/jira/browse/ITK-3047

An example output of running DiscreteGaussianImageFilter on a 2D image
with 4 streams before and after this change are as follows:

Before:
| 0 | 0.0111111 | 0.0222222 | 0.0333333 | 0.0444444 | 0.0555556 |
0.0666667 | 0.0777778 | 0.0888889 | 0.1
| 0.111111 | 0.111111 | 0.111111 | 0.122222 | 0.133333 | 0.144444 |
0.155556 | 0.166667 | 0.177778 | 0.188889
| 0.2 | 0.211111 | 0.222222 | 0.222222 | 0.222222 | 0.111111 |
0.122222 | 0.133333 | 0.144444 | 0.155556
| 0.166667 | 0.177778 | 0.188889 | 0.2 | 0.211111 | 0.222222 |
0.222222 | 0.111111 | 0.122222 | 0.133333
| 0.144444 | 0.155556 | 0.166667 | 0.177778 | 0.188889 | 0.2 |
0.211111 | 0.222222 | 0.222222 | 0.25
| 0.138889 | 0.15 | 0.161111 | 0.172222 | 0.183333 | 0.194444 |
0.205556 | 0.216667 | 0.227778 | 0.238889
| 0.25 | 0.25 | 0.138889 | 0.15 | 0.161111 | 0.172222 | 0.183333 |
0.194444 | 0.205556 | 0.216667
| 0.227778 | 0.238889 | 0.25 | 0.25 | 0.277778 | 0.166667 | 0.177778 |
0.188889 | 0.2 | 0.211111
| 0.222222 | 0.233333 | 0.244444 | 0.255556 | 0.266667 | 0.277778 |
0.277778 | 0.166667 | 0.177778 | 0.188889
| 0.2 | 0.211111 | 0.222222 | 0.233333 | 0.244444 | 0.255556 |
0.266667 | 0.277778 | 0.277778 | 0.305556
| 0.333333

After:
| 0 | 0.0111111 | 0.0222222 | 0.0333333 | 0.0444444 | 0.0555556 |
0.0666667 | 0.0777778 | 0.0888889 | 0.1
| 0.111111 | 0.111111 | 0.111111 | 0.122222 | 0.133333 | 0.144444 |
0.155556 | 0.166667 | 0.177778 | 0.188889
| 0.2 | 0.211111 | 0.222222 | 0.222222 | 0.222222 | 0.222222 |
0.233333 | 0.244444 | 0.255556 | 0.266667
| 0.277778 | 0.288889 | 0.3 | 0.311111 | 0.322222 | 0.333333 |
0.333333 | 0.333333 | 0.344444 | 0.355556
| 0.366667 | 0.377778 | 0.388889 | 0.4 | 0.411111 | 0.422222 |
0.433333 | 0.444444 | 0.444444 | 0.472222
| 0.472222 | 0.483333 | 0.494444 | 0.505556 | 0.516667 | 0.527778 |
0.538889 | 0.55 | 0.561111 | 0.572222
| 0.583333 | 0.583333 | 0.583333 | 0.594445 | 0.605556 | 0.616667 |
0.627778 | 0.638889 | 0.65 | 0.661111
| 0.672222 | 0.683333 | 0.694444 | 0.694444 | 0.722222 | 0.722222 |
0.733333 | 0.744444 | 0.755556 | 0.766667
| 0.777778 | 0.788889 | 0.8 | 0.811111 | 0.822222 | 0.833333 |
0.833333 | 0.833333 | 0.844445 | 0.855556
| 0.866667 | 0.877778 | 0.888889 | 0.9 | 0.911111 | 0.922222 |
0.933333 | 0.944444 | 0.944444 | 0.972222
| 1

Change-Id: Idf71bb6a1ea401f7c91149dce56f847dd5dfc15d
BUG: fix gradient recusive gaussian in VS debug

This is another case there we are relying on return value optimization
with VectorImages.

Change-Id: I6d8d84939b80a6d82a255b75e105fe6dd0395705
BUG: in NthElementAdaptor pass by reference to modify argument

Change-Id: I54d9b264216857ebd3b2ba7ac6d302e9ebdd56f8
BUG: LabelGeometry matrix difference tolerance

This patch relaxes the tolerance used to compare matrices so that the
tests will pass on very different OS versions.  It also corrects a
minor bug of default values causing compiler errors on some OS
versions.

Change-Id: I0866ec3597e7abafb418f3329a00bac8ca6be371
ENH: Added progress reporting to Masked FFT NCC

Added progress reporting to the
itkMaskedFFTNormalizedCorrelationImageFilter. The progress reporting
is calculated based on the progress of the FFT and IFFT computations,
which are the most computationally expensive steps of the algorithm.
There are 12 FFT/IFFT computations in the algorithm.

This patch address JIRA ticket: ITK-3099

Change-Id: Icd6af337f15ae359ec5bf1ab5fe84200a0575ff2
ENH: Adding a separate template parameter to handle transform precision

For now there is a confusion between interpolation precision and transform precision : the TInterpolatorPrecision template parameter is used as a template parameter for the transform as well.

It is therefore impossible to specify different type of precision for coordinate transforms and pixel value interpolation. This is hidden by the default template parameter, but may cause some trouble to use the ResampleImageFilter with exotic pixel types or interpolation, where the TInterpolatorPrecision is not a floating point scalar type.

The proposed patch adds a 4th template parameter called TTransformPrecision and use it to set-up the transform. It is set to double by default (as is the TInterpolatorPrecision paramater), so the patch is backward compatible with any code using the unpatched version (with 3 template parameters).

Change-Id: If5c39f19b6a287a3752f91063976f788951e0fd3
BUG: LabelGeometry improvements

This patch corrects the eccentricity, elongation, and orientation
features to operate on the largest eigenvector rather than eigenvector
1. This is the same thing for 2D but different in 3D and higher.

The orientation is also adjusted to always fall between 0 and pi
rather than -pi and pi.  This is possible since the major axis is
symmetric about the origin.  This also makes the orientation values
easier to read and more consistent.

A memory leak in the test was corrected by deleting the matrixPointer
allocated with new.

Change-Id: I12d0d952fe04df43edd118cffb2687f6896870e5
ENH: Implement RollingBallSubtractBackground filter

Change-Id: I532113fb3be2b4b30bd60d4f51737f88bb55a91c
STYLE: Remove unused commented-out code

Change-Id: Ib9814d89e841faca47ec4ed8cae3ad274ff2f75d
STYLE: Rename RollingBallStructuringElement to GrayscaleBallStructuringElement

Change-Id: Ifa6c6adfea10fd212ac5c1b2ade6fc2c60afd593
COMP: Fix linking issues in Windows

Change-Id: Ieb3935e968b15dbd7975000c0ed5ca4f4fdb7752
COMP: Fix up the CMake tests and move the images to Midas server

Change-Id: I89637852b601f2a316a049243e82a4bd3a5a0800
COMP: Change main definition since VS linker has bug

Change-Id: I3d2b39da5219e26716f484c885e8a7bfe7ebedf8
ENH: Add support for anistropic ball and differing ball and neighborhood sizes

Change-Id: I484a7da35dd1419ce310cb3dc785f4376c0455c1
ENH: Add support for anistropic ball to SubtractBackgroundImageFilter

Change-Id: I3c79a1aafd95ab29ef834d278789022a9d7ae983