Closed srivarra closed 12 months ago
@ngreenwald
Overall looks good. The point of this notebook is to showcase to people how they can take a generic set of labels, and a generic segmentation mask, and generate an overlay. So using the pixie labels mesmer segmentation as an example is fine, but it needs to be clear how people can take any random CSV that they've generated, and any random mask, and get the same output.
i.e., what columns does the df need to have? Or a step to make a compatible df out of the one they loaded.
@ngreenwald Added a section in Required Inputs which describes the columns of the DataFrame
/ csv
necessary.
Here's what the notebook needs to be able to.
The remapping from cluster to meta cluster is not the crucial part, that's specific to the pixie workflow. What matter is that given a segmentation mask and a generic list of categorical assignments, those can be visualized.
This is for internal use only; if you'd like to open an issue or request a new feature, please open a bug or enhancement issue
Instructions
This document should be filled out prior to embarking on any project that will take more than a couple of hours to complete. The goal is to make sure that everyone is on the same page for the functionality and requirements of new features. Therefore, it's important that this is detailed enough to catch any misunderstandings beforehand. For larger projects, it can be useful to first give a high-level sketch, and then go back and fill in the details. For smaller ones, filling the entire thing out at once can be sufficient.
Relevant background
With #1030 there are now multiple methods of creating, visualizing and saving segmentation masks. It'll be beneficial for a notebook to contain the available methods.
In addition, some objects and their associated characteristics are not categorical, so we should be able to supply a continuous colormap for those metrics.
Design overview
Sequential Colormaps
Plotting behavior will be similar to
create_cmap
andplot_cluster
in #1030, however it will not usecolors.ListedColormap
as that is primarily for discrete colormaps. Instead, the user can call any sequential colormap from Matplotlib, or create their own and use that.Optional Erosion Step
For segmentation mask boundaries, add an optional step for creating some empty space around each cell to make visualizations easier to understand.
Notebook
The notebook will consist of the following components:
Code mockup
Sequential Colormaps
Optional Erosion Step
Notebook
Required inputs
Segmentation masks from Notebook 1, and then clustering results from Notebook 2. Specifically the raw-cmap and the mapping of the clusters to the metaclusters, This may have to be a saved value, perhaps a JSON file or something of the like.
Plotting a cohort's segmentation masks requires a
csv
file containing at least two columns, the first being the original cluster value, and the second being the remapped value.For example:
which is the
pixel_meta_cluster_mapping.csv
file from Notebook 2 in the Pixie pipelineor
which is the
cell_meta_cluster_mapping.csv
file from Notebook 3 in the Pixie pipeline.We can generalize this to accept any
csv
file consisting of at least two columns, as long as there exists an original cluster value column and a remapped cluster value column. This is to account for clusters which may not exist in a particular FOV, but do in another.Output files
For example, we should get similar outputs to the following in #1030 with fov0:
In addition, we should get a colorized TIFF with the segmentation mask and the cell cluster mask, all saved in their respective directories
pixie/cell_output_dir/pixel_mask_colored
, or to any user specified directory.Timeline Give a rough estimate for how long you think the project will take. In general, it's better to be too conservative rather than too optimistic.
Estimated date when a fully implemented version will be ready for review: 8/17
Estimated date when the finalized project will be merged in: 8/22