Skip to content
Snippets Groups Projects
Commit 9d0ad220 authored by fsdavid's avatar fsdavid
Browse files

Show message when region connectivity does not exist

parent 50e44a92
No related branches found
No related tags found
No related merge requests found
......@@ -92,7 +92,7 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
public logConnectionsString: string
public pureConnections: any
public connectedAreas: BehaviorSubject<any[]> = new BehaviorSubject([])
public noConnectivityForRegion: boolean
private subscriptions: Subscription[] = []
public allRegions = []
private regionIndexInMatrix = -1
......@@ -217,14 +217,18 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
// ToDo this is caused by the bug existing on siibra python
private fixDatasetFormat = (ds) => ds.name.includes('{')? ({
...JSON.parse(ds.name.substring(ds.name.indexOf('{')).replace(/'/g, '"')),
...ds,
...JSON.parse(ds.name.substring(ds.name.indexOf('{')).replace(/'/g, '"'))
}) : ds
fetchConnectivity() {
this.sapi.getParcellation(this.atlas["@id"], this.parcellation["@id"]).getFeatureInstance(this.selectedDataset['@id'])
.pipe(catchError(() => {
this.fetching = false
return of(null)
}))
.subscribe(ds=> {
this.setMatrixData(ds)
this.setMatrixData(ds)
this.fetching = false
})
}
......@@ -232,6 +236,14 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
setMatrixData(data) {
const matrixData = data as SapiParcellationFeatureMatrixModel
this.regionIndexInMatrix = (matrixData.columns as Array<string>).findIndex(md => md === this.regionName)
if (this.regionIndexInMatrix < 0) {
this.fetching = false
this.noConnectivityForRegion = true
this.changeDetectionRef.detectChanges()
return
} else if (this.noConnectivityForRegion) {
this.noConnectivityForRegion = false
}
this.sapi.processNpArrayData<PARSE_TYPEDARRAY.RAW_ARRAY>(matrixData.matrix, PARSE_TYPEDARRAY.RAW_ARRAY)
.then(matrix => {
const regionProfile = matrix.rawArray[this.regionIndexInMatrix]
......
......@@ -55,7 +55,7 @@
<mat-checkbox class="mr-2"
[checked]="logChecked"
(change)="changeLog($event.checked)"
[disabled]="logDisabled">Log 10</mat-checkbox>
[disabled]="logDisabled || noConnectivityForRegion">Log 10</mat-checkbox>
<button mat-button [matMenuTriggerFor]="exportMenu"
[disabled]="!connectedAreas.value">
<i class="fas fa-download mb-2 mr-2"></i>
......@@ -65,12 +65,13 @@
<hbp-connectivity-matrix-row
#connectivityComponent
*ngIf="regionName && !fetching"
*ngIf="regionName && !fetching && !noConnectivityForRegion"
[region]="regionName + (regionHemisphere? ' - ' + regionHemisphere : '')"
[connections]="connectionsString"
show-export="true" hide-export-view="true"
theme="dark">
</hbp-connectivity-matrix-row>
<div *ngIf="noConnectivityForRegion">No connectivity for the region.</div>
<full-connectivity-grid #fullConnectivityGrid
[matrix]="matrixString"
[datasetName]="selectedDataset?.name"
......@@ -79,7 +80,7 @@
</full-connectivity-grid>
<mat-menu #exportMenu="matMenu">
<button mat-menu-item (click)="exportConnectivityProfile()">Regional</button>
<button mat-menu-item [disabled]="noConnectivityForRegion" (click)="exportConnectivityProfile()">Regional</button>
<button mat-menu-item (click)="exportFullConnectivity()">Dataset</button>
</mat-menu>
</div>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment