Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python joseph_forward_projection_image_filter does not behave as expected #450

Open
SimonRit opened this issue Oct 28, 2021 · 2 comments
Open

Comments

@SimonRit
Copy link
Collaborator

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...

@SimonRit
Copy link
Collaborator Author

@LucasGandel @thewtex, any ideas?

@arobert01
Copy link
Collaborator

Hi,

I'm facing the same issue with the last version on the Python wrapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants