flaviu2
(Flaviu)
1
I read a lot of Python code, and I saw that is used a lot sitk.GetArrayFromImage method. What is equivalent for C++ of this method ?
Example of Python code:
labelmaskimage = sitk.GetArrayFromImage(cc)
where cc is from
cc = sitk.ConnectedComponent(sitk_maskimg)
zivy
(Ziv Yaniv)
2
Hello @flaviu2,
That method is specific to Python and returns a numpy array.
Similar, not equivalent, in C++ are the Image classes GetBuffer*
methods.
3 Likes
flaviu2
(Flaviu)
3
I hope I would not push my luck
Then I could write directly:
// C++ code
sitk::Image labelmaskimage = cc;
instead of:
//(Python code):
labelmaskimage = sitk.GetArrayFromImage(cc)
?
zivy
(Ziv Yaniv)
4
The ConnectedComponent procedural interface returns a SimpleITK image, so the assignment will work, not really sure what is the issue you are encountering.
flaviu2
(Flaviu)
5
Is ok, I only need to know how to correctly convert Python code into C++ code (using SimpleITK).
Thank you a lot.