Mantid
Loading...
Searching...
No Matches
SaveNXTomo.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//---------------------------------------------------
10// Includes
11//---------------------------------------------------
12#include "MantidAPI/Algorithm.h"
13#include "MantidDataHandling/DllConfig.h"
17#include <vector>
18
19namespace Mantid {
20namespace DataHandling {
21
56class MANTID_DATAHANDLING_DLL SaveNXTomo final : public API::Algorithm {
57public:
58 SaveNXTomo();
60 const std::string name() const override { return "SaveNXTomo"; }
61
63 const std::string summary() const override {
64 return "Saves one or more workspaces (of type MatrixWorkspace) to a file "
65 "in the NXTomo format.";
66 }
67
69 int version() const override { return (1); }
70 const std::vector<std::string> seeAlso() const override { return {"SaveNexusProcessed"}; }
71
73 const std::string category() const override {
74 return "DataHandling\\Nexus;DataHandling\\Imaging;"
75 "Diffraction\\DataHandling";
76 }
77
78private:
80 void init() override;
82 void exec() override;
84 bool processGroups() override;
85
87 void setupFile();
88
90 void writeSingleWorkspace(const DataObjects::Workspace2D_sptr &workspace);
91
94 void writeLogValues(const DataObjects::Workspace2D_sptr &workspace, std::size_t thisFileInd);
95 void writeIntensityValue(const DataObjects::Workspace2D_sptr &workspace, std::size_t thisFileInd);
96 void writeImageKeyValue(const DataObjects::Workspace2D_sptr &workspace, std::size_t thisFileInd);
97
99 void processAll();
100
101 // Include error data in the written file
108 std::string m_filename;
109 // Dimensions for axis in nxTomo file.
111 // Infinite file range dimensions / for use with makeData data and error
113
115 static const std::string NXTOMO_VER;
116
117 std::vector<DataObjects::Workspace2D_sptr> m_workspaces;
118
119 // hold reference to NeXusFile;
120 std::unique_ptr<Nexus::File> m_nxFile;
121};
122
123} // namespace DataHandling
124} // namespace Mantid
IPeaksWorkspace_sptr workspace
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
Saves a workspace into a NeXus/HDF5 NXTomo file.
Definition SaveNXTomo.h:56
static const std::string NXTOMO_VER
file format version
Definition SaveNXTomo.h:115
const std::string summary() const override
Summary of algorithms purpose.
Definition SaveNXTomo.h:63
std::vector< DataObjects::Workspace2D_sptr > m_workspaces
Definition SaveNXTomo.h:117
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
Definition SaveNXTomo.h:70
int version() const override
Algorithm's version.
Definition SaveNXTomo.h:69
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition SaveNXTomo.h:60
std::unique_ptr< Nexus::File > m_nxFile
Definition SaveNXTomo.h:120
const std::string category() const override
Algorithm's category for identification.
Definition SaveNXTomo.h:73
std::string m_filename
The filename of the output file.
Definition SaveNXTomo.h:108
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
std::vector< dimsize_t > DimVector
Helper class which provides the Collimation Length for SANS instruments.