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

Add more options for Polaris jobs #182

Merged
merged 4 commits into from
Feb 28, 2022
Merged

Add more options for Polaris jobs #182

merged 4 commits into from
Feb 28, 2022

Conversation

tddough98
Copy link
Contributor

This PR introduces two new components MesmerForm and PolarisForm that contain workflow specific forms so that those jobs can be parameterized. The behavior for mesmer is unchanged, which polaris can now pick what segmentation model to use and which channels to use segmentation.

Each Form component updates the jobForm object in the Predict component. We now send the jobForm object to the /predict route, which unpacks the form to send to the consumer. As we expand the supported workflows and the contents of the jobForm varies more, we'll need to revisit how the route handles the jobForm contents.

I've also refactored the ChannelForm to simplify the state for selected channels. Previously, there were four collaborating variables that tracked the selected channels including:

  • targetChannels like { nuclei: 'red', cytoplasm: 'green' }
  • channels like ['red, 'green', 'blue']
  • channelValues like { red: 0, green: 1, blue: 2}
  • requiredChannels like ['nuclei', 'cytoplasm']

These variables had to be transformed between each other with complex expression like
Object.keys(channels).reduce((r, c) => Object.assign(r, { [channels[c]]: parseInt((r[channels[c]] || '').concat(c)) }), {}) and requiredChannels.map(c => channelValues[targetChannels[c]]).

I've refactored these variables into just requiredChannels ['nuclei', 'cytoplasm'] and selectedChannels [0, 1] which records which channel index should be used for each required channel. The selectedChannels are more similar to the data submitted to the api and is transformed with a simple expression selectedChannels.join(',') to yield 0,1. I've also moved ['red', 'green', 'blue'] to an internal detail of the ChannelDropdown component as it is only used in display text.

@tddough98 tddough98 requested a review from elaubsch February 12, 2022 00:23
@elaubsch
Copy link
Member

With the way the Polaris application is set up right now, it can't handle cytoplasm and nuclear segmentation for cell culture images. Could we make "None" an option for the channel form dropdown?

@tddough98
Copy link
Contributor Author

We submit selected channels as a comma separated list of channels indices. Something like 2,0 for mesmer to say the third channel is the nuclei and the first channel is the cytoplasm or0,2,1 for polaris to say the first channel is spots, the second is cytoplasm and the third is nuclei.

Would it work to leave out the number when we don't have a channel? So submitting 0,, to the polaris consumer means the first channel is spots and are there no nuclei or cytoplasm channels.

@tddough98
Copy link
Contributor Author

I've added a boolean required prop to the ChannelDropdown component that adds a None option to the select menu when true. Both MesmerForm and PolarisForm now have to specify which of their channels are required or not, so I've renamed requiredChannels to channels and changed requiredChannels to a list of booleans.

Here's what the form now looks like.
Screen Shot 2022-02-14 at 10 57 47 AM

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

Successfully merging this pull request may close these issues.

3 participants