From 8e395c8d76a5fc0d88aeaac62f3be69d15937013 Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Wed, 4 Aug 2021 14:28:59 +0200
Subject: [PATCH] WIP refactor

---
 docs/releases/v2.5.0.md                       |  5 ++
 mkdocs.yml                                    |  1 +
 release.sh                                    | 70 ----------------
 .../databrowserModule/databrowser.service.ts  | 23 -----
 .../regionSearch/regionSearch.component.ts    |  3 +
 .../regionSearch/regionSearch.template.html   |  2 +-
 .../regionMenu/regionMenu.template.html       |  2 +-
 .../ieeg/ieegCmp/ieeg.template.html           |  2 +-
 .../iEEGRecordings.template.html              |  2 +-
 .../splashScreen/splashScreen.component.ts    |  4 +
 .../splashScreen/splashScreen.template.html   |  2 +-
 src/components/components.module.ts           |  7 +-
 .../pipes => components}/safeHtml.pipe.ts     |  4 +-
 .../treeSearch.pipe.spec.ts                   |  0
 .../pipes => components}/treeSearch.pipe.ts   |  0
 src/main.module.ts                            |  9 --
 .../atlasViewer.pluginService.service.ts      | 14 +++-
 src/plugin/pluginCsp/pluginCsp.template.html  |  2 +-
 src/ui/ui.module.ts                           | 23 -----
 src/util/directives/counter.directive.ts      | 10 ---
 src/util/directives/delayEvent.directive.ts   | 54 ------------
 .../directives/dockedContainer.directive.ts   | 15 ----
 src/util/pipes/_tmpParcName.pipe.ts           | 17 ----
 src/util/pipes/appendTooltipText.pipe.ts      | 23 -----
 src/util/pipes/arrayContains.pipe.ts          | 12 ---
 src/util/pipes/filterByProperty.pipe.ts       | 12 ---
 src/util/pipes/filterNull.pipe.ts             | 11 ---
 .../pipes/filterRegionDataEntries.pipe.ts     | 14 ----
 src/util/pipes/flatMapArray.pipe.ts           | 11 ---
 src/util/pipes/getFileExt.pipe.ts             | 35 --------
 src/util/pipes/getLayerNamePipe.pipe.ts       | 19 -----
 src/util/pipes/getName.pipe.ts                | 14 ----
 src/util/pipes/getNames.pipe.ts               | 14 ----
 src/util/pipes/getNthElement.pipe.ts          |  2 +
 src/util/pipes/getProperty.pipe.spec.ts       |  1 -
 src/util/pipes/getProperty.pipe.ts            |  2 +-
 .../pipes/groupDataEntriesByRegion.pipe.ts    | 41 ---------
 src/util/pipes/includes.pipe.ts               |  2 +-
 src/util/pipes/kgSearchBtnColor.pipe.ts       | 14 ----
 .../newViewerDistinctViewToLayer.pipe.ts      | 53 ------------
 src/util/pipes/objToArray.pipe.spec.ts        | 17 ----
 src/util/pipes/objToArray.pipe.ts             | 22 -----
 src/util/pipes/pagination.pipe.ts             | 15 ----
 src/util/pipes/pluginBtnFabColor.pipe.ts      | 15 ----
 .../pipes/sortDataEntriesIntoRegion.pipe.ts   | 15 ----
 .../spatialLandmarksToDatabrowserItem.pipe.ts | 29 -------
 .../templateParcellationHasMoreInfo.pipe.ts   | 48 -----------
 src/util/pluginHandler.ts                     | 12 ---
 src/util/pureConstant.service.ts              | 15 +---
 src/util/util.module.ts                       | 21 -----
 .../nehubaViewerGlue.component.ts             |  4 +
 .../nehubaViewerGlue.template.html            | 10 +--
 worker/worker.js                              | 83 -------------------
 53 files changed, 51 insertions(+), 806 deletions(-)
 create mode 100644 docs/releases/v2.5.0.md
 delete mode 100755 release.sh
 rename src/{util/pipes => components}/safeHtml.pipe.ts (66%)
 rename src/{util/pipes => components}/treeSearch.pipe.spec.ts (100%)
 rename src/{util/pipes => components}/treeSearch.pipe.ts (100%)
 delete mode 100644 src/util/directives/counter.directive.ts
 delete mode 100644 src/util/directives/delayEvent.directive.ts
 delete mode 100644 src/util/directives/dockedContainer.directive.ts
 delete mode 100644 src/util/pipes/_tmpParcName.pipe.ts
 delete mode 100644 src/util/pipes/appendTooltipText.pipe.ts
 delete mode 100644 src/util/pipes/arrayContains.pipe.ts
 delete mode 100644 src/util/pipes/filterByProperty.pipe.ts
 delete mode 100644 src/util/pipes/filterNull.pipe.ts
 delete mode 100644 src/util/pipes/filterRegionDataEntries.pipe.ts
 delete mode 100644 src/util/pipes/flatMapArray.pipe.ts
 delete mode 100644 src/util/pipes/getFileExt.pipe.ts
 delete mode 100644 src/util/pipes/getLayerNamePipe.pipe.ts
 delete mode 100644 src/util/pipes/getName.pipe.ts
 delete mode 100644 src/util/pipes/getNames.pipe.ts
 delete mode 100644 src/util/pipes/getProperty.pipe.spec.ts
 delete mode 100644 src/util/pipes/groupDataEntriesByRegion.pipe.ts
 delete mode 100644 src/util/pipes/kgSearchBtnColor.pipe.ts
 delete mode 100644 src/util/pipes/newViewerDistinctViewToLayer.pipe.ts
 delete mode 100644 src/util/pipes/objToArray.pipe.spec.ts
 delete mode 100644 src/util/pipes/objToArray.pipe.ts
 delete mode 100644 src/util/pipes/pagination.pipe.ts
 delete mode 100644 src/util/pipes/pluginBtnFabColor.pipe.ts
 delete mode 100644 src/util/pipes/sortDataEntriesIntoRegion.pipe.ts
 delete mode 100644 src/util/pipes/spatialLandmarksToDatabrowserItem.pipe.ts
 delete mode 100644 src/util/pipes/templateParcellationHasMoreInfo.pipe.ts
 delete mode 100644 src/util/pluginHandler.ts

diff --git a/docs/releases/v2.5.0.md b/docs/releases/v2.5.0.md
new file mode 100644
index 000000000..5f9bcd526
--- /dev/null
+++ b/docs/releases/v2.5.0.md
@@ -0,0 +1,5 @@
+# v2.5.0
+
+## Under the hood stuff
+
+- refactor: remove unneeded code
diff --git a/mkdocs.yml b/mkdocs.yml
index b09aa94d7..f504c13ca 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -40,6 +40,7 @@ pages:
     - Fetching datasets: 'advanced/datasets.md'
     - Display non-atlas volumes: 'advanced/otherVolumes.md'
   - Release notes:
+    - v2.5.0: 'releases/v2.5.0.md'
     - v2.4.0: 'releases/v2.4.0.md'
     - v2.3.11: 'releases/v2.3.11.md'
     - v2.3.10: 'releases/v2.3.10.md'
