How to use paraview-glance - 10 common examples

To help you get started, we’ve selected a few paraview-glance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kitware / paraview-glance / src / components / core / App / script.js View on Github external
if (this.origConsoleError) {
      window.console.error = this.origConsoleError;
    }

    shortcuts.forEach(({ key, action }) => {
      if (Actions[action]) {
        Mousetrap.unbind(key);
      }
    });

    this.pxmSub.unsubscribe();
    this.renderListener.removeListeners();
  },
  methods: Object.assign(
    mapMutations({
      showApp: Mutations.SHOW_APP,
      showLanding: Mutations.SHOW_LANDING,
      toggleLanding() {
        if (this.landingVisible) {
          this.showApp();
        } else {
          this.showLanding();
        }
      },
    }),
    mapActions({
      promptUserFiles: Actions.PROMPT_FOR_FILES,

      openSample: (dispatch, urls, names) => {
        // dispatch: delete all loaded files since this is only called
        // by clicking on sample data
        dispatch(Actions.OPEN_REMOTE_FILES, { urls, names }).then(() =>
github Kitware / paraview-glance / src / components / tools / MeasurementTools / script.js View on Github external
mounted() {
    this.threeDViewActive =
      this.proxyManager.getActiveView().getClassName() === 'vtkViewProxy';

    this.paletteCycler = createPaletteCycler(this.palette);
    // used during the duration of widget placement
    this.viewSubs = [];
    // used to show/hide widgets per slice
    this.repSubs = [];
    this.widgetStateSub = makeSubManager();
  },
  beforeDestroy() {
github Kitware / paraview-glance / src / vtk / LabelMapVolumeRepProxy / index.js View on Github external
function vtkLabelMapVolumeRepProxy(publicAPI, model) {
  // Set our className
  model.classHierarchy.push('vtkLabelMapVolumeRepProxy');

  const labelMapSub = makeSubManager();

  // Volume
  model.mapper = vtkVolumeMapper.newInstance();
  model.volume = vtkVolume.newInstance();
  model.property = model.volume.getProperty();

  model.property.setInterpolationTypeToNearest();

  function updateTransferFunctions(labelmap) {
    const colorMap = labelmap.getColorMap();

    const cfun = vtkColorTransferFunction.newInstance();
    const ofun = vtkPiecewiseFunction.newInstance();

    Object.keys(colorMap).forEach((label) => {
      const l = Number(label);
github Kitware / paraview-glance / src / vtk / LabelMapSliceRepProxy / index.js View on Github external
function vtkLabelMapSliceRepProxy(publicAPI, model) {
  // Set our className
  model.classHierarchy.push('vtkLabelMapSliceRepProxy');

  const labelMapSub = makeSubManager();

  model.property.setInterpolationType(InterpolationType.NEAREST);

  function updateTransferFunctions(labelmap) {
    const colorMap = labelmap.getColorMap();

    const cfun = vtkColorTransferFunction.newInstance();
    const ofun = vtkPiecewiseFunction.newInstance();

    Object.keys(colorMap).forEach((label) => {
      const l = Number(label);
      cfun.addRGBPoint(l, ...colorMap[label].slice(0, 3).map((c) => c / 255));
      ofun.addPoint(l, colorMap[label][3] / 255);
    });

    model.property.setRGBTransferFunction(cfun);
github Kitware / paraview-glance / src / components / core / App / script.js View on Github external
mounted() {
    // listen for proxyManager changes
    this.renderListener = vtkListenerHelper.newInstance(
      () => {
        if (!this.loadingState) {
          this.proxyManager.autoAnimateViews();
        }
      },
      () =>
        [].concat(
          this.proxyManager.getSources(),
          this.proxyManager.getRepresentations(),
          this.proxyManager.getViews()
        )
    );
    this.pxmSub = this.proxyManager.onProxyRegistrationChange(
      this.renderListener.resetListeners
    );
github Kitware / paraview-glance / src / components / controls / SliceControl / script.js View on Github external
}

// ----------------------------------------------------------------------------

const OPTS = {
  onUpdate: ['updateOpacity'],
  onChange: {
    opacity: 'updateOpacity',
  },
};

// ----------------------------------------------------------------------------
// Add custom method
// ----------------------------------------------------------------------------

const component = helper.generateComponent('SliceControl', FIELDS, true, OPTS);
Object.assign(component.methods, {
  isSliceAvailable,
  updateOpacity,
});

export default component;
github Kitware / paraview-glance / src / components / controls / Molecule / script.js View on Github external
import helper from 'paraview-glance/src/components/core/Datasets/helper';

const FIELDS = [
  { name: 'tolerance', initialValue: 1 },
  { name: 'atomicRadiusScaleFactor', initialValue: 1 },
  { name: 'bondRadius', initialValue: 1 },
  // { name: 'deltaBondFactor', initialValue: 1 },
  { name: 'hideElements', initialValue: '' },
];

export default helper.generateComponent('Molecule', FIELDS, false, {
  onChange: {
    bondRadius: 'updateData',
    atomicRadiusScaleFactor: 'updateData',
    // tolerance: 'updateData',
  },
});
github Kitware / paraview-glance / src / store / fileLoader.js View on Github external
singleFileList.map((file, i) => {
          // Handle raw
          if (getExtension(file.name) === 'raw') {
            return readRawFile(file, state.rawInfos[i]).then((dataset) =>
              readers.push({
                name: file.name,
                dataset,
              })
            );
          }

          return ReaderFactory.loadFiles([file]).then((rs) =>
            readers.push(...rs)
          );
        }),
        ReaderFactory.loadFileSeries(
github Kitware / paraview-glance / src / components / core / BrowserIssues / script.js View on Github external
function getBrowserIssues() {
  const view = viewHelper.getView(this.proxyManager, DEFAULT_VIEW_TYPE);
  if (view) {
    const glRW = view.getOpenglRenderWindow();
    const allInfo = glRW.getGLInformations();
    const { UNMASKED_RENDERER, UNMASKED_VENDOR, WEBGL_VERSION } = allInfo;

    if (WEBGL_VERSION.value < 2) {
      this.$set(this.issues, 'webglVersion', WEBGL_VERSION.value);
    }

    const strToTest = `${UNMASKED_VENDOR.value} / ${UNMASKED_RENDERER.value}`.toLowerCase();
    if (strToTest.indexOf('intel') !== -1) {
      this.$set(this.issues, 'integratedGPU', UNMASKED_RENDERER.value);
    }
    // if (strToTest.indexOf('angle') !== -1) {
    //   this.$set(this.issues, 'angle', true);
    // }
github Kitware / paraview-glance / src / app.js View on Github external
export function createViewer(container, proxyConfig = null) {
  const proxyConfiguration = proxyConfig || activeProxyConfig || Config.Proxy;
  const proxyManager = vtkProxyManager.newInstance({ proxyConfiguration });

  const store = createStore(proxyManager);

  // subscription won't be unsubscribed b/c we currently
  // don't have a way to destroy a viewer
  registerProxyManagerHooks(proxyManager, store);

  /* eslint-disable no-new */
  new Vue({
    el: container,
    components: { App },
    store,
    vuetify: new Vuetify(),
    template: '',
  });