diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..aab7fe2
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,8 @@
+{
+ "recommendations": [
+ "vscjava.vscode-java-pack",
+ "esbenp.prettier-vscode",
+ "mosapride.zenkaku",
+ "streetsidesoftware.code-spell-checker"
+ ]
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..c075fe7
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,17 @@
+{
+ "editor.formatOnSave": true,
+ "editor.codeActionsOnSave": {
+ "source.organizeImports": true
+ },
+ "[jsonc]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ // Extensions - Code Spell Checker
+ "cSpell.ignoreWords": ["endianness", "noflat", "nopix", "omexml"],
+ "cSpell.words": ["bioformats", "imageinfo", "neurodata", "riken"],
+ // Extentions - Prettier
+ "prettier.printWidth": 120,
+ "prettier.singleQuote": true,
+ "prettier.tabWidth": 4,
+ "java.configuration.updateBuildConfiguration": "interactive"
+}
diff --git a/README.md b/README.md
index 0f55a2c..0006fa9 100644
--- a/README.md
+++ b/README.md
@@ -1,27 +1,33 @@
# BioFormatsImageInfo
+
Metadata extraction tool based on Bio-Formats
### make package
+
```shell
mvn package
```
### run
+
```shell
./target/dist/bin/bioformats-imageinfo "[path to image file]"
```
### run by jar
+
```shell
-java -jar ./target/dist/lib/bioformats-imageinfo-1.1.3.jar "[path to image file]"
+java -jar ./target/dist/lib/bioformats-imageinfo-1.1.4.jar "[path to image file]"
```
### run by fat jar
+
```shell
-java -jar ./target/bioformats-imageinfo-1.1.3-jar-with-dependencies.jar "[path to image file]"
+java -jar ./target/bioformats-imageinfo-1.1.4-jar-with-dependencies.jar "[path to image file]"
```
### library usage
+
```java
import java.util.LinkedHashMap;
import java.util.Map;
diff --git a/pom.xml b/pom.xml
index 74394a3..ef75182 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,15 +1,17 @@
-
+
4.0.0
jp.riken.neurodata.tools.BioFormatsImageInfo
bioformats-imageinfo
- 1.1.3
+ 1.1.4
bioformats-imageinfo
https://neurodata.riken.jp
- 6.12.0
+ 6.14.0
jp.riken.neurodata.tools.BioFormatsImageInfo
1.8
@@ -57,7 +59,7 @@
org.apache.maven.plugins
maven-dependency-plugin
- 3.5.0
+ 3.6.0
copy-dependencies
@@ -111,7 +113,7 @@
org.apache.maven.plugins
maven-assembly-plugin
- 3.5.0
+ 3.6.0
jar-with-dependencies
@@ -138,7 +140,7 @@
org.owasp
dependency-check-maven
- 8.2.1
+ 8.3.1
@@ -178,4 +180,4 @@
-
+
\ No newline at end of file
diff --git a/src/main/assembly/assembly.xml b/src/main/assembly/assembly.xml
index f117a78..f4bdf21 100644
--- a/src/main/assembly/assembly.xml
+++ b/src/main/assembly/assembly.xml
@@ -1,5 +1,6 @@
-
bin
@@ -32,4 +33,4 @@
lib
-
+
\ No newline at end of file
diff --git a/src/main/java/jp/riken/neurodata/tools/BioFormatsImageInfo.java b/src/main/java/jp/riken/neurodata/tools/BioFormatsImageInfo.java
index 9bc3091..0c4615b 100644
--- a/src/main/java/jp/riken/neurodata/tools/BioFormatsImageInfo.java
+++ b/src/main/java/jp/riken/neurodata/tools/BioFormatsImageInfo.java
@@ -142,14 +142,14 @@ public class BioFormatsImageInfo {
final int seriesCount = reader.getSeriesCount();
for (int j = 0; j < seriesCount; j++) {
reader.setSeries(j);
- final Hashtable seriesMagedata = reader.getSeriesMetadata();
- if (!seriesMagedata.isEmpty()) {
- final Map seriesMetadata = new LinkedHashMap();
- final String[] keys = MetadataTools.keys(seriesMagedata);
+ final Hashtable seriesMetadata = reader.getSeriesMetadata();
+ if (!seriesMetadata.isEmpty()) {
+ final Map originalMetadata = new LinkedHashMap();
+ final String[] keys = MetadataTools.keys(seriesMetadata);
for (int i = 0; i < keys.length; i++) {
- seriesMetadata.put(keys[i], seriesMagedata.get(keys[i]));
+ originalMetadata.put(keys[i], seriesMetadata.get(keys[i]));
}
- metadata.put(String.format("series[%d]", j), seriesMetadata);
+ metadata.put(String.format("series[%d]", j), originalMetadata);
}
}
@@ -188,7 +188,7 @@ public class BioFormatsImageInfo {
// json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
json = mapper.writeValueAsString(map);
} catch (final Throwable e) {
- // return "null" if conversion error occured
+ // return "null" if conversion error occurred
json = "null";
}
diff --git a/src/main/java/jp/riken/neurodata/tools/BioFormatsImageThumbnail.java b/src/main/java/jp/riken/neurodata/tools/BioFormatsImageThumbnail.java
index 94b7941..a820c85 100644
--- a/src/main/java/jp/riken/neurodata/tools/BioFormatsImageThumbnail.java
+++ b/src/main/java/jp/riken/neurodata/tools/BioFormatsImageThumbnail.java
@@ -27,7 +27,7 @@ import loci.formats.gui.BufferedImageReader;
public class BioFormatsImageThumbnail {
- protected static final float JPEG_QUORITY = 0.85f;
+ protected static final float JPEG_QUALITY = 0.85f;
protected static final int BACKGROUND_COLOR = 0x000000;
protected static final double MAXIMUM_SCALE = 2.0;
@@ -39,14 +39,14 @@ public class BioFormatsImageThumbnail {
final double scaleHeight = (double) height / (double) imageHeight;
double scale = Math.min(scaleWidth, scaleHeight);
if (scale > MAXIMUM_SCALE) {
- // limit scalling size to maximum scale
+ // limit scaling size to maximum scale
scale = MAXIMUM_SCALE;
}
int resizeWidth = imageWidth;
int resizeHeight = imageHeight;
Image resizeImage = image;
if (scale != 1.0) {
- // resize image if dimension is different with requrested dimension.
+ // resize image if dimension is different with requested dimension.
resizeWidth = (int) (scale * (double) imageWidth);
resizeHeight = (int) (scale * (double) imageHeight);
resizeImage = image.getScaledInstance(resizeWidth, resizeHeight, Image.SCALE_AREA_AVERAGING);
@@ -86,8 +86,8 @@ public class BioFormatsImageThumbnail {
protected static byte[] getJpegByteArray(final BufferedImage image, final float quality, final int matColor)
throws BioFormatsImageException {
byte[] ret = null;
- try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- final ImageOutputStream ios = ImageIO.createImageOutputStream(baos);) {
+ try (final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final ImageOutputStream ios = ImageIO.createImageOutputStream(bos);) {
final ImageWriter writer = ImageIO.getImageWritersByFormatName("jpeg").next();
final ImageWriteParam param = writer.getDefaultWriteParam();
if (param.canWriteCompressed()) {
@@ -97,7 +97,7 @@ public class BioFormatsImageThumbnail {
writer.setOutput(ios);
writer.write(null, new IIOImage(removeAlphaChannel(image, matColor), null, null), param);
writer.dispose();
- ret = baos.toByteArray();
+ ret = bos.toByteArray();
} catch (final IOException e) {
throw new BioFormatsImageException(e);
}
@@ -107,8 +107,8 @@ public class BioFormatsImageThumbnail {
protected static byte[] getPngByteArray(final BufferedImage image) throws BioFormatsImageException {
byte[] ret = null;
- try (final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- final ImageOutputStream ios = ImageIO.createImageOutputStream(baos);) {
+ try (final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final ImageOutputStream ios = ImageIO.createImageOutputStream(bos);) {
final ImageWriter writer = ImageIO.getImageWritersByFormatName("png").next();
final ImageWriteParam param = writer.getDefaultWriteParam();
if (param.canWriteCompressed()) {
@@ -118,7 +118,7 @@ public class BioFormatsImageThumbnail {
writer.setOutput(ios);
writer.write(null, new IIOImage(image, null, null), param);
writer.dispose();
- ret = baos.toByteArray();
+ ret = bos.toByteArray();
} catch (final IOException e) {
throw new BioFormatsImageException(e);
}
@@ -133,7 +133,7 @@ public class BioFormatsImageThumbnail {
bytes = getPngByteArray(image);
break;
case "image/jpeg":
- bytes = getJpegByteArray(image, JPEG_QUORITY, BACKGROUND_COLOR);
+ bytes = getJpegByteArray(image, JPEG_QUALITY, BACKGROUND_COLOR);
break;
default:
throw new BioFormatsImageException("Unsupported image format: " + mimeType);
@@ -178,12 +178,12 @@ public class BioFormatsImageThumbnail {
// System.out.println("series count: " + seriesCount);
// System.out.println("image count: " + reader.getImageCount());
// System.out.println("resolution: " + reader.getResolutionCount());
- // System.out.println("thubmail series: " + series);
+ // System.out.println("thumbnail series: " + series);
ret = reader.openThumbImage(no);
final boolean is16bit = reader.getBitsPerPixel() > 8;
final boolean isGrayScale = ret.getSampleModel().getNumBands() == 1;
if (is16bit || isGrayScale) {
- // perform auto scalling if 16bit or gray scale thumbnail image.
+ // perform auto scaling if 16bit or gray scale thumbnail image.
ret = AWTImageTools.autoscale(ret);
}
} catch (final Throwable t) {