imagej / imagej/imagej-ops

ScaleImg Bug - out is always the same image type of in

Open
#314 1 comment 0 reactions 1 assignee Claimed by @ctrueden View on GitHub
Dominant language
Java
Stars
94
Forks
44
PR merge metrics
No merged PRs in 30d

Description

[ScaleImg](https://github.com/imagej/imagej-ops/blob/master/src/main/java/net/imagej/ops/image/scale/ScaleImg.java#L92) always generate the `out` of the same image type of the `in`, while `out` could be of much larger size. For example:

``` java
// generate an (Integer.MAX_VALUE x 1) ArrayImg
final Img in = ArrayImgs.bytes(new byte[Integer.MAX_VALUE - 2], Integer.MAX_VALUE - 2, 1);
final double[] scaleFactors = new double[] { 1.0, 2.0 };
Img out = ops.image().scale(in, scaleFactors, new NLinearInterpolatorFactory());
// stack trace:
// java.lang.RuntimeException: Number of elements in Container too big, use for example
// CellContainer instead: 4294967290 > 2147483647
// ...
```

It should use a more sophisticated way to create the out.

In addition, [this line](https://github.com/imagej/imagej-ops/blob/master/src/main/java/net/imagej/ops/image/scale/ScaleImg.java#L94) is not working as expected. In the current implementation, `in` and `out` should always have the same `IterationOrder`, since they have the same `ImageFactory`.

I would fix this bug later.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.