diff --git a/docs/releases/v2.5.6.md b/docs/releases/v2.5.6.md index b68bd54771ba235dcb3dabbb091b89b293957f7d..1b7ec38867f0a49b941d65996a8b82c6827367d8 100644 --- a/docs/releases/v2.5.6.md +++ b/docs/releases/v2.5.6.md @@ -2,4 +2,5 @@ ## Bugfix -- re-introduced explore in KG button for parcellation citations \ No newline at end of file +- re-introduced explore in KG button for parcellation citations + diff --git a/docs/releases/v2.5.7.md b/docs/releases/v2.5.7.md new file mode 100644 index 0000000000000000000000000000000000000000..9aaabad886b2affba5f2747f71b3021ade63ddf6 --- /dev/null +++ b/docs/releases/v2.5.7.md @@ -0,0 +1,5 @@ +# v2.5.7 + +## Feature + +- Add menu to change perspective orientation by coronal/sagittal/axial views. diff --git a/mkdocs.yml b/mkdocs.yml index 896264a35008a823b6baa91c834161f92bfd49bb..300b8ee5f336e62adc328f83b4f602b5dc894cf5 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.7: 'releases/v2.5.7.md' - v2.5.6: 'releases/v2.5.6.md' - v2.5.5: 'releases/v2.5.5.md' - v2.5.4: 'releases/v2.5.4.md' diff --git a/package.json b/package.json index 9a5300cd07ca4a9e8051e9147f1b4429c3ca7a55..c87724a7533539c7f37e81b9be6f2b089996675e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interactive-viewer", - "version": "2.5.6", + "version": "2.5.7", "description": "HBP interactive atlas viewer. Integrating KG query, dataset previews & more. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular", "scripts": { "build-aot": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'` ng build --prod && node ./third_party/matomo/processMatomo.js", diff --git a/src/util/pureConstant.service.spec.ts b/src/util/pureConstant.service.spec.ts index 7372f12e3a37d661b321fb051eae699c186761f6..82e3a591947131afe10f6449a06f7682f2211d3d 100644 --- a/src/util/pureConstant.service.spec.ts +++ b/src/util/pureConstant.service.spec.ts @@ -75,6 +75,7 @@ describe('> pureConstant.service.ts', () => { const expT1 = httpController.expectOne(`${MOCK_BS_ENDPOINT}/atlases/${encodeURIComponent(mockAtlas.id)}/spaces`) expT1.flush([]) + const expP1 = httpController.expectOne(`${MOCK_BS_ENDPOINT}/atlases/${encodeURIComponent(mockAtlas.id)}/parcellations`) expP1.flush([]) }) diff --git a/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.html b/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.html new file mode 100644 index 0000000000000000000000000000000000000000..ad8aca3171ea86ce9172a856a9ea3bd192f4995f --- /dev/null +++ b/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.html @@ -0,0 +1,40 @@ +<button mat-menu-item [mat-menu-trigger-for]="perspectiveOrientationMenu"> + Change orientation to +</button> + +<mat-menu #perspectiveOrientationMenu="matMenu"> + + <div class="d-flex align-items-center text-light"> + <button mat-button color="basic" class="flex-grow-1 text-left" + (click)="set3DViewPoint('coronal', 'first')"> + Coronal view + </button> + <button class="flex-grow-0" mat-button + (click)="set3DViewPoint('coronal', 'second')"> + <i class="fas fa-arrows-alt-h"></i> + </button> + </div> + + <div class="d-flex align-items-center text-light"> <!--mat-menu-item--> + <button mat-button color="basic" class="flex-grow-1 text-left" + (click)="set3DViewPoint('sagittal', 'first')"> + Sagittal view + </button> + <button class="flex-grow-0" mat-button + (click)="set3DViewPoint('sagittal', 'second')"> + <i class="fas fa-arrows-alt-h"></i> + </button> + </div> + + <div class="d-flex align-items-center text-light"> <!--mat-menu-item--> + <button mat-button color="basic" class="flex-grow-1 text-left" + (click)="set3DViewPoint('axial', 'first')"> + Axial view + </button> + <button class="flex-grow-0" mat-button + (click)="set3DViewPoint('axial', 'second')"> + <i class="fas fa-arrows-alt-h"></i> + </button> + </div> + +</mat-menu> diff --git a/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.sass b/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.sass new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.spec.ts b/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..48c4d290030e11728232a182bf7aa200131b8876 --- /dev/null +++ b/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.spec.ts @@ -0,0 +1,34 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ChangePerspectiveOrientationComponent } from './changePerspectiveOrientation.component'; +import { MockStore, provideMockStore } from "@ngrx/store/testing" +import { AngularMaterialModule } from 'src/sharedModules'; +import { CommonModule } from '@angular/common'; + +describe('ChangePerspectiveOrientationComponent', () => { + let component: ChangePerspectiveOrientationComponent; + let fixture: ComponentFixture<ChangePerspectiveOrientationComponent>; + let mockStore: MockStore; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ + AngularMaterialModule, + CommonModule + ], + declarations: [ ChangePerspectiveOrientationComponent ], + providers: [provideMockStore()], + + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ChangePerspectiveOrientationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.ts b/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c4bdb1300fb0e7bc094a81d2dcac2d39f67c0d1 --- /dev/null +++ b/src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component.ts @@ -0,0 +1,33 @@ +import { Component } from '@angular/core'; +import {viewerStateChangeNavigation} from "src/services/state/viewerState/actions"; +import {Store} from "@ngrx/store"; + +@Component({ + selector: 'app-change-perspective-orientation', + templateUrl: './changePerspectiveOrientation.component.html', + styleUrls: ['./changePerspectiveOrientation.component.sass'] +}) +export class ChangePerspectiveOrientationComponent { + + private viewOrientations = { + coronal: [[0,-1,1,0], [-1,0,0,1]], + sagittal: [[-1,-1,1,1], [-1,1,-1,1]], + axial: [[0,0,1,0], [1,0,0,0]] + } + + constructor(private store$: Store<any>,) { } + + public set3DViewPoint(plane: 'coronal' | 'sagittal' | 'axial', view: 'first' | 'second') { + + const orientation = this.viewOrientations[plane][view === 'first'? 0 : 1] + + this.store$.dispatch( + viewerStateChangeNavigation({ + navigation: { + perspectiveOrientation: orientation, + } + }) + ) + } + +} diff --git a/src/viewerModule/nehuba/viewerCtrl/module.ts b/src/viewerModule/nehuba/viewerCtrl/module.ts index dbf9ed121ca150593b2c3ac08bd0f5e91bcb750e..7be1186474bddac9d4c33772d28fb682bfa61794 100644 --- a/src/viewerModule/nehuba/viewerCtrl/module.ts +++ b/src/viewerModule/nehuba/viewerCtrl/module.ts @@ -5,6 +5,7 @@ import { ComponentsModule } from "src/components"; import { AngularMaterialModule } from "src/sharedModules"; import { UtilModule } from "src/util"; import { ViewerCtrlCmp } from "./viewerCtrlCmp/viewerCtrlCmp.component"; +import {ChangePerspectiveOrientationComponent} from "src/viewerModule/nehuba/viewerCtrl/change-perspective-orientation/changePerspectiveOrientation.component"; @NgModule({ imports: [ @@ -17,6 +18,7 @@ import { ViewerCtrlCmp } from "./viewerCtrlCmp/viewerCtrlCmp.component"; ], declarations: [ ViewerCtrlCmp, + ChangePerspectiveOrientationComponent ], exports: [ ViewerCtrlCmp diff --git a/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.template.html b/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.template.html index a1a1507eedbdcf739c18c24f77642fb397d6df84..60a004bbd682af81cecb8244ce2207d42a85c55e 100644 --- a/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.template.html +++ b/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.template.html @@ -41,3 +41,4 @@ </form> </ng-container> +<app-change-perspective-orientation></app-change-perspective-orientation>