diff --git a/release.sh b/release.sh
deleted file mode 100755
index 2eb23818a..000000000
--- a/release.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#! /bin/bash
-
-# This is an automated script for TravisCI
-# It is triggered on push to master
-# It will create a release and publish to the github repo
-
-OWNER=HumanBrainProject
-REPO=interactive-viewer
-USER=xgui3783
-EMAIL=xgui3783@gmail.com
-#GITHUB_TOKEN should be populated by CI
-
-test -z "$GITHUB_TOKEN" && exit 1
-
-TAG=$(jq '.version' < package.json)
-TAG=${TAG#\"}
-TAG=v${TAG%\"}
-OBJECT=$(git rev-parse HEAD)
-DATE=$(date --iso-8601=seconds)
-BODY='{
-  "tag": "'$TAG'",
-  "message": "Annotated release for '$TAG'",
-  "object": "'$OBJECT'",
-  "type": "commit",
-  "tagger": {
-    "name": "'$USER'",
-    "email": "'$EMAIL'",
-    "date": "'$DATE'"
-  }
-}'
-
-# Create annotated tag
-
-echo curl -XPOST \
-  -H "Accept: application/vnd.github.v3+json" \
-  -u "$USER:$GITHUB_TOKEN"\
-  -d "$BODY" \
-  https://api.github.com/repos/$OWNER/$REPO/git/tags
-
-# Push tag to remote
-
-CREATE_REF_BODY='{
-  "ref":"refs/tags/'$TAG'",
-  "sha":"'$OBJECT'"
-}'
-
-echo curl -XPOST\
-  -u "$USER:$GITHUB_TOKEN"\
-  -H "Accept: application/vnd.github.v3+json" \
-  -d "$CREATE_REF_BODY"\
-  https://api.github.com/repos/$OWNER/$REPO/git/refs
-
-# Create release
-
-RELEASE_NOTES=$(sed -e 's/$/\\n/' docs/releases/$TAG.md)
-
-RELEASE_BODY='{
-  "tag_name":"'$TAG'",
-  "name":"'$TAG'",
-  "body":"'$(echo $RELEASE_NOTES)'",
-  "target_commitish": "master",
-  "draft":false,
-  "prerelease":false
-}'
-
-echo curl -XPOST\
-  -u "$USER:$GITHUB_TOKEN"\
-  -H "Accept: application/vnd.github.v3+json" \
-  -d "$RELEASE_BODY" \
-  https://api.github.com/repos/$OWNER/$REPO/releases
diff --git a/src/atlasComponents/databrowserModule/databrowser.service.ts b/src/atlasComponents/databrowserModule/databrowser.service.ts
index 31fd9b517..6a0cf707a 100644
--- a/src/atlasComponents/databrowserModule/databrowser.service.ts
+++ b/src/atlasComponents/databrowserModule/databrowser.service.ts
@@ -167,21 +167,6 @@ export class DatabrowserService implements OnDestroy {
       }),
     )
 
-    this.subscriptions.push(
-      fromEvent(this.workerService.worker, 'message').pipe(
-        filter((message: MessageEvent) => message && message.data && message.data.type === 'RETURN_REBUILT_REGION_SELECTION_TREE'),
-        map(message => message.data),
-      ).subscribe((payload: any) => {
-        /**
-         * rebuiltSelectedRegion contains super region that are
-         * selected as a result of all of its children that are selectted
-         */
-        const { rebuiltSelectedRegions, rebuiltSomeSelectedRegions } = payload
-        /**
-         * apply filter and populate databrowser instances
-         */
-      }),
-    )
   }
 
   public ngOnDestroy() {
@@ -337,14 +322,6 @@ export class DatabrowserService implements OnDestroy {
       })
   }
 
-  public rebuildRegionTree(selectedRegions, regions) {
-    this.workerService.worker.postMessage({
-      type: 'BUILD_REGION_SELECTION_TREE',
-      selectedRegions,
-      regions,
-    })
-  }
-
   public getModalityFromDE = getModalityFromDE
 }
 
