Skip to content

Commit a71897e

Browse files
author
splis
committed
old version of js files
1 parent 7f5c0ac commit a71897e

File tree

3 files changed

+800
-2316
lines changed

3 files changed

+800
-2316
lines changed

js/brainchop/connectedComponents3DAll.js

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -541,65 +541,6 @@ class ConnectCompFor3D extends ConnectCompFor2D {
541541
return label3D;
542542
}
543543

544-
// For future use
545-
546-
getConComponentsFor3DVolumeWithTimer = async(volumeSlices, sliceHeight, sliceWidth) => {
547-
548-
const self = this;
549-
550-
return new Promise((resolve, reject) => {
551-
document.getElementById("progressBarChild").parentElement.style.visibility = "visible";
552-
document.getElementById("progressBarChild").style.width = 0;
553-
554-
let binaryMaskData1D = [];
555-
let binaryMaskData2D = [];
556-
let label3D = [];
557-
558-
let sliceIdx = 0;
559-
560-
let ccTimer = window.setInterval(function() {
561-
562-
binaryMaskData1D[sliceIdx] = getBinaryMaskData1D(volumeSlices[sliceIdx]); // binaryMaskData1D has values 0 or 1
563-
binaryMaskData2D[sliceIdx] = convertBinaryDataTo2D(binaryMaskData1D[sliceIdx], sliceHeight, sliceWidth);
564-
565-
if(sliceIdx == 0) {
566-
//Only called for once at begining with first slice
567-
label3D[sliceIdx] = self.getConComponentsFor2D(binaryMaskData2D[sliceIdx], sliceHeight, sliceWidth);
568-
569-
} else {
570-
label3D[sliceIdx] = self._getConComponentsFor2Slices(binaryMaskData2D[sliceIdx], label3D[sliceIdx - 1], sliceHeight, sliceWidth);
571-
}
572-
573-
574-
if(sliceIdx == (volumeSlices.length -1)) {
575-
document.getElementById("progressBarChild").style.width = 0;
576-
window.clearInterval( ccTimer );
577-
578-
// 3d connected components third pass
579-
for(let sliceIdx = 0; sliceIdx < volumeSlices.length; sliceIdx++) {
580-
let row, col;
581-
for(row = 0; row < sliceHeight; row++) {
582-
for(col = 0; col < sliceWidth; col++) {
583-
584-
if( label3D[sliceIdx][row][col] != 0) {
585-
label3D[sliceIdx][row][col] = self._equivalenceTabel[label3D[sliceIdx][row][col]];
586-
}
587-
}
588-
}
589-
}
590-
591-
resolve(label3D);
592-
}
593-
594-
sliceIdx++;
595-
document.getElementById("progressBarChild").style.width = (sliceIdx + 1)*100/volumeSlices.length + "%";
596-
597-
}, 10); // timer delay
598-
599-
})
600-
}
601-
602-
603544

604545
/**
605546
* Get connected components For a Volume of 2 slices, current slice and previous slice.-- (refine)
@@ -702,10 +643,9 @@ class ConnectCompFor3D extends ConnectCompFor2D {
702643
findLargest3dRegion = (volumeSlices, sliceHeight, sliceWidth) => {
703644

704645
let label3D = [];
705-
646+
706647
label3D = this.getConComponentsFor3DVolume(volumeSlices, sliceHeight, sliceWidth);
707-
//-- label3D = await this.getConComponentsFor3DVolumeWithTimer(volumeSlices, sliceHeight, sliceWidth);
708-
648+
709649
// Filter only largest volumetric 3d region with the most voxels of same label and remove noisy smaller 3d regions
710650
let maxVolumeLabel = this.getMostFreqVolumeLabel3D(label3D, sliceHeight, sliceWidth, volumeSlices.length);
711651

0 commit comments

Comments
 (0)