Skip to content

Commit

Permalink
Switch to jai-imageio-jpeg2000
Browse files Browse the repository at this point in the history
I am hopeful that scifio-jai-imageio is obsolete now, due to
https://github.com/jai-imageio, which has existed for more than five
years now. This org is the closest thing we have to an "official"
revived jai-imageio project, so we should use it if possible rather than
rolling our own.

The slightly different values in the test are unfortunate, but it is
within some reasonable epsilon (http://tom7.org/papers/epsilon.pdf),
so I'm just going ahead with the switch. We can always revert back if
it causes disruptions downstream.
  • Loading branch information
ctrueden committed Feb 28, 2024
1 parent 482e84e commit d5dfe9a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
19 changes: 12 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>io.scif</groupId>
<artifactId>scifio</artifactId>
<version>0.46.1-SNAPSHOT</version>
<version>0.47.0-SNAPSHOT</version>

<name>SCIFIO Core</name>
<description>SCIFIO is a library for scientific N-dimensional image I/O.</description>
Expand Down Expand Up @@ -126,15 +126,13 @@
<imglib2-cache.version>1.0.0-beta-17</imglib2-cache.version>

<xdg-java.version>0.1.1</xdg-java.version>

<jai-imageio.version>1.4.0</jai-imageio.version>
<jai-imageio-jpeg2000.version>${jai-imageio.version}</jai-imageio-jpeg2000.version>
<com.github.jai-imageio.jai-imageio-jpeg2000.version>${jai-imageio-jpeg2000.version}</com.github.jai-imageio.jai-imageio-jpeg2000.version>
</properties>

<dependencies>
<!-- SCIFIO dependencies -->
<dependency>
<groupId>io.scif</groupId>
<artifactId>scifio-jai-imageio</artifactId>
</dependency>

<!-- ImageJ dependencies -->
<dependency>
<groupId>net.imagej</groupId>
Expand All @@ -157,6 +155,13 @@
<artifactId>scijava-common</artifactId>
</dependency>

<!-- JAI ImageIO dependencies -->
<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-jpeg2000</artifactId>
<version>${com.github.jai-imageio.jai-imageio-jpeg2000.version}</version>
</dependency>

<!-- Test scope dependencies -->
<dependency>
<groupId>junit</groupId>
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/io/scif/services/JAIIIOServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@

package io.scif.services;

import com.github.jaiimageio.jpeg2000.J2KImageReadParam;
import com.github.jaiimageio.jpeg2000.J2KImageWriteParam;
import com.github.jaiimageio.jpeg2000.impl.J2KImageReader;
import com.github.jaiimageio.jpeg2000.impl.J2KImageReaderSpi;
import com.github.jaiimageio.jpeg2000.impl.J2KImageWriter;
import com.github.jaiimageio.jpeg2000.impl.J2KImageWriterSpi;

import io.scif.codec.JPEG2000CodecOptions;
import io.scif.media.imageio.plugins.jpeg2000.J2KImageReadParam;
import io.scif.media.imageio.plugins.jpeg2000.J2KImageWriteParam;
import io.scif.media.imageioimpl.plugins.jpeg2000.J2KImageReader;
import io.scif.media.imageioimpl.plugins.jpeg2000.J2KImageReaderSpi;
import io.scif.media.imageioimpl.plugins.jpeg2000.J2KImageWriter;
import io.scif.media.imageioimpl.plugins.jpeg2000.J2KImageWriterSpi;

import java.awt.image.BufferedImage;
import java.awt.image.Raster;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/scif/writing/JPEG2000FormatTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void testWriting_int32() throws IOException {
final ImgPlus<?> sourceImg = opener.openImgs(new TestImgLocation.Builder().name(
"testimg").pixelType("int32").axes("X", "Y", "C").lengths(100, 100, 3)
.build()).get(0);
testWritingApprox(sourceImg, 14699.999654369429);
testWritingApprox(sourceImg, 14699.999658373417);
}

@Test
Expand All @@ -108,7 +108,7 @@ public void testWriting_uint32() throws IOException {
final ImgPlus<?> sourceImg = opener.openImgs(new TestImgLocation.Builder().name(
"testimg").pixelType("uint32").axes("X", "Y", "C").lengths(100, 100, 3)
.build()).get(0);
testWritingApprox(sourceImg, 0.00034952256828546524);
testWritingApprox(sourceImg, 0.0003455772530287504);
}

@Test
Expand Down

0 comments on commit d5dfe9a

Please sign in to comment.