VTK  9.1.0
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 <string> // for std::string
30
31namespace details
32{
33enum class EndiannessType : std::uint8_t
34{
37};
38
39static constexpr int SEP_READER_MAX_DIMENSION = 32u;
40}
41
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, double*);
72 vtkGetMacro(DataSpacing, 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];
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
166#endif // vtkSEPReader_h
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Stanford Exploration Project files reader.
Definition: vtkSEPReader.h:45
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:132
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:131
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:39
@ range
Definition: vtkX3D.h:244
@ offset
Definition: vtkX3D.h:444
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH