c++ - Not able to write image SimpleElastix (Python) -
i'm trying run following example part of simpleelastix library:
import simpleitk sitk elastiximagefilter = sitk.elastiximagefilter() elastiximagefilter.setfixedimage(sitk.readimage('1.jpg', sitk.sitkfloat32)) elastiximagefilter.setmovingimage(sitk.readimage('2.jpg', sitk.sitkfloat32)) elastiximagefilter.setparametermap(sitk.getdefaultparametermap('rigid')) elastiximagefilter.execute() sitk.writeimage(elastiximagefilter.getresultimage())
when try run above code, following error (i'm showing part of output):
traceback (most recent call last): file "rigid_transform.py", line 8, in <module> sitk.writeimage(elastiximagefilter.getresultimage()) file "/usr/local/lib/python2.7/dist-packages/simpleelastix-1.0.1rc1.dev331+gd756f-py2.7-linux-x86_64.egg/simpleitk/simpleitk.py", line 8015, in writeimage return _simpleitk.writeimage(*args) notimplementederror: wrong number or type of arguments overloaded function 'writeimage'. possible c/c++ prototypes are: itk::simple::writeimage(itk::simple::image const &,std::string const &,bool) itk::simple::writeimage(itk::simple::image const &,std::vector< std::string,std::allocator< std::string > > const &,bool)
how can solve issue?
edit: per @dženan's answer, got following:
traceback (most recent call last): file "rigid_transform.py", line 8, in <module> sitk.writeimage(elastiximagefilter.getresultimage(), 'result.jpg') file "/usr/local/lib/python2.7/dist-packages/simpleelastix-1.0.1rc1.dev331+gd756f-py2.7-linux-x86_64.egg/simpleitk/simpleitk.py", line 8015, in writeimage return _simpleitk.writeimage(*args) runtimeerror: exception thrown in simpleitk writeimage: /home/me/desktop/simpleelastix/build/itk/modules/io/jpeg/src/itkjpegimageio.cxx:454: itk::error: jpegimageio(0x1a5daa0): jpeg supports unsigned char/int
thanks.
you missing file name. try this:
sitk.writeimage(elastiximagefilter.getresultimage(), 'result.jpg')
edit: can try other file extensions: result.png
, result.tif
, result.nrrd
, result.mha
etc.
wiki
Comments
Post a Comment