COMP: Fix print import statement in itkExtras.py

Will fix the following error in the tests:

Traceback (most recent call last):
  File "/home/kevin/kitware/ITK/Wrapping/Generators/Python/Tests/CurvatureFlowImageFilter.py", line 24, in <module>
    import itk
  File "/home/kevin/kitware/ITK_Build/Wrapping/Generators/Python/itk.py", line 24, in <module>
    import itkExtras
  File "/home/kevin/kitware/ITK_Build/Wrapping/Generators/Python/itkExtras.py", line 28
    from __future__ import print_function
SyntaxError: from __future__ imports must occur at the beginning of the file
itkTestDriver: Process exited with return value: 1

Change-Id: I3880862f1fd85f05dd9e85d347bd5e33498275ec
ENH: Enable observed events to modify observers

There is no way to know if an object is executing an event, and it
wasn't safe to modify the observers when an event was being executed.

This patch is inspired by the ModifiedList implementation in the VTK
SubjectHelper class. It allows for recursive execution of events
and modification of the observers during execution.

The Command list items are saved on the stack recursively. Given that
it's not expected to utilize a large number of Observers with ITK, nor
is it expected to be common practice to delete Observers during event
execution, this method was chosen because it does not utilize any
dynamic memory allocation which causes reduce performance. This was
done at the expense of stack space. Additionally, when an observer is
deleted the search time is O(n^2), but it's safe.

Change-Id: Ia2068044454806b2cf018ba881126b65b152ac3c
Merge topic 'EnhanceDirectionCosDocumentation'

e4c851f3 DOC: Improved Image Representation
PERF: Minimize redundant function calls

The highest percentage of time in the MattesMutualInformation
filter was spent evaluating if specialized work needed to
be done for displacment fields.

In a minimalistic test case, prior to this change the registration
took 846 seconds, after this change, registration took 309 seconds.

bin/BRAINSFit   \
  "--costMetric" "MMI"  \
  "--failureExitCode" "-1"   \
  "--numberOfIterations" "1"  \
  "--numberOfHistogramBins" "50"  \
  "--splineGridSize" "7,5,6"  \
  "--numberOfSamples" "14000"   \
  "--minimumStepLength" "0.1"  \
  "--initializeTransformMode" "useCenterOfHeadAlign"  \
  "--transformType" "BSpline"  \
  "--fixedVolume"  "BRAINSTools-build/ExternalData/TestData/test.nii.gz"  \
  "--movingVolume" "BRAINSTools-build/ExternalData/TestData/rotation.rescale.rigid.nii.gz"  \
  "--outputVolume" "BRAINSTools-build/BRAINSFit/TestSuite/BRAINSFitTest_BSplineScaleRotationRescaleHeadMasks.test.nii.gz"  \
  "--outputTransform" "BRAINSTools-build/BRAINSFit/TestSuite/BRAINSFitTest_BSplineScaleRotationRescaleHeadMasks.h5"  \
  "--maxBSplineDisplacement" "7.3"

Change-Id: I3782e78cae99acfe577a40444882688ae5b76472
PERF: Pull loop termination constants out of loop

When evaluating loops, loop termination criteria that
are accessed via member functions should not be
used at every iteration.  Common static loop iteration
termination values are stored locally and reused.

Change-Id: Ia847f411640cce6921b28ac2a2da448c40ebe24c
ENH: Refactoring the CompositeTransform class

Prefer initialization to assignment (i.e. use class constructors
rather than resize variables).

Add const correctness, and use const references to temporary
local variables rather than copy constructing them.

Change-Id: I79a0dd7e3e22d3e5866b13b343c7f14296293606
Merge topic 'EnableObserverModifyObservers'

f7307e26 ENH: Enable observed events to modify observers
4c4e6266 ENH: Explicitly specify internal linkage for internal observer objects
ENH: [SG]et optimizable params ITKv4 registration

Currently the only way the initialize the registration configuration is
to set up an initial moving transform. Inside the registration filter,
this initial transform is added to a composite transform along with the
output optimizable transform, and this composite transform is used for
metric evaluation at each iteration.

In this case, we also need to use a composite transform after the
regsitration process to concatenate the initial moving transform and
the output of the registration filter to create the final transform for
the resampler.

Doing all above is a lot of work that is not necessary in many cases.

In this patch new APIs are added to the ITKv4 registration framework
that allow us to directly initialize the output optimizable transform.

