seung-lab / connected-components-3d

Connected components on discrete and continuous multilabel 3D & 2D images. Handles 26, 18, and 6 connected variants; periodic boundaries (4, 8, & 6)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a better error for type support.

aymuos15 opened this issue · comments

  File "cc3d.pyx", line 336, in cc3d.connected_components
  File "cc3d.pyx", line 225, in cc3d.estimate_provisional_labels
TypeError: Type float16 not currently supported.

Listing what all are the available options would be nice.

Thanks for the feedback! Here's what's supported iirc:

bool, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64

float16 is more difficult to support because it's not a native type in C++ though there are some libraries to help with that. What you can do though (though it might not always work) is:

data.view(np.uint16) which will view the same data as uint16 and may allow it to be processed. Since the particularities of the actual value don't matter, only whether the values are equal, this can be okay.

Sorry, you may have misunderstood me. I mean to say that, just while presenting the error, you could just list out what the available options are so one does not need to come here to check. Like, within the TypeError itself.

I do not (personally) think it is required to add float16 because of what you said about the absence of the native typing.

Ah I already did both! Check out the latest release. The supported types are printed out and float16 is supported for labeled images (but not continuous images).

That sounds great! Thank you so much :)