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"
16#include <vector>
17
18namespace Mantid {
19namespace DataHandling {
20
55class MANTID_DATAHANDLING_DLL SaveNXTomo final : public API::Algorithm {
56public:
57 SaveNXTomo();
59 const std::string name() const override { return "SaveNXTomo"; }
60
62 const std::string summary() const override {
63 return "Saves one or more workspaces (of type MatrixWorkspace) to a file "
64 "in the NXTomo format.";
65 }
66
68 int version() const override { return (1); }
69 const std::vector<std::string> seeAlso() const override { return {"SaveNexusProcessed"}; }
70
72 const std::string category() const override {
73 return "DataHandling\\Nexus;DataHandling\\Imaging;"
74 "Diffraction\\DataHandling";
75 }
76
77private:
79 void init() override;
81 void exec() override;
83 bool processGroups() override;
84
86 ::NeXus::File setupFile();
87
89 void writeSingleWorkspace(const DataObjects::Workspace2D_sptr &workspace, ::NeXus::File &nxFile);
90
93 void writeLogValues(const DataObjects::Workspace2D_sptr &workspace, ::NeXus::File &nxFile, int thisFileInd);
94 void writeIntensityValue(const DataObjects::Workspace2D_sptr &workspace, ::NeXus::File &nxFile, int thisFileInd);
95 void writeImageKeyValue(const DataObjects::Workspace2D_sptr &workspace, ::NeXus::File &nxFile, int thisFileInd);
96
98 void processAll();
99
100 // Include error data in the written file
104 std::vector<int64_t> m_slabStart;
105 std::vector<int64_t> m_slabSize;
107 std::string m_filename;
108 // Dimensions for axis in nxTomo file.
109 std::vector<int64_t> m_dimensions;
110 // Infinite file range dimensions / for use with makeData data and error
111 std::vector<int64_t> m_infDimensions;
112
114 static const std::string NXTOMO_VER;
115
116 std::vector<DataObjects::Workspace2D_sptr> m_workspaces;
117};
118
119} // namespace DataHandling
120} // namespace Mantid
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Saves a workspace into a NeXus/HDF5 NXTomo file.
Definition: SaveNXTomo.h:55
static const std::string NXTOMO_VER
file format version
Definition: SaveNXTomo.h:114
const std::string summary() const override
Summary of algorithms purpose.
Definition: SaveNXTomo.h:62
std::vector< DataObjects::Workspace2D_sptr > m_workspaces
Definition: SaveNXTomo.h:116
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:69
int version() const override
Algorithm's version.
Definition: SaveNXTomo.h:68
std::vector< int64_t > m_slabSize
Definition: SaveNXTomo.h:105
const std::string name() const override
Algorithm's name for identification overriding a virtual method.
Definition: SaveNXTomo.h:59
std::vector< int64_t > m_dimensions
Definition: SaveNXTomo.h:109
std::vector< int64_t > m_slabStart
Definition: SaveNXTomo.h:104
std::vector< int64_t > m_infDimensions
Definition: SaveNXTomo.h:111
const std::string category() const override
Algorithm's category for identification.
Definition: SaveNXTomo.h:72
std::string m_filename
The filename of the output file.
Definition: SaveNXTomo.h:107
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
Helper class which provides the Collimation Length for SANS instruments.