Skip to content

Commit

Permalink
Merge branch 'ebremer:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ebremer authored May 19, 2023
2 parents c5e12ca + 505e0f1 commit 1ab584c
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 280 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Hatch 3.0.0
# Hatch 3.0.1

This tool converts the largest image in a VSI, SVS, or TIF image into a new TIFF image with a freshly created image pyramid with each scaling 1/2 dimensions each scale.

Expand Down
114 changes: 2 additions & 112 deletions config/jni-config.json
Original file line number Diff line number Diff line change
@@ -1,120 +1,10 @@
[
{
"name":"com.sun.imageio.plugins.jpeg.JPEGImageReader",
"methods":[
{"name":"acceptPixels","parameterTypes":["int","boolean"] },
{"name":"passComplete","parameterTypes":[] },
{"name":"passStarted","parameterTypes":["int"] },
{"name":"pushBack","parameterTypes":["int"] },
{"name":"readInputData","parameterTypes":["byte[]","int","int"] },
{"name":"setImageData","parameterTypes":["int","int","int","int","int","byte[]"] },
{"name":"skipInputBytes","parameterTypes":["long"] },
{"name":"skipPastImage","parameterTypes":["int"] },
{"name":"warningOccurred","parameterTypes":["int"] },
{"name":"warningWithMessage","parameterTypes":["java.lang.String"] }
]
},
{
"name":"com.sun.imageio.plugins.jpeg.JPEGImageWriter",
"methods":[
{"name":"grabPixels","parameterTypes":["int"] },
{"name":"warningOccurred","parameterTypes":["int"] },
{"name":"warningWithMessage","parameterTypes":["java.lang.String"] },
{"name":"writeMetadata","parameterTypes":[] },
{"name":"writeOutputData","parameterTypes":["byte[]","int","int"] }
]
},
{
"name":"java.awt.GraphicsEnvironment",
"methods":[{"name":"isHeadless","parameterTypes":[] }]
},
{
"name":"java.awt.image.BufferedImage",
"fields":[
{"name":"colorModel"},
{"name":"imageType"},
{"name":"raster"}
],
"methods":[
{"name":"getRGB","parameterTypes":["int","int","int","int","int[]","int","int"] },
{"name":"setRGB","parameterTypes":["int","int","int","int","int[]","int","int"] }
]
},
{
"name":"java.awt.image.ColorModel",
"fields":[
{"name":"colorSpace"},
{"name":"colorSpaceType"},
{"name":"isAlphaPremultiplied"},
{"name":"is_sRGB"},
{"name":"nBits"},
{"name":"numComponents"},
{"name":"pData"},
{"name":"supportsAlpha"},
{"name":"transparency"}
],
"methods":[{"name":"getRGBdefault","parameterTypes":[] }]
},
{
"name":"java.awt.image.Raster",
"fields":[
{"name":"dataBuffer"},
{"name":"height"},
{"name":"minX"},
{"name":"minY"},
{"name":"numBands"},
{"name":"numDataElements"},
{"name":"sampleModel"},
{"name":"sampleModelTranslateX"},
{"name":"sampleModelTranslateY"},
{"name":"width"}
]
},
{
"name":"java.awt.image.SampleModel",
"fields":[
{"name":"height"},
{"name":"width"}
],
"methods":[
{"name":"getPixels","parameterTypes":["int","int","int","int","int[]","java.awt.image.DataBuffer"] },
{"name":"setPixels","parameterTypes":["int","int","int","int","int[]","java.awt.image.DataBuffer"] }
]
"name":"java.io.IOException",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
},
{
"name":"java.lang.Boolean",
"methods":[{"name":"getBoolean","parameterTypes":["java.lang.String"] }]
},
{
"name":"java.lang.System",
"methods":[
{"name":"load","parameterTypes":["java.lang.String"] },
{"name":"setProperty","parameterTypes":["java.lang.String","java.lang.String"] }
]
},
{
"name":"javax.imageio.plugins.jpeg.JPEGHuffmanTable",
"fields":[
{"name":"lengths"},
{"name":"values"}
]
},
{
"name":"javax.imageio.plugins.jpeg.JPEGQTable",
"fields":[{"name":"qTable"}]
},
{
"name":"sun.awt.image.ByteComponentRaster",
"fields":[
{"name":"data"},
{"name":"dataOffsets"},
{"name":"pixelStride"},
{"name":"scanlineStride"},
{"name":"type"}
]
},
{
"name":"sun.java2d.Disposer",
"methods":[{"name":"addRecord","parameterTypes":["java.lang.Object","long","long"] }]
}
]
53 changes: 9 additions & 44 deletions config/reflect-config.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[
{
"name": "sun.awt.image.BufImgSurfaceData",
"methods": [
{"name": "getSolidLoops", "parameterTypes": ["sun.java2d.loops.SurfaceType"]}
],
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true
},
{
"name":"[[I"
},
{
"name":"[[J"
},
{
"name":"[[Lloci.formats.tiff.TiffRational;"
},
{
"name":"boolean",
"allDeclaredFields":true
Expand All @@ -23,11 +22,6 @@
"queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"com.beust.jcommander.converters.IntegerConverter",
"queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
},
{
"name":"com.beust.jcommander.validators.NoValidator",
"methods":[{"name":"<init>","parameterTypes":[] }]
Expand All @@ -41,31 +35,10 @@
"allDeclaredFields":true,
"queryAllDeclaredMethods":true
},
{
"name":"int",
"allDeclaredFields":true
},
{
"name":"java.io.File",
"allDeclaredFields":true
},
{
"name":"java.security.SecureRandomParameters"
},
{
"name":"javax.imageio.spi.ImageReaderSpi"
},
{
"name":"javax.imageio.spi.ImageReaderWriterSpi",
"methods":[
{"name":"getFileSuffixes","parameterTypes":[] },
{"name":"getFormatNames","parameterTypes":[] },
{"name":"getMIMETypes","parameterTypes":[] }
]
},
{
"name":"javax.imageio.spi.ImageWriterSpi"
},
{
"name":"loci.common.Log4jTools",
"methods":[{"name":"setRootLevel","parameterTypes":["java.lang.String"] }]
Expand Down Expand Up @@ -163,13 +136,5 @@
},
{
"name":"ome.codecs.services.LuraWaveServiceImpl"
},
{
"name":"sun.security.provider.NativePRNG",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"sun.security.provider.SHA",
"methods":[{"name":"<init>","parameterTypes":[] }]
}
]
8 changes: 1 addition & 7 deletions config/resource-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@
{
"pattern":"\\Qorg/joda/time/tz/data/America/New_York\\E"
},
{
"pattern":"\\Qorg/joda/time/tz/data/Etc/UTC\\E"
},
{
"pattern":"\\Qorg/joda/time/tz/data/ZoneInfoMap\\E"
}
]},
"bundles":[{
"name":"sun.awt.resources.awt",
"classNames":["sun.awt.resources.awt"]
}]
"bundles":[]
}
2 changes: 1 addition & 1 deletion dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>edu.stonybrook.bmi</groupId>
<artifactId>hatch</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
<build>
<resources>
<resource>
Expand Down
63 changes: 0 additions & 63 deletions ha.txt

