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

Error in branchless distance driven #1

Open
JeffFessler opened this issue Jun 15, 2022 · 7 comments
Open

Error in branchless distance driven #1

JeffFessler opened this issue Jun 15, 2022 · 7 comments
Assignees

Comments

@JeffFessler
Copy link

Thanks for providing branchless distance driven code!
The version posted works for "almost parallel beam" geometry
but if we change the geometry parameters to be more like a typical fan-beam geometry
then the code has errors in a while loop.

geo.DSO = 99700; % Distance from source to iso-center

Specifically in this while loop


we get indexing past the end of one of the arrays. Any ideas how to fix?

@rodrigovimieiro
Copy link
Owner

Hello @JeffFessler,

Thanks for posting this issue.

Do you have a code or geometry to reproduce this error?

I have tested the Branchless Distance Driven code for cone-beam geometry, but not for fan-beam. This is the implementation for cone-beam, which works fine.

@rodrigovimieiro rodrigovimieiro self-assigned this Jun 23, 2022
@JeffFessler
Copy link
Author

JeffFessler commented Jun 23, 2022

Thanks for asking.
All one has to do is change geo.DSO = 99700 to geo.DSO = 70000 so that it is more magnification and it causes an Index error.

I had to change the suffix from .m to .txt to upload the exact file.

ddbbug.txt

@rodrigovimieiro
Copy link
Owner

I guess it is related with the crazy geometry I have created. When you changed the geo.DSO, for certain angles, the object was being projected outside the detector, causing the error. I am not familiar with CT geometries, so years ago I created that one (as you mentioned "almost parallel beam") just for testing.

Now, I have modified to a geometry which I think might be more realistic and maybe close to the fan-beam. I am still not sure.

Screen Shot 2022-06-23 at 3 37 06 PM

Screen Shot 2022-06-23 at 3 30 14 PM

At least it gives some results:

Screen Shot 2022-06-23 at 3 29 02 PM

This is the modified file:

ddbbug_edited.txt

See if it works for you.

@JeffFessler
Copy link
Author

That CT detector geometry is quite realistic. However, there are two problems now.

If you look at the sinogram, you can see that there are horizontal bands every 45 or 90 degrees. It should not look like that - so there must be some bug(s) in the code.

And in practice it is usually the case that parts of the image (especially the corners) will project outside of the detector and we have to handle that carefully in the code.

If you are still working with this code and plan to fix it, please let us know.
We were converting this code to Julia and discovered the issue.
JuliaImageRecon/Sinograms.jl#9
If you fix it in Matlab, then we will translate that fix to Julia.
If you are not working with the 2D code anymore then I guess we will go back to the original papers and develop Julia code from there. Thanks.

(cc'ing @SoniaMinseoKim)

@rodrigovimieiro
Copy link
Owner

rodrigovimieiro commented Jun 23, 2022

I see,

I think it is somehow related to the size of the detector mapped on the X axis, see:

Screen Shot 2022-06-23 at 4 54 38 PM

So, in #L231 it makes the sonogram darker at certain angles:

sinoTmp(detInd) = sinoTmp(detInd)+(Pdk(detInd+c2)-Pdk(detInd))/deltaDetm;

There is also the fact that the mapped detector size changes depending on the detector element position. I would need to go back to the paper to see how to fix it.

Unfortunately, I am not working with 2D anymore. I will post this as a known issue. Let me know if you guys find out.

@rodrigovimieiro
Copy link
Owner

Hello @JeffFessler ,

Were you able to figure out the problem?

Thanks!

@JeffFessler
Copy link
Author

we ended up doing a pretty big rewrite:
https://github.com/JuliaImageRecon/Sinograms.jl/blob/main/src/sys2/bdd_2d.jl
it works, but still needs further refinement:
https://juliaimagerecon.github.io/Sinograms.jl/dev/generated/examples/08-bdd2d

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