Fix transform tests removing dynamic cast
Created by: jcfr
This PR fixes regressions introduced by InsightSoftwareConsortium/ITK@d1e9fe2 (BUG: Ensure Transform IO factories are registered once.) and integrated in r24836 (ENH: Update ITKv4 to v4.9.0 release branch).
Following this ITK commit, the ITKIO transform libraries are build as shared and dynamic_cast can NOT be used with templated classes that are instantiated in a translation unit different than the one where they are defined. It will work only if the classes are explicitly instantiated and exported.
To workaround the issue, code that was relying on dynamic_cast
is updated to (1) ensure the objects are of the right type doing string comparison and (2) then use static_cast
instead of dynamic_cast
.
To summarize, the following tests that started to fail on Ubuntu since January 8th will now pass:
EMSegCL_RunSetEverything
EMSegCL_Task_BRAINS_MRIHumanBrain_scalartype_float_very_small
EMSegCL_Task_BRAINS_MRIHumanBrain_scalartype_uint_very_small
EMSegCL_Task_HumanEye_BRAINS_small
EMSegCL_Task_MRIHumanBrain_BRAINS_small
EMSegCL_Task_MRIHumanBrainExp_BRAINS_small
EMSegCL_Task_MRIHumanBrainFullParcellation_BRAINS_small
EMSegCL_Task_MRIHumanBrainParcellation_BRAINS_small
EMSegCL_Task_NonHumanPrimate_BRAINS_small
ResampleScalarVectorDWIVolumeBSplineInterpolationTest
ResampleScalarVectorDWIVolumeBSplineWSInterpolationTest
ResampleScalarVectorDWIVolumeRotationAndAffineTest
ResampleScalarVectorDWIVolumeRotationNNTest
ResampleDTIVolumeRotationNNTest
ResampleDTIVolume2RigidTransformsLinearTest
ResampleDTIVolumeBSplineWSInterpolationTest
ResampleDTIVolumeBSplineInterpolationTest
vtkSlicerTransformLogicTest1
vtkMRMLNonlinearTransformNodeTest1
The tests EMSeg_SlicerCommonInterfaceTestGeneral
and EMSegCL_Task_MRIHumanBrain_2CH
are failing because of issue with N4ITKBiasFieldCorrection
. This is tracked in issue
#4130.
Test vtkMRMLFiberBundleNodeTest1
failure is tracked in issue #4129.
Cc: @thewtex @fbudin69500 @lassoan @pieper @hjmjohnson