PERF: Revert Remove large foot print of PDF derivatives.

This reverts commit 4c98ab6355ef578a4bfc66879e88d5467bbcc698.
The previous attempt to address speed issues resulted in
a serious performance penalty for BSpline registration types
due to the size of the derivatives generated.

Lessons learned from investigating this path are are
incorporated into the next set of patches.

Change-Id: I91f5a0efc2025efd37c9861567a2ced46dc13bc8
STYLE: Test against almost equal for floating point values

Comparing floating point values for absolute equals is
nearly always a bad practice.  This patch adds the smallest
of tolerances to ensure that miniscule accumulation differences
due to multi-threading do not cause in-consequential test
failures.

Change-Id: I7636fa5c6d6e8f07ecfa2b1b7a72a525f5ff9af7
STYLE: Non-exact floating point testing

Floating point numbers should not be required to be absolutely the same value
when the accumulations orders can not be strictly enforced.  Use the
itk::Math::FloatAlmostEqual() function to test when floating point
values are nearly identical.

Change-Id: I7ebaff0e8fcdf58d344c7ac8b3c7fcc883c6edee
ENH: Improve precision of the joint PDF sum

In Mattes MI v4 metric, use a compenstated summation
to improve the overall precision of the estimates.

Change-Id: I5a9d5ec3138e423698dabb259fbcc0a898a0ce89
PERF: Distribute initialization per thread buffers

The process of zero'ing out and creating new buffers
across 32 threads is quite time consuming.  By
distributing the load across each of the threads, this can
occur in parallel, thus providing a huge speed increase.

This solution scales to many cores better than alternative
solutions attempted.

Change-Id: If1d15b6ed2045f75fa205dee21bdc3fb2714870a
ENH: Remove unnecessary mutable qualifier.

Change-Id: I56b9692508881708aefdc01472ace20f109e2cab
STYLE: Remove comment with no meaning.

These comments in the implementation file added no value to the code.

Change-Id: Ia3db4822c1ba7370330d20a7c1b324065d0ed2ae
ENH: Moved accumlator logic to main MI class

Do accumualtions with independant accumulator so
that they can be done as each thread completes.

Replace accumulations on the zero buffer with
independant buffer accumulations.

The algorithmic components that are not part of the
ThreadedGetValueAndDerivative are pushed back into
the main Mattes class rather than occuring in the single threaded
AfterThreadedGenerate portion of the computations.

Co-authored-by: Matt McCormick <matt.mccormick@kitware.com>
Co-authored-by: Bradley Lowekamp <blowekamp@mail.nih.gov>

Change-Id: Id6c4dd07fbd1ef4b0eec4320ab16e2285cc42102
ENH: Allow staggering of accumulations per thread.

This patch uses mutex locking so that only the accumulations
for approximages 1/NumThreadss of the accumulator buffer
block for each thread.  As each thread is accumulating onto
the common buffer, the the other portions of the
accumulator remain free for writing by other threads.

Co-authored-by: Matt McCormick <matt.mccormick@kitware.com>

Change-Id: I493c97a3fd816c1fd58c0229023927674e59ceb5
PERF: Zero reset thread buffers during finalize

This patch set moves the zero'ing of thread buffers to occur
at the same time as the accumulation process, thus allowing
for more cache coherence of memory manipulations and
overall improved CPU utilization.

Change-Id: I5464321e0e1181852b69827180d241e85be5addc
Merge branch 'PartialRevertMattesPDFSize_release' into release

Change-Id: If0e5340531f32d4b390b6cc921e0c657be25081e