RTK
RTK copied to clipboard
Python joseph_forward_projection_image_filter does not behave as expected
The following code works
import itk
from itk import RTK as rtk
ImageType = itk.Image[itk.F,3]
emptyVol = rtk.constant_image_source(origin=[-63.5]*3, size=[128]*3,spacing=[1.]*3,ttype=ImageType)
sl = rtk.draw_shepp_logan_filter(emptyVol)
geometry = rtk.ThreeDCircularProjectionGeometry.New()
geometry.AddProjection(600,1200,0.)
emptyProj = rtk.constant_image_source(origin=[-127,-127,0.], size=[128,128,1],spacing=[2.]*3,ttype=ImageType)
projector = rtk.JosephForwardProjectionImageFilter[ImageType,ImageType].New()
projector.SetInput(0,emptyProj)
projector.SetInput(1,sl)
projector.SetGeometry(geometry)
projector.Update()
itk.imwrite(projector.GetOutput(), 'projections.mha')
If I also want to use the same syntax for the projector
import itk
from itk import RTK as rtk
ImageType = itk.Image[itk.F,3]
emptyVol = rtk.constant_image_source(origin=[-63.5]*3, size=[128]*3,spacing=[1.]*3,ttype=ImageType)
sl = rtk.draw_shepp_logan_filter(emptyVol)
geometry = rtk.ThreeDCircularProjectionGeometry.New()
geometry.AddProjection(600,1200,0.)
emptyProj = rtk.constant_image_source(origin=[-127,-127,0.], size=[128,128,1],spacing=[2.]*3,ttype=ImageType)
projections = rtk.joseph_forward_projection_image_filter(emptyProj,sl,geometry=geometry)
itk.imwrite(projections, 'projections.mha')
I obtain a seg fault. If I look at help(rtk.joseph_forward_projection_image_filter)
, I see it is a Proxy of C++ rtkJosephForwardProjectionImageFilterIF3IF3SWMFDFIPC class.
(defined in rtkJosephForwardAttenuatedProjectionImageFilter.wrap
) which is wrong. I want it to be a proxy for
rtkJosephForwardProjectionImageFilterIF3IF3
(defined in rtkJosephForwardProjectionImageFilter.wrap
). No clue how to solve this...
@LucasGandel @thewtex, any ideas?
Hi,
I'm facing the same issue with the last version on the Python wrapping.