If all input images to dip::Framework::Scan (after singleton expansion to match dimensions) have the same dimension singleton-expanded, then the output image should have that same dimension be singleton-expanded.
For example, currently:
dip::Image img;
dip::CreateRamp(img, {256, 256}, 0);
// img now has size 256x256, but only stores 256 values, the 2nd dimension has a stride of 0.
img *= 2;
// img now stores 256x256 values, and has normal strides. We did 256 times too many multiplications.
Instead, img *= 2 should produce again an image with only 256 values, and the operation should do only 256 multiplications, not 256x256 multiplications.
This can be accomplished by finding such dimensions, unexpanding them, then create the output and do the computations as we do now, and finally expand those dimensions in the output image(s).
If all input images to
dip::Framework::Scan
(after singleton expansion to match dimensions) have the same dimension singleton-expanded, then the output image should have that same dimension be singleton-expanded.For example, currently:
Instead,
img *= 2
should produce again an image with only 256 values, and the operation should do only 256 multiplications, not 256x256 multiplications.This can be accomplished by finding such dimensions, unexpanding them, then create the output and do the computations as we do now, and finally expand those dimensions in the output image(s).