How to use paraviewweb - 10 common examples

To help you get started, we’ve selected a few paraviewweb 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 / paraviewweb / src / InfoViz / Native / HistogramSelector / score.js View on Github external
div.uncertainty *= uncertScale;
    });
    // console.log('DBG partitionSelection', JSON.stringify(partitionSelection, 2));

    // Construct a partition annotation:
    let partitionAnnotation = null;
    if (def.annotation && !model.provider.shouldCreateNewAnnotation()) {
      // don't send a new selection unless it's changed.
      const saveGen = partitionSelection.generation;
      partitionSelection.generation = def.annotation.selection.generation;
      const changeSet = { score: def.regions };
      if (!deepEquals(partitionSelection, def.annotation.selection)) {
        partitionSelection.generation = saveGen;
        changeSet.selection = partitionSelection;
      }
      partitionAnnotation = AnnotationBuilder.update(def.annotation, {
        selection: partitionSelection,
        score: def.regions,
      });
    } else {
      partitionAnnotation = AnnotationBuilder.annotation(
        partitionSelection,
        def.regions,
        1,
        ''
      );
    }
    AnnotationBuilder.updateReadOnlyFlag(
      partitionAnnotation,
      model.readOnlyFields
    );
    return partitionAnnotation;
github OpenChemistry / tomviz / web / src / tomviz-viewer.js View on Github external
import GenericViewer      from 'paraviewweb/src/React/Viewers/ImageBuilderViewer';
import QueryDataModel     from 'paraviewweb/src/IO/Core/QueryDataModel';
import LookupTableManager from 'paraviewweb/src/Common/Core/LookupTableManager';

import ImageQueryDataModelViewer from 'arctic-viewer/lib/types/ImageQueryDataModel';
import SortedCompositeViewer     from 'arctic-viewer/lib/types/SortedComposite';

// Resource images -----------------------------------------------------------

import link from './tomvizLink.png';

// Global variables -----------------------------------------------------------

const iOS = /iPad|iPhone|iPod/.test(window.navigator.platform);
const lookupTableManager = new LookupTableManager();
const dataViewers = [
  ImageQueryDataModelViewer,
  SortedCompositeViewer,
];

// Add class to body if iOS device --------------------------------------------

if (iOS) {
  document.querySelector('body').classList.add('is-ios-device');
}

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

