PERF: Remove IncreaseFrequencyOfMeasurement from inner loops

The Histogram::IncreaseFrequencyOfMeasurement uses a local
IncreaseFrequencyOfMeasurement::IndexType for the index. This is a
dynamically allocated array. When used in per-pixel loops most of the
time is spent in memory allocation. Move the index outside the loop to
remove the dynamic memory allocation in the inner-loop.

This results in an over 2X speed up for all automatic histogram
thresholding filters such as OtsuThresholdImageFilter.

After this observation, other uses of IncreaseFrequencyOfMeasurement
where replace with the extracted Index allocation. Speed up is
expected in numerous filters.

Change-Id: I7a862cc368cd935f4e05a71974c398317bb82dc5
Merge topic 'RemoveHistogramIndexAllocation'

9baf9fba PERF: Remove IncreaseFrequencyOfMeasurement from inner loops