scverse / squidpy

Spatial Single Cell Analysis in Python
https://squidpy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
401 stars 72 forks source link

error when sq.im.segment #793

Closed lvmt closed 4 months ago

lvmt commented 5 months ago

hi,

nice tool.

I'm running the toturial "tangram with squidpy", the code error like

my code

img = sq.datasets.visium_fluo_image_crop()  
sq.im.process(img=img, layer="image", method="smooth")
sq.im.segment(
    img=img,
    layer="image_smooth",
    method="watershed",
    channel=0,
)

error message :

TypeError Traceback (most recent call last) Cell In[5], line 1 ----> 1 sq.im.segment( 2 img=img, 3 layer="image_smooth", 4 method="watershed", 5 channel=0, 6 )

File d:\software\miniconda3\envs\st38\lib\site-packages\squidpy\im_segment.py:340, in segment(img, layer, library_id, method, channel, chunks, lazy, layer_added, copy, **kwargs) 337 assert isinstance(method, SegmentationModel) 339 start = logg.info(f"Segmenting an image of shape {img[layer].shape} using {method}") --> 340 res: ImageContainer = method.segment( 341 img, 342 layer=layer, 343 channel=channel, 344 library_id=library_id, 345 chunks=None, 346 fn_kwargs=kwargs, 347 copy=True, 348 drop=copy, 349 lazy=lazy, 350 ) 351 logg.info("Finish", time=start) ... 236 ) 237 elif label.dtype.kind == "b": 238 indexer = label

TypeError: get_loc() got an unexpected keyword argument 'method'

package:

squidpy 1.2.2 tangram-sc 1.0.4 scanpy 1.9.6

need your help and thanks.

giovp commented 5 months ago

hi @lvmt I would suggest you to update to latest squidpy and try again

lvmt commented 4 months ago

thanks, problem solved .