javascript - Reading files from CD using HTML5, webkitdirectory takes more time compared to reading local files -




i have web application allows user upload dicom , non-dicom files account. using javascript, html5, webkitdirectory, chrome , datatable populate selected files on ui. issue facing -

while selecting files local machine following code seems work pretty fast , selected files populated on ui, while selecting same amount of files cd takes time render on ui. here example -

for cd 20 dicoms + 2 non dicoms studies, , 2241 images, takes 5-6 min populate list first time on ui. if try select same cd folder, list populate in 60 sec if it’s been populated once before during same session.

but if use same set of files local machine takes 6 -7 sec populate on ui.

here code executed each , every dicom file -

var filereader = new filereader(); filereader.onload = function(evt){     console.log("completed reading");     var arraybuffer = filereader.result;      var bytearray = new uint8array(arraybuffer);     _parsedicom(bytearray);     try {         if (filereader.readystate !== 2) {             filereader.abort();         }     }     catch (err) {         console.log('error occured: '+err);     } } var blob = f.slice(0, 50000); console.log("starting read"); filereader.readasarraybuffer(blob); 

after analyzing issue came with,

  • the basic thing guess is, os takes time mount cd memory external drive. it takes less time if access second time, because cd content mounted.

  • the time between "starting read" , "completed reading" relatively more while reading files cd local machine.

  • i tried looking dicomdir file, index of study files contained on disc, , included reason: avoid lengthy scans of disc. didn't find standard or way parse dicomdir file in javascript

is there way reduce amount of time takes read files cd ??

update -

i able dicomdir file structure javascript using dicomparser - https://github.com/chafey/dicomparser

var fr = new filereader(); fr.onload = function(evt){     var bytearray = new uint8array(fr.result);     try {         var dataset = dicomparser.parsedicom(bytearray);         _searchdicom(dataset, f);     } catch (err) {         if (typeof err.dataset != 'undefined') {             _searchdicom(err.dataset, f);         }     } } var blob = f.slice(0, 1000000);  fr.readasarraybuffer(blob);  function _searchdicom(dataset,f) {     var data = dataset.elements.x00041220.items;     if(data) {     data.foreach(function (e) {         if (e.dataset.string('x00041430') === 'patient') {             console.log("patient name - "+e.dataset.string('x00100010'));         }         else if (e.dataset.string('x00041430') === 'study') {}         else if (e.dataset.string('x00041430') === 'series') {}         else if (e.dataset.string('x00041430') === 'image') {}                   });     } } 

the structure of object similar displayed on - https://rawgit.com/chafey/dicomparser/master/examples/dumpwithdatadictionary/index.html
when upload dicomdir file.

the problem here not able collect patients,studies,series or images @ once. solution found iterate , check whether it's patient,study,series or image object

is there method/standard retrieve in better way ??





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -