Browse Source

volume param tweaks, handle 0 sigma

Alexander Rose 6 years ago
parent
commit
ab7dd9eaf3

+ 3 - 3
src/mol-geo/geometry/direct-volume/direct-volume.ts

@@ -73,7 +73,7 @@ export namespace DirectVolume {
 
     export const Params = {
         ...BaseGeometry.Params,
-        isoValue: PD.Numeric(0.22, { min: -1, max: 1, step: 0.01 }),
+        isoValueNorm: PD.Numeric(0.22, { min: 0, max: 1, step: 0.01 }, { description: 'Normalized Isolevel Value' }),
         renderMode: PD.Select('volume', RenderModeOptions),
         controlPoints: PD.LineGraph([
             Vec2.create(0.19, 0.0), Vec2.create(0.2, 0.05), Vec2.create(0.25, 0.05), Vec2.create(0.26, 0.0),
@@ -122,7 +122,7 @@ export namespace DirectVolume {
             boundingSphere: ValueCell.create(boundingSphere),
             invariantBoundingSphere: ValueCell.create(invariantBoundingSphere),
 
-            uIsoValue: ValueCell.create(props.isoValue),
+            uIsoValue: ValueCell.create(props.isoValueNorm),
             uBboxMin: bboxMin,
             uBboxMax: bboxMax,
             uBboxSize: bboxSize,
@@ -145,7 +145,7 @@ export namespace DirectVolume {
     }
 
     function updateValues(values: DirectVolumeValues, props: PD.Values<Params>) {
-        ValueCell.updateIfChanged(values.uIsoValue, props.isoValue)
+        ValueCell.updateIfChanged(values.uIsoValue, props.isoValueNorm)
         ValueCell.updateIfChanged(values.uAlpha, props.alpha)
         ValueCell.updateIfChanged(values.dUseFog, props.useFog)
         ValueCell.updateIfChanged(values.dRenderMode, props.renderMode)

+ 1 - 1
src/mol-model/volume/data.ts

@@ -55,7 +55,7 @@ namespace VolumeIsoValue {
     }
 
     export function calcRelative(stats: VolumeData['dataStats'], absoluteValue: number): number {
-        return (absoluteValue - stats.mean) / stats.sigma
+        return stats.sigma === 0 ? 0 : ((absoluteValue - stats.mean) / stats.sigma)
     }
 
     export function toAbsolute(value: VolumeIsoValue): Absolute {

+ 1 - 1
src/mol-plugin/ui/controls/parameters.tsx

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ * Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
  *
  * @author David Sehnal <david.sehnal@gmail.com>
  * @author Alexander Rose <alexander.rose@weirdbyte.de>

+ 1 - 1
src/mol-repr/structure/visual/gaussian-density-volume.ts

@@ -95,7 +95,7 @@ export function GaussianDensityVolumeVisual(): ComplexVisual<GaussianDensityVolu
             if (newProps.radiusOffset !== currentProps.radiusOffset) state.createGeometry = true
             if (newProps.smoothness !== currentProps.smoothness) {
                 state.createGeometry = true
-                newProps.isoValue = Math.exp(-newProps.smoothness)
+                newProps.isoValueNorm = Math.exp(-newProps.smoothness)
             }
         }
     })

+ 0 - 1
src/mol-repr/volume/direct-volume.ts

@@ -152,7 +152,6 @@ export async function createDirectVolume(ctx: VisualContext, volume: VolumeData,
         await createDirectVolume2d(runtime, webgl, volume, directVolume)
 }
 
-
 //
 
 export const DirectVolumeParams = {

+ 2 - 2
src/mol-repr/volume/isosurface.ts

@@ -25,12 +25,12 @@ const IsoValueParam = PD.Conditioned(
         'absolute': PD.Converted(
             (v: VolumeIsoValue) => VolumeIsoValue.toAbsolute(v).absoluteValue,
             (v: number) => VolumeIsoValue.absolute(VolumeData.Empty.dataStats, v),
-            PD.Numeric(0, { min: -1, max: 1, step: 0.01 })
+            PD.Numeric(0.5, { min: -1, max: 1, step: 0.01 })
         ),
         'relative': PD.Converted(
             (v: VolumeIsoValue) => VolumeIsoValue.toRelative(v).relativeValue,
             (v: number) => VolumeIsoValue.relative(VolumeData.Empty.dataStats, v),
-            PD.Numeric(0, { min: -1, max: 1, step: 0.01 })
+            PD.Numeric(2, { min: -10, max: 10, step: 0.01 })
         )
     },
     (v: VolumeIsoValue) => v.kind === 'absolute' ? 'absolute' : 'relative',