From 139b0299d016f8dab6738333c767a3add47bfc14 Mon Sep 17 00:00:00 2001 From: cjd24 Date: Mon, 2 Apr 2018 04:37:05 +0100 Subject: Working on converting to Vips, didnt commit czi in this one as is sadly broken --- src/conversion/czi/convertJxrs.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/conversion/czi/convertJxrs.py') diff --git a/src/conversion/czi/convertJxrs.py b/src/conversion/czi/convertJxrs.py index d19a59a..2ba81b3 100644 --- a/src/conversion/czi/convertJxrs.py +++ b/src/conversion/czi/convertJxrs.py @@ -10,11 +10,16 @@ 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 + try: + 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 + except: + print ("Processing Failed. Probably couldn't find decoder due to invalid system environment path, check this before debugging.") + exit(0); + print (f"> Processed File: {counter}/{totalFiles} : {filename} --> {filename.rsplit('.',1)[0]}.png") -- cgit v1.2.1 From 1d65ce003823143d33beba03cc82729a6c975ce7 Mon Sep 17 00:00:00 2001 From: cjd24 Date: Thu, 19 Apr 2018 05:01:01 +0100 Subject: Added a write of the base teir JSON object, made the images actually write to file lol - still havent been able to tell if this is a working commit yet, need to try from the second teir onwards. --- src/conversion/czi/convertJxrs.py | 44 ++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'src/conversion/czi/convertJxrs.py') diff --git a/src/conversion/czi/convertJxrs.py b/src/conversion/czi/convertJxrs.py index 2ba81b3..f4b897f 100644 --- a/src/conversion/czi/convertJxrs.py +++ b/src/conversion/czi/convertJxrs.py @@ -8,19 +8,21 @@ coutner = 0 def convertjxrs(filename): - global counter - global totalFiles + global counter + global totalFiles try: 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 - except: - print ("Processing Failed. Probably couldn't find decoder due to invalid system environment path, check this before debugging.") + check_call(['JxrDecApp', "-i", filename, "-o", asTif]) + check_call(['convert', asTif, filename.rsplit('.',1)[0] + ".png"]) + check_call(['rm', filename, asTif]) + counter += 1 + except Exception as help: + print ("Processing Failed. Probably couldn't find decoder due to invalid system environment path, check this before debugging."); + print ("Actual error was:"); + print (help); exit(0); - print (f"> Processed File: {counter}/{totalFiles} : {filename} --> {filename.rsplit('.',1)[0]}.png") + print (f"> Processed File: {counter}/{totalFiles} : {filename} --> {filename.rsplit('.',1)[0]}.png") if __name__ == "__main__": @@ -29,15 +31,15 @@ if __name__ == "__main__": 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 ===========") + 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