From 1d6508151eb12c1a1038093e258801c8e1e1b948 Mon Sep 17 00:00:00 2001 From: Gergely Csucs Date: Thu, 5 Dec 2024 02:06:37 +0100 Subject: [PATCH] Setup transform Displays table with transformed filenames and actual filenames --- index.html | 61 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 6cde01e..6a838cd 100644 --- a/index.html +++ b/index.html @@ -20,6 +20,7 @@ if(lock===stamp) log.innerText=msg; } + document.getElementById("trfbox").hidden=true; setlog(""); if(pyramids.startsWith("img-")) setlog("Shouldn't it be buckets/"+pyramids+"?\n\n"); @@ -50,12 +51,19 @@ return; } if(pyramids.endsWith(".dzip")) { - let baselink=`${location.href.match(/(.*\/)[^/]*/)[1]}filmstripzoom.html?atlas=${atlas.value}&series=${jsonurl}&dziproot=${pyramids.match(/(.*\/)/)[1]}`; - let antools=`${baselink}&tools`; - let nltools=`${antools}&nl`; - log.innerHTML=`Viewer: ${baselink}
`+ - `Annotation tools: ${antools}
`+ - `Nonlinear tools: ${nltools}`; +// let dziproot=pyramids.match(/(.*\/)/)[1]; + const [dziproot,bucket,path]=pyramids.match(/(.*?\/buckets\/.+?)\/(.*\/)?/); + const dzips=await fetch((path?bucket+"?prefix="+path:bucket)+"&limit=10000") + .then(response=>response.json()) + .then(json=>json.objects.map(obj=>obj.name.substring(path?path.length:0)).filter(name=>name.endsWith(".dzip"))); + let baselink=`${location.href.match(/(.*\/)[^/]*/)[1]}filmstripzoom.html?atlas=${atlas.value}&series=${jsonurl}&dziproot=${dziproot}`; +// let antools=`${baselink}&tools`; +// let nltools=`${antools}&nl`; +// log.innerHTML=`Viewer: ${baselink}
`+ +// `Annotation tools: ${antools}
`+ +// `Nonlinear tools: ${nltools}`; + trfparams={baselink,dzips,sections:json.slices.map(slice=>slice.filename)}; + transform(); return; } let slices=json.slices; @@ -126,6 +134,38 @@ pyramids.value="https://data-proxy.ebrains.eu/api/v1/buckets/img-8992ccf2-e993-4fb3-996a-f5ba4780856f/.nesysWorkflowFiles/zippedPyramids/AdenosineA1/wt272_dpmg_col_s020.dzip"; check(); } + let trfparams; + function transform(){ + let {baselink,dzips,sections}=trfparams; + const trf=document.getElementById("trf").value; + if(trf)baselink+="&transform="+trf; + let antools=`${baselink}&tools`; + let nltools=`${antools}&nl`; + log.innerHTML=`Viewer: ${baselink}
`+ + `Annotation tools: ${antools}
`+ + `Nonlinear tools: ${nltools}`; + document.getElementById("trfbox").hidden=false; + const parts=trf.split(",").map(part=>part.split("=")); + let rows=""; + for(let name of sections){ + if(parts) + for (const part of parts) + name=name.replaceAll(part[0],part.length>1?part[1]: ""); + const _s=name.match(/(_s\d+)/); + let pair="?"; + if(_s){ + for(const dzip of dzips) + if(dzip.includes(_s[0])) + pair=dzip; + } + let match=0; + while(match${name.substring(0,match)}${name.substring(match)} + ${pair.substring(0,match)}${pair.substring(match)}`; + } + document.getElementById("pairs").innerHTML=rows; + } @@ -154,5 +194,14 @@
+