From b984807d99328ff9d5813d8b9305cc92f515645e Mon Sep 17 00:00:00 2001 From: cjd24 Date: Mon, 26 Feb 2018 00:36:01 +0000 Subject: Adding script to get Jxr conversion lib, and all my current C code for extracting and converting czi files to normal things --- src/conversion/czi/convertJxrs.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/conversion/czi/convertJxrs.py (limited to 'src/conversion/czi/convertJxrs.py') diff --git a/src/conversion/czi/convertJxrs.py b/src/conversion/czi/convertJxrs.py new file mode 100644 index 0000000..d19a59a --- /dev/null +++ b/src/conversion/czi/convertJxrs.py @@ -0,0 +1,38 @@ +from concurrent.futures import ThreadPoolExecutor +from subprocess import check_call +from glob import glob +from sys import argv + +totalFiles = 0 +coutner = 0 + + +def convertjxrs(filename): + global counter + global totalFiles + asTif = filename.rsplit('.',1)[0] + ".tif" + check_call(['./JxrDecApp', "-i", filename, "-o", asTif]) + check_call(['convert', asTif, filename.rsplit('.',1)[0] + ".png"]) + check_call(['rm', filename, asTif]) + counter += 1 + print (f"> Processed File: {counter}/{totalFiles} : {filename} --> {filename.rsplit('.',1)[0]}.png") + + +if __name__ == "__main__": + + if (len(argv) != 2): + print("\nMissing Argument!\n\nUsage:\npython3 convertJxrs.py ") + exit(0) + else: + print("=========== BEGIN JXR CONVERSION ===========") + print ('Files Dir: ' + argv[1] + '\n') + + filenames = glob(argv[1] + 'data-*.jxr') + counter = 0 + totalFiles = len(filenames) + + pool = ThreadPoolExecutor(5) + for f in pool.map(convertjxrs, filenames): + pass + pool.shutdown(True) + print("=========== FINISH JXR CONVERSION ===========") -- cgit v1.2.1