Transform itk::Image to itk::SpatialObject

What’s the best way to transform an itk::Image class to an itk::SpatialObject class?

Thanks!

Edit: The context is I have an itk::Image object which contains the a label map, and I would like to transform this object to a registration metric mask, i.e. itk::SpatialObject.

Hello Ray,

I don’t think there is a function to convert directly from itk::Image to itk::SpatialObject. But you may be able to use [1] to convert from MetaObject to SpatialObject (FYI, I haven’t tried).
For your registraton problem, you may be ableto simply use your label map directly if you select a metric that can work with this (you can try the sum of square difference).

[1] https://itk.org/Doxygen/html/classitk_1_1MetaImageConverter.html