diff --git a/Testing/Code/DisparityMap/CMakeLists.txt b/Testing/Code/DisparityMap/CMakeLists.txt index 5edb3457ba530cf17620970554e88d2058180c61..b0a7e6c67854a2d5e20c10df9d29d5119db106d6 100644 --- a/Testing/Code/DisparityMap/CMakeLists.txt +++ b/Testing/Code/DisparityMap/CMakeLists.txt @@ -129,9 +129,7 @@ ADD_TEST(dmTvBSplinesInterpolateTransformDeformationFieldGenerator ${DISPARITYMA # ------- Additional tests for deformation fields estimation ---------- ADD_TEST(dmTvTranslationDeformationFieldEstimation ${DISPARITYMAP_TESTS} - --compare-n-images ${EPSILON} 10 - ${TEMP}/dmTvTranslationDeformationFieldEstimationOutput_nnt_oi.tif - ${BASELINE}/dmTvTranslationDeformationFieldEstimationOutput_nnt_oi.tif + --compare-n-images ${EPSILON} 12 ${TEMP}/dmTvTranslationDeformationFieldEstimationOutput_bs_df.hdr ${BASELINE}/dmTvTranslationDeformationFieldEstimationOutput_bs_df.hdr ${TEMP}/dmTvTranslationDeformationFieldEstimationOutput_bs_oi.tif @@ -150,6 +148,12 @@ ADD_TEST(dmTvTranslationDeformationFieldEstimation ${DISPARITYMAP_TESTS} ${BASELINE}/dmTvTranslationDeformationFieldEstimationOutput_nt_oi.tif ${TEMP}/dmTvTranslationDeformationFieldEstimationOutput_nnt_df.hdr ${BASELINE}/dmTvTranslationDeformationFieldEstimationOutput_nnt_df.hdr + ${TEMP}/dmTvTranslationDeformationFieldEstimationOutput_nnt_oi.tif + ${BASELINE}/dmTvTranslationDeformationFieldEstimationOutput_nnt_oi.tif + ${TEMP}/dmTvTranslationDeformationFieldEstimationOutput_bst_df.hdr + ${BASELINE}/dmTvTranslationDeformationFieldEstimationOutput_bst_df.hdr + ${TEMP}/dmTvTranslationDeformationFieldEstimationOutput_bst_oi.tif + ${BASELINE}/dmTvTranslationDeformationFieldEstimationOutput_bst_oi.tif otbTranslationDeformationFieldEstimation ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub.tif ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub_warped_translation.tif @@ -158,9 +162,7 @@ ADD_TEST(dmTvTranslationDeformationFieldEstimation ${DISPARITYMAP_TESTS} ) ADD_TEST(dmTvEuler2DDeformationFieldEstimation ${DISPARITYMAP_TESTS} - --compare-n-images ${EPSILON} 10 - ${TEMP}/dmTvEuler2DDeformationFieldEstimationOutput_nnt_oi.tif - ${BASELINE}/dmTvEuler2DDeformationFieldEstimationOutput_nnt_oi.tif + --compare-n-images ${EPSILON} 12 ${TEMP}/dmTvEuler2DDeformationFieldEstimationOutput_bs_df.hdr ${BASELINE}/dmTvEuler2DDeformationFieldEstimationOutput_bs_df.hdr ${TEMP}/dmTvEuler2DDeformationFieldEstimationOutput_bs_oi.tif @@ -179,6 +181,12 @@ ADD_TEST(dmTvEuler2DDeformationFieldEstimation ${DISPARITYMAP_TESTS} ${BASELINE}/dmTvEuler2DDeformationFieldEstimationOutput_nt_oi.tif ${TEMP}/dmTvEuler2DDeformationFieldEstimationOutput_nnt_df.hdr ${BASELINE}/dmTvEuler2DDeformationFieldEstimationOutput_nnt_df.hdr + ${TEMP}/dmTvEuler2DDeformationFieldEstimationOutput_nnt_oi.tif + ${BASELINE}/dmTvEuler2DDeformationFieldEstimationOutput_nnt_oi.tif + ${TEMP}/dmTvEuler2DDeformationFieldEstimationOutput_bst_df.hdr + ${BASELINE}/dmTvEuler2DDeformationFieldEstimationOutput_bst_df.hdr + ${TEMP}/dmTvEuler2DDeformationFieldEstimationOutput_bst_oi.tif + ${BASELINE}/dmTvEuler2DDeformationFieldEstimationOutput_bst_oi.tif otbEuler2DDeformationFieldEstimation ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub.tif ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub_warped_euler2D.tif @@ -187,9 +195,7 @@ ADD_TEST(dmTvEuler2DDeformationFieldEstimation ${DISPARITYMAP_TESTS} ) ADD_TEST(dmTvCenteredRigidDeformationFieldEstimation ${DISPARITYMAP_TESTS} - --compare-n-images ${EPSILON} 10 - ${TEMP}/dmTvCenteredRigidDeformationFieldEstimationOutput_nnt_oi.tif - ${BASELINE}/dmTvCenteredRigidDeformationFieldEstimationOutput_nnt_oi.tif + --compare-n-images ${EPSILON} 12 ${TEMP}/dmTvCenteredRigidDeformationFieldEstimationOutput_bs_df.hdr ${BASELINE}/dmTvCenteredRigidDeformationFieldEstimationOutput_bs_df.hdr ${TEMP}/dmTvCenteredRigidDeformationFieldEstimationOutput_bs_oi.tif @@ -208,6 +214,12 @@ ADD_TEST(dmTvCenteredRigidDeformationFieldEstimation ${DISPARITYMAP_TESTS} ${BASELINE}/dmTvCenteredRigidDeformationFieldEstimationOutput_nt_oi.tif ${TEMP}/dmTvCenteredRigidDeformationFieldEstimationOutput_nnt_df.hdr ${BASELINE}/dmTvCenteredRigidDeformationFieldEstimationOutput_nnt_df.hdr + ${TEMP}/dmTvCenteredRigidDeformationFieldEstimationOutput_nnt_oi.tif + ${BASELINE}/dmTvCenteredRigidDeformationFieldEstimationOutput_nnt_oi.tif + ${TEMP}/dmTvCenteredRigidDeformationFieldEstimationOutput_bst_df.hdr + ${BASELINE}/dmTvCenteredRigidDeformationFieldEstimationOutput_bst_df.hdr + ${TEMP}/dmTvCenteredRigidDeformationFieldEstimationOutput_bst_oi.tif + ${BASELINE}/dmTvCenteredRigidDeformationFieldEstimationOutput_bst_oi.tif otbCenteredRigidDeformationFieldEstimation ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub.tif ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub_warped_centered_rigid.tif @@ -216,9 +228,7 @@ ADD_TEST(dmTvCenteredRigidDeformationFieldEstimation ${DISPARITYMAP_TESTS} ) ADD_TEST(dmTvSinusoidDeformationFieldEstimation ${DISPARITYMAP_TESTS} - --compare-n-images ${EPSILON} 10 - ${TEMP}/dmTvSinusoidDeformationFieldEstimationOutput_nnt_oi.tif - ${BASELINE}/dmTvSinusoidDeformationFieldEstimationOutput_nnt_oi.tif + --compare-n-images ${EPSILON} 12 ${TEMP}/dmTvSinusoidDeformationFieldEstimationOutput_bs_df.hdr ${BASELINE}/dmTvSinusoidDeformationFieldEstimationOutput_bs_df.hdr ${TEMP}/dmTvSinusoidDeformationFieldEstimationOutput_bs_oi.tif @@ -237,6 +247,12 @@ ADD_TEST(dmTvSinusoidDeformationFieldEstimation ${DISPARITYMAP_TESTS} ${BASELINE}/dmTvSinusoidDeformationFieldEstimationOutput_nt_oi.tif ${TEMP}/dmTvSinusoidDeformationFieldEstimationOutput_nnt_df.hdr ${BASELINE}/dmTvSinusoidDeformationFieldEstimationOutput_nnt_df.hdr + ${TEMP}/dmTvSinusoidDeformationFieldEstimationOutput_nnt_oi.tif + ${BASELINE}/dmTvSinusoidDeformationFieldEstimationOutput_nnt_oi.tif + ${TEMP}/dmTvSinusoidDeformationFieldEstimationOutput_bst_df.hdr + ${BASELINE}/dmTvSinusoidDeformationFieldEstimationOutput_bst_df.hdr + ${TEMP}/dmTvSinusoidDeformationFieldEstimationOutput_bst_oi.tif + ${BASELINE}/dmTvSinusoidDeformationFieldEstimationOutput_bst_oi.tif otbTranslationDeformationFieldEstimation ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub.tif ${INPUTDATA}/ROI_IKO_PAN_LesHalles_sub_warped_sinus.tif diff --git a/Testing/Code/DisparityMap/otbCenteredRigidDeformationFieldEstimation.cxx b/Testing/Code/DisparityMap/otbCenteredRigidDeformationFieldEstimation.cxx index df8b3d0ca082345eca3db9be8af0661ca346b9b5..b07fad98e2f7c0f6d62ddcebf400d7efa186666a 100644 --- a/Testing/Code/DisparityMap/otbCenteredRigidDeformationFieldEstimation.cxx +++ b/Testing/Code/DisparityMap/otbCenteredRigidDeformationFieldEstimation.cxx @@ -33,6 +33,7 @@ #include "otbBSplinesInterpolateDeformationFieldGenerator.h" #include "otbNearestTransformDeformationFieldGenerator.h" #include "otbNNearestTransformsLinearInterpolateDeformationFieldGenerator.h" +#include "otbBSplinesInterpolateTransformDeformationFieldGenerator.h" int otbCenteredRigidDeformationFieldEstimation(int argc, char* argv[]) @@ -110,6 +111,7 @@ try typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesGeneratorType; typedef otb::NearestTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> NearestTransformGeneratorType; typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> NNearestTransformGeneratorType; + typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesTransformGeneratorType; // Warper typedef itk::WarpImageFilter<ImageType,ImageType,DeformationFieldType> ImageWarperType; @@ -365,7 +367,42 @@ try writer->SetFileName(oss.str().c_str()); writer->SetInput(rescaler->GetOutput()); writer->Update(); + + //3.e Transforms deformation field spline interpolation generator + writer = WriterType::New(); + dfwriter = DeformationFieldWriterType::New(); + warper = ImageWarperType::New(); + rescaler = RescalerType::New(); + + BSplinesTransformGeneratorType::Pointer generator6 = BSplinesTransformGeneratorType::New(); + generator6->SetPointSet(dmestimator->GetOutput()); + generator6->SetOutputOrigin(fixedReader->GetOutput()->GetOrigin()); + generator6->SetOutputSpacing(fixedReader->GetOutput()->GetSpacing()); + generator6->SetOutputSize(fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize()); + generator6->SetMetricThreshold(metricThreshold); + generator6->SetTransform(transform); + generator6->SetSplineOrder(4); + generator6->SetNumberOfControlPoints(5); + + warper->SetInput(fixedReader->GetOutput()); + warper->SetDeformationField(generator6->GetOutput()); + rescaler->SetInput(warper->GetOutput()); + rescaler->SetOutputMaximum(255); + rescaler->SetOutputMinimum(0); + rescaler->Update(); + + oss.str(""); + oss<<outputFileNamePrefix<<"_bst_df.hdr"; + dfwriter->SetFileName(oss.str().c_str()); + dfwriter->SetInput(generator6->GetOutput()); + dfwriter->Update(); + + oss.str(""); + oss<<outputFileNamePrefix<<"_bst_oi.tif"; + writer->SetFileName(oss.str().c_str()); + writer->SetInput(rescaler->GetOutput()); + writer->Update(); } catch( itk::ExceptionObject & err ) diff --git a/Testing/Code/DisparityMap/otbEuler2DDeformationFieldEstimation.cxx b/Testing/Code/DisparityMap/otbEuler2DDeformationFieldEstimation.cxx index 7213b4530285e7b8c165d539b5cef464103c9a69..92110a9a37745ff5dcc974cb6ea4d6823014cc7c 100644 --- a/Testing/Code/DisparityMap/otbEuler2DDeformationFieldEstimation.cxx +++ b/Testing/Code/DisparityMap/otbEuler2DDeformationFieldEstimation.cxx @@ -33,6 +33,7 @@ #include "otbBSplinesInterpolateDeformationFieldGenerator.h" #include "otbNearestTransformDeformationFieldGenerator.h" #include "otbNNearestTransformsLinearInterpolateDeformationFieldGenerator.h" +#include "otbBSplinesInterpolateTransformDeformationFieldGenerator.h" int otbEuler2DDeformationFieldEstimation(int argc, char* argv[]) @@ -110,6 +111,7 @@ try typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesGeneratorType; typedef otb::NearestTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> NearestTransformGeneratorType; typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> NNearestTransformGeneratorType; + typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesTransformGeneratorType; // Warper typedef itk::WarpImageFilter<ImageType,ImageType,DeformationFieldType> ImageWarperType; @@ -368,6 +370,42 @@ try writer->SetInput(rescaler->GetOutput()); writer->Update(); +//3.e Transforms deformation field spline interpolation generator + writer = WriterType::New(); + dfwriter = DeformationFieldWriterType::New(); + warper = ImageWarperType::New(); + rescaler = RescalerType::New(); + + BSplinesTransformGeneratorType::Pointer generator6 = BSplinesTransformGeneratorType::New(); + generator6->SetPointSet(dmestimator->GetOutput()); + generator6->SetOutputOrigin(fixedReader->GetOutput()->GetOrigin()); + generator6->SetOutputSpacing(fixedReader->GetOutput()->GetSpacing()); + generator6->SetOutputSize(fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize()); + generator6->SetMetricThreshold(metricThreshold); + generator6->SetTransform(transform); + generator6->SetSplineOrder(4); + generator6->SetNumberOfControlPoints(5); + + + warper->SetInput(fixedReader->GetOutput()); + warper->SetDeformationField(generator6->GetOutput()); + rescaler->SetInput(warper->GetOutput()); + rescaler->SetOutputMaximum(255); + rescaler->SetOutputMinimum(0); + rescaler->Update(); + + oss.str(""); + oss<<outputFileNamePrefix<<"_bst_df.hdr"; + dfwriter->SetFileName(oss.str().c_str()); + dfwriter->SetInput(generator6->GetOutput()); + dfwriter->Update(); + + oss.str(""); + oss<<outputFileNamePrefix<<"_bst_oi.tif"; + writer->SetFileName(oss.str().c_str()); + writer->SetInput(rescaler->GetOutput()); + writer->Update(); + } catch( itk::ExceptionObject & err ) diff --git a/Testing/Code/DisparityMap/otbTranslationDeformationFieldEstimation.cxx b/Testing/Code/DisparityMap/otbTranslationDeformationFieldEstimation.cxx index 060e4adf23180dd3a393d261922ca40753e23bfb..f6c65d0e56b4cecb0091981fe7dc34c16aa21676 100644 --- a/Testing/Code/DisparityMap/otbTranslationDeformationFieldEstimation.cxx +++ b/Testing/Code/DisparityMap/otbTranslationDeformationFieldEstimation.cxx @@ -33,7 +33,7 @@ #include "otbBSplinesInterpolateDeformationFieldGenerator.h" #include "otbNearestTransformDeformationFieldGenerator.h" #include "otbNNearestTransformsLinearInterpolateDeformationFieldGenerator.h" - +#include "otbBSplinesInterpolateTransformDeformationFieldGenerator.h" int otbTranslationDeformationFieldEstimation(int argc, char* argv[]) { @@ -108,6 +108,7 @@ try typedef otb::BSplinesInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesGeneratorType; typedef otb::NearestTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> NearestTransformGeneratorType; typedef otb::NNearestTransformsLinearInterpolateDeformationFieldGenerator<PointSetType,DeformationFieldType> NNearestTransformGeneratorType; + typedef otb::BSplinesInterpolateTransformDeformationFieldGenerator<PointSetType,DeformationFieldType> BSplinesTransformGeneratorType; // Warper typedef itk::WarpImageFilter<ImageType,ImageType,DeformationFieldType> ImageWarperType; @@ -354,6 +355,43 @@ try writer->SetInput(rescaler->GetOutput()); writer->Update(); + + //3.e Transforms deformation field spline interpolation generator + writer = WriterType::New(); + dfwriter = DeformationFieldWriterType::New(); + warper = ImageWarperType::New(); + rescaler = RescalerType::New(); + + BSplinesTransformGeneratorType::Pointer generator6 = BSplinesTransformGeneratorType::New(); + generator6->SetPointSet(dmestimator->GetOutput()); + generator6->SetOutputOrigin(fixedReader->GetOutput()->GetOrigin()); + generator6->SetOutputSpacing(fixedReader->GetOutput()->GetSpacing()); + generator6->SetOutputSize(fixedReader->GetOutput()->GetLargestPossibleRegion().GetSize()); + generator6->SetMetricThreshold(metricThreshold); + generator6->SetTransform(transform); + generator6->SetSplineOrder(4); + generator6->SetNumberOfControlPoints(5); + + + warper->SetInput(fixedReader->GetOutput()); + warper->SetDeformationField(generator6->GetOutput()); + rescaler->SetInput(warper->GetOutput()); + rescaler->SetOutputMaximum(255); + rescaler->SetOutputMinimum(0); + rescaler->Update(); + + oss.str(""); + oss<<outputFileNamePrefix<<"_bst_df.hdr"; + dfwriter->SetFileName(oss.str().c_str()); + dfwriter->SetInput(generator6->GetOutput()); + dfwriter->Update(); + + oss.str(""); + oss<<outputFileNamePrefix<<"_bst_oi.tif"; + writer->SetFileName(oss.str().c_str()); + writer->SetInput(rescaler->GetOutput()); + writer->Update(); + } catch( itk::ExceptionObject & err )