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
Denoising images using non-local means #320
Conversation
Unless you have awesome models, of course :) |
|
||
# calculate weights between the central patch and the moving patch in block | ||
# (m, n, o) coordinates are the center of the moving patch | ||
# (a, b, c) run incide both patches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inside
Seems good, it change the code and example afterward I guess. |
Another question/comment. I just denoised a 500Mb full brain dataset and my RAM consumption went up to 3 Giga. So, a factor of 6 increase. I see that I inputed an float32 file and the output was a float64. So, this might be contributing to the issue. Do you think that if the input is int16 or float32, the output should as well? My old binary used to do that. Still fast and good results! |
Should be the responsability of the user to save it himself as another dtype I'd say. Dunno for the ram usage though. |
@mdesco good catch. Please give it a try with the a new fix. It should be okay now. Please let me know otherwise. |
I still have a large RAM consumption. 251Mb input and my RAM goes up to 3Gig during the processing. |
What type of dataset is the one that you use? Is it a 4D image of dMRI data? |
Hi Max, I am not able to replicate your problem. I monitored the memory usage with a 4D dataset of 400MB and the memory needed at the end and during execution time was an extra 400MB as expected. So, the total amount of memory was ~800MB. I would suggest maybe to recompile your dipy installation after having fetch my latest changes for this brunch. If that doesn't work then let's have a look together at IMEKA. |
All good on my side. It works fine and nlmeans supports 4D. Thanks. |
Okay, guys. This is ready on my side. Can someone who is not from the SCIL give it a last review and merge this baby? |
@@ -0,0 +1,8 @@ | |||
#init for denoisa aka the denoising module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo : "denoise"
I will take a look. On Mon, Feb 24, 2014 at 6:19 AM, Eleftherios Garyfallidis <
|
the denoised ``arr`` which has the same shape as ``arr``. | ||
|
||
""" | ||
if arr.ndim != 3: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring suggests that either 4D or 3D arrays are acceptable inputs. Which is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Thx!
I am getting this error when running the example. Are you sure the input to the AssertionError Traceback (most recent call last) /Users/arokem/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/pyplot.pyc in savefig(_args, *_kwargs) /Users/arokem/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/figure.pyc in savefig(self, _args, *_kwargs) /Users/arokem/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, *_kwargs) /Users/arokem/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/figure.pyc in get_tightbbox(self, renderer) /Users/arokem/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/transforms.pyc in union(bboxes) |
Hi @arokem I added all your suggestions except from the bbox_inches='tight'. I think this problem is on your side. This option is recommended in many places. Let me know if the problem persists. Could it be that you have some problems with your matplotlib installation or version? My version is 1.2.1. Also if you know a better way to remove the padding from the figure let me know. |
Denoising images using non-local means
In this PR I am adding a new general way to apply denoising in 3D and 4D images using NLMEANS. I have rewrote and optimized the algorithm. For the first time we use OpenMP in dipy through cython. OpenMP increases considerable execution time when you want to use multi-threading with shared memory.
A few things that are missing and they should come soon in another PR.
@samuelstjean will work on these steps as I need to focus on a different project and denoising is his main interest.
GGT!