While I was building http://feram.co/scikit-image-cheatsheet I noticed several inconsistencies in the scikit-image API. I'll just layout how I would restructure the API. Sorry for any duplicates with other issues and this should probably be split into several issues later 😅😇.
Inconsistent argument names
image vs. img vs. im vs. …
Done in #2617
Details
I think it should be image everywhere.
Outliers:
I probably missed a few ...
label vs label_image
I'm in favor of label_image, but I figured pythonistas like unreadable concise shortcuts. I guess label is good as well …
Or maybe it should also be just image?
Outliers:
row vs. rvs.rowsvs.rr
Definitely row, rows, col & cols (Actually I'd prefer column and columns, but I guess that's too long for python =D)
There are definitely more inconsistent argument names I just can't remember them right now ...
Create new shapes module
There are so many shapes in the morphology module. I think they deserve their own module. I found kind of surprising to found the shape methods intermingled with the morphology operations.
This means we would have shape.{cube,diamond,disk,octagon,octahedron,rectangle,square,star}
Create new binarize module
Sciunto: See #2121 and #2490
While it makes sense to be able to retrieve the threshold generated by a certain thresholding algorithm, I think most people will simply want to use it to binarize their images. That's why a propose a module corresponding to the thresholds.
binarize.isodata(image)
binarize.li(image)
binarize.local(image)
binarize.niblack(image)
binarize.otsu(image)
binarize.sauvola(image)
binarize.triangle(image)
binarize.yen(image)
binarize.all(image)
They expect an (grayscale) image and return the binarized image. Simple as that.
Also the thresholds should probably be moved to their own module as well.
I mean you already prefix all of them with threshold_. Why not use threshold. and make it a proper module? 😄
Btw: The API of the thresholds is also kind of chaotic. Some return images, some simple values. There should be at least an argument flag for each one to always return an image.
[WIP] - I need to get back to work ... will fill out the rest later =P
While I was building http://feram.co/scikit-image-cheatsheet I noticed several inconsistencies in the scikit-image API. I'll just layout how I would restructure the API. Sorry for any duplicates with other issues and this should probably be split into several issues later 😅😇.
Inconsistent argument names
imagevs.imgvs.imvs. …Done in #2617
Details
I think it should be image everywhere.Outliers:
transform.hough_ellipsetransform.hough_line(@jni says: possibly won't fix — different type of input?)transform.hough_line_peakstransform.integral_imagedraw.set_colorfeature.daisyfeature.draw_multiblock_lbpfeature.multiblock_lbpI probably missed a few ...
label vs label_image
I'm in favor of
label_image, but I figured pythonistas likeunreadableconcise shortcuts. I guess label is good as well …Or maybe it should also be just
image?Outliers:
segmentation.find_boundariessegmentation.mark_boundariesrowvs.rvs.rowsvs.rrDefinitely
row,rows,col&cols(Actually I'd prefercolumnandcolumns, but I guess that's too long for python =D)There are definitely more inconsistent argument names I just can't remember them right now ...
Create new
shapesmoduleThere are so many shapes in the morphology module. I think they deserve their own module. I found kind of surprising to found the shape methods intermingled with the morphology operations.
This means we would have
shape.{cube,diamond,disk,octagon,octahedron,rectangle,square,star}Create new
binarizemoduleSciunto: See #2121 and #2490
While it makes sense to be able to retrieve the threshold generated by a certain thresholding algorithm, I think most people will simply want to use it to binarize their images. That's why a propose a module corresponding to the thresholds.
binarize.isodata(image)binarize.li(image)binarize.local(image)binarize.niblack(image)binarize.otsu(image)binarize.sauvola(image)binarize.triangle(image)binarize.yen(image)binarize.all(image)They expect an (grayscale) image and return the binarized image. Simple as that.
Also the thresholds should probably be moved to their own module as well.
I mean you already prefix all of them with
threshold_. Why not usethreshold.and make it a proper module? 😄Btw: The API of the thresholds is also kind of chaotic. Some return images, some simple values. There should be at least an argument flag for each one to always return an image.
[WIP] - I need to get back to work ... will fill out the rest later =P