Pymorph Label function

Skip to first unread message

Pankaj Kumar

Aug 31, 2017, 6:15:25 PM8/31/17
to pythonvision

I am using the image matrix which has been dilated using pymorph.dilation, however, when I try to label those dilated cells using pymorph.label then it gives me a following error:

Traceback (most recent call last):
  File "<editor selection>", line 1, in <module>
  File "C:\Python27\Lib\site-packages\pymorph\", line 737, in label
    f = pad4n(f, Bc, 0)
  File "C:\Python27\Lib\site-packages\pymorph\", line 4486, in pad4n
    g[ ch: -ch, cw: -cw] = f
TypeError: slice indices must be integers or None or have an __index__ method

However, when I use mahotas.label then it works well. Can you please help me in it ?

Thanks in advance.

Luis Pedro Coelho

Aug 31, 2017, 6:17:01 PM8/31/17
to Pankaj Kumar, pythonvision
Hi Pankaj,

Any reason for using pymorph? I maintained it for a while (even though I
didn't start the project), but I don't think anybody is working on it

Except in the few cases where there are pymorph functions not in other
packages, I would recommend the mahotas function (it's also much faster
as it's compiled C++ code).


Luis Pedro Coelho | EMBL |
My blog:
> --
> You received this message because you are subscribed to the Google Groups
> "pythonvision" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
> For more options, visit

Pankaj Kumar

Sep 4, 2017, 10:31:14 AM9/4/17
to Luis Pedro Coelho, pythonvision
Dear Luis,

Many thanks for your response. In that case, I will continue to use Mahotas libraries.

Pankaj Kumar


Reply all
Reply to author
0 new messages