How to use the mout/src/array/contains function in mout

To help you get started, we’ve selected a few mout 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 / arctic-viewer / lib / types / ImageQueryDataModel.js View on Github external
export default function build({ viewer, dataType }) {
  // Can we handle the data
  if (!contains(dataType, 'tonic-query-data-model') || dataType.length > 1) {
    return false;
  }

  viewer.imageBuilder = new QueryDataModelImageBuilder(viewer.queryDataModel);
  viewer.imageBuilder.update();

  return true;
}
github Kitware / arctic-viewer / lib / types / Histogram2DPlotly.js View on Github external
export default function build({ basepath, viewer, dataType }) {
  // Can we handle the data
  if (!contains(dataType, 'histogram2D') || !contains(dataType, 'plotly')) {
    return false;
  }

  viewer.ui = 'ChartViewer';
  viewer.allowMagicLens = false;
  viewer.chartBuilder = new ChartBuilder(viewer.queryDataModel);

  viewer.queryDataModel.fetchData();

  return true;
}
github Kitware / arctic-viewer / lib / types / index.js View on Github external
const viewer = {
    ui: 'GenericViewer',
    config,
    allowMagicLens: true,
  };

  // Initializer shared variables
  config.lookupTableManager = lookupTableManager;

  // Update background if available
  if (data && data.metadata && data.metadata.backgroundColor) {
    viewer.bgColor = data.metadata.backgroundColor;
  }

  // Update QueryDataModel if needed
  if (contains(dataType, 'tonic-query-data-model')) {
    viewer.queryDataModel =
      config.queryDataModel || new QueryDataModel(data, basepath);
  }

  // Find the right viewer and build it
  const args = { basepath, data, callback, viewer, dataType };
  while (viewerCount && !foundViewer) {
    viewerCount -= 1;
    foundViewer = dataViewers[viewerCount](args);
  }

  setImmediate(() => callback(viewer));
  return foundViewer;
}
github Kitware / arctic-viewer / lib / types / DepthComposite.js View on Github external
export default function build({ viewer, dataType }) {
  // Can we handle the data
  if (
    !contains(dataType, 'webgl-composite') &&
    !contains(dataType, 'depth-composite')
  ) {
    return false;
  }

  viewer.pipelineModel = new PipelineModel(viewer.queryDataModel.originalData);
  viewer.imageBuilder = new DepthCompositeImageBuilder(
    viewer.queryDataModel,
    viewer.pipelineModel,
    viewer.config.lookupTableManager
  );
  viewer.imageBuilder.update();

  return true;
}
github Kitware / arctic-viewer / lib / types / VTKVolumeSLICDebug.js View on Github external
export default function build({ basepath, viewer, dataType }) {
  // Can we handle the data
  if (!contains(dataType, 'vtk-slic-volume-debug')) {
    return false;
  }

  const surfaceClusters = new ClusterSurfaceDataModel(viewer.queryDataModel, 2);

  viewer.ui = 'GeometryViewer';
  viewer.allowMagicLens = false;
  viewer.geometryBuilder = surfaceClusters;
  viewer.menuAddOn = [
    ,
  ];
github Kitware / arctic-viewer / lib / types / SortedComposite.js View on Github external
export default function build({ viewer, dataType }) {
  // Can we handle the data
  if (!contains(dataType, 'sorted-composite')) {
    return false;
  }

  if (contains(dataType, 'multi-color-by')) {
    viewer.pipelineModel = new PipelineModel(
      viewer.queryDataModel.originalData,
      true
    );
    viewer.imageBuilder = new MultiColorBySortedImageBuilder(
      viewer.queryDataModel,
      viewer.config.lookupTableManager,
      viewer.pipelineModel
    );
    viewer.imageBuilder.update();
  } else {
    viewer.imageBuilder = new SortedCompositeImageBuilder(
      viewer.queryDataModel,
      viewer.config.lookupTableManager
    );
    viewer.imageBuilder.update();
github Kitware / arctic-viewer / lib / types / Chart.js View on Github external
export default function build({ basepath, viewer, dataType }) {
  // Can we handle the data
  if (!contains(dataType, 'chart')) {
    return false;
  }

  viewer.ui = 'ChartViewer';
  viewer.allowMagicLens = false;
  viewer.chartBuilder = new ChartBuilder(viewer.queryDataModel);

  viewer.queryDataModel.fetchData();

  return true;
}
github Kitware / arctic-viewer / lib / types / DataProber.js View on Github external
export default function build({ viewer, dataType, callback }) {
  let ProberImageBuilder = DataProberImageBuilder;
  let dimensions = null;

  // Can we handle the data
  if (
    !contains(dataType, 'in-situ-data-prober') &&
    !(contains(dataType, 'data-prober') && contains(dataType, 'binary'))
  ) {
    return false;
  }

  // Handle the image and binary format
  if (contains(dataType, 'data-prober') && contains(dataType, 'binary')) {
    ProberImageBuilder = BinaryDataProberImageBuilder;
    dimensions = viewer.queryDataModel.originalData.DataProber.dimensions;
  } else {
    dimensions = viewer.queryDataModel.originalData.InSituDataProber.dimensions;
  }

  // Create 2 viewer choice
  const singleView = {
    name: 'Single View',
github Kitware / arctic-viewer / lib / types / TimeFloatImage.js View on Github external
export default function build({ viewer, dataType }) {
  // Can we handle the data
  if (!contains(dataType, 'float-image')) {
    return false;
  }

  let colors = palettes.Paired;
  const configJson = viewer.queryDataModel.originalData;
  if (
    configJson.metadata &&
    configJson.metadata.probePalette &&
    configJson.metadata.probePalette in palettes
  ) {
    colors = palettes[configJson.metadata.probePalette];
  }

  const timeSize = viewer.queryDataModel.getSize('time');
  if (
    viewer.queryDataModel.originalData.FloatImage.layers.length > 1 ||
github Kitware / arctic-viewer / lib / factory.js View on Github external
getJSON(url, (error, data) => {
      const dataType = data.type;
      let queryDataModel = null;
      let ready = 0;

      if (contains(dataType, 'ensemble-dataset')) {
        const renderers = {};
        const expected = data.Ensemble.datasets.length;

        // Let the factory know to not build everything
        buildViewerForEnsemble = true;

        data.Ensemble.datasets.forEach((ds) => {
          createViewer(basepath + ds.data, (viewer) => {
            ready += 1;
            if (viewer.ui === 'ViewerSelector') {
              renderers[ds.name] = {
                builder: viewer.list[0].imageBuilder,
                name: ds.name,
                queryDataModel: viewer.list[0].queryDataModel,
              };
              viewer.list[0].imageBuilder.name = ds.name;