Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
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;
}
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;
}
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;
}
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 = [
,
];
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();
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;
}
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',
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 ||
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;