VTK  9.2.6
vtkSEPReader.h
Go to the documentation of this file.
1/*=========================================================================
2 Copyright (c) GeometryFactory
3 All rights reserved.
4 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
5
6 This software is distributed WITHOUT ANY WARRANTY; without even
7 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 PURPOSE. See the above copyright notice for more information.
9
10=========================================================================*/
19#ifndef vtkSEPReader_h
20#define vtkSEPReader_h
21
22#include "vtkIOImageModule.h" // For export macro
23
24#include "vtkExtentTranslator.h" // for vtkExtentTranslator
25#include "vtkImageAlgorithm.h"
26#include "vtkNew.h" // for ivars
27
28#include <array> // for std::array
29#include <cstdint> // for std::uint8_t
30#include <string> // for std::string
31
32namespace details
33{
34enum class EndiannessType : std::uint8_t
35{
38};
39
40static constexpr int SEP_READER_MAX_DIMENSION = 32u;
41}
42
43class vtkStringArray;
44
45class VTKIOIMAGE_EXPORT vtkSEPReader : public vtkImageAlgorithm
46{
47public:
48 static vtkSEPReader* New();
50 void PrintSelf(ostream& os, vtkIndent indent) override;
51
57
62 vtkGetMacro(OutputGridDimension, int);
63 vtkSetMacro(OutputGridDimension, int);
64
69 vtkSetMacro(ExtentSplitMode, int);
70 vtkGetMacro(ExtentSplitMode, int);
71
72 vtkGetMacro(DataOrigin, VTK_FUTURE_CONST double*);
73 vtkGetMacro(DataSpacing, VTK_FUTURE_CONST double*);
74
79 vtkGetObjectMacro(AllDimensions, vtkStringArray);
80
85 vtkGetObjectMacro(AllRanges, vtkStringArray);
86
97
98 vtkSetMacro(FixedDimensionValue1, int);
99 vtkSetMacro(FixedDimensionValue2, int);
100 vtkGetVector2Macro(FixedDimRange, int);
101
102 bool CanReadFile(VTK_FILEPATH const char*);
103
104 std::array<std::int32_t, 6> ComputeExtent() const;
105
106protected:
108
111
113 bool ReadData(vtkImageData*, int*);
114
118 std::string FileName = "";
119 int OutputGridDimension = 3;
120 int ExtentSplitMode = vtkExtentTranslator::BLOCK_MODE;
123 std::string XDimension = "CDP";
124 std::string YDimension = "LINE";
125 std::string ZDimension = "DEPTH"; // used only in 3D
126 std::string FixedDimension1 = "OFFSET";
127 std::string FixedDimension2 = "DEPTH"; // used only in 2D
128 int FixedDimensionValue1 = details::SEP_READER_MAX_DIMENSION;
129 int FixedDimensionValue2 = details::SEP_READER_MAX_DIMENSION;
130 int FixedDimRange[2] = { 0, 0 };
131
134
135private:
136 enum class DataFormatType : std::uint8_t
137 {
138 XDR_FLOAT = 0,
139 XDR_INT = 1,
140 XDR_DOUBLE = 2
141 };
142
146 DataFormatType DataFormat = DataFormatType::XDR_FLOAT;
147 details::EndiannessType Endianness;
148 int Dimensions[details::SEP_READER_MAX_DIMENSION];
149 double OutputSpacing[3];
150 double OutputOrigin[3];
151 std::string Label[details::SEP_READER_MAX_DIMENSION];
152 std::string DataFileType;
153 std::string BinaryFilename;
154 int ESize = 4;
158 int FixedDimension1ArrayId = details::SEP_READER_MAX_DIMENSION;
159 int FixedDimension2ArrayId = details::SEP_READER_MAX_DIMENSION;
160
161 void ReadDataPiece(FILE* file, char*& dataOutput, vtkIdType offset, vtkIdType range);
162
163 vtkSEPReader(const vtkSEPReader&) = delete;
164 void operator=(const vtkSEPReader&) = delete;
165};
166
167#endif // vtkSEPReader_h
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Allocate and hold a VTK object.
Definition vtkNew.h:56
Stanford Exploration Project files reader.
std::array< std::int32_t, 6 > ComputeExtent() const
int RequestData(vtkInformation *request, vtkInformationVector **, vtkInformationVector *) override
This is called in response to a REQUEST_DATA request from the executive.
vtkGetCharFromStdStringMacro(FileName)
vtkSetStdStringFromCharMacro(ZDimension)
vtkNew< vtkStringArray > AllRanges
vtkSetStdStringFromCharMacro(YDimension)
vtkSetStdStringFromCharMacro(FixedDimension2)
bool ReadData(vtkImageData *, int *)
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkNew< vtkStringArray > AllDimensions
vtkSetStdStringFromCharMacro(XDimension)
Specify the name for each spatial / fixed dimension.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSetStdStringFromCharMacro(FixedDimension1)
bool ReadHeader()
static vtkSEPReader * New()
bool CanReadFile(VTK_FILEPATH const char *)
vtkSetStdStringFromCharMacro(FileName)
Specify file name for the SEP Header file.
a vtkAbstractArray subclass for strings
static constexpr int SEP_READER_MAX_DIMENSION
int vtkIdType
Definition vtkType.h:332
#define VTK_FILEPATH