kevinjohncutler / omnipose

Omnipose: a high-precision solution for morphology-independent cell segmentation
https://omnipose.readthedocs.io
Other
85 stars 29 forks source link

NameError with io.save_masks #72

Closed ZiyangCh3n closed 5 months ago

ZiyangCh3n commented 5 months ago

Hi there,

I followed this tutorial and ran into NameError at the Save the Results step. I'm just trying to run through the example here. See below for the error message.

Thanks, Ziyang

from cellpose_omni import io
io.save_masks(imgs, masks, flows, files, 
              png=False,
              tif=True, # whether to use PNG or TIF format
              suffix='', # suffix to add to files if needed 
              save_flows=False, # saves both RGB depiction as *_flows.png and the raw components as *_dP.tif
              save_outlines=False, # save outline images 
              dir_above=0, # save output in the image directory or in the directory above (at the level of the image directory)
              in_folders=True, # save output in folders (recommended)
              save_txt=False, # txt file for outlines in imageJ
              save_ncolor=False) # save ncolor version of masks for visualization and editing 
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[18], line 2
      1 from cellpose_omni import io
----> 2 io.save_masks(imgs, masks, flows, files, 
      3               png=False,
      4               tif=True, # whether to use PNG or TIF format
      5               suffix='', # suffix to add to files if needed 
      6               save_flows=False, # saves both RGB depiction as *_flows.png and the raw components as *_dP.tif
      7               save_outlines=False, # save outline images 
      8               dir_above=0, # save output in the image directory or in the directory above (at the level of the image directory)
      9               in_folders=True, # save output in folders (recommended)
     10               save_txt=False, # txt file for outlines in imageJ
     11               save_ncolor=False) # save ncolor version of masks for visualization and editing 

File [~/Documents/omnipose/cellpose_omni/io.py:514](https://vscode-remote+mydella-002eprinceton-002eedu.vscode-resource.vscode-cdn.net/scratch/gpfs/ziyangc/PASA/Omnipose/~/Documents/omnipose/cellpose_omni/io.py:514), in save_masks(images, masks, flows, file_names, png, tif, suffix, save_flows, save_outlines, outline_col, save_ncolor, dir_above, in_folders, savedir, save_txt, save_plot, omni, channel_axis)
    512 if isinstance(masks, list):
    513     for image, mask, flow, file_name in zip(images, masks, flows, file_names):
--> 514         save_masks(image, mask, flow, file_name, png=png, tif=tif, suffix=suffix, dir_above=dir_above,
    515                    save_flows=save_flows,save_outlines=save_outlines, outline_col=outline_col,
    516                    save_ncolor=save_ncolor, savedir=savedir, save_txt=save_txt, save_plot=save_plot,
    517                    in_folders=in_folders, omni=omni, channel_axis=channel_axis)
    518     return
    520 # make sure there is a leading underscore if any suffix was supplied
...
    157 def imsave(filename, arr):
--> 158     io.loggwarning('WARNING: imsave is deprecated, use io.imwrite instead')
    159     return imwrite(filename, arr)

NameError: name 'io' is not defined
kevinjohncutler commented 5 months ago

Sorry about that! I just pushed the fix.