From 7d6212d05d60f1c29c076363605ef626d15a6056 Mon Sep 17 00:00:00 2001 From: Pranjal Sahu Date: Wed, 17 Aug 2022 10:02:29 -0400 Subject: [PATCH] ENH: Add MetaDataObject wrapping with Matrix Needed to convert image to xarray. Dict method on image fails without these wrappings. --- Modules/Core/Common/wrapping/itkMetaDataObject.wrap | 3 +++ .../Core/Common/wrapping/test/itkMetaDataDictionaryTest.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Modules/Core/Common/wrapping/itkMetaDataObject.wrap b/Modules/Core/Common/wrapping/itkMetaDataObject.wrap index 2bbd9d585af..b8a86a9fe6f 100644 --- a/Modules/Core/Common/wrapping/itkMetaDataObject.wrap +++ b/Modules/Core/Common/wrapping/itkMetaDataObject.wrap @@ -1,5 +1,6 @@ itk_wrap_include("itkArray.h") itk_wrap_include("") +itk_wrap_include("itkMatrix.h") itk_wrap_class("itk::MetaDataObject" POINTER) itk_wrap_template("D" "double") @@ -17,4 +18,6 @@ itk_wrap_class("itk::MetaDataObject" POINTER) itk_wrap_template("vectorD" "std::vector< double >") itk_wrap_template("vectorvectorF" "std::vector< std::vector< float > >") itk_wrap_template("vectorvectorD" "std::vector< std::vector< double > >") + itk_wrap_template("matrixD33" "itk::Matrix< double, 3, 3 >") + itk_wrap_template("matrixF44" "itk::Matrix< float, 4, 4 >") itk_end_wrap_class() diff --git a/Modules/Core/Common/wrapping/test/itkMetaDataDictionaryTest.py b/Modules/Core/Common/wrapping/test/itkMetaDataDictionaryTest.py index 91c9323f50a..c0d92d2e9cb 100644 --- a/Modules/Core/Common/wrapping/test/itkMetaDataDictionaryTest.py +++ b/Modules/Core/Common/wrapping/test/itkMetaDataDictionaryTest.py @@ -30,4 +30,9 @@ print(md["double"]) # Required for "NRRD_measurement frame" -itk.MetaDataObject[itk.vector[itk.vector[itk.D]]].New() +md1 = itk.MetaDataObject[itk.vector[itk.vector[itk.D]]].New() +print(md1) + +# Required for "qto_xyz" metadata +md2 = itk.MetaDataObject[itk.Matrix[itk.F, 4, 4]].New() +print(md2)