ITK icon indicating copy to clipboard operation
ITK copied to clipboard

Incorrect size of itk::MaximumProjectionImageFilter output

Open aystroganov opened this issue 5 years ago • 5 comments

Description

There seems to be an inconsistent behaviour in how itk::MaximumProjectionImageFilter creates its output: if I pass a 3D image (XYZ axes) and ask for a maximum projection along X, I expect to get a 2D image with YZ axis order. However, the filter produces it in ZY order. When the direction of projection is set to Y or Z, the filter outputs the image in the correct order: XZ and XY respectively.

Steps to Reproduce

Run MWE: https://gist.github.com/aystroganov/e82783d6f23b84640245fd7b35b8bfb8

Expected behavior

The scripts prints [20, 30]

Actual behavior

The scripts prints [30, 20]

Reproducibility

100%

Versions

ITK 5.0.1

Environment

Windows 10, VS 2017

Additional Information

aystroganov avatar Jul 27 '20 07:07 aystroganov

@fbudin69500 you touched this last in 93edbf81b47c78aff4caa372e20623c1751cf4f7. Is it supposed to work like this, or is this a bug?

dzenanz avatar Jul 27 '20 14:07 dzenanz

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

stale[bot] avatar Nov 24 '20 23:11 stale[bot]

I ran into this unexpected issue also - and affects other projections (e.g. min). I don't think @fbudin69500 made any functional changes to the way the indices were computed. The fix isn't particularly difficult, it will however change the output and break user code. Would you be happy to accept a PR to correct this?

dbeurle avatar Aug 31 '21 06:08 dbeurle

Perhaps we could introduce a new ivar named OldStyleAxisOrder, WrapAroundAxisOrder or something similar which controls this? Then emphasize in the class documentation that the default might be counter-intuitive and that this setting is used to change it?

Silently changing behavior of such an old class is not a good idea. If you insist that the new behavior is the right one, then make the default dependent on ITK_LEGACY_REMOVE: old default with legacy ON, new default with legacy removed. Of course, emphasize this in the class docs and add an entry in the migration guide.

PRs are generally welcome.

dzenanz avatar Aug 31 '21 13:08 dzenanz

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 10:04 stale[bot]