diff --git a/docs/releases/v2.13.4.md b/docs/releases/v2.13.4.md index d91f822860eae0e66df37e5343a397043cec012f..666387071289003028004e1f1a1d2bc53fea5644 100644 --- a/docs/releases/v2.13.4.md +++ b/docs/releases/v2.13.4.md @@ -5,10 +5,12 @@ - Properly navigate to volume of interest based on volume meta: - properly calculate the orientation - properly calculate enclosed, and navigate to closest point if outside +- Added button to navigate to the point assignment UI ## Bugfix - Fixed expected siibra-api version +- Fixed previously selected point not rendering ## Behind the scenes diff --git a/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.html b/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.html index f031edbf5a99879f0041c02a545f234d0b4cd71a..2691032bb97317125bc1179257a61f61f2f27cb5 100644 --- a/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.html +++ b/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.html @@ -12,6 +12,15 @@ </div> <ng-template [ngIf]="df$ | async" let-df> + + <ng-template [ngIf]="point$ | async | sandsToNum" let-coordinates> + <button mat-icon-button class="sxplr-m-2" + (click)="navigateToPoint(coordinates.coords)" + [matTooltip]="'Navigate To ' + (coordinates.coords | numbers : 2 | addUnitAndJoin : '')"> + <i class="fas fa-map-marker-alt"></i> + </button> + </ng-template> + <button mat-raised-button class="sxplr-m-2" (click)="openDialog(datatableTmpl)"> diff --git a/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.spec.ts b/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.spec.ts index 2f1a0ef9f6fa2e6802f49ffcd1a60f5d32e5459f..86fd2406a4594e0acbc1acf0036e799db7325631 100644 --- a/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.spec.ts +++ b/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.spec.ts @@ -5,6 +5,7 @@ import { SAPI } from 'src/atlasComponents/sapi/sapi.service'; import { EMPTY } from 'rxjs'; import { MatDialogModule } from '@angular/material/dialog'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { provideMockStore } from '@ngrx/store/testing'; describe('PointAssignmentComponent', () => { let component: PointAssignmentComponent; @@ -14,12 +15,15 @@ describe('PointAssignmentComponent', () => { await TestBed.configureTestingModule({ declarations: [ PointAssignmentComponent ], imports: [ MatDialogModule, NoopAnimationsModule ], - providers: [{ - provide: SAPI, - useValue: { - v3Get: () => EMPTY + providers: [ + provideMockStore(), + { + provide: SAPI, + useValue: { + v3Get: () => EMPTY + } } - }] + ] }) .compileComponents(); diff --git a/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.ts b/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.ts index 00ee69f552743fe8cd9a771dbfb44e6cd00ced89..0dbe66f73574a47914db245b094c99948f8ef739 100644 --- a/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.ts +++ b/src/atlasComponents/sapiViews/volumes/point-assignment/point-assignment.component.ts @@ -9,6 +9,8 @@ import { PathReturn } from 'src/atlasComponents/sapi/typeV3'; import { TFace, TSandsPoint } from 'src/util/types'; import { TZipFileConfig } from "src/zipFilesOutput/type" import { environment } from "src/environments/environment" +import { Store } from '@ngrx/store'; +import { atlasSelection } from 'src/state'; const DOING_PROB_ASGMT = "Performing probabilistic assignment ..." const DOING_LABEL_ASGMT = "Probabilistic assignment failed. Performing labelled assignment ..." @@ -31,14 +33,14 @@ export class PointAssignmentComponent implements OnDestroy { #error$ = new BehaviorSubject<string>(null) error$ = this.#error$.asObservable() - #point = new BehaviorSubject<TSandsPoint>(null) + point$ = new BehaviorSubject<TSandsPoint>(null) @Input() set point(val: TSandsPoint|TFace) { const { '@type': type } = val if (type === "siibra-explorer/surface/face") { return } - this.#point.next(val) + this.point$.next(val) } #template = new BehaviorSubject<SxplrTemplate>(null) @@ -57,7 +59,7 @@ export class PointAssignmentComponent implements OnDestroy { clickOnRegion = new EventEmitter<{ target: SxplrRegion, event: MouseEvent }>() df$: Observable<PathReturn<"/map/assign">> = combineLatest([ - this.#point, + this.point$, this.#parcellation, this.#template, ]).pipe( @@ -112,7 +114,7 @@ export class PointAssignmentComponent implements OnDestroy { map(df => df.columns as string[]) ) - constructor(private sapi: SAPI, private dialog: MatDialog) {} + constructor(private sapi: SAPI, private dialog: MatDialog, private store: Store) {} #dialogRef: MatDialogRef<unknown> openDialog(tmpl: TemplateRef<unknown>){ @@ -135,7 +137,7 @@ export class PointAssignmentComponent implements OnDestroy { } zipfileConfig$: Observable<TZipFileConfig[]> = combineLatest([ - this.#point, + this.point$, this.#parcellation, this.#template, this.df$ @@ -150,6 +152,17 @@ export class PointAssignmentComponent implements OnDestroy { }] as TZipFileConfig[] }) ) + + navigateToPoint(coordsInMm: number[]){ + this.store.dispatch( + atlasSelection.actions.navigateTo({ + animation: true, + navigation: { + position: coordsInMm.map(v => v * 1e6) + } + }) + ) + } } function generateReadMe(pt: TSandsPoint, parc: SxplrParcellation, tmpl: SxplrTemplate){ diff --git a/src/atlasComponents/sapiViews/volumes/sandsToNum.pipe.ts b/src/atlasComponents/sapiViews/volumes/sandsToNum.pipe.ts new file mode 100644 index 0000000000000000000000000000000000000000..5f254ad5c0ccf5e74699f8f3d1606b4134775d2d --- /dev/null +++ b/src/atlasComponents/sapiViews/volumes/sandsToNum.pipe.ts @@ -0,0 +1,14 @@ +import { Pipe, PipeTransform } from "@angular/core"; +import { TSandsPoint } from "src/util/types"; + +@Pipe({ + name: 'sandsToNum', + pure: true +}) +export class SandsToNumPipe implements PipeTransform{ + public transform(val: TSandsPoint) { + return { + coords: val.coordinates.map(v => v.value / 1e6) + } + } +} diff --git a/src/atlasComponents/sapiViews/volumes/volumes.module.ts b/src/atlasComponents/sapiViews/volumes/volumes.module.ts index 1a5a32d0f5cf07a536f3e559c29ad835ca1abb6f..a2e461bff5120ae1d79abce59e1fc2287ec3008d 100644 --- a/src/atlasComponents/sapiViews/volumes/volumes.module.ts +++ b/src/atlasComponents/sapiViews/volumes/volumes.module.ts @@ -8,12 +8,16 @@ import { MatDialogModule } from '@angular/material/dialog'; import { MatButtonModule } from '@angular/material/button'; import { MatSortModule } from '@angular/material/sort'; import { ZipFilesOutputModule } from 'src/zipFilesOutput/module'; +import { SandsToNumPipe } from "./sandsToNum.pipe" +import { SapiViewsUtilModule } from '../util'; +import { MatTooltipModule } from '@angular/material/tooltip'; @NgModule({ declarations: [ - PointAssignmentComponent + PointAssignmentComponent, + SandsToNumPipe, ], imports: [ CommonModule, @@ -24,6 +28,8 @@ import { ZipFilesOutputModule } from 'src/zipFilesOutput/module'; MatButtonModule, MatSortModule, ZipFilesOutputModule, + SapiViewsUtilModule, + MatTooltipModule, ], exports: [ PointAssignmentComponent diff --git a/src/viewerModule/threeSurfer/threeSurferGlue/threeSurfer.component.ts b/src/viewerModule/threeSurfer/threeSurferGlue/threeSurfer.component.ts index 9689793140503916e47fc7677659ecdb91228839..05b5d7f437f80102f03169b716113e2f233d8276 100644 --- a/src/viewerModule/threeSurfer/threeSurferGlue/threeSurfer.component.ts +++ b/src/viewerModule/threeSurfer/threeSurferGlue/threeSurfer.component.ts @@ -356,6 +356,9 @@ export class ThreeSurferGlueCmp implements IViewer<'threeSurfer'>, AfterViewInit map(([ latIdxReg, cms ]) => { const cm = cms[0] const returnValue: TLatCm = {} + if (!cm) { + return returnValue + } for (const lat in latIdxReg) { returnValue[lat] = { labelIndices: [], diff --git a/src/viewerModule/viewerCmp/viewerCmp.template.html b/src/viewerModule/viewerCmp/viewerCmp.template.html index 14259c7f42e1b25cb7455688129282dcee4a453d..ecdd84d7eef19889f3aa783e35a7f5a389a790b7 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.template.html +++ b/src/viewerModule/viewerCmp/viewerCmp.template.html @@ -902,7 +902,7 @@ <div class="sxplr-list-like-button-body"> - <ng-template [ngIf]="data?.point?.point"> + <ng-template [ngIf]="data?.point"> <span class="sxplr-list-like-button-body-line"> {{ data.point | nmToMm | numbers | addUnitAndJoin : '' }} (mm) </span>