LEAP icon indicating copy to clipboard operation
LEAP copied to clipboard

leaptorch Projector's bp and fbp error

Open fang-2020-github opened this issue 11 months ago • 5 comments

Hi, when I use Projector class in leaptorch: proj = Projector(forward_project=False, use_static=True, use_gpu=True, gpu_device=device, batch_size=batchSize) f = proj(g) proj.leapct.fbp(g, f0) I found that f is in the order of 10^3, while f0 is in the order 10^(-4), is here any mistake I made? Actually I need to use f= proj(g) in my program, but the result's order is far from the order of FBP's result.

fang-2020-github avatar Dec 26 '24 06:12 fang-2020-github

I may need some clarification on what the issue is here.

What I can tell you is that f is the backprojection of g and f0 is the FBP reconstruction of g, so the scaling and appearance of f and f0 should definitely be different. Note that backprojection is NOT the inverse of forward projection. Backprojection is the ADJOINT of forward projection.

kylechampley avatar Dec 27 '24 16:12 kylechampley

I may need some clarification on what the issue is here.

What I can tell you is that f is the backprojection of g and f0 is the FBP reconstruction of g, so the scaling and appearance of f and f0 should definitely be different. Note that backprojection is NOT the inverse of forward projection. Backprojection is the ADJOINT of forward projection. In my iterative unrolling program, I need to call the forward projection A, and the transpose of A, i.e. A_T, which Class in the leaptorch can I use?

fang-2020-github avatar Dec 30 '24 05:12 fang-2020-github

Sorry for the slow response; I was on vacation.

You may just want to use the tomographicModels class in leapctype.py. leaptorch has the PyTorch autograd stuff in it, but if all you want is to perform forward and back projections, just use leapctype; it works with both PyTorch tensors and numpy arrays. Just use it like this;

from leapctype import * leapct = tomographicModels() ... g = leapct.allocate_projections() f = leapct.allocate_volume() ...

Forward Projection

leapct.project(g,f)

Backprojection

leapct.backproject(g,f)

There are several examples of this in the leapctype demos folder. For example, see here.

kylechampley avatar Jan 05 '25 18:01 kylechampley

Hi kyle,

Does the tomographicModels class work on GPU?

sunly92 avatar Jan 30 '25 21:01 sunly92

Yes, of course!

kylechampley avatar Jan 31 '25 15:01 kylechampley