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

"Chain" filters in filterplot (?) #41

Open
SarthakJariwala opened this issue Sep 6, 2020 · 2 comments
Open

"Chain" filters in filterplot (?) #41

SarthakJariwala opened this issue Sep 6, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@SarthakJariwala
Copy link
Owner

Allow chaining different filters together to give a final filtered image

For example, Raw Image ---> Gaussian Filter ---> Percentile Filter ---> Visualize the final filtered image

Currently, in filterplot() only individual filters are supported.

Potential challenges

While the filters that need to be applied can be passed as a list or something, the kwargs for the different filters need to be handled correctly. Can't just dump all the kwargs into the individual functions...

Something that could work (?)

Create a new chain_kw or something and have the individual filter parameters be supplied in there.
Maybe something like this (?) :

isns.filterplot(img, ["gaussian", "percentile"], chain_kw=[{"sigma" : 2}, {"percentile" : 10, "size" : 10}] )
@SarthakJariwala SarthakJariwala added the enhancement New feature or request label Sep 6, 2020
@SarthakJariwala
Copy link
Owner Author

Thinking more about it - should this be part of the filterplot() or its own separate function....? If its a separate function, then it could be made a "figure-level" function where a split parameter is implemented to visualize all the intermediary filter steps towards the eventual filtered image.
For eg, doing

isns.fcplot(img, ["gaussian", "percentile"], 
                 chain_kw=[{"sigma" : 2}, {"percentile" : 10, "size" : 10}], 
                 chain=True)

will retrun 'one' image img after applying "gaussian" and "percentile" filters in that order (one after the other like a chain).
But doing

isns.fcplot(img, ["gaussian", "percentile"], 
                 chain_kw=[{"sigma" : 2}, {"percentile" : 10, "size" : 10}], 
                 chain=True, split=True)

will return 'all' the intermediary filtered images. So, here it would return - Gaussian filtered image and Gaussian+Percentile filtered image.

Going further with this idea, if chain=False, the filters specified will be applied in isolation to the supplied image. For eg,

isns.fcplot(img, ["gaussian", "percentile"], 
                 chain_kw=[{"sigma" : 2}, {"percentile" : 10, "size" : 10}], 
                 chain=False)

will return img after gaussian filter and img after percentile filter, both applied in isolation to the img (and not in chain)

NOTE: function name and parameters are not final....

Need to think more if FilterGrid (#30) can be adapted to do this or just better to create another function for this use case and let filterplot and FilterGrid handle their own use cases...?

@SarthakJariwala SarthakJariwala added this to the v0.4 milestone Sep 24, 2020
@SarthakJariwala
Copy link
Owner Author

This is going to be added as isns.nfilterplot() in v0.5

isns.nfilterplot(data, filt, filt_kws=None, chain=True, split=False)

@SarthakJariwala SarthakJariwala modified the milestones: v0.4, v0.5 Oct 16, 2020
@SarthakJariwala SarthakJariwala removed this from the v0.5 milestone Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant