Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offsets are multiplied by 2 when setting image dimension metadata #502

Open
imagejan opened this issue Jul 4, 2018 · 1 comment
Open

Comments

@imagejan
Copy link

imagejan commented Jul 4, 2018

When using the Set Image Metadata node to set the dimension name (and nothing else), e.g. Dimension 2 to "Z" (as is required for bitmasks after the Feature Calculator (BETA) node currently - another bug?), the image offsets get multiplied by 2, as illustrated by this workflow:

image
Set Metadata Offsets Bug.zip

I suspect the issue somewhere in these lines, where the min gets set correctly first, but later the image gets translated by the very same min again:

final long[] min = new long[imgPlusVal.getDimensions().length];
imgPlusVal.getImgPlus().min(min);
for (int i = 0; i < Math.min(min.length, m_offsetColIndices.length); i++) {
if (m_offsetColIndices[i] != -1) {
min[i] = ((LongValue)row.getCell(m_offsetColIndices[i])).getLongValue();
}
}

final ImgPlus<T> res = new ImgPlus<>(
ImgView.wrap(Views.translate(imgPlus.getImg(), min), imgPlus.getImg().factory()), metadata);

Not sure if my guess is correct, though... I only quickly looked at the code.

(Tested with KNIME 3.5.3 and the nightly-built KNIME Image Processing 1.6.1.201806190602)

@imagejan
Copy link
Author

imagejan commented Aug 9, 2018

(as is required for bitmasks after the Feature Calculator (BETA) node currently - another bug?)

I opened an issue for this one: #506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant