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

Mappings from physical components (phase,retardance,orientation) to HSV /JCh #141

Closed
wants to merge 13 commits into from

Conversation

edyoshikun
Copy link
Contributor

This PR has czyx functions that take a stack and output an RGB image mapping the label-free measurements to HSV.

This includes PRO-> HSV, RO->HSV and RO->JCh.

@edyoshikun edyoshikun requested a review from talonchandler June 12, 2024 17:36
@edyoshikun
Copy link
Contributor Author

@talonchandler tagging you here as reviewer, so we can move these functions to whatever repo makes sense later.

@ieivanov
Copy link
Collaborator

ieivanov commented Jul 1, 2024

@talonchandler

@talonchandler
Copy link
Contributor

talonchandler commented Jul 1, 2024

Thanks @edyoshikun, I just took a closer look and I think there're some really nice functions in analysis/visualization.py.

I think the key function signatures are:

def HSV_PRO(czyx, channel_order, max_val_V: float = 1.0, max_val_S: float = 1.0):
def HSV_RO(czyx, channel_order: list[int], max_val_V: int = 1):
def JCh_mapping(czyx, channel_order: list[int], max_val_ret: int = None, noise_level: int = 1):

Compare those with the signature of recOrder's overlay function

def ret_ori_overlay(retardance, orientation, ret_max: Union[float, Literal["auto"]] = 10, cmap: Literal["JCh", "HSV"] = "JCh")

I think it's worthwhile cleaning these up and merging them.

Notes on overlap:

  • ret_ori_overlay and HSV_RO share similar functionality. ret_ori_overlay provides more colormap options and IMO has a clearer name.
  • HSV_PRO provides new and useful functionality, a mapping from (retardance, orientation, phase) to (hue, saturation, value)
  • JCh_mapping provides a different mapping from (retardance, orientation, phase) to (hue, saturation, value).

I will suggest:

  • HSV_RO be removed (I don't think it adds anything new)
  • HSV_PRO and JCh_mapping be merged into a ret_ori_phase_overlay function with a cmap option.
  • The new function signature be: def ret_ori_phase_overlay(retardance, orientation, phase, phase_max, ret_max, cmap). I prefer direct slots instead of the channel_order pattern, but please comment @edyoshikun if you have a different perspective.
  • That these functions live in recOrder for now, with a potential move to iphub or similar in the future.

@talonchandler
Copy link
Contributor

talonchandler commented Jul 1, 2024

@edyoshikun and I met and discussed our plan for handling this. I will work through and request @edyoshikun's reviews

  • confirm oindex behavior
>>> z = zarr.array(np.arange(15).reshape(3, 5))
>>> z.oindex[:, [3, 1]]
array([[ 3,  1],
       [ 8,  6],
       [13, 11]])
>>> z.oindex[:, [1, 3]]
array([[ 1,  3],
       [ 6,  8],
       [11, 13]])
  • refactor shrimpy visualization call into this function definition def ret_ori_phase_overlay(czyx, max_val_V: float = 1.0, max_val_S: float = 1.0, cmap: Literal["JCh", "HSV"] = "JCh"): -> (3, z, y, x) and move it to recOrder
  • refactor recOrder's call to match def ret_ori_overlay(czyx, ret_max: Union[float, Literal["auto"]] = 10, cmap: Literal["JCh", "HSV"] = "JCh"): -> (3, z, y, x)
  • test with recOrder test datasets, and merge into recOrder
  • close this draft PR without merging

@talonchandler
Copy link
Contributor

Paired with mehta-lab/recOrder#473. After approving and merging that PR, this PR can close.

@talonchandler talonchandler deleted the HSV_PRO_mapping branch July 2, 2024 23:30
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.

3 participants