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

return multichannel image to use in cellpose worklfow #11

Open
pr4deepr opened this issue Sep 13, 2022 · 0 comments
Open

return multichannel image to use in cellpose worklfow #11

pr4deepr opened this issue Sep 13, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@pr4deepr
Copy link
Collaborator

pr4deepr commented Sep 13, 2022

Currently, napari-lattice Workflow module iterates through each channel and applies the custom processing defined in the workflow.
For cellpose, if a multichannel image is given, this can be used as input for improved prediction using cyto models.
For example if channel 1 is nuclei and channel 2 is cytoplasm, segmentation maybe more accurate on the combined multichannel image than on channel 1 or two individually.

Either new function for this or alter the code here:

for time_point in tqdm(time_range, desc="Time", position=0):
output_array = []
data_table = []
for ch in tqdm(channel_range, desc="Channels", position=1,leave=False):
if len(vol.shape) == 3:
raw_vol = vol
else:
raw_vol = vol[time_point, ch, :, :, :]
#TODO: disable if support for resourc backed dask array is added
if type(raw_vol) in [resource_backed_dask_array]:
raw_vol = raw_vol.compute() #convert to numpy array as resource backed dask array not su
#to access current time and channel, create a file config.py in same dir as workflow or in home directory
#add "channel = 0" and "time=0" in the file and save
#https://docs.python.org/3/faq/programming.html?highlight=global#how-do-i-share-global-variables-across-modules
config.channel = ch
config.time = time_point
#if deconvolution, need to define psf and choose the channel appropriate one
if deconvolution:
workflow.set(psf_arg,psf[ch])
#if decon_processing == "cuda_gpu":
#workflow.set("psf",psf[ch])
#else:
#workflow.set("psf",psf[ch])
#Set input to the workflow to be volume from each time point and channel
workflow.set(input_arg,raw_vol)
#execute workflow
processed_vol = workflow.get(last_task)
output_array.append(processed_vol)
output_array = np.array(output_array)

@pr4deepr pr4deepr added the enhancement New feature or request label Sep 13, 2022
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

No branches or pull requests

1 participant