diff --git a/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts b/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts index 86476d4b9345522b9a6e2f384c77b36f18342d8c..983ceac740fb229df3fe1d6e16dc118d8f7d6dc1 100644 --- a/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts +++ b/src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts @@ -43,12 +43,13 @@ export namespace VolumeStreaming { export function createParams(data?: VolumeServerInfo.Data) { // fake the info const info = data || { kind: 'em', header: { sampling: [fakeSampling], availablePrecisions: [{ precision: 0, maxVoxels: 0 }] }, emDefaultContourLevel: VolumeIsoValue.relative(0) }; + const box = (data && data.structure.boundary.box) || Box3D.empty(); return { view: PD.MappedStatic('selection-box', { 'box': PD.Group({ - bottomLeft: PD.Vec3(Vec3.create(-22.4, -33.4, -21.6)), - topRight: PD.Vec3(Vec3.create(-7.1, -10, -0.9)), + bottomLeft: PD.Vec3(box.min), + topRight: PD.Vec3(box.max), }, { description: 'Static box defined by cartesian coords.', isFlat: true }), 'selection-box': PD.Group({ radius: PD.Numeric(5, { min: 0, max: 50, step: 0.5 }), @@ -59,7 +60,7 @@ export namespace VolumeStreaming { // 'auto': PD.Group({ }), // based on camera distance/active selection/whatever, show whole structure or slice. }, { options: [['box', 'Bounded Box'], ['selection-box', 'Selection'], ['cell', 'Whole Structure']] }), detailLevel: PD.Select<number>(Math.min(1, info.header.availablePrecisions.length - 1), - info.header.availablePrecisions.map((p, i) => [i, `${i + 1} (${Math.pow(p.maxVoxels, 1 / 3) | 0}^3)`] as [number, string])), + info.header.availablePrecisions.map((p, i) => [i, `${i + 1} [ ${Math.pow(p.maxVoxels, 1 / 3) | 0}^3 cells ]`] as [number, string])), channels: info.kind === 'em' ? PD.Group({ 'em': channelParam('EM', Color(0x638F8F), info.emDefaultContourLevel || VolumeIsoValue.relative(1), info.header.sampling[0].valuesInfo[0]) @@ -184,6 +185,7 @@ export namespace VolumeStreaming { switch (params.view.name) { case 'box': box = Box3D.create(params.view.params.bottomLeft, params.view.params.topRight); + emptyData = Box3D.volume(box) < 0.0001; break; case 'selection-box': { box = Box3D.create(Vec3.clone(params.view.params.bottomLeft), Vec3.clone(params.view.params.topRight)); diff --git a/src/mol-plugin/behavior/dynamic/volume-streaming/transformers.ts b/src/mol-plugin/behavior/dynamic/volume-streaming/transformers.ts index d7c6f12f27e27a0b1e302c471d80b0481a610e32..e3aa09b470dc0900c6fd36442dedc19d4ca6b582 100644 --- a/src/mol-plugin/behavior/dynamic/volume-streaming/transformers.ts +++ b/src/mol-plugin/behavior/dynamic/volume-streaming/transformers.ts @@ -52,7 +52,7 @@ export const InitVolumeStreaming = StateAction.build({ const infoObj = await state.updateTree(infoTree).runInContext(taskCtx); - const behTree = state.build().to(infoTree.ref).apply(CreateVolumeStreamingBehavior, PD.getDefaultValues(VolumeStreaming.createParams(infoObj.data))) + const behTree = state.build().to(infoTree.ref).apply(CreateVolumeStreamingBehavior, PD.getDefaultValues(VolumeStreaming.createParams(infoObj.data))); if (params.method === 'em') { behTree.apply(VolumeStreamingVisual, { channel: 'em' }, { props: { isGhost: true } }); } else {