<div dir="ltr">Dear all,<br>
<br>
I'm now using SimpleITK in Python. When combining itk with it, I had a problem.<br>
<br>
I know the way to implement the conversion between itk image and SimpleITK<br>
image in C++, which is an example in SimpleITK (Examples/ITKIntegration.cxx).<br>
<br>
//<br>
// Extract the itk image from the SimpleITK image<br>
//<br>
InternalImageType::Pointer itkImage =<br>
dynamic_cast <InternalImageType*>( image.GetITKBase() );<br>
...<br>
//<br>
// Return to the simpleITK setting by making a SimpleITK image using the<br>
// output of the blur filter.<br>
//<br>
sitk::Image blurredImage = sitk::Image( blurFilter->GetOutput() );<br>
<br>
But in Python, when I used "sitk.Image(itkImage)" in which itkImage is an<br>
itkImage, I got an error "this = _SimpleITK.new_Image(*args)<br>
NotImplementedError: Wrong number or type of arguments for overloaded<br>
function 'new_Image'". And in python it's impossible to convert the type<br>
like "dynamic_cast" in C++.<br>
<br>
There's one possible solution for this, which use PyBuffer to convert<br>
itkImage into numpy array and then use SimpleITK to convert array into<br>
SimpleITK image finally. But I fail in building the itkPyBuffer. And I think<br>
this method isn't direct to solve this problem.<br>
<br>
I have tried my best to search in the Internet, but found nothing. Can you<br>
help me to convert the C++ code into available python code? <br><br>Thank you.<br clear="all"><br>-- <br><p>Guo Hengkai (Undergraduate) </p><p>郭亨凯 (本科生)<br>Dept. of Biomedical Engineering<br>School of Medicine,Tsinghua Univ.</p>
<p>清华大学,医学院,生物医学工程系<br>Beijing, China 中国,北京</p>
</div>