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=========================================================================*/
22#ifndef vtkSEPReader_h
23#define vtkSEPReader_h
24
25#include "vtkIOImageModule.h" // For export macro
26
27#include "vtkExtentTranslator.h" // for vtkExtentTranslator
28#include "vtkImageAlgorithm.h"
29#include "vtkNew.h" // for ivars
30
31#include <array> // for std::array
32#include <string> // for std::string
33
34namespace details
35{
36enum class EndiannessType : std::uint8_t
37{
40};
41
42static constexpr int SEP_READER_MAX_DIMENSION = 32u;
43}
44
45class vtkStringArray;
46
47class VTKIOIMAGE_EXPORT vtkSEPReader : public vtkImageAlgorithm
48{
49public:
50 static vtkSEPReader* New();
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
59
64 vtkGetMacro(OutputGridDimension, int);
65 vtkSetMacro(OutputGridDimension, int);
66
71 vtkSetMacro(ExtentSplitMode, int);
72 vtkGetMacro(ExtentSplitMode, int);
73
74 vtkGetMacro(DataOrigin, VTK_FUTURE_CONST double*);
75 vtkGetMacro(DataSpacing, VTK_FUTURE_CONST double*);
76
81 vtkGetObjectMacro(AllDimensions, vtkStringArray);
82
87 vtkGetObjectMacro(AllRanges, vtkStringArray);
88
99
100 vtkSetMacro(FixedDimensionValue1, int);
101 vtkSetMacro(FixedDimensionValue2, int);
102 vtkGetVector2Macro(FixedDimRange, int);
103
104 bool CanReadFile(VTK_FILEPATH const char*);
105
106 std::array<std::int32_t, 6> ComputeExtent() const;
107
108protected:
110
113
115 bool ReadData(vtkImageData*, int*);
116
120 std::string FileName = "";
121 int OutputGridDimension = 3;
122 int ExtentSplitMode = vtkExtentTranslator::BLOCK_MODE;
125 std::string XDimension = "CDP";
126 std::string YDimension = "LINE";
127 std::string ZDimension = "DEPTH"; // used only in 3D
128 std::string FixedDimension1 = "OFFSET";
129 std::string FixedDimension2 = "DEPTH"; // used only in 2D
130 int FixedDimensionValue1 = details::SEP_READER_MAX_DIMENSION;
131 int FixedDimensionValue2 = details::SEP_READER_MAX_DIMENSION;
132 int FixedDimRange[2] = { 0, 0 };
133
136
137private:
138 enum class DataFormatType : std::uint8_t
139 {
140 XDR_FLOAT = 0,
141 XDR_INT = 1,
142 XDR_DOUBLE = 2
143 };
144
148 DataFormatType DataFormat = DataFormatType::XDR_FLOAT;
149 details::EndiannessType Endianness;
150 int Dimensions[details::SEP_READER_MAX_DIMENSION];
151 double OutputSpacing[3];
152 double OutputOrigin[3];
154 std::string DataFileType;
155 std::string BinaryFilename;
156 int ESize = 4;
160 int FixedDimension1ArrayId = details::SEP_READER_MAX_DIMENSION;
161 int FixedDimension2ArrayId = details::SEP_READER_MAX_DIMENSION;
162
163 void ReadDataPiece(FILE* file, char*& dataOutput, vtkIdType offset, vtkIdType range);
164
165 vtkSEPReader(const vtkSEPReader&) = delete;
166 void operator=(const vtkSEPReader&) = delete;
167};
168
169#endif // vtkSEPReader_h
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Stanford Exploration Project files reader.
Definition: vtkSEPReader.h:48
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
Definition: vtkSEPReader.h:135
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
Definition: vtkSEPReader.h:134
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
Definition: vtkSEPReader.h:42
@ range
Definition: vtkX3D.h:244
@ offset
Definition: vtkX3D.h:444
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH