BUG: Call clear instead of empty on PatchBasedDenoising EmptyCaches().

See http://www.viva64.com/en/b/0271/

PVS-Studio's diagnostic messages:

V530 The return value of function 'empty' is required to be utilized.
itkpatchbaseddenoisingimagefilter.hxx 85
V530 The return value of function 'empty' is required to be utilized.
itkpatchbaseddenoisingimagefilter.hxx 86
Due to inattention, the programmer implemented a call of the 'empty()'
function instead of 'clear()'. It leads to adding garbage to the cache, so
using it becomes dangerous. This bug is hard to find and it can lead to very
strange side effects.

Furthermore, the usage of new and delete for manual memory management of
the eigenValsCache and eigenVecsCache elements have been replaced with RAII.

No performance slowdowns were found when switching to RAII.

Co-Authored-By: Ho Cheung <hocheung20@gmail.com>
Co-Authored-By: Kris Zygmunt <krismz@sci.utah.edu>

Change-Id: Ic9bb2dc847a8ba96842594a8475580b1e1eb450a
Merge topic 'PatchEmptyCache_release'

f9dce6ff BUG: Call clear instead of empty on PatchBasedDenoising EmptyCaches().
COMP: Add tolerance for comparing floating point

The multi-threaded accumulation can not ensure the order of the accumulations
and very slight differences can occur depending on the order of thread
processing that is done.  A very small tolerance was added to the test
to accomodate these very slight differences.

Improve debugging statements for test and info on timing and variables size.

Testing can require using larger sized images and a view of the performance
is needed in the test.  This patch adds timing for computing the metric
and the ability to more easily change the size of the images being tested.

Change-Id: I70e43c16e398de6c5d1c78b3cc7a00686903806b
PERF: Remove non-threadable algorithm components

During testing of thread optimization, some of the accumulation
operations were determined to be less efficient in each thread than
to just do them in single threaded mode.  The complicated code
constructs for having multiple threads remained in the single threaded
code parts.

The per thread PDF accumulations no longer need to be sub-divided
over the thread "BinStart[thread]-BinEnd[thread]" partitioning.

Change-Id: I5ae4461cfcf4ea2be7f32fdbf4d19764d169b12e

The vector of thread variables for the JointPDFSum were never
used in the threads.  Converted to a single value for simplifying
the code.

The accumulation phases of this algorithm are all occuring inside
of non threaded code sections.  There is a note stating that the
threaded implmentations of the accumulation process was not faster
than the single threaded version (presumably due to overhead issues).

Remove unnecessary block definition per thread variables:
m_ThreaderJointPDFStartBin[threadId]
m_ThreaderJointPDFEndBin[threadId]

Change-Id: Id14daf5d271928e0f38b46b7fc7c1c79eb65939a
Merge branch 'release'

Change-Id: Ib74f38b25acca93b9df8e1f8deadb862918e4c84
PERF: Remove large foot print of PDF derivatives.

ITK-3286 Describes that the memory footprint is very
large for many threads and MattesMutualInformation
due to the amount of memory being allocated per thread.

Allocating memory is also the most time consuming portion
of the MI algorithm and drastically restricts the
scalability of the algorithm to many threads.

Performance Enhancments for minimizing number of
memory bufers needed to avoid false sharing by using
a queue based accumulation per thread that is periodically
syncronized with the primary pdf.  This approach
allows the time consuming part of each thread to
occur and the syncronized writing to the JointPDFDerivative
in parallel.

Each computation of a point was previously allocating new
memory.  This patch set checks if the currently allocated
memory is the proper size, and then re-initalizes that
memory if possible.

Change-Id: I72f1d1ea2be71a883a47fe71afc2724e5ec88fb8
Merge topic 'MattesMemoryUsage'

4c98ab63 PERF: Remove large foot print of PDF derivatives.
BUG: Fix Size() in ImageToListSampleAdaptor for VectorImage's.

Also add appropriate test coverage.

Change-Id: I64eb94cd1ac51adf08008247483ef2c569735979
Merge topic 'ImageToListAdaptorVectorImage_release'

a316dc18 BUG: Fix Size() in ImageToListSampleAdaptor for VectorImage's.