Skip to content

Conversation

srivarra
Copy link
Contributor

@srivarra srivarra commented Jul 28, 2023

If you haven't already, please read through our contributing guidelines before opening your PR

What is the purpose of this PR?

Refactors a portion of plot_pixel_cell_cluster_overlay and plot_neighborhood_cluster_result.

How did you implement your changes

Extracts the plotting functionality into a new function plot_cluster which takes a cluster mask, or any image, and colors
the pixels based on a user provided colormap and normalization object. Cluster labels + colorbar can be removed from the plot as well.

Added tests for plot_neighborhood_cluster_result.
Added a function which takes a numpy array representation of colors (rgb and rgba) and generates a discrete colormap from the colors provided.

Changed the readthedocs python version to 3.11 to support type hints introduced in 3.9.

Remaining issues

N/A

Next Release v0.6.4 (#1012)

* 0.6.4

* updated environment.yml

* Update README.md

* updated windows setup docs

* added repo verison in git clone

* file fix

Deepcell upload loop cleaning (#1023)

* loop check for successful deepcell upload

* update test zip paths

* helper functions pls

* zip input, upload, and extract per batch

* cleaning

* docstring indent

* fov -> fovs file name

* remove overwrite warning

* new dir for each test call

* fix bad logic warning testing

* remove arg from docstring

* add helper function test

* batch_num start at 1

* add previously processed warning

* set timeouts and scrap retry

* correct timeout errors and update tests

* timeout 5 mins

* add to unprocessed list after loop closes

* continue loop after extraction

* break instead of continue

* skipped processing print fixes

* adjust print statements

* 3 seconds before second zip call

update
@srivarra srivarra linked an issue Jul 28, 2023 that may be closed by this pull request
@srivarra srivarra self-assigned this Jul 28, 2023
@srivarra srivarra added the enhancement New feature or request label Jul 28, 2023
@srivarra srivarra marked this pull request as ready for review August 1, 2023 18:39
Copy link
Contributor

@alex-l-kong alex-l-kong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor comments.

Copy link
Contributor

@camisowers camisowers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! The wrapper functions are really clean and succinct.

@srivarra srivarra requested a review from alex-l-kong August 1, 2023 23:01
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@srivarra srivarra requested a review from ngreenwald August 2, 2023 18:28
Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Can you attach some screenshots of what the plotting looks like now?

@srivarra
Copy link
Contributor Author

srivarra commented Aug 8, 2023

@ngreenwald

Cell Clustering Sample Image:
cell_clustering_fov1

Neighborhood Analysis Sample Image:
neighborhood_analysis_fov6


I added a function which converts a numpy array to a discrete colormap. Is there any place in the notebooks for it, or is it better to leave it out of the notebooks?

@srivarra srivarra requested a review from ngreenwald August 8, 2023 20:25
@srivarra srivarra linked an issue Aug 8, 2023 that may be closed by this pull request
3 tasks
Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing to add to the design doc: change the mask generation logic to include the erosion step that's in the example code in the linked issue. This creates a small amount of space around each cell, making it easier to read

@srivarra srivarra mentioned this pull request Aug 30, 2023
alex-l-kong and others added 11 commits September 12, 2023 17:56
…xie (#1051)

* Drop cells without any SOM cluster expressions

* Add testing for dropping non-expressed cells
* Ensure mantis can read the image sub folder specified

* Test on example dataset

* Default img_sub_folder to None in create_mantis_dir (standard used elsewhere)

* Doc fix and updated example dataset

* Update segmentation labels again

* Clarify img_sub_folder (mostly for refreshing tests)

* Force .github/get_example_dataset.py to use updated revision

* Update the file names to look for
* pin to 0.19.3

* requirement less than 0.19.3
…o helper functions (#1058)

* Propagate overwrite functionality for pixel clustering

* Ensure re-normalization prevented on overwrite for pixel SOM re-assignment

* normalize_data should be the opposite of overwrite
* single mantis dir, no recopying

* post clustering mask suffix

* generic clustering adjustments

* mask prefix

* remove mask prefix
* added plotting notebook

* updated readmed

* git merge issues

* git merge fixes v2 - docs/landing.md

* type

* Remove cells that don't have any pixel clusters expressed prior to Pixie (#1051)

* Drop cells without any SOM cluster expressions

* Add testing for dropping non-expressed cells

* Include `img_sub_folder` as parameter in Mantis calls (#1050)

* Ensure mantis can read the image sub folder specified

* Test on example dataset

* Default img_sub_folder to None in create_mantis_dir (standard used elsewhere)

* Doc fix and updated example dataset

* Update segmentation labels again

* Clarify img_sub_folder (mostly for refreshing tests)

* Force .github/get_example_dataset.py to use updated revision

* Update the file names to look for

* fixed clipped plots in the notebooks.

* Update HuggingFace version (#1053)

* v0.1.10 (#1057)

* Added continuous variable segmentation plots

* Pin to scikit-image to v0.19.3 (#1060)

* pin to 0.19.3

* requirement less than 0.19.3

* Make sure overwrite functionality for pixel clustering propagates into helper functions (#1058)

* Propagate overwrite functionality for pixel clustering

* Ensure re-normalization prevented on overwrite for pixel SOM re-assignment

* normalize_data should be the opposite of overwrite

* Single mantis directory (#1061)

* single mantis dir, no recopying

* post clustering mask suffix

* generic clustering adjustments

* mask prefix

* remove mask prefix

* strange merge issue

* removed branch filters on CI, so if you branch off of a branch and run GHA, the CI workflow should work

* changed ci.yml, filter push on main branch only

* python 3.9 doesn't support | for Union type overloading

* added fovs parameter for continuous variable plots

* updated notebook to include plots

* updated cell clustering notebooks to add erosion (default to True), cleaned up some notebook outputs

* fixed style imports

* re-added test_generate_summary_stats. Was accidently deleted in a refactoring step.

* newline at eof fiber_segmentation_test.py

* seaborn-paper -> seaborn-v0_8-paper

* added cell to view all plotting styles i mask gen nb

* pycodestyle

---------

Co-authored-by: alex-l-kong <31424707+alex-l-kong@users.noreply.github.com>
Co-authored-by: camisowers <38049893+camisowers@users.noreply.github.com>
@srivarra srivarra requested a review from ngreenwald September 18, 2023 19:50
Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@ngreenwald ngreenwald merged commit e4caefe into main Sep 18, 2023
@ngreenwald ngreenwald deleted the masks/generation branch September 18, 2023 19:56
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.

Modular Mask Generation Refactor mask generation
4 participants