Image-Py / imagepy

Image process framework based on plugin like imagej, it is esay to glue with scipy.ndimage, scikit-image, opencv, simpleitk, mayavi...and any libraries based on numpy
http://imagepy.org
BSD 4-Clause "Original" or "Old" License
1.29k stars 330 forks source link

More lax array type check #88

Closed CsatiZoltan closed 4 years ago

CsatiZoltan commented 4 years ago

The Mark Boundaries command requires an integer type https://github.com/Image-Py/imagepy/blob/9710a277ad5711ca91c19c9324cb1bc18f4e2ff6/imagepy/menus/Analysis/label_plg.py#L34 This is however not required because the find_boundaries function of scikit-image accepts bool type too. Boolean types could be implemented in the note list as 'bool'.


In some cases, one could accept an RGB image and implicitly convert it to e.g. uint8 when necessary. The Filter plugin already supports auto-conversion, as described in the documentation, in the form of '2int' and '2float'. What about implementing 'rgb2uint32, rgb2uint64, etc.?

yxdragon commented 4 years ago

for bool is a "detyped uint8", and it cost the same memory as uint8. we use imread, imsave to treat bool, it also come into uint8. So there is no need to treat bool as a specific type.

and the 2int, 2float is for keeping the accuracy in filters, that means if the dtype is lower than float: xxx 2 float, float count, result 2 xxx (filter is image 2 image, and update itself, not generate new window). but we can not define int2rgb. So If we need treat it, using Image > Type > to transfrom.

CsatiZoltan commented 4 years ago

not generate new window

Most plugins modify the current image but some create a new image (e.g. Analysis -> Mark Boundaries). How do you decide whether to create a new image or not? Related question: how can I make imagepy.IPy.show_img replace the current image and not opening a new one?

yxdragon commented 4 years ago

filter means modify inplace, and the Filter base class will loop the images sequence by default.

but some operation return different dtype, So we use simple, and we must treat sequence by a for loop. then show a new one.

We can not show new image in a filter, else it would pop many windws when processing sequence.