UNPKG

@itk-viewer/element

Version:
41 lines 1.77 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; import { css, html } from 'lit'; import { customElement } from 'lit/decorators.js'; import { SelectorController } from 'xstate-lit'; import { ItkViewport } from './itk-viewport.js'; let ImageInfoViewport = class ImageInfoViewport extends ItkViewport { setActor(actor) { super.setActor(actor); if (!this.actor) return; this.image = new SelectorController(this, this.actor, (state) => state.context.image); } render() { const image = this.image?.value; if (!image) return html `<h1>No Image</h1>`; const { name, imageType, spatialDims, direction } = image; const imageInfo = `Image Type: ${JSON.stringify(imageType, null, 2)}\nSpatial Dimensions: ${spatialDims}\nDirection: ${direction}`; return html ` <h1>Image Information</h1> <pre>Name: ${name}</pre> <pre>${imageInfo}</pre> `; } static { this.styles = css ` :host { margin: 0 auto; padding: 2rem; } `; } }; ImageInfoViewport = __decorate([ customElement('itk-image-info-viewport') ], ImageInfoViewport); export { ImageInfoViewport }; //# sourceMappingURL=itk-image-info-viewport.js.map