SaveMDWorkspaceToVTK v1

../_images/SaveMDWorkspaceToVTK-v1_dlg.png

SaveMDWorkspaceToVTK dialog.

Summary

Saves MD workspaces to VTK file types which can be loaded by ParaView. MDHisto workspaces are saved as .vts files and MDEvent workspaces as .vtu files.

Properties

Name Direction Type Default Description
InputWorkspace Input IMDWorkspace Mandatory MDWorkspace to save/export
Filename Input string Mandatory Save location. Allowed extensions: [‘.vts’, ‘.vtu’]
Normalization Input string AutoSelect The visual normalization option. The automatic default will choose a normalization based on your data type and instrument. Allowed values: [‘AutoSelect’, ‘NoNormalization’, ‘NumEventsNormalization’, ‘VolumeNormalization’]
RecursionDepth Input number 5 The recursion depth is only required for MDEvent workspaces and determines to which level data should be displayed.
CompressorType Input string NONE Select which compression library to use. Allowed values: [‘NONE’, ‘ZLIB’]

Description

The algorithm SaveMDWorkspaceToVTK will write an IMDHistoWorkspace or IMDEventWorkspace to either a .vts or .vtu file, respectively.This file can be directly loaded into a standalone ParaView application.

To make use of all stored out features, such as axes annotations, it is required to load the NonOrthogonalSource plugin. To set this plugin navigate to Tools > Manage Plugins and open the Plugin Manager. Enable the Auto Load option on the and press Load Selected.

Note that it is currently not possible to save out workspaces with more than three dimensions.

Usage

import os
signalInput = [i for i in range(1,28)]
errorInput = [1 for i in range(1,28)]

ws = CreateMDHistoWorkspace(SignalInput=signalInput, ErrorInput=errorInput, Dimensionality='3',
                            Extents='-1,1,-1,1,-1,1', NumberOfBins='3,3,3', Names='A,B,C', Units='U,T,W')

ws2 = CreateMDHistoWorkspace(SignalInput='1,2,3,4,5,6,7,8,9', ErrorInput='1,1,1,1,1,1,1,1,1', Dimensionality='2',
                            Extents='-1,1,-1,1', NumberOfBins='3,3', Names='A,B', Units='U,T')

savefile = os.path.join(config["defaultsave.directory"], "mdhws.vts")
SaveMDWorkspaceToVTK(InputWorkspace = ws, Filename = savefile)

print("File created: {}".format(os.path.exists(savefile)))
File created: True

Categories: AlgorithmIndex | MDAlgorithms

Source

C++ source: SaveMDWorkspaceToVTK.cpp (last modified: 2019-06-05)

C++ header: SaveMDWorkspaceToVTK.h (last modified: 2018-10-05)