angelolab / Nimbus

Other
12 stars 1 forks source link

Clean up application notebooks #64

Closed ngreenwald closed 1 year ago

ngreenwald commented 1 year ago

Is your feature request related to a problem? Please describe. The current application notebooks have a bunch of functions defined within them, rather than imported. In addition, there are some manual steps (defining marker names) that should probably be handled automatically. There's also stuff about the google drive integration, example datasets, etc that was copied from ark that we should remove or update to be correct.

All of this cleanup will be good to do before we start having people try out the pipeline so we can figure out what's working and what isn't.

JLrumberger commented 1 year ago

Instructions

I started and did a first refactor, but I think a design doc is needed. Goal is to re-organize the code in predict.ipynb, such that it is easy to use while having enough degrees of freedom to be not embarrassing.

Relevant background This feature should ensure great UX for users when loading and using our model for inference on their own data.

Design overview The utility needed for inference on new data includes the following:

Code mockup

class Nimbus(deepcell.applications.Application)

def init
list fov_paths
list exclude_channels
func segmentation_naming_convention
str output_dir
bool half_resolution
bool save_predictions

def check_inputs
# check inputs and return well written error messages

def prepare_normalization_dict
# loads or calculates and saves normalization dict

def download_weights
# downloads weights from online repo

def get_model
# instantiates model and loads weights

def prep_input
# prepares input data for prediction including resizing

def prep_output
# prepares output including resizing

def predict(fov_paths)
# predicts all non excluded marker images from fovs in fov_paths and saves predictions

class ViewerWidget

def init
list fov_paths
func segmentation_naming_convention
str output_dir

def load_input

def load_output

def start_viewer
# dropdown FoVs
# dropdown with channels
# shows input and output side-by-side for fov/channel combination

Required inputs

Output files

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: 08/15

Estimated date when the finalized project will be merged in: 08/18