Compare commits

...

8 Commits

5 changed files with 50 additions and 24 deletions

View File

@ -1,8 +1,9 @@
{ {
"recommendations": [ "recommendations": [
"vscjava.vscode-java-pack",
"esbenp.prettier-vscode", "esbenp.prettier-vscode",
"mosapride.zenkaku", "mosapride.zenkaku",
"streetsidesoftware.code-spell-checker" "redhat.fabric8-analytics",
"streetsidesoftware.code-spell-checker",
"vscjava.vscode-java-pack"
] ]
} }

View File

@ -1,7 +1,7 @@
{ {
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.organizeImports": true "source.organizeImports": "explicit"
}, },
"[jsonc]": { "[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
@ -13,5 +13,6 @@
"prettier.printWidth": 120, "prettier.printWidth": 120,
"prettier.singleQuote": true, "prettier.singleQuote": true,
"prettier.tabWidth": 4, "prettier.tabWidth": 4,
"java.configuration.updateBuildConfiguration": "interactive" "java.configuration.updateBuildConfiguration": "interactive",
"java.compile.nullAnalysis.mode": "automatic"
} }

View File

@ -2,31 +2,38 @@
Metadata extraction tool based on Bio-Formats Metadata extraction tool based on Bio-Formats
### make package ## make package
```shell ```shell
mvn package mvn package
``` ```
### run ## run
```shell ```shell
./target/dist/bin/bioformats-imageinfo "[path to image file]" ./target/dist/bin/bioformats-imageinfo "[OPTION]" "[path to image file]"
``` ```
### run by jar ### run by jar
```shell ```shell
java -jar ./target/dist/lib/bioformats-imageinfo-1.1.4.jar "[path to image file]" java -jar ./target/dist/lib/bioformats-imageinfo-1.2.4.jar "[OPTION]" "[path to image file]"
``` ```
### run by fat jar ### run by fat jar
```shell ```shell
java -jar ./target/bioformats-imageinfo-1.1.4-jar-with-dependencies.jar "[path to image file]" java -jar ./target/bioformats-imageinfo-1.2.4-jar-with-dependencies.jar "[OPTION]" "[path to image file]"
``` ```
### library usage ### OPTION
```shell
-M output metadata
-T output thumbnail
```
## library usage
```java ```java
import java.util.LinkedHashMap; import java.util.LinkedHashMap;

16
pom.xml
View File

@ -5,13 +5,13 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>jp.riken.neurodata.tools.BioFormatsImageInfo</groupId> <groupId>jp.riken.neurodata.tools.BioFormatsImageInfo</groupId>
<artifactId>bioformats-imageinfo</artifactId> <artifactId>bioformats-imageinfo</artifactId>
<version>1.1.4</version> <version>1.2.4</version>
<name>bioformats-imageinfo</name> <name>bioformats-imageinfo</name>
<url>https://neurodata.riken.jp</url> <url>https://neurodata.riken.jp</url>
<properties> <properties>
<bio-formats.version>6.14.0</bio-formats.version> <bio-formats.version>7.3.0</bio-formats.version>
<bioformats-imageinfo.mainClass>jp.riken.neurodata.tools.BioFormatsImageInfo</bioformats-imageinfo.mainClass> <bioformats-imageinfo.mainClass>jp.riken.neurodata.tools.BioFormatsImageInfo</bioformats-imageinfo.mainClass>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
@ -30,7 +30,7 @@
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId> <artifactId>slf4j-nop</artifactId>
<version>1.7.30</version> <version>2.0.9</version>
</dependency> </dependency>
</dependencies> </dependencies>
@ -39,7 +39,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId> <artifactId>maven-enforcer-plugin</artifactId>
<version>3.3.0</version> <version>3.5.0</version>
<executions> <executions>
<execution> <execution>
<id>enforce-maven</id> <id>enforce-maven</id>
@ -59,7 +59,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version> <version>3.6.1</version>
<executions> <executions>
<execution> <execution>
<id>copy-dependencies</id> <id>copy-dependencies</id>
@ -76,7 +76,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version> <version>3.4.1</version>
<configuration> <configuration>
<archive> <archive>
<manifest> <manifest>
@ -113,7 +113,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version> <version>3.7.1</version>
<configuration> <configuration>
<descriptorRefs> <descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef> <descriptorRef>jar-with-dependencies</descriptorRef>
@ -140,7 +140,7 @@
<plugin> <plugin>
<groupId>org.owasp</groupId> <groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId> <artifactId>dependency-check-maven</artifactId>
<version>8.3.1</version> <version>9.0.9</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>

View File

@ -248,17 +248,34 @@ public class BioFormatsImageInfo {
boolean status = true; boolean status = true;
String message = ""; String message = "";
String format = ""; String format = "";
boolean metadataON = true;
boolean thumbnailON = true;
String path = "";
final Map<String, Object> metadata = new LinkedHashMap<String, Object>(); final Map<String, Object> metadata = new LinkedHashMap<String, Object>();
final Map<String, Object> thumbnail = new LinkedHashMap<String, Object>(); final Map<String, Object> thumbnail = new LinkedHashMap<String, Object>();
if (args.length != 1) { if (args.length == 1) {
status = false; path = args[0];
message = "filename argument required"; } else if (args.length == 2) {
if (args[0].startsWith("-")) {
metadataON = args[0].toUpperCase().contains("M");
thumbnailON = args[0].toUpperCase().contains("T");
}
path = args[1];
} else { } else {
final String path = args[0]; status = false;
message = "invalid parameters";
message += "\nUsage ./target/dist/bin/bioformats-imageinfo \"[OPTION]\" \"[path to image file]\"";
message += "\n-M output metadata\n-T output thumbnail";
}
if (status) {
try { try {
DebugTools.enableLogging("OFF"); DebugTools.enableLogging("OFF");
if (metadataON) {
format = readMetadata(path, metadata); format = readMetadata(path, metadata);
}
if (thumbnailON) {
BioFormatsImageThumbnail.readThumbnail(path, thumbnail); BioFormatsImageThumbnail.readThumbnail(path, thumbnail);
}
} catch (Throwable t) { } catch (Throwable t) {
status = false; status = false;
message = t.getMessage(); message = t.getMessage();