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

Adapt function rag_mean_color to multi-band rasters (remote sensing research) #6117

Open
kimzed opened this issue Dec 9, 2021 · 1 comment

Comments

@kimzed
Copy link

kimzed commented Dec 9, 2021

For the rag_mean_color function, I had to modify the function to adapt it to raster data, that can have more than three bands.
I thought with a bit of control flow it would be possible to extend the function to any number of channels.

  for n in graph:
      #graph.nodes[n].update({'labels': [n],
      #                       'pixel count': 0,
      #                       'total color': np.array([0, 0, 0],
      #                                              dtype=np.double)})

      # modification to adapt to multi_label data
      graph.nodes[n].update({'labels': [n],
                             'pixel count': 0,
                             'total color': np.zeros(image.shape[-1],
                                                     dtype=np.double)})

PS: this is my first issue

@rfezzani
Copy link
Member

Thank you @kimzed for your interest. This in fact could be a good addition, I also see that rag_mean_color assumes that the channel axis is the last channel. We introduced the channel_axis argument to handle any channel axis position, so it can also be a good update to the function API.

BTW, I will convert this issue to a Discussion as we try to only report bugs in our Issues. We can continue this discussion there ;)

@scikit-image scikit-image locked and limited conversation to collaborators Dec 13, 2021
@rfezzani rfezzani converted this issue into a discussion Dec 13, 2021
@scikit-image scikit-image unlocked this conversation Apr 8, 2022
@grlee77 grlee77 reopened this Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants