Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
itk_wrap_class("itk::ANTSNeighborhoodCorrelationImageToImageMetricv4" POINTER)
itk_wrap_image_filter("${WRAP_ITK_REAL}" 2 2+)
foreach(d ${ITK_WRAP_IMAGE_DIMS})
foreach(t ${WRAP_ITK_REAL})
itk_wrap_template("${ITKM_${t}}${d}${ITKM_${t}}${d}I${ITKM_${t}}${d}"
"itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >")
endforeach()
endforeach()
itk_end_wrap_class()
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
itk_wrap_class("itk::CorrelationImageToImageMetricv4" POINTER)
itk_wrap_image_filter("${WRAP_ITK_REAL}" 2 2+)
foreach(d ${ITK_WRAP_IMAGE_DIMS})
foreach(t ${WRAP_ITK_REAL})
itk_wrap_template("${ITKM_${t}}${d}${ITKM_${t}}${d}I${ITKM_${t}}${d}"
"itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >")
endforeach()
endforeach()
itk_end_wrap_class()
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
itk_wrap_class("itk::DemonsImageToImageMetricv4" POINTER)
itk_wrap_image_filter("${WRAP_ITK_REAL}" 2 2+)
foreach(d ${ITK_WRAP_IMAGE_DIMS})
foreach(t ${WRAP_ITK_REAL})
itk_wrap_template("${ITKM_${t}}${d}${ITKM_${t}}${d}I${ITKM_${t}}${d}"
"itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >")
endforeach()
endforeach()
itk_end_wrap_class()
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
itk_wrap_class("itk::ImageToImageMetricv4" POINTER_WITH_SUPERCLASS)
foreach(d ${ITK_WRAP_DIMS})
foreach(d ${ITK_WRAP_IMAGE_DIMS})
foreach(t ${WRAP_ITK_REAL})
itk_wrap_template("${ITKM_${t}}${d}${ITKM_${t}}${d}"
"itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >")
itk_wrap_template("${ITKM_${t}}${d}${ITKM_${t}}${d}I${ITKM_${t}}${d}"
"itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >")
endforeach()
endforeach()
itk_end_wrap_class()
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
itk_wrap_class("itk::JointHistogramMutualInformationImageToImageMetricv4" POINTER)
itk_wrap_image_filter("${WRAP_ITK_REAL}" 2 2+)
foreach(d ${ITK_WRAP_IMAGE_DIMS})
foreach(t ${WRAP_ITK_REAL})
itk_wrap_template("${ITKM_${t}}${d}${ITKM_${t}}${d}I${ITKM_${t}}${d}"
"itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >")
endforeach()
endforeach()
itk_end_wrap_class()
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
itk_wrap_class("itk::MattesMutualInformationImageToImageMetricv4" POINTER_WITH_2_SUPERCLASSES)
itk_wrap_image_filter("${WRAP_ITK_REAL}" 2 2+)
foreach(d ${ITK_WRAP_IMAGE_DIMS})
foreach(t ${WRAP_ITK_REAL})
itk_wrap_template("${ITKM_${t}}${d}${ITKM_${t}}${d}I${ITKM_${t}}${d}"
"itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >")
endforeach()
endforeach()
itk_end_wrap_class()
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
itk_wrap_class("itk::MeanSquaresImageToImageMetricv4" POINTER_WITH_2_SUPERCLASSES)
itk_wrap_image_filter("${WRAP_ITK_REAL}" 2 2+)
foreach(d ${ITK_WRAP_IMAGE_DIMS})
foreach(t ${WRAP_ITK_REAL})
itk_wrap_template("${ITKM_${t}}${d}${ITKM_${t}}${d}I${ITKM_${t}}${d}"
"itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >, itk::Image< ${ITKT_${t}}, ${d} >")
endforeach()
endforeach()
itk_end_wrap_class()
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
itk_wrap_class("itk::ObjectToObjectMultiMetricv4" POINTER)
foreach(d ${ITK_WRAP_IMAGE_DIMS})
foreach(t ${WRAP_ITK_REAL})
itk_wrap_template("${d}${d}I${ITKM_${t}}${d}" "${d},${d},itk::Image< ${ITKT_${t}}, ${d} >")
endforeach()
endforeach()
itk_end_wrap_class()
5 changes: 5 additions & 0 deletions Modules/Registration/Metricsv4/wrapping/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ if(ITK_WRAP_PYTHON)
EXPRESSION "instance = itk.MeanSquaresImageToImageMetricv4.New()"
)

itk_python_add_test(
NAME itkObjectToObjectMultiMetricv4PythonTest
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/itkObjectToObjectMultiMetricv4Test.py
)

itk_python_expression_add_test(
NAME itkPointSetToPointSetMetricv4PythonTest
EXPRESSION "instance = itk.PointSetToPointSetMetricv4.New()"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# ==========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==========================================================================

import itk

# Test with float images
Dimension = 2
ImageType = itk.Image[itk.F, Dimension]

# Test basic instantiation
multi_metric = itk.ObjectToObjectMultiMetricv4[Dimension, Dimension, ImageType].New()
assert multi_metric is not None

# Create a simple metric to add - now with explicit TVirtualImage
ms_metric = itk.MeanSquaresImageToImageMetricv4[ImageType, ImageType, ImageType].New()
assert ms_metric is not None

# Add metric to the multi-metric
multi_metric.AddMetric(ms_metric)

# Test that we can get the number of metrics
assert multi_metric.GetNumberOfMetrics() == 1

# Set metric weights
weights = itk.Array[itk.D](1)
weights[0] = 0.5
multi_metric.SetMetricWeights(weights)

# Verify weights were set
retrieved_weights = multi_metric.GetMetricWeights()
assert retrieved_weights.GetSize() == 1

print("Test passed!")
Loading