JP2 to TIFF file format migration with quality assurance
Created: 2013-02-07 14:00:18
This workflow reads a textfile containing absolute paths to JP2 image files and converts them to TIFF image files using Kakadu's j2k_to_image command line application (http://www.kakadusoftware.com).
Based on the input text file, the workflow creates a Taverna list to be processed file by file. A temporary directory is created (createtmpdir) where the migrated image files and some temporary tool outputs are stored.
Before converting the files, the JP2 input files are validated using the SCAPE tool Jpylyzer (http://www.openplanetsfoundation.org/software/jpylyzer). The TIFF files are validated using JHove2 (http://www.jhove2.org) and the original JP2 file and the migrated TIFF file are compared using a direct SIFTComparison metric of the SCAPE Matchbox tool (https://github.com/openplanets/scape/tree/master/pc-qa-matchbox). If the SIFTComparison result is greater than a defined treshold (treshold_value), the migration is supposed to be successful.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (1)
JP2 to TIFF file format migration with quality assurance |
Descriptions (1)
This workflow reads a textfile containing absolute paths to JP2 image files and converts them to TIFF image files using Kakadu's j2k_to_image command line application (http://www.kakadusoftware.com).
Based on the input text file, the workflow creates a Taverna list to be processed file by file. A temporary directory is created (createtmpdir) where the migrated image files and some temporary tool outputs are stored.
Before converting the files, the JP2 input files are validated using the SCAPE tool Jpylyzer (http://www.openplanetsfoundation.org/software/jpylyzer). The TIFF files are validated using JHove2 (http://www.jhove2.org) and the original JP2 file and the migrated TIFF file are compared using a direct SIFTComparison metric of the SCAPE Matchbox tool (https://github.com/openplanets/scape/tree/master/pc-qa-matchbox). If the SIFTComparison result is greater than a defined treshold (treshold_value), the migration is supposed to be successful. |
Dependencies (0)
Inputs (1)
Name |
Description |
inputUrl |
URL to text file with URLs referencing files to be processed
|
Processors (17)
Name |
Type |
Description |
Text2List |
localworker |
ScriptList split = new ArrayList();
if (!string.equals("")) {
String regexString = ",";
if (regex != void) {
regexString = regex;
}
String[] result = string.split(regexString);
for (int i = 0; i < result.length; i++) {
String r = result[i];
r = r.replaceAll("\\s+$", "");
split.add(r);
}
}
|
readFile |
localworker |
ScriptBufferedReader getReader (String fileUrl) throws IOException {
InputStreamReader reader;
try {
reader = new FileReader(fileUrl);
}
catch (FileNotFoundException e) {
// try a real URL instead
URL url = new URL(fileUrl);
reader = new InputStreamReader (url.openStream());
}
return new BufferedReader(reader);
}
StringBuffer sb = new StringBuffer(4000);
BufferedReader in = getReader(fileurl);
String str;
String lineEnding = System.getProperty("line.separator");
while ((str = in.readLine()) != null) {
sb.append(str);
sb.append(lineEnding);
}
in.close();
filecontents = sb.toString();
|
regex |
stringconstant |
Value\n |
jpylyzerValidation |
externaltool |
|
XPathJpylyzer |
xpath |
Xpath Expression/jpylyzer/isValidJP2/text() |
createtmpdir |
externaltool |
|
j2k_to_image |
externaltool |
|
MatchboxComparison |
externaltool |
|
XPathMatchbox |
xpath |
Xpath Expression/comparison/task/ssim/text() |
Jhove2Validation |
externaltool |
|
XPathJhove2 |
xpath |
Xpath Expression/default:fits/default:filestatus/default:valid//text() |
FlattenJpylyzerList |
localworker |
Scriptflatten(inputs, outputs, depth) {
for (i = inputs.iterator(); i.hasNext();) {
element = i.next();
if (element instanceof Collection && depth > 0) {
flatten(element, outputs, depth - 1);
} else {
outputs.add(element);
}
}
}
outputlist = new ArrayList();
flatten(inputlist, outputlist, 1); |
FlattenJhove2List |
localworker |
Scriptflatten(inputs, outputs, depth) {
for (i = inputs.iterator(); i.hasNext();) {
element = i.next();
if (element instanceof Collection && depth > 0) {
flatten(element, outputs, depth - 1);
} else {
outputs.add(element);
}
}
}
outputlist = new ArrayList();
flatten(inputlist, outputlist, 1); |
FlattenMatchboxList |
localworker |
Scriptflatten(inputs, outputs, depth) {
for (i = inputs.iterator(); i.hasNext();) {
element = i.next();
if (element instanceof Collection && depth > 0) {
flatten(element, outputs, depth - 1);
} else {
outputs.add(element);
}
}
}
outputlist = new ArrayList();
flatten(inputlist, outputlist, 1); |
ValidateSsimValue |
beanshell |
Scriptdouble ssimn = Double.parseDouble(ssim);
double tresholdn = Double.parseDouble(treshold);
if(ssimn > tresholdn)
result = "true";
else
result = "false";
|
treshold |
stringconstant |
Value0.97 |
CreateReport |
beanshell |
Scriptint countValidJpylyzer = 0;
int countValidJhove = 0;
int countValidMatchbox = 0;
List jpylyzerList = (List) jpylyzer;
List jhoveList = (List) jhove;
List matchboxList = (List) matchbox;
int size = jpylyzerList.size();
for (int i = 0; i < size; i++) {
if(((String)jpylyzerList.get(i)).equals("True"))
countValidJpylyzer++;
if(((String)jhoveList.get(i)).equals("true"))
countValidJhove++;
if(((String)matchboxList.get(i)).equals("true"))
countValidMatchbox++;
}
report = "";
report += "Number of files processed:\t\t\t"+size+"\n";
report += "Valid JP2 input files (Jpylyzer):\t\t"+countValidJpylyzer+"\n";
report += "Valid migrated TFF files (JHove):\t\t"+countValidJhove+"\n";
report += "Valid image comparisons (Matchbox):\t\t"+countValidMatchbox+""; |
Beanshells (2)
Name |
Description |
Inputs |
Outputs |
ValidateSsimValue |
|
ssim
treshold
|
result
|
CreateReport |
|
jpylyzer
jhove
matchbox
|
report
|
Datalinks (23)
Source |
Sink |
readFile:filecontents |
Text2List:string |
regex:value |
Text2List:regex |
inputUrl |
readFile:fileurl |
Text2List:split |
jpylyzerValidation:inFileAbsPath |
jpylyzerValidation:STDOUT |
XPathJpylyzer:xml_text |
Text2List:split |
j2k_to_image:jp2infilepath |
createtmpdir:STDOUT |
j2k_to_image:tmpdir |
FlattenJpylyzerList:outputlist |
j2k_to_image:isvalidjp2 |
j2k_to_image:STDOUT |
MatchboxComparison:tiffimagepath |
Text2List:split |
MatchboxComparison:j2kimagepath |
createtmpdir:STDOUT |
MatchboxComparison:tmpdir |
MatchboxComparison:STDOUT |
XPathMatchbox:xml_text |
j2k_to_image:STDOUT |
Jhove2Validation:tiffimagepath |
Jhove2Validation:STDOUT |
XPathJhove2:xml_text |
XPathJpylyzer:nodelistAsXML |
FlattenJpylyzerList:inputlist |
XPathJhove2:nodelistAsXML |
FlattenJhove2List:inputlist |
XPathMatchbox:nodelistAsXML |
FlattenMatchboxList:inputlist |
treshold:value |
ValidateSsimValue:treshold |
FlattenMatchboxList:outputlist |
ValidateSsimValue:ssim |
FlattenJpylyzerList:outputlist |
CreateReport:jpylyzer |
FlattenJhove2List:outputlist |
CreateReport:jhove |
ValidateSsimValue:result |
CreateReport:matchbox |
CreateReport:report |
report |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1
(of 1)
Credits (1)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
Shared with Groups (1)
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment