aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcjd242018-04-02 04:37:05 +0100
committercjd242018-04-02 04:37:05 +0100
commit139b0299d016f8dab6738333c767a3add47bfc14 (patch)
treef1c87668aa3e23c9872b91135f415be967b03778
parentSwapped over the zoom tier section to use vips directly (diff)
downloadmedicine-139b0299d016f8dab6738333c767a3add47bfc14.tar.gz
medicine-139b0299d016f8dab6738333c767a3add47bfc14.zip

Working on converting to Vips, didnt commit czi in this one as is sadly broken

-rwxr-xr-xgetmecziconversion.sh9
-rw-r--r--src/conversion/czi/convertJxrs.py15
-rw-r--r--src/conversion/czi/pyramidWorker.ts2
3 files changed, 16 insertions, 10 deletions
diff --git a/getmecziconversion.sh b/getmecziconversion.sh
index 7a4316c..ada2efc 100755
--- a/getmecziconversion.sh
+++ b/getmecziconversion.sh
@@ -4,7 +4,7 @@ git clone https://github.com/glencoesoftware/jxrlib.git
cd ./jxrlib/
mkdir build
make ${PWD}/build/JxrDecApp
-cp ./build/JxrDecApp ../src/conversion/czi/JxrDecApp
+cp ./build/JxrDecApp ../ext/bin/JxrDecApp
cd ../
rm -rf jxrlib
@@ -12,8 +12,9 @@ curl -L https://github.com/jcupitt/libvips/releases/download/v8.6.3/vips-8.6.3.t
tar xf vips-8.6.3.tar.gz
rm vips-8.6.3.tar.gz
cd vips-8.6.3
-./configure
-make
-cp ./tools/vips ..
+./configure --prefix="$PWD/../ext/"
+make install
cd ..
rm -rf vips-8.6.3
+PATH="$PATH:$PWD/ext/bin"
+LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/ext/lib"
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")
diff --git a/src/conversion/czi/pyramidWorker.ts b/src/conversion/czi/pyramidWorker.ts
index fdaa038..19acbf9 100644
--- a/src/conversion/czi/pyramidWorker.ts
+++ b/src/conversion/czi/pyramidWorker.ts
@@ -44,7 +44,7 @@ const getFinalTile: Function = async function(imageDir: string, imageTier: CZIHe
}
let outputFileName: string =`${imageDir}/tmp/${uuid.generate()}.png`
- require('shelljs').exec(`./vips arrayjoin "${involvedTiles}" ${outputFileName} --across ${imageTier.plane[0].length}`)
+ require('shelljs').exec(`vips arrayjoin "${involvedTiles}" ${outputFileName} --across ${imageTier.plane[0].length}`)
let extractionRegion = new TileBounds(
desiredRegion.left - imageTier.plane[0][0].width,