OH. Right. That's what's happening, it's not inverted, it's looping around with the overflow! (I was wondering why the correlation was not closer to -1.)
Guh. imho:
- This really shouldn't happen. The plugin selection should be aware of the data type, and use only a plugin that can handle it (if available)
- PIL can definitely do 16bit PNG, so either it is being used incorrectly, or the imsave docstring stating that PIL is the first selection is wrong. I just tested this on my PIL-based Gala library, which is 3D so it required a bit of modification:
In [66]: imio.write_png_image_stack(s[np.newaxis, ...], '~/Desktop/im%02i.png', axis=0)
In [67]: srg = imio.read_image_stack('/Users/nuneziglesiasj/Desktop/im0*.png')
In [68]: srg.shape
Out[68]: (1040, 1392)
In [69]: (s == srg).all()
Out[69]: True
- The IO module is a mess! I know Stefan mentioned overhauling it briefly, but I didn't quite realise how urgent that was. In particular:
- is `from blah import *` used as a matter of policy or is it a remnant of an earlier age? Took me ages to find the `call` function.
- `plugin_store`? I have no idea where this gets updated.
So, to the core skimage devs: what is the scope for updating this? Am I allowed to break some functionality in a PR? Or are we sticking with this API?