The new API is called "InitializeOptimizableParametersFromTransform",
and it provides a new option for iniatialization of the registration framework.
This feature lets us to initialize the optimizable registration transform
directly in a same way as we used to do in ITKv3.

Change-Id: I49a1ee0fd88e289bbc266ea61e68d6d0968fd761
Merge topic 'FixPrintImport'

ccc97cc3 COMP: Fix python print import for .pth file creation
Merge topic 'FixPythonTestPrintImports'

69f406fb COMP: Fix print import statement in itkExtras.py
Merge topic 'ImproveRegistrationInitialization'

9c1a5212 ENH: [SG]et optimizable params ITKv4 registration
Merge topic 'PerfMattesRegistration'

73835b81 ENH: Refactoring the CompositeTransform class
cafef89d PERF: Pull loop termination constants out of loop
304448f1 PERF: Minimize redundant function calls
ENH: remove VersorTransformOptimizerv4 from ITKv4

The recently added RegularStepGradientDescentOptimizerv4 can be used
form both vector and versor transforms optimization. Therefore, the
versor optimzer can be considered as a duplicated class and can be
removed form ITK.

Change-Id: I2705f21fdb4667fa31bcabf5e18b1567d75ca961
BUG: Catch exception in DeleteEvent

If an exception was thrown by a DeleteEvent Observer the reference
counting for the object wouldn't occur and a SmartPointer destructor
would thrown an exception. This would lead to a memory leak, program
termination or other undefined behavior.

Change-Id: Ib0dda1d8abc510999523db6e2eee5281e3a18056
STYLE: Explicitly declare virtual for derived class member functions

Class member functions derived from parent class with virtual functions
of the same name are implicitly virtual.  This patch set uses a macro
for the c++11 override keyword to indicate that this function was
intended to be overridden in this derived class.

Ensuring that functions signatures are described as virtual is not
strictly needed, but it facilitates maintenance by being consistent.
Approximately 1/2 of the toolkit had the explicit virtual designation and 1/2
relied on implicit behavior.

The ITK_OVERRIDE define allows for non-c++11 compilers to continue to work.

Change-Id: Iba5c2970f2bad4f7f664b92a4420d217546bb22f
STYLE: Explicitly recognize virtual functions

Build the latest version of llvm with clang and extra tools

The clang-modernize tool can insert missing override keyword
as a macro so that missing [optional] virtual identifiers
can be easily added.

mkdir ITK-newclang
cd ITK-newclang/
CC=/opt/llvm_trunk/bin/clang CXX=/opt/llvm_trunk/bin/clang++ CXXFLAGS="-std=c++11 -stdlib=libstdc++" ccmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON ../ITK
make -j23
clang-modernize -p ITK-newclang/ -include ITK/Modules/ -exclude ITK/Modules/ThirdParty  -add-override -override-macros

Change-Id: Ifbfb774b8b6eb489f4c0bd8955b13a9b5bce21d0
STYLE: Add ITK_NULLPTR supporting c++11 checks

In c++11 there is an explicit nullptr type that introduces a new keyword to
serve as a distinguished null pointer constant: nullptr. It is of type
nullptr_t, which is implicitly convertible and comparable to any pointer type
or pointer-to-member type. It is not implicitly convertible or comparable to
integral types, except for bool.

This patch adds a define for ITK_NULLPTR as nullptr when c++11 is
available.

clang-modernize -p ITK-newclang/ -include ITK/Modules/ -exclude ITK/Modules/ThirdParty -use-nullptr

Change-Id: I2f9aeb7d92581cc84a75bdc6a00b79169e72100a
ENH: Turn off DCMTK Logger messages by default

Reading DICOM Image files will sometimes generate thousands of
DCMTK warnings, even though all the DICOM tags needed to extract
Image data and metadata are read correctly.

This patch turns off the DCMTK logger except for fatal errors.
New Set/GetLogLevel are added to control DCMTK logging. A user
might well want to turn on more verbose output from DCMTK while
debugging.

Change-Id: I152aa446b7620b8268f74436e968c21e54b59101
Merge topic 'DeclareVirtualFunctionsExplicitly'

0d61aa07 STYLE: Add ITK_NULLPTR supporting c++11 checks
10757725 STYLE: Explicitly recognize virtual functions
1c860901 STYLE: Explicitly declare virtual for derived class member functions
Merge topic 'ExceptionSafteySmartPointerDestructor'

cf589ecb BUG: Catch exception in DeleteEvent