Mantid
Loading...
Searching...
No Matches
SaveFITS.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2016 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
11#include "MantidDataHandling/DllConfig.h"
12
13namespace Mantid {
14namespace DataHandling {
15
19class MANTID_DATAHANDLING_DLL SaveFITS final : public API::Algorithm {
20public:
21 const std::string name() const override final;
22
23 int version() const override final;
24 const std::vector<std::string> seeAlso() const override { return {"LoadFITS", "SaveNXTomo"}; }
25
26 const std::string category() const override final;
27
28 const std::string summary() const override final;
29
30private:
31 void init() override final;
32
33 void exec() override final;
34
35 std::map<std::string, std::string> validateInputs() override;
36
37 void saveFITSImage(const API::MatrixWorkspace_sptr &img, const std::string &filename);
38
39 void writeFITSHeaderBlock(const API::MatrixWorkspace_sptr &img, std::ofstream &file);
40
41 void writeFITSImageMatrix(const API::MatrixWorkspace_sptr &img, std::ofstream &file);
42
43 void writeFITSHeaderEntry(const std::string &hdr, std::ofstream &file);
44
45 std::string makeBitDepthHeader(size_t depth) const;
46
47 void writeFITSHeaderAxesSizes(const API::MatrixWorkspace_sptr &img, std::ofstream &file);
48
49 void writePaddingFITSHeaders(size_t count, std::ofstream &file);
50
51 static const size_t g_maxBitDepth;
52 static const std::array<int, 3> g_bitDepths;
53 static const size_t g_maxBytesPP;
54 // size of header entries in bytes
55 static const size_t g_maxLenHdr;
56 // pre-defined header contents
57 static const std::string g_FITSHdrEnd;
58 static const std::string g_FITSHdrFirst;
59 static const std::string g_bitDepthPre;
60 static const std::string g_bitDepthPost;
61 static const std::string g_FITSHdrAxes;
62 static const std::string g_FITSHdrExtensions;
63 static const std::string g_FITSHdrRefComment1;
64 static const std::string g_FITSHdrRefComment2;
65};
66
67} // namespace DataHandling
68} // namespace Mantid
int count
counter
Definition: Matrix.cpp:37
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
SaveFITS : Save images in FITS formats.
Definition: SaveFITS.h:19
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: SaveFITS.h:24
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
Helper class which provides the Collimation Length for SANS instruments.
STL namespace.