This file was deleted.

6 changes: 3 additions & 3 deletions nbactions-hatchjar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<properties>
<exec.vmArgs></exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs>-v -src \boom\TCGA-AC-A2QJ-01Z-00-DX1.48C303BB-5A23-4037-BD28-77629A8CD9DA.svs -dest \boom\TCGA-AC-A2QJ-01Z-00-DX1.48C303BB-5A23-4037-BD28-77629A8CD9DA.tif</exec.appArgs>
<exec.appArgs>-jp2 -v -src \hatchtest\src -dest \hatchtest\dest</exec.appArgs>
<exec.mainClass>edu.stonybrook.bmi.hatch.Hatch</exec.mainClass>
<exec.executable>java</exec.executable>
</properties>
Expand All @@ -29,7 +29,7 @@
<properties>
<exec.vmArgs>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs>-v -src \boom\TCGA-AC-A2QJ-01Z-00-DX1.48C303BB-5A23-4037-BD28-77629A8CD9DA.svs -dest \boom\TCGA-AC-A2QJ-01Z-00-DX1.48C303BB-5A23-4037-BD28-77629A8CD9DA.tif</exec.appArgs>
<exec.appArgs>-jp2 -v -src \hatchtest\src -dest \hatchtest\dest</exec.appArgs>
<exec.mainClass>edu.stonybrook.bmi.hatch.Hatch</exec.mainClass>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
Expand All @@ -49,7 +49,7 @@
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.mainClass>edu.stonybrook.bmi.hatch.Hatch</exec.mainClass>
<exec.executable>java</exec.executable>
<exec.appArgs>-v -src \boom\TCGA-AC-A2QJ-01Z-00-DX1.48C303BB-5A23-4037-BD28-77629A8CD9DA.svs -dest \boom\TCGA-AC-A2QJ-01Z-00-DX1.48C303BB-5A23-4037-BD28-77629A8CD9DA.tif</exec.appArgs>
<exec.appArgs>-jp2 -v -src \hatchtest\src -dest \hatchtest\dest</exec.appArgs>
</properties>
</action>
</actions>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>edu.stonybrook.bmi</groupId>
<artifactId>hatch</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/edu/stonybrook/bmi/hatch/CellSensReader.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package edu.stonybrook.bmi.hatch;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -1010,11 +1012,13 @@ public byte[] getRaw(byte[] rawbuffer, int no, int row, int col) throws FormatEx
}
}
BufferedImage bi = AWTImageTools.makeImage(tile, 512, 512, 3, true, 8/8, false, true, false);
Graphics2D graphics = bi.createGraphics();
graphics.setColor(Color.BLACK);
graphics.fillRect(0, 0, 512, 512);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(bi, "jpg", baos );
tile = baos.toByteArray();
throw new Error("BUFFER UNDER");
//return tile;
return tile;
}
Long offset = tileOffsets.get(getCoreIndex())[index];
byte[] buf = null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/stonybrook/bmi/hatch/Hatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @author erich
*/
public class Hatch {
public static String software = "hatch 3.0.0 by Wing-n-Beak";
public static String software = "hatch 3.0.1 by Wing-n-Beak";
private static final String[] ext = new String[] {".vsi", ".svs", ".tif"};
public static final String HELP = Hatch.software+"\n"+
"""
Expand Down
13 changes: 4 additions & 9 deletions src/main/java/edu/stonybrook/bmi/hatch/HatchWriter.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package edu.stonybrook.bmi.hatch;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import loci.common.RandomAccessOutputStream;
import loci.formats.FormatException;
import loci.formats.codec.CodecOptions;
Expand All @@ -29,16 +27,13 @@ public HatchWriter(String file) throws IOException {
public void nextImage() throws IOException {
ros.seek(ros.length());
}


@Override
public void close() throws Exception {
try {
try (ros; writer) {
System.out.println("closing Writer....");
}
public void close() {
try (ros; writer) {
System.out.println("closing Writer....");
} catch (IOException ex) {
Logger.getLogger(HatchWriter.class.getName()).log(Level.SEVERE, null, ex);
System.out.println("HatchWriter : "+ex);
}
}

Expand Down
Loading

0 comments on commit 1ab584c

Please sign in to comment.