cellpose icon indicating copy to clipboard operation
cellpose copied to clipboard

TypeError: imsave() missing 1 required positional argument: 'arr' in run_Cellpose-SAM.ipynb

Open Jiadalee opened this issue 7 months ago • 2 comments

Describe the bug I'm running the run_Cellpose-SAM.ipynb file in colab with gpu, but got the TypeError: imsave() missing 1 required positional argument: 'arr' . To resolve this issue, I double checked the io.imsave() and io.save_rois() API guide. I found these two functions do not return anything, so you cannot assign the output to a variable. The code line masks0 = io.imsave(dir / (f.name + "_masks" + masks_ext)) should be corrected to be io.imsave(dir / (f.name + "_masks" + masks_ext)), and then it works fine. I'd like to submit a PR if this raised issue and fix looks good to you

To Reproduce Steps to reproduce the behavior:

  1. Go to run_Cellpose-SAM.ipynb
  2. run run_Cellpose-SAM.ipynb
  3. Scroll down to final bottom code block
  4. See error : TypeError: imsave() missing 1 required positional argument: 'arr'

Run log Error message:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-14-330c8aba240f>](https://localhost:8080/#) in <cell line: 0>()
      1 for i in trange(len(files)):
      2     f = files[i]
----> 3     masks0 = io.imsave(dir / (f.name + "_masks" + masks_ext))
      4     io.save_rois(masks0, f)

TypeError: imsave() missing 1 required positional argument: 'arr'

Code block:

for i in trange(len(files)):
    f = files[i]
    masks0 = io.imsave(dir / (f.name + "_masks" + masks_ext))
    io.save_rois(masks0, f)

Screenshots

Image

Jiadalee avatar May 28 '25 15:05 Jiadalee

Hi @Jiadalee please make a PR for this

mrariden avatar May 29 '25 14:05 mrariden

Hi @Jiadalee please make a PR for this

@mrariden PR was created and feel free to review: https://github.com/MouseLand/cellpose/pull/1211

Jiadalee avatar May 29 '25 20:05 Jiadalee