skan icon indicating copy to clipboard operation
skan copied to clipboard

Suggestion for API: Return pixel_indices in different format

Open constantinpape opened this issue 5 years ago • 2 comments

First of all, thanks a lot for skan. It makes my life much easier for an upcoming project involving quite a bit of skeleton analysis. I have a few minor pain points with the API though. The first one:

csr.skeleton_to_csgraph returns pixel_indices as np.array[n_skel_pix, n_dim] in float64. This can't be used to index the original image. I am using this to turn it into something that can index:

pixel_indices = tuple(pixel_indices[:, i].astype('uint64') for i in range(pixel_indices.shape[1]))

I am wondering if it wouldn't make sense to return this format by default. If this is not possible because downstream functionality depends on the output format, it might be nice to add a method to csr.Skeleton that wraps this.

constantinpape avatar Jan 23 '19 18:01 constantinpape

The thing is that it's actually subpixel coordinates... (Again, see supplementary material of the paper.) Perhaps I need to change the name of some variables... =P And perhaps a command-line flag could change this behaviour...

jni avatar Jan 24 '19 00:01 jni

The thing is that it's actually _sub_pixel coordinates...

Ok, I will check out the paper. But just to clarify, for now the pixel_indices returned always correspond to the pixel position of the skeleton node, irrespective of the spacing parameter (at least that's the behaviour in 0.7.1)?!

And perhaps a command-line flag could change this behaviour...

Yes, I think that would be very useful for indexing.

constantinpape avatar Jan 24 '19 08:01 constantinpape