function viewerBuilder(basepath, data, config, callback) {
  var foundViewer = false;
  var viewerCount = dataViewers.length;
github Kitware / paraviewweb / src / InfoViz / Native / HistogramSelector / score.js View on Github external
function dividersToPartition(def, scores) {
    if (!def.regions || !def.dividers || !scores) return null;
    if (def.regions.length !== def.dividers.length + 1) return null;
    const uncertScale = getUncertScale(def);

    const partitionSelection = SelectionBuilder.partition(
      def.name,
      def.dividers
    );
    partitionSelection.partition.dividers.forEach((div, index) => {
      div.uncertainty *= uncertScale;
    });
    // console.log('DBG partitionSelection', JSON.stringify(partitionSelection, 2));

    // Construct a partition annotation:
    let partitionAnnotation = null;
    if (def.annotation && !model.provider.shouldCreateNewAnnotation()) {
      // don't send a new selection unless it's changed.
      const saveGen = partitionSelection.generation;
      partitionSelection.generation = def.annotation.selection.generation;
      const changeSet = { score: def.regions };
      if (!deepEquals(partitionSelection, def.annotation.selection)) {
github Kitware / paraviewweb / src / InfoViz / Native / HistogramSelector / score.js View on Github external
function sendScores(def, passive = false) {
    const scoreData = dividersToPartition(def, model.scores);
    if (scoreData === null) {
      console.error('Cannot translate scores to send to provider');
      return;
    }
    if (model.provider.isA('SelectionProvider')) {
      if (!scoreData.name) {
        AnnotationBuilder.setDefaultName(scoreData);
        if (model.provider.isA('AnnotationStoreProvider')) {
          scoreData.name = model.provider.getNextStoredAnnotationName(
            scoreData.name
          );
        }
      }
      if (!passive) {
        model.provider.setAnnotation(scoreData);
      } else if (
        model.provider.isA('AnnotationStoreProvider') &&
        model.provider.getStoredAnnotation(scoreData.id)
      ) {
        // Passive means we don't want to set the active annotation, but if there is
        // a stored annotation matching these score dividers, we still need to update
        // that stored annotation
        model.provider.updateStoredAnnotations({
github Kitware / paraviewweb / src / InfoViz / Core / HistogramBinHoverProvider / index.js View on Github external
// ----------------------------------------------------------------------------

export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);

  CompositeClosureHelper.destroy(publicAPI, model);
  CompositeClosureHelper.isA(publicAPI, model, 'HistogramBinHoverProvider');
  CompositeClosureHelper.event(publicAPI, model, 'HoverBinChange');

  histogramBinHoverProvider(publicAPI, model);
}

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

export const newInstance = CompositeClosureHelper.newInstance(extend);

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

export default { newInstance, extend };
github Kitware / paraviewweb / src / InfoViz / Native / HistogramSelector / example / index.js View on Github external
const histogramSelectorContainer = document.createElement('div');
histogramSelectorContainer.style.position = 'relative';
histogramSelectorContainer.style.width = '58%';
histogramSelectorContainer.style.height = defaultHeight;
histogramSelectorContainer.style.float = 'left';
bodyElt.appendChild(histogramSelectorContainer);

const fieldSelectorContainer = document.createElement('div');
fieldSelectorContainer.style.position = 'relative';
fieldSelectorContainer.style.width = '42%';
fieldSelectorContainer.style.height = defaultHeight;
fieldSelectorContainer.style.float = 'left';
fieldSelectorContainer.style['font-size'] = '10pt';
bodyElt.appendChild(fieldSelectorContainer);

const provider = CompositeClosureHelper.newInstance(
  (publicAPI, model, initialValues = {}) => {
    Object.assign(model, initialValues);
    FieldProvider.extend(publicAPI, model, initialValues);
    Histogram1DProvider.extend(publicAPI, model, initialValues);
    HistogramBinHoverProvider.extend(publicAPI, model);
    LegendProvider.extend(publicAPI, model, initialValues);
    ScoresProvider.extend(publicAPI, model, initialValues);
    SelectionProvider.extend(publicAPI, model, initialValues);
  }
)(dataModel);

// set provider behaviors
provider.setFieldsSorted(true);
provider.getFieldNames().forEach((name) => {
  provider.addLegendEntry(name);
});
github Kitware / paraviewweb / src / InfoViz / Core / AnnotationStoreProvider / index.js View on Github external
export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);

  CompositeClosureHelper.destroy(publicAPI, model);
  CompositeClosureHelper.isA(publicAPI, model, PROVIDER_NAME);
  CompositeClosureHelper.event(publicAPI, model, 'StoreAnnotationChange');
  CompositeClosureHelper.set(publicAPI, model, ['defaultEmptyAnnotationName']);
  CompositeClosureHelper.get(publicAPI, model, ['defaultEmptyAnnotationName']);

  annotationStoreProvider(publicAPI, model);
}

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

export const newInstance = CompositeClosureHelper.newInstance(extend);

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

export default { newInstance, extend };
github Kitware / paraviewweb / src / InfoViz / Core / SelectionProvider / index.js View on Github external
CompositeClosureHelper.isA(publicAPI, model, 'SelectionProvider');
  CompositeClosureHelper.get(publicAPI, model, ['selection', 'annotation']);
  CompositeClosureHelper.event(publicAPI, model, 'selectionChange');
  CompositeClosureHelper.event(publicAPI, model, 'annotationChange');
  CompositeClosureHelper.event(
    publicAPI,
    model,
    'dataSelectionSubscriptionChange'
  );

  selectionProvider(publicAPI, model);
}

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

export const newInstance = CompositeClosureHelper.newInstance(extend);

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

export default { newInstance, extend };
github Kitware / paraviewweb / src / InfoViz / Core / LegendProvider / index.js View on Github external
};

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

export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);

  CompositeClosureHelper.destroy(publicAPI, model);
  CompositeClosureHelper.isA(publicAPI, model, 'LegendProvider');

  legendProvider(publicAPI, model);
}

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

export const newInstance = CompositeClosureHelper.newInstance(extend);

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

export default Object.assign({ newInstance, extend }, STATIC);
github Kitware / paraviewweb / src / InfoViz / Core / ScoresProvider / index.js View on Github external
// ----------------------------------------------------------------------------

export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);

  CompositeClosureHelper.destroy(publicAPI, model);
  CompositeClosureHelper.isA(publicAPI, model, 'ScoresProvider');
  CompositeClosureHelper.event(publicAPI, model, 'scoresChange', false);
  CompositeClosureHelper.get(publicAPI, model, ['scores']);

  scoresProvider(publicAPI, model);
}

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

export const newInstance = CompositeClosureHelper.newInstance(extend);

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

export default { newInstance, extend };