diff --git a/src/atlasComponents/parcellation/regionSearch/regionSearch.component.ts b/src/atlasComponents/parcellation/regionSearch/regionSearch.component.ts
index b3db031c4..6ff6301a2 100644
--- a/src/atlasComponents/parcellation/regionSearch/regionSearch.component.ts
+++ b/src/atlasComponents/parcellation/regionSearch/regionSearch.component.ts
@@ -171,6 +171,9 @@ export class RegionTextSearchAutocomplete {
   public autocompleteList$: Observable<any[]>
   public formControl = new FormControl()
 
+  public filterNullFn(item: any){
+    return !!item
+  }
   public regionsSelected$: Observable<any>
   public parcellationSelected$: Observable<any>
 
diff --git a/src/atlasComponents/parcellation/regionSearch/regionSearch.template.html b/src/atlasComponents/parcellation/regionSearch/regionSearch.template.html
index b2f543412..965cc3c65 100644
--- a/src/atlasComponents/parcellation/regionSearch/regionSearch.template.html
+++ b/src/atlasComponents/parcellation/regionSearch/regionSearch.template.html
@@ -74,7 +74,7 @@
 <ng-template #regionHierarchy>
   <region-hierarchy
     [useMobileUI]="useMobileUI$ | async"
-    [selectedRegions]="regionsSelected$ | async | filterNull"
+    [selectedRegions]="regionsSelected$ | async | filterArray : filterNullFn"
     (singleClickRegion)="handleRegionClick({ mode: 'single', region: $event })"
     (doubleClickRegion)="handleRegionClick({ mode: 'double', region: $event })"
     (clearAllRegions)="deselectAllRegions($event)"
diff --git a/src/atlasComponents/parcellationRegion/regionMenu/regionMenu.template.html b/src/atlasComponents/parcellationRegion/regionMenu/regionMenu.template.html
index 52e6a76f5..7f7a0cc5c 100644
--- a/src/atlasComponents/parcellationRegion/regionMenu/regionMenu.template.html
+++ b/src/atlasComponents/parcellationRegion/regionMenu/regionMenu.template.html
@@ -173,7 +173,7 @@
   let-iavNgIf="iavNgIf"
   let-content="content">
   <mat-expansion-panel
-    [expanded]="activePanelTitles$ | async | arrayContains : title"
+    [expanded]="activePanelTitles$ | async | includes : title"
     [attr.data-opened]="expansionPanel.expanded"
     [attr.data-mat-expansion-title]="title"
     (closed)="handleExpansionPanelClosedEv(title)"
diff --git a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.template.html b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.template.html
index ff8c7d311..be044298e 100644
--- a/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.template.html
+++ b/src/atlasComponents/regionalFeatures/bsFeatures/ieeg/ieegCmp/ieeg.template.html
@@ -27,7 +27,7 @@
 <ng-template #electrodeTmpl let-electrode>
 
   <mat-expansion-panel
-    [expanded]="openElectrode$ | async | arrayContains : electrode"
+    [expanded]="openElectrode$ | async | includes : electrode"
     (opened)="handleDatumExpansion(electrode, true)"
     (closed)="handleDatumExpansion(electrode, false)"
     togglePosition="before">
diff --git a/src/atlasComponents/regionalFeatures/singleFeatures/iEEGRecordings/iEEGRecordings/iEEGRecordings.template.html b/src/atlasComponents/regionalFeatures/singleFeatures/iEEGRecordings/iEEGRecordings/iEEGRecordings.template.html
index aefcfeb42..7a4b70d88 100644
--- a/src/atlasComponents/regionalFeatures/singleFeatures/iEEGRecordings/iEEGRecordings/iEEGRecordings.template.html
+++ b/src/atlasComponents/regionalFeatures/singleFeatures/iEEGRecordings/iEEGRecordings/iEEGRecordings.template.html
@@ -3,7 +3,7 @@
   <mat-accordion
     class="ml-24px-n mr-24px-n d-block">
     <mat-expansion-panel *ngFor="let datum of (data$ | async)"
-      [expanded]="openElectrodeId$ | async | arrayContains : datum['@id']"
+      [expanded]="openElectrodeId$ | async | includes : datum['@id']"
       (opened)="handleDatumExpansion(datum['@id'], true)"
       (closed)="handleDatumExpansion(datum['@id'], false)"
       togglePosition="before">
diff --git a/src/atlasComponents/splashScreen/splashScreen/splashScreen.component.ts b/src/atlasComponents/splashScreen/splashScreen/splashScreen.component.ts
index 2435c4e08..3d4ed603f 100644
--- a/src/atlasComponents/splashScreen/splashScreen/splashScreen.component.ts
+++ b/src/atlasComponents/splashScreen/splashScreen/splashScreen.component.ts
@@ -21,6 +21,10 @@ export class SplashScreen {
 
   public loadedAtlases$: Observable<any[]>
 
+  public filterNullFn(atlas: any){
+    return !!atlas
+  }
+
   @ViewChild('parentContainer', {read: ElementRef})
   public activatedTemplate$: Subject<any> = new Subject()
 
diff --git a/src/atlasComponents/splashScreen/splashScreen/splashScreen.template.html b/src/atlasComponents/splashScreen/splashScreen/splashScreen.template.html
index bb855b2ef..6236bd010 100644
--- a/src/atlasComponents/splashScreen/splashScreen/splashScreen.template.html
+++ b/src/atlasComponents/splashScreen/splashScreen/splashScreen.template.html
@@ -7,7 +7,7 @@
     <mat-card
       (click)="selectAtlas(atlas)"
       matRipple
-      *ngFor="let atlas of loadedAtlases$ | async | filterNull"
+      *ngFor="let atlas of loadedAtlases$ | async | filterArray : filterNullFn"
       class="m-3 col-md-12 col-lg-12 pe-all">
       <mat-card-header>
         <mat-card-title class="text-nowrap font-stretch">
diff --git a/src/components/components.module.ts b/src/components/components.module.ts
index c03ce4ea9..a17a533ba 100644
--- a/src/components/components.module.ts
+++ b/src/components/components.module.ts
@@ -8,9 +8,8 @@ import {  MarkdownDom } from './markdown/markdown.component';
 import { CommonModule } from '@angular/common';
 import { AngularMaterialModule } from 'src/ui/sharedModules/angularMaterial.module';
 import { UtilModule } from 'src/util';
-import { SearchResultPaginationPipe } from '../util/pipes/pagination.pipe';
-import { SafeHtmlPipe } from '../util/pipes/safeHtml.pipe'
-import { TreeSearchPipe } from '../util/pipes/treeSearch.pipe';
+import { SafeHtmlPipe } from './safeHtml.pipe'
+import { TreeSearchPipe } from './treeSearch.pipe';
 import { ConfirmDialogComponent } from './confirmDialog/confirmDialog.component';
 import { DialogComponent } from './dialog/dialog.component';
 import { AppendSiblingFlagPipe } from './flatTree/appendSiblingFlag.pipe';
@@ -69,7 +68,6 @@ import { SpinnerCmp } from './spinner/spinner.component';
 
     /* pipes */
     SafeHtmlPipe,
-    SearchResultPaginationPipe,
     TreeSearchPipe,
     FlattenTreePipe,
     RenderPipe,
@@ -98,7 +96,6 @@ import { SpinnerCmp } from './spinner/spinner.component';
     DynamicMaterialBtn,
     SpinnerCmp,
 
-    SearchResultPaginationPipe,
     TreeSearchPipe,
 
     HoverableBlockDirective,
diff --git a/src/util/pipes/safeHtml.pipe.ts b/src/components/safeHtml.pipe.ts
similarity index 66%
rename from src/util/pipes/safeHtml.pipe.ts
rename to src/components/safeHtml.pipe.ts
index 272c1c316..046bbc39c 100644
--- a/src/util/pipes/safeHtml.pipe.ts
+++ b/src/components/safeHtml.pipe.ts
@@ -1,4 +1,4 @@
-import { Pipe, PipeTransform } from '@angular/core';
+import { Pipe, PipeTransform, SecurityContext } from '@angular/core';
 import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
 
 @Pipe({
@@ -10,6 +10,6 @@ export class SafeHtmlPipe implements PipeTransform {
 
   }
   public transform(html: string): SafeHtml {
-    return this.ds.bypassSecurityTrustHtml(html)
+    return this.ds.sanitize(SecurityContext.HTML, html)
   }
 }
diff --git a/src/util/pipes/treeSearch.pipe.spec.ts b/src/components/treeSearch.pipe.spec.ts
similarity index 100%
rename from src/util/pipes/treeSearch.pipe.spec.ts
rename to src/components/treeSearch.pipe.spec.ts
diff --git a/src/util/pipes/treeSearch.pipe.ts b/src/components/treeSearch.pipe.ts
similarity index 100%
rename from src/util/pipes/treeSearch.pipe.ts
rename to src/components/treeSearch.pipe.ts
diff --git a/src/main.module.ts b/src/main.module.ts
index cc25b0115..dc5bdfbc1 100644
--- a/src/main.module.ts
+++ b/src/main.module.ts
@@ -9,8 +9,6 @@ import { ComponentsModule } from "./components/components.module";
 import { LayoutModule } from "./layouts/layout.module";
 import { ngViewerState, pluginState, uiState, userConfigState, UserConfigStateUseEffect, viewerConfigState, viewerState } from "./services/stateStore.service";
 import { UIModule } from "./ui/ui.module";
-import { GetNamePipe } from "./util/pipes/getName.pipe";
-import { GetNamesPipe } from "./util/pipes/getNames.pipe";
 
 import { HttpClientModule } from "@angular/common/http";
 import { EffectsModule } from "@ngrx/effects";
@@ -28,10 +26,8 @@ import { ViewerStateUseEffect } from "./services/state/viewerState.store";
 import { UIService } from "./services/uiService.service";
 import { DatabrowserModule, OVERRIDE_IAV_DATASET_PREVIEW_DATASET_FN, DataBrowserFeatureStore, GET_KGDS_PREVIEW_INFO_FROM_ID_FILENAME, DatabrowserService } from "src/atlasComponents/databrowserModule";
 import { ViewerStateControllerUseEffect } from "src/state";
-import { DockedContainerDirective } from "./util/directives/dockedContainer.directive";
 import { FloatingContainerDirective } from "./util/directives/floatingContainer.directive";
 import { FloatingMouseContextualContainerDirective } from "./util/directives/floatingMouseContextualContainer.directive";
-import { NewViewerDisctinctViewToLayer } from "./util/pipes/newViewerDistinctViewToLayer.pipe";
 import { ClickInterceptor, CLICK_INTERCEPTOR_INJECTOR, PureContantService, UtilModule } from "src/util";
 import { SpotLightModule } from 'src/spotlight/spot-light.module'
 import { TryMeComponent } from "./ui/tryme/tryme.component";
@@ -133,14 +129,9 @@ export function debug(reducer: ActionReducer<any>): ActionReducer<any> {
     TryMeComponent,
 
     /* directives */
-    DockedContainerDirective,
     FloatingContainerDirective,
     FloatingMouseContextualContainerDirective,
 
-    /* pipes */
-    GetNamesPipe,
-    GetNamePipe,
-    NewViewerDisctinctViewToLayer,
   ],
   entryComponents : [
     DialogComponent,
diff --git a/src/plugin/atlasViewer.pluginService.service.ts b/src/plugin/atlasViewer.pluginService.service.ts
index 42ac1eb77..1c83a6d28 100644
--- a/src/plugin/atlasViewer.pluginService.service.ts
+++ b/src/plugin/atlasViewer.pluginService.service.ts
@@ -6,7 +6,6 @@ import { select, Store } from "@ngrx/store";
 import { BehaviorSubject, from, merge, Observable, of } from "rxjs";
 import { catchError, filter, map, mapTo, shareReplay, switchMap, switchMapTo, take, tap } from "rxjs/operators";
 import { LoggingService } from 'src/logging';
-import { PluginHandler } from 'src/util/pluginHandler';
 import { WidgetUnit, WidgetServices } from "src/widget";
 import { APPEND_SCRIPT_TOKEN, REMOVE_SCRIPT_TOKEN, getHttpHeader } from 'src/util/constants';
 import { PluginFactoryDirective } from './pluginFactory.directive';
@@ -18,6 +17,19 @@ import { PureContantService } from 'src/util';
 
 const requiresReloadMd = `\n\n***\n\n**warning**: interactive atlas viewer **will** be reloaded in order for the change to take effect.`
 
+class PluginHandler {
+  public onShutdown: (callback: () => void) => void
+  public blink: (sec?: number) => void
+  public shutdown: () => void
+
+  public initState?: any
+  public initStateUrl?: string
+
+  public setInitManifestUrl: (url: string|null) => void
+
+  public setProgressIndicator: (progress: number) => void
+}
+
 export const registerPluginFactoryDirectiveFactory = (pSer: PluginServices) => {
   return (pFactoryDirective: PluginFactoryDirective) => {
     pSer.loadExternalLibraries = pFactoryDirective.loadExternalLibraries.bind(pFactoryDirective)
diff --git a/src/plugin/pluginCsp/pluginCsp.template.html b/src/plugin/pluginCsp/pluginCsp.template.html
index 477d41a9c..16159fa0b 100644
--- a/src/plugin/pluginCsp/pluginCsp.template.html
+++ b/src/plugin/pluginCsp/pluginCsp.template.html
@@ -36,7 +36,7 @@
       </button>
   
       <mat-list>
-        <ng-container *ngFor="let csp of pluginCsp['pluginCsp'] | objToArray">
+        <ng-container *ngFor="let csp of pluginCsp['pluginCsp'] | keyvalue">
           <span mat-subheader>
             {{ csp['key'] }}
           </span>
diff --git a/src/ui/ui.module.ts b/src/ui/ui.module.ts
index ff474d2af..0ab786dc6 100644
--- a/src/ui/ui.module.ts
+++ b/src/ui/ui.module.ts
@@ -4,22 +4,13 @@ import { ComponentsModule } from "src/components/components.module";
 import { FormsModule, ReactiveFormsModule } from "@angular/forms";
 import { LayoutModule } from "src/layouts/layout.module";
 
-import { FilterRegionDataEntries } from "src/util/pipes/filterRegionDataEntries.pipe";
-import { GroupDatasetByRegion } from "src/util/pipes/groupDataEntriesByRegion.pipe";
-
-import { GetLayerNameFromDatasets } from "../util/pipes/getLayerNamePipe.pipe";
-import { SortDataEntriesToRegion } from "../util/pipes/sortDataEntriesIntoRegion.pipe";
 import { CitationsContainer } from "./citation/citations.component";
 
 import { ScrollingModule } from "@angular/cdk/scrolling"
 import { HttpClientModule } from "@angular/common/http";
 import { AngularMaterialModule } from 'src/ui/sharedModules/angularMaterial.module'
-import { AppendtooltipTextPipe } from "src/util/pipes/appendTooltipText.pipe";
-import { FlatmapArrayPipe } from "src/util/pipes/flatMapArray.pipe";
-import { GetFileExtension } from "src/util/pipes/getFileExt.pipe";
 import { UtilModule } from "src/util";
 import { DownloadDirective } from "../util/directives/download.directive";
-import { SpatialLandmarksToDataBrowserItemPipe } from "../util/pipes/spatialLandmarksToDatabrowserItem.pipe";
 
 
 import { DatabrowserModule } from "../atlasComponents/databrowserModule/databrowser.module";
@@ -29,9 +20,6 @@ import { MobileOverlay } from "./nehubaContainer/mobileOverlay/mobileOverlay.com
 import { MobileControlNubStylePipe } from "./nehubaContainer/pipes/mobileControlNubStyle.pipe";
 
 import { HumanReadableFileSizePipe } from "src/util/pipes/humanReadableFileSize.pipe";
-import { KgSearchBtnColorPipe } from "src/util/pipes/kgSearchBtnColor.pipe";
-import { PluginBtnFabColorPipe } from "src/util/pipes/pluginBtnFabColor.pipe";
-import { TemplateParcellationHasMoreInfo } from "src/util/pipes/templateParcellationHasMoreInfo.pipe";
 
 import { ReorderPanelIndexPipe } from "./nehubaContainer/reorderPanelIndex.pipe";
 
@@ -77,19 +65,8 @@ import { AtlasCmpParcellationModule } from "src/atlasComponents/parcellation";
     ActionDialog,
 
     /* pipes */
-    GroupDatasetByRegion,
-    FilterRegionDataEntries,
-    FlatmapArrayPipe,
-    GetLayerNameFromDatasets,
-    SortDataEntriesToRegion,
-    SpatialLandmarksToDataBrowserItemPipe,
-    AppendtooltipTextPipe,
     MobileControlNubStylePipe,
-    PluginBtnFabColorPipe,
-    KgSearchBtnColorPipe,
-    GetFileExtension,
 
-    TemplateParcellationHasMoreInfo,
     HumanReadableFileSizePipe,
     ReorderPanelIndexPipe,
 
diff --git a/src/util/directives/counter.directive.ts b/src/util/directives/counter.directive.ts
deleted file mode 100644
index d66f71877..000000000
--- a/src/util/directives/counter.directive.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { Directive } from "@angular/core";
-
-@Directive({
-  selector: '[iav-counter]',
-  exportAs: 'iavCounter'
-})
-
-export class CounterDirective{
-  public value: number = 0
-}
\ No newline at end of file
diff --git a/src/util/directives/delayEvent.directive.ts b/src/util/directives/delayEvent.directive.ts
deleted file mode 100644
index fa896a09f..000000000
--- a/src/util/directives/delayEvent.directive.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import { Directive, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, Output } from "@angular/core";
-
-const VALID_EVENTNAMES = new Set([
-  'mousedown',
-  'mouseup',
-  'click',
-  'mouseenter',
-  'mouseleave',
-  'touchstart',
-  'touchmove',
-  'touchend',
-])
-
-@Directive({
-  selector: '[iav-delay-event]',
-})
-
-export class DelayEventDirective implements OnChanges, OnDestroy {
-
-  private evListener = (ev: Event) => setTimeout(() => this.delayedEmit.emit(ev))
-
-  @Input('iav-delay-event')
-  public delayEvent: string = ''
-
-  @Output('iav-delay-event-emit')
-  public delayedEmit: EventEmitter<any> = new EventEmitter()
-
-  constructor(
-    private el: ElementRef,
-  ) {
-
-  }
-
-  private destroyCb: Array<() => void> = []
-  public ngOnChanges() {
-    this.ngOnDestroy()
-
-    if (!this.delayEvent || this.delayEvent === '') { return }
-    const el = this.el.nativeElement as HTMLElement
-    for (const evName of this.delayEvent.split(' ')) {
-      if (VALID_EVENTNAMES.has(evName)) {
-        el.addEventListener(evName, this.evListener)
-        this.destroyCb.push(() => el.removeEventListener(evName, this.evListener))
-      } else {
-        // tslint:disable-next-line
-        console.warn(`${evName} is not a valid event name in the supported set`, VALID_EVENTNAMES)
-      }
-    }
-  }
-
-  public ngOnDestroy() {
-    while (this.destroyCb.length > 0) { this.destroyCb.pop()() }
-  }
-}
diff --git a/src/util/directives/dockedContainer.directive.ts b/src/util/directives/dockedContainer.directive.ts
deleted file mode 100644
index 4f9a9ab90..000000000
--- a/src/util/directives/dockedContainer.directive.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Directive, ViewContainerRef } from "@angular/core";
-import { WidgetServices } from "src/widget";
-
-@Directive({
-  selector: '[dockedContainerDirective]',
-})
-
-export class DockedContainerDirective {
-  constructor(
-    widgetService: WidgetServices,
-    viewContainerRef: ViewContainerRef,
-  ) {
-    widgetService.dockedContainer = viewContainerRef
-  }
-}
diff --git a/src/util/pipes/_tmpParcName.pipe.ts b/src/util/pipes/_tmpParcName.pipe.ts
deleted file mode 100644
index 455249098..000000000
--- a/src/util/pipes/_tmpParcName.pipe.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-/**
- * this is a temporary pipe class that transform 
- * JuBrain -> Julich-Brain 
- * in prod version of IAV
- */
-
-@Pipe({
-  name: 'tmpParcNamePipe'
-})
-
-export class TmpParcNamePipe implements PipeTransform{
-  public transform(input: string): string{
-    return input.replace(/JuBrain/gi, 'Julich-Brain')
-  }
-}
\ No newline at end of file
diff --git a/src/util/pipes/appendTooltipText.pipe.ts b/src/util/pipes/appendTooltipText.pipe.ts
deleted file mode 100644
index 76f871069..000000000
--- a/src/util/pipes/appendTooltipText.pipe.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-/**
- * TODO
- * merge this pipe into cpProp pipe
- */
-
-@Pipe({
-  name: 'appendTooltipTextPipe',
-})
-
-export class AppendtooltipTextPipe implements PipeTransform {
-  public transform(array: any[]) {
-    return array.map(item => {
-      const { properties = {} } = item
-      const { description: tooltipText } = properties
-      return {
-        ...item,
-        tooltipText,
-      }
-    })
-  }
-}
diff --git a/src/util/pipes/arrayContains.pipe.ts b/src/util/pipes/arrayContains.pipe.ts
deleted file mode 100644
index e36b1283d..000000000
--- a/src/util/pipes/arrayContains.pipe.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-@Pipe({
-  name: 'arrayContains',
-  pure: true
-})
-
-export class ArrayContainsPipe implements PipeTransform{
-  public transform<T>(inputArray: T[], qualifier: T): boolean{
-    return (inputArray || []).some(it => it === qualifier)
-  }
-}
diff --git a/src/util/pipes/filterByProperty.pipe.ts b/src/util/pipes/filterByProperty.pipe.ts
deleted file mode 100644
index 6e7819bfe..000000000
--- a/src/util/pipes/filterByProperty.pipe.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-@Pipe({
-  name: 'filterByProperty',
-  pure: true
-})
-
-export class FilterByPropertyPipe implements PipeTransform{
-  public transform<T>(input: T[], prop: string): T[]{
-    return input.filter(item => !!item[prop])
-  }
-}
diff --git a/src/util/pipes/filterNull.pipe.ts b/src/util/pipes/filterNull.pipe.ts
deleted file mode 100644
index 4bbde2567..000000000
--- a/src/util/pipes/filterNull.pipe.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-@Pipe({
-  name: 'filterNull',
-})
-
-export class FilterNullPipe implements PipeTransform {
-  public transform(arr: any[], fn?: (item: any) => boolean) {
-    return (arr && arr.filter(obj => fn ? fn(obj) : obj !== null)) || []
-  }
-}
diff --git a/src/util/pipes/filterRegionDataEntries.pipe.ts b/src/util/pipes/filterRegionDataEntries.pipe.ts
deleted file mode 100644
index 204c3343d..000000000
--- a/src/util/pipes/filterRegionDataEntries.pipe.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-import { IDataEntry } from "../../services/stateStore.service";
-
-@Pipe({
-  name : 'filterRegionDataEntries',
-})
-
-export class FilterRegionDataEntries implements PipeTransform {
-  public transform(arr: Array<{region: any|null, searchResults: IDataEntry[]}>, selectedRegions: any[]): Array<{region: any|null, searchResults: IDataEntry[]}> {
-    return selectedRegions.length > 0 ?
-      arr.filter(obj => obj.region !== null && selectedRegions.findIndex(r => obj.region.name === r.name) >= 0) :
-      arr
-  }
-}
diff --git a/src/util/pipes/flatMapArray.pipe.ts b/src/util/pipes/flatMapArray.pipe.ts
deleted file mode 100644
index 695a82dbf..000000000
--- a/src/util/pipes/flatMapArray.pipe.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-@Pipe({
-  name: 'flatmapArrayPipe',
-})
-
-export class FlatmapArrayPipe implements PipeTransform {
-  public transform(aoa: any[][]) {
-    return aoa.reduce((acc, array) => acc.concat(array), [])
-  }
-}
diff --git a/src/util/pipes/getFileExt.pipe.ts b/src/util/pipes/getFileExt.pipe.ts
deleted file mode 100644
index 2d6777495..000000000
--- a/src/util/pipes/getFileExt.pipe.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-const NIFTI = `NIFTI Volume`
-const VTK = `VTK Mesh`
-
-const extMap = new Map([
-  ['.nii', NIFTI],
-  ['.nii.gz', NIFTI],
-  ['.vtk', VTK],
-])
-
-@Pipe({
-  name: 'getFileExtension',
-})
-
-export class GetFileExtension implements PipeTransform {
-  private regex: RegExp = new RegExp('(\\.[\\w\\.]*?)$')
-
-  private getRegexp(ext) {
-    return new RegExp(`${ext.replace(/\./g, '\\.')}$`, 'i')
-  }
-
-  private detFileExt(filename: string): string {
-    for (const [key, val] of extMap) {
-      if (this.getRegexp(key).test(filename)) {
-        return val
-      }
-    }
-    return filename
-  }
-
-  public transform(filename: string): string {
-    return this.detFileExt(filename)
-  }
-}
diff --git a/src/util/pipes/getLayerNamePipe.pipe.ts b/src/util/pipes/getLayerNamePipe.pipe.ts
deleted file mode 100644
index 5acf0167a..000000000
--- a/src/util/pipes/getLayerNamePipe.pipe.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-@Pipe({
-  name : 'getLayerNameFromDatasets',
-})
-
-export class GetLayerNameFromDatasets implements PipeTransform {
-  public transform(ngLayerName: string, datasets?: any[]): string {
-    if (!datasets) {
-      return ngLayerName
-    }
-
-    const foundDataset = datasets.find(ds => ds.files.findIndex(file => file.url === ngLayerName) >= 0)
-
-    return foundDataset
-      ? foundDataset.name
-      : ngLayerName
-  }
-}
diff --git a/src/util/pipes/getName.pipe.ts b/src/util/pipes/getName.pipe.ts
deleted file mode 100644
index 56e4b4cfa..000000000
--- a/src/util/pipes/getName.pipe.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-@Pipe({
-  name : 'getName',
-})
-
-export class GetNamePipe implements PipeTransform {
-
-  public transform(object: any): string {
-    return object ?
-      object.name ? object.name : 'Untitled' :
-      'Untitled'
-  }
-}
diff --git a/src/util/pipes/getNames.pipe.ts b/src/util/pipes/getNames.pipe.ts
deleted file mode 100644
index 8e2f0c833..000000000
--- a/src/util/pipes/getNames.pipe.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-@Pipe({
-  name : 'getNames',
-})
-
-export class GetNamesPipe implements PipeTransform {
-
-  public transform(array: any[]): string[] {
-    return array ?
-      array.map(item => item.name ? item.name : 'Untitled') :
-      []
-  }
-}
diff --git a/src/util/pipes/getNthElement.pipe.ts b/src/util/pipes/getNthElement.pipe.ts
index d4b27720b..2a5d9bc82 100644
--- a/src/util/pipes/getNthElement.pipe.ts
+++ b/src/util/pipes/getNthElement.pipe.ts
@@ -1,5 +1,7 @@
 import { Pipe, PipeTransform } from "@angular/core";
 
+// TODO use getProperty pipe instead
+
 @Pipe({
   name: 'getNthElement'
 })
diff --git a/src/util/pipes/getProperty.pipe.spec.ts b/src/util/pipes/getProperty.pipe.spec.ts
deleted file mode 100644
index 0ffdd02fc..000000000
--- a/src/util/pipes/getProperty.pipe.spec.ts
+++ /dev/null
@@ -1 +0,0 @@
-// TODO
\ No newline at end of file
diff --git a/src/util/pipes/getProperty.pipe.ts b/src/util/pipes/getProperty.pipe.ts
index 024135aee..2132c83f2 100644
--- a/src/util/pipes/getProperty.pipe.ts
+++ b/src/util/pipes/getProperty.pipe.ts
@@ -6,7 +6,7 @@ import { Pipe, PipeTransform } from "@angular/core";
 })
 
 export class GetPropertyPipe implements PipeTransform{
-  public transform(input, property = '@id') {
+  public transform(input: any, property: any = '@id') {
     return input && input[property]
   }
 }
diff --git a/src/util/pipes/groupDataEntriesByRegion.pipe.ts b/src/util/pipes/groupDataEntriesByRegion.pipe.ts
deleted file mode 100644
index 50f7a394c..000000000
--- a/src/util/pipes/groupDataEntriesByRegion.pipe.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-import { IDataEntry } from "../../services/stateStore.service";
-
-@Pipe({
-  name : 'groupDatasetByRegion',
-})
-export class GroupDatasetByRegion implements PipeTransform {
-  public transform(datasets: IDataEntry[], regions: any[]): Array<{region: any|null, searchResults: IDataEntry[]}> {
-
-    return datasets.reduce((acc, curr) => {
-      return (curr.parcellationRegion && curr.parcellationRegion.length > 0)
-        ? curr.parcellationRegion.reduce((acc2, reName) => {
-          const idx = acc.findIndex(it => it.region === null
-            ? reName.name === 'none'
-            : it.region.name === reName.name )
-
-          return idx >= 0
-            ? acc2.map((v, i) => i === idx
-              ? Object.assign({}, v, {searchResults : v.searchResults.concat(curr)})
-              : v )
-            : acc2.concat({
-              region : this.getRegionFromRegionName(reName.name, regions),
-              searchResults : [ curr ],
-            })
-        }, acc)
-        : acc.findIndex(it => it.region == null) >= 0
-          ? acc.map(it => it.region === null
-            ? Object.assign({}, it, {searchResults: it.searchResults.concat(curr)})
-            : it)
-          : acc.concat({
-            region : null,
-            searchResults : [curr],
-          })
-    }, [] as Array<{region: any|null, searchResults: IDataEntry[]}>)
-  }
-
-  private getRegionFromRegionName(regionName: string, regions: any[]): any|null {
-    const idx =  regions.findIndex(re => re.name == regionName)
-    return idx >= 0 ? regions[idx] : null
-  }
-}
diff --git a/src/util/pipes/includes.pipe.ts b/src/util/pipes/includes.pipe.ts
index 9d7dc2d1d..2625cd6d3 100644
--- a/src/util/pipes/includes.pipe.ts
+++ b/src/util/pipes/includes.pipe.ts
@@ -7,7 +7,7 @@ const defaultCompareFn = (item: any, comparator: any): boolean => item === compa
 })
 
 export class IncludesPipe implements PipeTransform {
-  public transform(array: any[], item: any, compareFn= defaultCompareFn): boolean {
+  public transform(array: any[], item: any, compareFn = defaultCompareFn): boolean {
     if (!array) { return false }
     if (!(array instanceof Array)) { return false }
     return array.some(it => compareFn(it, item))
diff --git a/src/util/pipes/kgSearchBtnColor.pipe.ts b/src/util/pipes/kgSearchBtnColor.pipe.ts
deleted file mode 100644
index 7adf205b3..000000000
--- a/src/util/pipes/kgSearchBtnColor.pipe.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-import { WidgetUnit } from "src/widget";
-
-@Pipe({
-  name: 'kgSearchBtnColorPipe',
-})
-
-export class KgSearchBtnColorPipe implements PipeTransform {
-  public transform([minimisedWidgetUnit]: [Set<WidgetUnit>, string], wu: WidgetUnit ) {
-    return minimisedWidgetUnit.has(wu)
-      ? 'primary'
-      : 'accent'
-  }
-}
diff --git a/src/util/pipes/newViewerDistinctViewToLayer.pipe.ts b/src/util/pipes/newViewerDistinctViewToLayer.pipe.ts
deleted file mode 100644
index c00db3f04..000000000
--- a/src/util/pipes/newViewerDistinctViewToLayer.pipe.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-@Pipe({
-  name : 'newViewerDisctinctViewToLayer',
-})
-
-export class NewViewerDisctinctViewToLayer implements PipeTransform {
-  public transform(input: [any | null, string | null]): AtlasViewerLayerInterface[] {
-    try {
-      if (!input) {
-        return []
-      }
-      const newViewer = input[0]
-      const dedicatedViewer = input[1]
-      return []
-        .concat(newViewer
-          ? Object.keys(newViewer.nehubaConfig.dataset.initialNgState.layers).map(key => ({
-            name : key,
-            url : newViewer.nehubaConfig.dataset.initialNgState.layers[key].source,
-            type : newViewer.nehubaConfig.dataset.initialNgState.layers[key].type === 'image'
-              ? 'base'
-              : newViewer.nehubaConfig.dataset.initialNgState.layers[key].type === 'segmentation'
-                ? 'mixable'
-                : 'nonmixable',
-            transform : newViewer.nehubaConfig.dataset.initialNgState.layers[key].transform
-              ? newViewer.nehubaConfig.dataset.initialNgState.layers[key].transform.map(quat => Array.from(quat))
-              : null,
-          }))
-          : [])
-        .concat(dedicatedViewer
-          ? { name : 'dedicated view', url : dedicatedViewer, type : 'nonmixable' }
-          : [])
-        .sort((l1, l2) => l1.type < l2.type
-          ? -1
-          : l1.type > l2.type
-            ? 1
-            : 0 )
-    } catch (e) {
-
-      // tslint:disable-next-line
-      console.error('new viewer distinct view to layer error', e)
-      return []
-    }
-  }
-}
-
-export interface AtlasViewerLayerInterface {
-  name: string
-  url: string
-  type: string // 'base' | 'mixable' | 'nonmixable'
-  transform?: [[number, number, number, number], [number, number, number, number], [number, number, number, number], [number, number, number, number]] | null
-  // colormap : string
-}
diff --git a/src/util/pipes/objToArray.pipe.spec.ts b/src/util/pipes/objToArray.pipe.spec.ts
deleted file mode 100644
index d1a54e082..000000000
--- a/src/util/pipes/objToArray.pipe.spec.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { ObjectToArrayPipe } from "./objToArray.pipe"
-
-describe('> objToArray.pipe.ts', () => {
-  describe('> ObjectToArrayPipe', () => {
-    const pipe = new ObjectToArrayPipe()
-    it('> transforms obj to array', () => {
-      const result = pipe.transform({'a': '1', 'b': '2'})
-      expect(result).toEqual([{
-        key: 'a',
-        value: '1'
-      }, {
-        key: 'b',
-        value: '2'
-      }])
-    })
-  })
-})
\ No newline at end of file
diff --git a/src/util/pipes/objToArray.pipe.ts b/src/util/pipes/objToArray.pipe.ts
deleted file mode 100644
index 9320b3631..000000000
--- a/src/util/pipes/objToArray.pipe.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-interface ITransformedObj{
-  key: string
-  value: string
-}
-
-@Pipe({
-  name: 'objToArray',
-  pure: true
-})
-
-export class ObjectToArrayPipe implements PipeTransform{
-  public transform(input: { [key: string]: any }): ITransformedObj[]{
-    return Object.keys(input).map(key => {
-      return {
-        key,
-        value: input[key]
-      }
-    })
-  }
-}
\ No newline at end of file
diff --git a/src/util/pipes/pagination.pipe.ts b/src/util/pipes/pagination.pipe.ts
deleted file mode 100644
index b574b1f16..000000000
--- a/src/util/pipes/pagination.pipe.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-@Pipe({
-  name : 'searchResultPagination',
-})
-
-export class SearchResultPaginationPipe implements PipeTransform {
-  private _hitsPerPage: number = 15
-  private _pageNumber: number = 0
-  public transform(arr: any[], pageNumber?: number, hitsPerPage?: number) {
-    return arr.filter((_, idx) =>
-      (idx >= (pageNumber === undefined ? this._pageNumber : pageNumber) * (hitsPerPage === undefined ? this._hitsPerPage : hitsPerPage)) &&
-      idx < ((pageNumber === undefined ? this._pageNumber : pageNumber) + 1) * (hitsPerPage === undefined ? this._hitsPerPage : hitsPerPage))
-  }
-}
diff --git a/src/util/pipes/pluginBtnFabColor.pipe.ts b/src/util/pipes/pluginBtnFabColor.pipe.ts
deleted file mode 100644
index eb4d28a82..000000000
--- a/src/util/pipes/pluginBtnFabColor.pipe.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-
-@Pipe({
-  name: 'pluginBtnFabColorPipe',
-})
-
-export class PluginBtnFabColorPipe implements PipeTransform {
-  public transform([launchedSet, minimisedSet], pluginName) {
-    return minimisedSet.has(pluginName)
-      ? 'primary'
-      : launchedSet.has(pluginName)
-        ? 'accent'
-        : 'basic'
-  }
-}
diff --git a/src/util/pipes/sortDataEntriesIntoRegion.pipe.ts b/src/util/pipes/sortDataEntriesIntoRegion.pipe.ts
deleted file mode 100644
index 71433de55..000000000
--- a/src/util/pipes/sortDataEntriesIntoRegion.pipe.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-import { IDataEntry } from "../../services/stateStore.service";
-
-@Pipe({
-  name : 'sortDataEntriesToRegion',
-})
-
-export class SortDataEntriesToRegion implements PipeTransform {
-  public transform(regions: any[], datasets: IDataEntry[]): Array<{region: any, searchResults: IDataEntry[]}> {
-    return regions.map(region => ({
-      region,
-      searchResults : datasets.filter(dataset => dataset.parcellationRegion.some(r => r.name === region.name)),
-    }))
-  }
-}
diff --git a/src/util/pipes/spatialLandmarksToDatabrowserItem.pipe.ts b/src/util/pipes/spatialLandmarksToDatabrowserItem.pipe.ts
deleted file mode 100644
index 6972299d5..000000000
--- a/src/util/pipes/spatialLandmarksToDatabrowserItem.pipe.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-import { IDataEntry, ILandmark, IPlaneLandmarkGeometry, IPointLandmarkGeometry } from "../../services/stateStore.service";
-
-@Pipe({
-  name : 'spatialLandmarksToDataBrowserItemPipe',
-})
-
-export class SpatialLandmarksToDataBrowserItemPipe implements PipeTransform {
-  public transform(landmarks: ILandmark[]): Array<{region: any, searchResults: Array<Partial<IDataEntry>>}> {
-    return landmarks.map(landmark => ({
-      region : Object.assign({}, landmark, {
-        spatialLandmark : true,
-      }, landmark.geometry.type === 'point'
-        ? {
-          position : (landmark.geometry as IPointLandmarkGeometry).position.map(v => v * 1e6),
-        }
-        : landmark.geometry.type === 'plane'
-          ? {
-            POIs : (landmark.geometry as IPlaneLandmarkGeometry).corners.map(corner => corner.map(coord => coord * 1e6)),
-          }
-          : {}),
-      searchResults : [{
-        name : 'Associated dataset',
-        type : 'Associated dataset',
-        files : landmark.files,
-      }],
-    }))
-  }
-}
diff --git a/src/util/pipes/templateParcellationHasMoreInfo.pipe.ts b/src/util/pipes/templateParcellationHasMoreInfo.pipe.ts
deleted file mode 100644
index e94e975da..000000000
--- a/src/util/pipes/templateParcellationHasMoreInfo.pipe.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { Pipe, PipeTransform } from "@angular/core";
-import { IPublication } from "src/services/stateStore.service";
-
-interface KgSchemaId {
-  kgSchema: string
-  kgId: string
-}
-
-interface MoreInfo {
-  name: string
-  description: string
-  publications: IPublication[]
-  originDatasets: KgSchemaId[]
-  mindsId: KgSchemaId
-}
-
-const notNullNotEmptyString = (string) => !!string && string !== ''
-const notEmptyArray = (arr) => !!arr && arr instanceof Array && arr.length > 0
-
-@Pipe({
-  name: 'templateParcellationHasMoreInfoPipe',
-})
-
-export class TemplateParcellationHasMoreInfo implements PipeTransform {
-  public transform(obj: any): MoreInfo {
-
-    const { description, properties = {}, publications, name, originDatasets, mindsId } = obj
-    const { description: pDescriptions, publications: pPublications, name: pName, mindsId: pMindsId } = properties
-
-    const hasMoreInfo = notNullNotEmptyString(description)
-      || notNullNotEmptyString(pDescriptions)
-      || notEmptyArray(publications)
-      || notEmptyArray(pPublications)
-      || notEmptyArray(originDatasets)
-
-    return hasMoreInfo
-      ? {
-        name: pName || name,
-        description: pDescriptions || description,
-        publications: pPublications || publications,
-        originDatasets: notEmptyArray(originDatasets)
-          ? originDatasets
-          : [{ kgSchema: null, kgId: null }],
-        mindsId: pMindsId || mindsId,
-      }
-      : null
-  }
-}
diff --git a/src/util/pluginHandler.ts b/src/util/pluginHandler.ts
deleted file mode 100644
index e2767e294..000000000
--- a/src/util/pluginHandler.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export class PluginHandler {
-  public onShutdown: (callback: () => void) => void
-  public blink: (sec?: number) => void
-  public shutdown: () => void
-
-  public initState?: any
-  public initStateUrl?: string
-
-  public setInitManifestUrl: (url: string|null) => void
-
-  public setProgressIndicator: (progress: number) => void
-}
diff --git a/src/util/pureConstant.service.ts b/src/util/pureConstant.service.ts
index f15f92263..e3ff4e53e 100644
--- a/src/util/pureConstant.service.ts
+++ b/src/util/pureConstant.service.ts
@@ -1,11 +1,10 @@
 import { Inject, Injectable, OnDestroy } from "@angular/core";
 import { Store, select } from "@ngrx/store";
-import { Observable, Subscription, of, forkJoin, fromEvent, combineLatest } from "rxjs";
+import { Observable, Subscription, of, forkJoin, combineLatest } from "rxjs";
 import { viewerConfigSelectorUseMobileUi } from "src/services/state/viewerConfig.store.helper";
-import { shareReplay, tap, scan, catchError, filter, switchMap, map, take, distinctUntilChanged, mapTo } from "rxjs/operators";
+import { shareReplay, tap, scan, catchError, filter, switchMap, map, distinctUntilChanged, mapTo } from "rxjs/operators";
 import { HttpClient } from "@angular/common/http";
 import { viewerStateFetchedTemplatesSelector, viewerStateSetFetchedAtlases } from "src/services/state/viewerState.store.helper";
-import { AtlasWorkerService } from "src/atlasViewer/atlasViewer.workerService.service";
 import { LoggingService } from "src/logging";
 import { viewerStateFetchedAtlasesSelector, viewerStateSelectedTemplateSelector } from "src/services/state/viewerState/selectors";
 import { BS_ENDPOINT } from "src/util/constants";
@@ -185,15 +184,6 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
     return this._backendUrl
   }
 
-  /**
-   * TODO remove
-   * when removing, also remove relevant worker code
-   */
-  private workerUpdateParcellation$ = fromEvent(this.workerService.worker, 'message').pipe(
-    filter((message: MessageEvent) => message && message.data && message.data.type === 'UPDATE_PARCELLATION_REGIONS'),
-    map(({ data }) => data)
-  )
-
   public getRegionDetail(atlasId: string, parcId: string, spaceId: string, region: any) {
     return this.http.get<TRegionDetail>(
       `${this.bsEndpoint}/atlases/${encodeURIComponent(atlasId)}/parcellations/${encodeURIComponent(parcId)}/regions/${encodeURIComponent(region.name)}`,
@@ -330,7 +320,6 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}"
     private store: Store<any>,
     private http: HttpClient,
     private log: LoggingService,
-    private workerService: AtlasWorkerService,
     @Inject(BS_ENDPOINT) private bsEndpoint: string,
   ){
     this.darktheme$ = this.store.pipe(
diff --git a/src/util/util.module.ts b/src/util/util.module.ts
index 51b202ea5..4d817736e 100644
--- a/src/util/util.module.ts
+++ b/src/util/util.module.ts
@@ -1,10 +1,8 @@
 import { NgModule } from "@angular/core";
 import { FilterRowsByVisbilityPipe } from "src/components/flatTree/filterRowsByVisibility.pipe";
-import { DelayEventDirective } from "./directives/delayEvent.directive";
 import { KeyListner } from "./directives/keyDownListener.directive";
 
 import { StopPropagationDirective } from "./directives/stopPropagation.directive";
-import { FilterNullPipe } from "./pipes/filterNull.pipe";
 import { IncludesPipe } from "./pipes/includes.pipe";
 import { SafeResourcePipe } from "./pipes/safeResource.pipe";
 import { CaptureClickListenerDirective } from "./directives/captureClickListener.directive";
@@ -15,17 +13,12 @@ import { MediaQueryDirective } from './directives/mediaQuery.directive'
 import { LayoutModule } from "@angular/cdk/layout";
 import { MapToPropertyPipe } from "./pipes/mapToProperty.pipe";
 import { ClickOutsideDirective } from "src/util/directives/clickOutside.directive";
-import { CounterDirective } from "./directives/counter.directive";
 import { GetNthElementPipe } from "./pipes/getNthElement.pipe";
 import { ParseAsNumberPipe } from "./pipes/parseAsNumber.pipe";
 import { GetUniquePipe } from "./pipes/getUnique.pipe";
 import { GetPropertyPipe } from "./pipes/getProperty.pipe";
 import { FilterArrayPipe } from "./pipes/filterArray.pipe";
-import { FilterByPropertyPipe } from "./pipes/filterByProperty.pipe";
-import { ArrayContainsPipe } from "./pipes/arrayContains.pipe";
 import { DoiParserPipe } from "./pipes/doiPipe.pipe";
-import { TmpParcNamePipe } from "./pipes/_tmpParcName.pipe";
-import { ObjectToArrayPipe } from "./pipes/objToArray.pipe";
 import { GetFilenamePipe } from "./pipes/getFilename.pipe";
 
 @NgModule({
@@ -33,10 +26,8 @@ import { GetFilenamePipe } from "./pipes/getFilename.pipe";
     LayoutModule
   ],
   declarations: [
-    FilterNullPipe,
     FilterRowsByVisbilityPipe,
     StopPropagationDirective,
-    DelayEventDirective,
     KeyListner,
     IncludesPipe,
     SafeResourcePipe,
@@ -47,24 +38,17 @@ import { GetFilenamePipe } from "./pipes/getFilename.pipe";
     MediaQueryDirective,
     MapToPropertyPipe,
     ClickOutsideDirective,
-    CounterDirective,
     GetNthElementPipe,
     ParseAsNumberPipe,
     GetUniquePipe,
     GetPropertyPipe,
     FilterArrayPipe,
-    FilterByPropertyPipe,
-    ArrayContainsPipe,
     DoiParserPipe,
-    TmpParcNamePipe,
-    ObjectToArrayPipe,
     GetFilenamePipe,
   ],
   exports: [
-    FilterNullPipe,
     FilterRowsByVisbilityPipe,
     StopPropagationDirective,
-    DelayEventDirective,
     KeyListner,
     IncludesPipe,
     SafeResourcePipe,
@@ -75,17 +59,12 @@ import { GetFilenamePipe } from "./pipes/getFilename.pipe";
     MediaQueryDirective,
     MapToPropertyPipe,
     ClickOutsideDirective,
-    CounterDirective,
     GetNthElementPipe,
     ParseAsNumberPipe,
     GetUniquePipe,
     GetPropertyPipe,
     FilterArrayPipe,
-    FilterByPropertyPipe,
-    ArrayContainsPipe,
     DoiParserPipe,
-    TmpParcNamePipe,
-    ObjectToArrayPipe,
     GetFilenamePipe,
   ]
 })
diff --git a/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.ts b/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.ts
index c071875bb..4b203fcbf 100644
--- a/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.ts
+++ b/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.ts
@@ -128,6 +128,10 @@ export class NehubaGlueCmp implements IViewer<'nehuba'>, OnChanges, OnDestroy, A
     }))),
   )
 
