8000 iradon filter function by kczimm · Pull Request #3099 · scikit-image/scikit-image · GitHub
[go: up one dir, main page]

Skip to content

iradon filter function #3099

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

Closed
wants to merge 14 commits into from
Closed

Conversation

kczimm
Copy link
Contributor
@kczimm kczimm commented May 23, 2018

Description

A continuation of #3067 to split the iradon filter creation into a separate function and provide tests for the filters.

Checklist

[It's fine to submit PRs which are a work in progress! But before they are merged, all PRs should provide:]

[For detailed information on these and other aspects see scikit-image contribution guidelines]

References

[If this is a bug-fix or enhancement, it closes issue # ]
[If this is a new feature, it implements the following paper: ]

For reviewers

(Don't remove the checklist below.)

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.

@pep8speaks
Copy link
pep8speaks commented May 23, 2018

Hello @kczimm! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 179:1: W293 blank line contains whitespace

Line 7:80: E501 line too long (80 > 79 characters)
Line 56:35: E226 missing whitespace around arithmetic operator
Line 63:1: W293 blank line contains whitespace
Line 66:12: E201 whitespace after '('
Line 66:26: E202 whitespace before ')'

Comment last updated at 2020-08-30 21:25:56 UTC

@codecov-io
Copy link
codecov-io commented May 23, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@dc8b56f). Click here to learn what that means.
The diff coverage is 92.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #3099   +/-   ##
=========================================
  Coverage          ?   85.94%           
=========================================
  Files             ?      336           
  Lines             ?    27340           
  Branches          ?        0           
=========================================
  Hits              ?    23498           
  Misses            ?     3842           
  Partials          ?        0
Impacted Files Coverage Δ
skimage/transform/tests/test_radon_transform.py 81.59% <100%> (ø)
skimage/transform/radon_transform.py 93.33% <89.28%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dc8b56f...0bdef5c. Read the comment docs.

pass
elif filter_name == "shepp-logan":
# Start from first element to avoid divide by zero
kernel[1:] *= np.sin(omega[1:] / 2) / (omega[1:] / 2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be sinc.

Since sinc is defined as sin(pi x) / (pi x), I suggest using f instead of omega. and doing

f = fftfreq(size)
kernel *= np.sinc(f)

n2 = np.arange(size / 2 - 1, 0, -1, dtype=np.int)
n = np.concatenate((n1, n2))
f = np.zeros(size)
f[0] = 0.25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please mention Kak & Slaney here and the number of the equation, otherwise it is very difficult to understand where it comes from (as opposed to the naive ramp filter, which is much easier to understand)

@emmanuelle
Copy link
Member

Thanks, LGTM. With your improvements, is it possible to decrease the tolerance in the test_radon_transform module?

@emmanuelle
Copy link
Member

I suggest that we merge your PR first, and then see if we must also include changes from #2165.

@kczimm
Copy link
Contributor Author
kczimm commented Jul 30, 2018

@emmanuelle I created that tolerance to have a passing test. There is still some bias in the reconstruction but with this PR, it is significantly reduced. I cannot decrease the tolerance by an order of magnitude without the test failing. However, the error is small enough that after a user converts to Hounsfield units (which is a common use case in CT applications) the error will still be less than 0.1 HU bias using the ramp filter.

@stefanv
Copy link
Member
stefanv commented Dec 6, 2019

This is so close with only minor modifications needed before merge. @kczimm would you like to take a look, or should @scikit-image/core polish it up before merging?

@kczimm
Copy link
Contributor Author
kczimm commented Dec 7, 2019

@stefanv if @scikit-image/core can polish it up, I'm OK with that. This was so long ago that I did this that it might take me more effort to get back up to speed than the core team would need to finish it off. If it won't go through otherwise, I'll finish it up. It shouldn't stay in scikit-image broken.

@stefanv
Copy link
Member
stefanv commented Dec 10, 2019

@kczimm I apologize for letting this issue slide; thank you again for your work.

@alexdesiqueira
Copy link
Member

Hey @hmaarrfk, could you help me close this one? As @stefanv said, we're almost there (but I don't know what's happening here 😅). Thanks!

@hmaarrfk
Copy link
Member
hmaarrfk commented Aug 30, 2020

Because digging this one out took alot of merging, I decided to revert my changes to this PR (sorry for the force push), and move them to: #4950 so we can visually compare.

I think there were two goals for this PR:

  1. exporting a public API function for iradon filters.
  2. Reducing the error. <--- this was done in transform: fix filter bias #3067 and is evident using BLAME on the github GUI. not sure why it is not reflected here.

Therefore, the main contribution here is the refactoring of the iradon_filters function. I now need time to review this,

@rfezzani
Copy link
Member

@kczimm, the iradon_filter function that you defined is now implemented as the hidden function _get_fourier_filter. May be can you update your PR to add the test_iradon_rampfilter_bias_circular_phantom test (or it is may be easier to start a new PR)?
I would be very happy to accept it 😉.
Thank you for your time!

Base automatically changed from master to main February 18, 2021 18:23
@stefanv
Copy link
Member
stefanv commented Feb 7, 2023

I think this was quite an elegant refactoring, and surprisingly it has aged well. @kczimm is there any chance you want to pick it back up?

@stefanv
Copy link
Member
stefanv commented Apr 5, 2023

I missed that this work has already been included by @rfezzani. Thank you again @kczimm. I will grab the test from here and add that as a new PR.

@stefanv stefanv closed this Apr 5, 2023
stefanv added a commit to stefanv/scikit-image that referenced this pull request Apr 5, 2023
Implementation by @kczimm from scikit-image#3099

Co-authored-by: kczimm <kevinczimmerman@gmail.com>
@stefanv
Copy link
Member
stefanv commented Apr 5, 2023

See #6873

@kczimm
Copy link
Contributor A 9E88 uthor
kczimm commented Apr 5, 2023

@stefanv thanks for doing this and sorry I'm just seeing this now.

jarrodmillman pushed a commit that referenced this pull request Apr 6, 2023
Implementation by @kczimm from #3099

Co-authored-by: kczimm <kevinczimmerman@gmail.com>
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

Successfully merging this pull request may close these issues.

8 participants
0