VTK  9.4.20241218
vtkSEPReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright (c) GeometryFactory
3// SPDX-License-Identifier: BSD-3-Clause
15#ifndef vtkSEPReader_h
16#define vtkSEPReader_h
17
18#include "vtkIOImageModule.h" // For export macro
19
20#include "vtkExtentTranslator.h" // for vtkExtentTranslator
21#include "vtkImageAlgorithm.h"
22#include "vtkNew.h" // for ivars
23
24#include <array> // for std::array
25#include <cstdint> // for std::uint8_t and std::uint32_t
26#include <string> // for std::string
27
28namespace details
29{
30VTK_ABI_NAMESPACE_BEGIN
31enum class EndiannessType : std::uint8_t
32{
35};
36
37static constexpr int SEP_READER_MAX_DIMENSION = 32u;
38VTK_ABI_NAMESPACE_END
39}
40
41VTK_ABI_NAMESPACE_BEGIN
42class vtkStringArray;
43
44class VTKIOIMAGE_EXPORT vtkSEPReader : public vtkImageAlgorithm
45{
46public:
47 static vtkSEPReader* New();
49 void PrintSelf(ostream& os, vtkIndent indent) override;
50
56
61 vtkGetMacro(OutputGridDimension, int);
62 vtkSetMacro(OutputGridDimension, int);
63
68 vtkSetMacro(ExtentSplitMode, int);
69 vtkGetMacro(ExtentSplitMode, int);
70
71 vtkGetMacro(DataOrigin, VTK_FUTURE_CONST double*);
72 vtkGetMacro(DataSpacing, VTK_FUTURE_CONST double*);
73
78 vtkGetObjectMacro(AllDimensions, vtkStringArray);
79
84 vtkGetObjectMacro(AllRanges, vtkStringArray);
85
96
97 vtkSetMacro(FixedDimensionValue1, int);
98 vtkSetMacro(FixedDimensionValue2, int);
99 vtkGetVector2Macro(FixedDimRange, int);
100
101 bool CanReadFile(VTK_FILEPATH const char*);
102
103 std::array<std::int32_t, 6> ComputeExtent() const;
104
105protected:
107
110
112 bool ReadData(vtkImageData*, int*);
113
117 std::string FileName;
118 int OutputGridDimension = 3;
119 int ExtentSplitMode = vtkExtentTranslator::BLOCK_MODE;
122 std::string XDimension = "CDP";
123 std::string YDimension = "LINE";
124 std::string ZDimension = "DEPTH"; // used only in 3D
125 std::string FixedDimension1 = "OFFSET";
126 std::string FixedDimension2 = "DEPTH"; // used only in 2D
127 int FixedDimensionValue1 = details::SEP_READER_MAX_DIMENSION;
128 int FixedDimensionValue2 = details::SEP_READER_MAX_DIMENSION;
129 int FixedDimRange[2] = { 0, 0 };
130
133
134private:
135 enum class DataFormatType : std::uint8_t
136 {
137 XDR_FLOAT = 0,
138 XDR_INT = 1,
139 XDR_DOUBLE = 2
140 };
141
145 DataFormatType DataFormat = DataFormatType::XDR_FLOAT;
146 details::EndiannessType Endianness;
147 int Dimensions[details::SEP_READER_MAX_DIMENSION];
148 double OutputSpacing[3];
149 double OutputOrigin[3];
150 std::string Label[details::SEP_READER_MAX_DIMENSION];
151 std::string DataFileType;
152 std::string BinaryFilename;
153 int ESize = 4;
157 int FixedDimension1ArrayId = details::SEP_READER_MAX_DIMENSION;
158 int FixedDimension2ArrayId = details::SEP_READER_MAX_DIMENSION;
159
160 void ReadDataPiece(FILE* file, char*& dataOutput, vtkIdType offset, vtkIdType range);
161
162 vtkSEPReader(const vtkSEPReader&) = delete;
163 void operator=(const vtkSEPReader&) = delete;
164};
165
166VTK_ABI_NAMESPACE_END
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:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Allocate and hold a VTK object.
Definition vtkNew.h:167
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)
std::string FileName
Exposed Properties.
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:315
#define VTK_FILEPATH