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

RLEImageReader: use PixelInterleavedSampleModel instead BandedSampleModel for monochrome images #1118

Closed
gunterze opened this issue Jan 28, 2022 · 1 comment
Assignees
Milestone

Comments

@gunterze
Copy link
Member

RLEImageReader: use PixelInterleavedSampleModel instead BandedSampleModel for monochrome images

Rationale:
Attempts to apply AffineTransform.html#getScaleInstance(double,double) to a BufferedImage with BandedSampleModel fails:

Caused by: java.awt.image.ImagingOpException: Unable to transform src image
	at java.desktop/java.awt.image.AffineTransformOp.filter(AffineTransformOp.java:287)
@gunterze gunterze added this to the 5.26.0 milestone Jan 28, 2022
@gunterze gunterze self-assigned this Jan 28, 2022
@gunterze
Copy link
Member Author

gunterze commented Jan 28, 2022

Fixed by 67cc393:

$ git show 67cc393839abb2bc529c207fda62d30153b296c9 ./dcm4che-image/src/main/java/org/dcm4che3/image/PhotometricInterpretation.java
commit 67cc393839abb2bc529c207fda62d30153b296c9
Author: Gunter Zeilinger <gunterze@protonmail.com>
Date:   Fri Jan 28 11:39:41 2022 +0100

    reset version to 5.25.1

diff --git a/dcm4che-image/src/main/java/org/dcm4che3/image/PhotometricInterpretation.java b/dcm4che-image/src/main/java/org/dcm4che3/image/PhotometricInterpretation.java
index 8d5a4bd3f..8d70f8177 100644
--- a/dcm4che-image/src/main/java/org/dcm4che3/image/PhotometricInterpretation.java
+++ b/dcm4che-image/src/main/java/org/dcm4che3/image/PhotometricInterpretation.java
@@ -221,7 +221,7 @@ public enum PhotometricInterpretation {
         int[] indicies = new int[samples];
         for (int i = 1; i < samples; i++)
             indicies[i] = i;
-        return banded
+        return banded && samples > 1
                 ? new BandedSampleModel(dataType, w, h,  w, indicies, new int[samples])
                 : new PixelInterleavedSampleModel(dataType, w, h, samples, w * samples, indicies);
     }

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

No branches or pull requests

1 participant