@@ -541,65 +541,6 @@ class ConnectCompFor3D extends ConnectCompFor2D {
541
541
return label3D ;
542
542
}
543
543
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
-
603
544
604
545
/**
605
546
* Get connected components For a Volume of 2 slices, current slice and previous slice.-- (refine)
@@ -702,10 +643,9 @@ class ConnectCompFor3D extends ConnectCompFor2D {
702
643
findLargest3dRegion = ( volumeSlices , sliceHeight , sliceWidth ) => {
703
644
704
645
let label3D = [ ] ;
705
-
646
+
706
647
label3D = this . getConComponentsFor3DVolume ( volumeSlices , sliceHeight , sliceWidth ) ;
707
- //-- label3D = await this.getConComponentsFor3DVolumeWithTimer(volumeSlices, sliceHeight, sliceWidth);
708
-
648
+
709
649
// Filter only largest volumetric 3d region with the most voxels of same label and remove noisy smaller 3d regions
710
650
let maxVolumeLabel = this . getMostFreqVolumeLabel3D ( label3D , sliceHeight , sliceWidth , volumeSlices . length ) ;
711
651
0 commit comments