ENH: Added radiusIsParametric  mode to FlatStructuringElement

This patch introduces an optional flag called
"radiusIsParametric" to the "ball" and "annulus" structuring
elements of FlatStructuringElement.  Setting this flag to true will
generate structuring elements with more accurate areas, which can be
especially important when morphological operations are intended to
remove or retain objects of particular sizes.

This mode was introduced because the original ball and annulus
structuring elements have a systematic bias in the radius of +0.5
voxels in each dimension relative to the analytic definition of the
radius.

We recommend using this mode for more accurate structuring elements.
However, this mode is turned off by default for backward
compatibility.

Examples:
For a 3D ball of radius 5 should have an area of 523. With this mode
turned on, the number of "on" pixels is 515 (error 1.6%), but with it
turned off, the area is 739 (error 41%).

For a 3D annulus of radius 5 and thickness 2, the area should be 410.
With this mode turned on, the area is 392 (error 4.5%),  but when
turned off it is 560 (error 36%).

This same trend holds for balls and annuli of any radius or dimension.
For more detailed experiments with this mode, please refer to the
results of the test itkFlatStructuringElementTest.cxx or the wiki
example.

Change-Id: If7b2f654de396771beb49b6736eae57b28445eed
BUG: TvirtualImage mismatch in registrationV4 and metric object

Consider a situation that we want to register two float images using a
double type transform.
We instantiate our metric as an object of itkImageToImageMetricv4 class
or one of its derived classes.
In the definition of the metric classes, the TvirtualImage is set to TFixedImage,
and the InternalComputationValueType is set to double by default.
Therefore, in the case of our example, the metric object has the type of:

  itkImageToImageMetricv4< Image<float,Dim>,
                           Image<float,Dim>,
                           Image<float,Dim>,
                           double>                  (1)

The above metric object is set to the itkImageRegistrationMethodv4
class as its base class type:

  itkObjectToObjectMetricBaseTemplate<double>

because the metric type in ITKv4 registration framework is defined as:

  typedef itkObjectToObjectMetricBaseTemplate<RealType> MetricType;

Where the RealType comes from the output transform type:

  typedef typename OutputTransformType::ScalarType RealType;

That is "double" in our example.

Inside the registration framework, the above MetricType object should be
casted to the ImageMetricType that is defined as:

  itkImageToImageMetricv4< Image<float,Dim>,
                           Image<float,Dim>,
                           Image<double,Dim>,
                           double>                  (2)

As in ITKv4 registration method class, we have:

  typedef ImageToImageMetricv4<FixedImageType, MovingImageType,
                              VirtualImageType, RealType> ImageMetricType;

Where the virtual image type is defined as:

  typedef Image<typename ObjectToObjectMetricBaseTemplate<RealType>::ParametersValueType,
               ImageDimension>   VirtualImageType;

That in our example, the RealType is double and the virtualImageType
have the type of: Image<double,Dim>.

Obviously a dynamic cast from (1) to (2) will be failed and causes a
segfault in current version of ITK.

To avoid this issue, we should have consistent definitions for the
virtualImageType in the metric classes and RegistrationMethodv4 class.
Therefore, we should be able to pass the VirtualImageType to
the ITKv4 registration framework as a template parameter that is set to
TFixedIamge by default the same as metric classes.

A new test is added to ITKv4 to show above bug. This test returns
failure with current version of ITK; however, it will be passed after
applying the changes introduced by this patch.

Change-Id: I06e6f8fcee8e7e54f23e0e05054be77495f82c68
Merge topic 'virtualImageTestPass'

2823465 BUG: TvirtualImage mismatch in registrationV4 and metric object
Merge topic 'FlatStructuringElementForegroundHasAccurateArea'

789954b ENH: Added radiusIsParametric  mode to FlatStructuringElement
ENH: Avoid use of cast in ImageToImageMetricV4

use function overload and templates to
avoid casting Point types in TransformAndEvaluatePoint.

Change-Id: I650d5278914c26401465ce445177e24e09433fc9
COMP: Allow single precision space definition

The spacing and physical space definitions for
ITK images is hardcoded as double precision.  This patch
allows for an advanced compiler option to be provided
that rebuilds the entire toolkit so that physical
space is represented by single precision floating
point numbers.

The primary reason for this is to test for performance
issues that arise due to implicit conversion between
double and float.