+  public filterCustomLandmark(lm: any){
+    return !!lm['showInSliceView']
+  }
+
   public panelOrder$ = this.store$.pipe(
     select(ngViewerSelectorPanelOrder),
     distinctUntilChanged(),
diff --git a/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.template.html b/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.template.html
index d79c49a59..83852858e 100644
--- a/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.template.html
+++ b/src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.template.html
@@ -25,19 +25,19 @@
     [quick-tour-order]="quickTourSliceViewSlide.order"
     [quick-tour-overwrite-arrow]="sliceViewArrow"
     [quick-tour-overwrite-position]="quickTourOverwritingPos">
-    <ng-content *ngTemplateOutlet="ngPanelOverlayTmpl; context: { panelIndex: panelOrder$ | async | getNthElement : 0 | parseAsNumber }"></ng-content>
+    <ng-content *ngTemplateOutlet="ngPanelOverlayTmpl; context: { panelIndex: panelOrder$ | async | getProperty : 0 | parseAsNumber }"></ng-content>
   </div>
   <div class="w-100 h-100 position-relative" cell-ii>
-    <ng-content *ngTemplateOutlet="ngPanelOverlayTmpl; context: { panelIndex: panelOrder$ | async | getNthElement : 1 | parseAsNumber }"></ng-content>
+    <ng-content *ngTemplateOutlet="ngPanelOverlayTmpl; context: { panelIndex: panelOrder$ | async | getProperty : 1 | parseAsNumber }"></ng-content>
   </div>
   <div class="w-100 h-100 position-relative" cell-iii>
-    <ng-content *ngTemplateOutlet="ngPanelOverlayTmpl; context: { panelIndex: panelOrder$ | async | getNthElement : 2 | parseAsNumber }"></ng-content>
+    <ng-content *ngTemplateOutlet="ngPanelOverlayTmpl; context: { panelIndex: panelOrder$ | async | getProperty : 2 | parseAsNumber }"></ng-content>
   </div>
   <div class="w-100 h-100 position-relative" cell-iv
     quick-tour
     [quick-tour-description]="quickTour3dViewSlide.description"
     [quick-tour-order]="quickTour3dViewSlide.order">
-    <ng-content *ngTemplateOutlet="ngPanelOverlayTmpl; context: { panelIndex: panelOrder$ | async | getNthElement : 3 | parseAsNumber }"></ng-content>
+    <ng-content *ngTemplateOutlet="ngPanelOverlayTmpl; context: { panelIndex: panelOrder$ | async | getProperty : 3 | parseAsNumber }"></ng-content>
   </div>
 </current-layout>
 
@@ -84,7 +84,7 @@
 
       <!-- customLandmarks -->
       <!-- only show landmarks in slice views -->
-      <landmark-2d-flat-cmp *ngFor="let lm of (customLandmarks$ | async | filterByProperty : 'showInSliceView')"
+      <landmark-2d-flat-cmp *ngFor="let lm of (customLandmarks$ | async | filterArray : filterCustomLandmark)"
         (mouseenter)="handleMouseEnterCustomLandmark(lm)"
         (mouseleave)="handleMouseLeaveCustomLandmark(lm)"
         [color]="lm.color || [255, 255, 255]"
diff --git a/worker/worker.js b/worker/worker.js
index cd05c6ae4..2c73c7567 100644
--- a/worker/worker.js
+++ b/worker/worker.js
@@ -17,7 +17,6 @@ if (typeof self.importScripts === 'function')  self.importScripts('./worker-plot
 const validTypes = [
   'GET_LANDMARKS_VTK',
   'GET_USERLANDMARKS_VTK',
-  'BUILD_REGION_SELECTION_TREE',
   'PROPAGATE_PARC_REGION_ATTR'
 ]
 
@@ -32,8 +31,6 @@ const VALID_METHODS = [
 const validOutType = [
   'ASSEMBLED_LANDMARKS_VTK',
   'ASSEMBLED_USERLANDMARKS_VTK',
-  'RETURN_REBUILT_REGION_SELECTION_TREE',
-  'UPDATE_PARCELLATION_REGIONS'
 ]
 
 const getVertexHeader = (numVertex) => `POINTS ${numVertex} float`
@@ -229,80 +226,6 @@ const getuserLandmarksVtk = (action) => {
   })
 }
 
-const rebuildSelectedRegion = (payload) => {
-  const { selectedRegions, regions } = payload
-
-  /**
-   * active tree branch
-   * branch is active if ALL children are active
-   */
-  const activeTreeBranch = []
-  const isRegionActive = (region) => selectedRegions.some(r => r.name === region.name)
-    || region.children && region.children.length > 0 && region.children.every(isRegionActive)
-
-  /**
-   * some active tree branch
-   * branch is active if SOME children are active
-   */
-  const someActiveTreeBranch = []
-  const isSomeRegionActive = (region) => selectedRegions.some(r => r.name === region.name)
-    || region.children && region.children.length > 0 && region.children.some(isSomeRegionActive)
-
-  const handleRegion = (r) => {
-    isRegionActive(r) ? activeTreeBranch.push(r) : {}
-    isSomeRegionActive(r) ? someActiveTreeBranch.push(r) : {}
-    if (r.children && r.children.length > 0)
-      r.children.forEach(handleRegion)
-  }
-  regions.forEach(handleRegion)
-  postMessage({
-    type: 'RETURN_REBUILT_REGION_SELECTION_TREE',
-    rebuiltSelectedRegions: activeTreeBranch,
-    rebuiltSomeSelectedRegions: someActiveTreeBranch
-  })
-}
-const recursivePropagateAttri = (region, inheritAttrsOpts) => {
-
-  const inheritAttrs = Object.keys(inheritAttrsOpts)
-
-  const returnRegion = {
-    ...region
-  }
-  const newInhAttrsOpts = {}
-  for (const attr of inheritAttrs){
-    returnRegion[attr] = returnRegion[attr] || inheritAttrsOpts[attr]
-    newInhAttrsOpts[attr] = returnRegion[attr] || inheritAttrsOpts[attr]
-  }
-  returnRegion.children = returnRegion.children && Array.isArray(returnRegion.children)
-    ? returnRegion.children.map(c => recursivePropagateAttri(c, newInhAttrsOpts))
-    : null
-  return returnRegion
-}
-
-const propagateAttri = (parcellation, inheritAttrsOpts) => {
-  const inheritAttrs = Object.keys(inheritAttrsOpts)
-  if (inheritAttrs.indexOf('children') >= 0) throw new Error(`children attr cannot be inherited`)
-
-  const regions = Array.isArray(parcellation.regions)
-    ? parcellation.regions.map(r => recursivePropagateAttri(r, inheritAttrsOpts))
-    : []
-
-  return {
-    ...parcellation,
-    regions
-  }
-}
-
-const processParcRegionAttr = (payload) => {
-  const { parcellation, inheritAttrsOpts } = payload
-  const p = propagateAttri(parcellation, inheritAttrsOpts)
-  postMessage({
-    ...payload,
-    type: 'UPDATE_PARCELLATION_REGIONS',
-    parcellation: p
-  })
-}
-
 let plotyVtkUrl
 
 onmessage = (message) => {
@@ -355,12 +278,6 @@ onmessage = (message) => {
       case 'GET_USERLANDMARKS_VTK':
         getuserLandmarksVtk(message.data)
         return
-      case 'BUILD_REGION_SELECTION_TREE':
-        rebuildSelectedRegion(message.data)
-        return
-      case 'PROPAGATE_PARC_REGION_ATTR':
-        processParcRegionAttr(message.data)
-        return
       default:
         console.warn('unhandled worker action', message)
     }
-- 
GitLab