Mini Shell

Direktori : /home/ukubnwwt/viewer.ukubona.cloud/assets/
Upload File :
Current File : /home/ukubnwwt/viewer.ukubona.cloud/assets/ModelView-BW6rmrlH.js

import{_ as b,g as k,h as D,j as F,a as T,i as l,c as r,b as e,t as d,k as _,l as y,n as m,F as I,r as v,d as O,v as P,o as a,p as x,f as w}from"./index-9sqZWoEd.js";import{r as C,m as R,c as E,e as L,a as g,b as p,d as S,f as N}from"./cornerstoneWADOImageLoader.bundle.min-EU_ZCHA5.js";const M="/assets/1acce291-f809-41b2-b665-8ce57b31efb8-DO4KjI-M.jpg",U="/assets/edema-C0l58YIh.jpeg",A="/assets/Untitled-66-0zKtI6-Q.jpeg",H={data(){return{img2:k,img1:D,moment:F,radiology:C,microscopy:R,cardiology:E,endoscopy:L,edema:U,pneumonia:A,brain_tumor_mri_image:M,selectedFile:null,filesData:null,showFileTableLoader:!1,userData:null,modelResultReady:!1,areImagesPrefetched:!1,element:null,selectedExtension:null,model_list:[],models_count:0}},mounted(){this.$root.loadScripts(),this.getFiles(),this.getModelList(),this.getUserData(),this.$nextTick(()=>{this.element=this.$refs.dicomImage||document.getElementById("dicomImage")||document.querySelector(".dimg")})},methods:{redirectTo(s){this.$router.push(s)},isURLDicomImage(s){return s.split("?")[0].split("#")[0].toLowerCase().endsWith(".dcm")?(this.selectedExtension="dcm",!0):(this.selectedExtension=null,!1)},loadAndDisplayImage(s){g.loadAndCacheImage(s).then(o=>{g.displayImage(this.element,o)}).catch(o=>{console.error(`Error loading image: ${o}`)})},loadFromUrl(){if(this.isURLDicomImage(this.selectedFile.getFileURL))if(this.element=this.element||this.$refs.dicomImage,console.log("stuff",this.element),this.element){g.enable(this.element),p.external.cornerstone=S,p.external.dicomParser=N,p.configure({beforeSend:function(o){}}),g.registerImageLoader("wadouri",p.wadouri.loadImage);const s=`wadouri:${this.selectedFile.getFileURL}`;this.loadAndDisplayImage(s)}else console.error("Failed to find the DICOM image element.")},async refreshToken(s){try{const o=await this.$http.post("api/token/refresh",{refresh:this.$store.state.refresh});o.data.access?(this.$store.commit("setAccess",o.data.access),T.defaults.headers.common.Authorization=`Bearer ${o.data.access}`,await s()):this.$router.push("/login")}catch(o){console.error("Failed to refresh token",o),this.$router.push("/login")}},async getModelList(){this.$root.isLoading=!0;try{const s=await this.$http.get("api/v1/ai-models-list");this.model_list=s.data.data,this.models_count=this.model_list.length,this.$root.isLoading=!1}catch(s){if(this.$root.isLoading=!1,s.response){const o=s.response.status;o===401?await this.refreshToken(this.getModelList):(console.error(`Error ${o}: ${s.response.data.message}`),l.error(`Error ${o}: ${s.response.data.message}`,{autoClose:3e3,position:l.POSITION.TOP_RIGHT}))}else s.request?(console.error("No response received:",s.request),l.error("No response received. Please try again later.",{autoClose:3e3,position:l.POSITION.TOP_RIGHT})):(console.error("Error",s),l.error(`Error: ${s.message}`,{autoClose:3e3,position:l.POSITION.TOP_RIGHT}))}},async getUserData(){this.$root.isLoading=!0;try{const s=await this.$http.get("accounts/userdata");this.userData=s.data,this.$root.profileInfo={name:this.userData.first_name,image:this.userData.profile_image_url},this.$root.isLoading=!1}catch(s){if(this.$root.isLoading=!1,s.response){const o=s.response.status;o===401?await this.refreshToken(this.getUserData):(console.error(`Error ${o}: ${s.response.data.message}`),l.error(`Error ${o}: ${s.response.data.message}`,{autoClose:3e3,position:l.POSITION.TOP_RIGHT}))}else s.request?(console.error("No response received:",s.request),l.error("No response received. Please try again later.",{autoClose:3e3,position:l.POSITION.TOP_RIGHT})):(console.error("Error",s),l.error(`Error: ${s.message}`,{autoClose:3e3,position:l.POSITION.TOP_RIGHT}))}},async useModel(s){if(!this.selectedFile){alert("Please select a file to use the model");return}const o={fileUUID:this.selectedFile.uuid,model_name:s};try{await T.post("api/v1/model",o).then(c=>{console.log("Model used successfully",c.data),l.info("AI Model request is Processing",{autoClose:3e3,position:l.POSITION.TOP_RIGHT}),this.modelResultReady=!0,this.modelResult=c.data.data})}catch(c){if(this.$root.isLoading=!1,c.response){const h=c.response.status;h===401?await this.refreshToken(this.useModel):(console.error(`Error ${h}: ${c.response.data.message}`),l.error(`Error ${h}: ${c.response.data.message}`,{autoClose:3e3,position:l.POSITION.TOP_RIGHT}))}else c.request?(console.error("No response received:",c.request),l.error("No response received. Please try again later.",{autoClose:3e3,position:l.POSITION.TOP_RIGHT})):(console.error("Error",c),l.error(`Error: ${c.message}`,{autoClose:3e3,position:l.POSITION.TOP_RIGHT}))}},async prefetchAllImages(){if(!this.areImagesPrefetched){this.areImagesPrefetched=!0;for(let s=0;s<this.filesData.data.length;s++){let o=this.filesData.data[s];this.$root.preloadImage(o.getFileURL)}}},async getFiles(s=null,o=null){this.showFileTableLoader=!0;let c={};try{s&&(c.page=s),o&&(c.search=o),console.log("herte",s),await this.$http.get("api/v1/files",{params:c}).then(h=>{const t=h.data;t.status&&(this.filesData=t,this.showFileTableLoader=!1)}),this.prefetchAllImages()}catch(h){if(this.showFileTableLoader=!1,h.response){const t=h.response.status;t===401?await this.refreshToken(this.getFiles):(console.error(`Error ${t}: ${h.response.data.message}`),l.error(`Error ${t}: ${h.response.data.message}`,{autoClose:3e3,position:l.POSITION.TOP_RIGHT}))}else h.request?(console.error("No response received:",h.request),l.error("No response received. Please try again later.",{autoClose:3e3,position:l.POSITION.TOP_RIGHT})):(console.error("Error",h),l.error(`Error: ${h.message}`,{autoClose:3e3,position:l.POSITION.TOP_RIGHT}))}}}},n=s=>(x("data-v-1fa857ea"),s=s(),w(),s),G={class:"home"},q={class:"container"},$={key:0},z=n(()=>e("div",{class:"heading flex1"},[e("h3",null," AI Models"),e("p",null,"Dashboard / Models")],-1)),B={class:"content flex"},V={class:"content_left"},j={class:"top"},Y={class:"wlecome flex1"},W=n(()=>e("div",{class:"text"},[e("h3",null,"Welcome Back !"),e("label",null,"Ukubona Dashboard")],-1)),K={class:"img"},Q=["src"],J={key:0,class:"profile flex1"},X={class:"box"},Z={class:"image"},ee=["src"],se={class:"text"},te={key:0,class:"box"},oe=n(()=>e("label",null,"Saved FIles",-1)),le=n(()=>e("br",null,null,-1)),ie=n(()=>e("button",null,[y(" View Profile "),e("i",{class:"fas fa-chevron-down"})],-1)),re={class:"content_right"},ae={class:"right_top grid"},ne={class:"rbox flex1"},ce={class:"text"},de=n(()=>e("h4",null,"total AI Results",-1)),he={key:0},_e={key:1},ue=n(()=>e("div",{class:"icon"},[e("span",{class:"material-icons"}," library_books ")],-1)),me={class:"rbox flex1"},ge={class:"text"},pe=n(()=>e("h4",null,"Available AI models",-1)),fe=n(()=>e("div",{class:"icon"},[e("span",{class:"material-icons"}," widgets ")],-1)),Ie={class:"home",style:{"margin-top":"3rem"}},ve={class:"container"},ye={key:0,class:"img-container"},Te={style:{color:"var(--dark)"}},be={style:{color:"var(--primary)"}},ke={class:"imgbox"},De=["src"],Fe={key:1,class:"model-view-button",style:{width:"100%","text-align":"center"}},Oe={class:"heading flex1"},Pe=n(()=>e("h3",{style:{"font-size":"22px","font-weight":"600"}},"Available Models",-1)),xe={key:0,style:{color:"#e32"}},we={key:0,class:"cards"},Ce={class:"card"},Re=["src"],Ee={class:"card__overlay"},Le={class:"card__header"},Se=n(()=>e("svg",{class:"card__arc",xmlns:"http://www.w3.org/2000/svg"},[e("path")],-1)),Ne={class:"card__header-text"},Me={class:"card__title"},Ue={class:"card__description"},Ae={class:"card__description"},He=["onClick"],Ge={key:1},qe=n(()=>e("h3",null,null,-1)),$e=[qe],ze=n(()=>e("section",{class:"models"},null,-1)),Be={class:"table"},Ve={class:"container"},je={class:"top-level"},Ye={class:"left"},We=n(()=>e("h3",null,"Uploaded Files",-1)),Ke={class:"search-button"},Qe=n(()=>e("thead",null,[e("tr",null,[e("th",null,"File Name"),e("th",null,"File Size"),e("th",null,"Uploaded"),e("th",null,"File Description"),e("th")])],-1)),Je={key:0,style:{position:"relative !important"}},Xe=["onClick"],Ze=n(()=>e("td",null,null,-1)),es={key:0,class:"loading-table"},ss=n(()=>e("div",{class:"spinner"},null,-1)),ts=[ss],os={key:1},ls={key:0,class:"pagination"},is=["onClick"];function rs(s,o,c,h,t,u){return a(),r("main",null,[e("section",G,[e("div",q,[t.userData?(a(),r("h3",$,d(t.userData.hospital.name),1)):_("",!0),z,e("div",B,[e("div",V,[e("div",j,[e("div",Y,[W,e("div",K,[e("img",{src:t.img2,alt:""},null,8,Q)])]),t.userData?(a(),r("div",J,[e("div",X,[e("div",Z,[e("img",{src:t.userData.profile_image_url,alt:""},null,8,ee)]),e("div",se,[e("p",null,d(t.userData.last_name)+" "+d(t.userData.first_name),1),e("label",null,d(t.userData.role),1)])]),t.userData?(a(),r("div",te,[e("p",null,d(t.userData.saved_files),1),oe,y(),le,ie])):_("",!0)])):_("",!0)])]),e("div",re,[e("div",ae,[e("div",ne,[e("div",ce,[de,t.userData?(a(),r("h2",he,d(t.userData.total_scans),1)):(a(),r("h2",_e,"..."))]),ue]),e("div",me,[e("div",ge,[pe,e("h2",null,d(t.models_count),1)]),fe])])])])])]),e("section",Ie,[e("div",ve,[t.selectedFile?(a(),r("div",ye,[e("h3",Te,[y("Selected File:"),e("span",be,d(t.selectedFile.fileName),1)]),e("div",ke,[u.isURLDicomImage(t.selectedFile.getFileURL)?_("",!0):(a(),r("img",{key:0,src:t.selectedFile.getFileURL,alt:"",style:{background:"var(--light)"}},null,8,De))])])):_("",!0),e("div",{id:"dicomImage",ref:"dicomImage",class:m(["img dimg",{disable:!t.selectedFile||t.selectedExtension!="dcm"}]),style:{}},null,2),t.modelResultReady?(a(),r("div",Fe,[e("button",{type:"button",style:{"font-size":"14px","font-weight":"400px",cursor:"pointer !important"},onClick:o[0]||(o[0]=i=>u.redirectTo("/results"))},"View Model Results")])):_("",!0),e("div",Oe,[Pe,t.selectedFile?_("",!0):(a(),r("h3",xe,"SELECT A FILE BEFORE CHOOSING A MODEL"))])]),t.model_list&&t.model_list.length>0?(a(),r("ul",we,[(a(!0),r(I,null,v(t.model_list,i=>(a(),r("li",{key:i},[e("span",Ce,[e("img",{src:i.getImageURL,class:"card__image",alt:""},null,8,Re),e("div",Ee,[e("div",Le,[Se,e("div",Ne,[e("h3",Me,d(i.model_name),1)])]),e("p",Ue,d(i.model_description),1),e("p",Ae,"Model Accuracy: "+d(i.model_accuracy),1),t.selectedFile?(a(),r("button",{key:0,type:"button",class:"model-button",onClick:f=>u.useModel(i.model_tag)},"Use Model",8,He)):_("",!0)])])]))),128))])):(a(),r("div",Ge,$e))]),ze,e("section",Be,[e("div",Ve,[e("div",je,[e("div",Ye,[We,O(e("input",{type:"search",name:"",id:"",placeholder:"search files","onUpdate:modelValue":o[1]||(o[1]=i=>s.searchText=i)},null,512),[[P,s.searchText]]),e("span",Ke,[e("i",{class:"fa-solid fa-magnifying-glass",onClick:o[2]||(o[2]=i=>u.getFiles(null,s.searchText))})])])]),e("table",null,[Qe,t.filesData?(a(),r("tbody",Je,[(a(!0),r(I,null,v(t.filesData.data,i=>(a(),r("tr",{key:i},[e("td",null,d(i.fileName),1),e("td",null,d(i.fileSize),1),e("td",null,d(t.moment(`${i.dateUploaded}`).format("DD MMM, YYYY . HH:MM:SS")),1),e("td",null,d(i.fileDescription.slice(0,15))+"...",1),e("td",null,[t.selectedFile&&t.selectedFile.uuid==i.uuid?(a(),r("button",{key:0,onClick:o[3]||(o[3]=f=>{t.selectedFile=null,t.selectedExtension=null}),style:{"background-color":"var(--success)"}},"Selected")):(a(),r("button",{key:1,onClick:f=>{t.selectedFile=i,u.loadFromUrl()}},"Select File",8,Xe))]),Ze]))),128)),t.showFileTableLoader?(a(),r("div",es,ts)):_("",!0)])):(a(),r("tbody",os))]),t.filesData?(a(),r("div",ls,[e("ul",null,[e("li",null,[e("i",{class:m(["fas fa-chevron-left",{disabled:t.filesData.pagination.current_page<=1}]),onClick:o[4]||(o[4]=i=>u.getFiles(t.filesData.pagination.current_page-1))},null,2)]),(a(!0),r(I,null,v(t.filesData.pagination.total_pages,(i,f)=>(a(),r("li",{key:i,class:m({active:t.filesData.pagination.current_page==i}),onClick:as=>u.getFiles(i)},[e("span",null,d(i),1)],10,is))),128)),e("li",null,[e("i",{class:m(["fas fa-chevron-right",{disabled:t.filesData.pagination.current_page>=t.filesData.pagination.total_pages}]),onClick:o[5]||(o[5]=i=>u.getFiles(t.filesData.pagination.current_page+1))},null,2)])])])):_("",!0)])])])}const ds=b(H,[["render",rs],["__scopeId","data-v-1fa857ea"]]);export{ds as default};