Thanks to visit codestin.com
Credit goes to vtk.org

VTK  9.5.20251007
vtkMetaImageReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
162#ifndef vtkMetaImageReader_h
163#define vtkMetaImageReader_h
164
165#include "vtkIOImageModule.h" // For export macro
166#include "vtkImageReader2.h"
167
168namespace vtkmetaio
169{
170class MetaImage;
171} // forward declaration
172
173VTK_ABI_NAMESPACE_BEGIN
174
175class VTKIOIMAGE_EXPORT vtkMetaImageReader : public vtkImageReader2
176{
177public:
179 void PrintSelf(ostream& os, vtkIndent indent) override;
180
185
186 const char* GetFileExtensions() override { return ".mhd .mha"; }
187
188 const char* GetDescriptiveName() override { return "MetaIO Library: MetaImage"; }
189
190 // These duplicate functions in vtkImageReader2, vtkMedicalImageReader.
191 double* GetPixelSpacing() { return this->GetDataSpacing(); }
192 int GetWidth() { return (this->GetDataExtent()[1] - this->GetDataExtent()[0] + 1); }
193 int GetHeight() { return (this->GetDataExtent()[3] - this->GetDataExtent()[2] + 1); }
194 double* GetImagePositionPatient() { return this->GetDataOrigin(); }
197 int GetDataByteOrder() override;
198
199 vtkGetMacro(RescaleSlope, double);
200 vtkGetMacro(RescaleOffset, double);
201 vtkGetMacro(BitsAllocated, int);
202 vtkGetStringMacro(DistanceUnits);
203 vtkGetStringMacro(AnatomicalOrientation);
204 vtkGetMacro(GantryAngle, double);
205 vtkGetStringMacro(PatientName);
206 vtkGetStringMacro(PatientID);
207 vtkGetStringMacro(Date);
208 vtkGetStringMacro(Series);
209 vtkGetStringMacro(ImageNumber);
210 vtkGetStringMacro(Modality);
211 vtkGetStringMacro(StudyID);
212 vtkGetStringMacro(StudyUID);
213 vtkGetStringMacro(TransferSyntaxUID);
214
219 int CanReadFile(VTK_FILEPATH const char* name) override;
220
221protected:
224
225 // These functions make no sense for this (or most) file readers
226 // and should be hidden from the user...but then the getsettest fails.
227 /*virtual void SetFilePrefix(const char * arg)
228 { vtkImageReader2::SetFilePrefix(arg); }
229 virtual void SetFilePattern(VTK_FILEPATH const char * arg)
230 { vtkImageReader2::SetFilePattern(arg); }
231 virtual void SetDataScalarType(int type)
232 { vtkImageReader2::SetDataScalarType(type); }
233 virtual void SetDataScalarTypeToFloat()
234 { this->SetDataScalarType(VTK_FLOAT); }
235 virtual void SetDataScalarTypeToDouble()
236 { this->SetDataScalarType(VTK_DOUBLE); }
237 virtual void SetDataScalarTypeToInt()
238 { this->SetDataScalarType(VTK_INT); }
239 virtual void SetDataScalarTypeToShort()
240 { this->SetDataScalarType(VTK_SHORT); }
241 virtual void SetDataScalarTypeToUnsignedShort()
242 {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
243 virtual void SetDataScalarTypeToUnsignedChar()
244 {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
245 vtkSetMacro(NumberOfScalarComponents, int);
246 vtkSetVector6Macro(DataExtent, int);
247 vtkSetMacro(FileDimensionality, int);
248 vtkSetVector3Macro(DataSpacing, double);
249 vtkSetVector3Macro(DataOrigin, double);
250 vtkSetMacro(HeaderSize, unsigned long);
251 unsigned long GetHeaderSize(unsigned long)
252 { return 0; }
253 virtual void SetDataByteOrderToBigEndian()
254 { this->SetDataByteOrderToBigEndian(); }
255 virtual void SetDataByteOrderToLittleEndian()
256 { this->SetDataByteOrderToBigEndian(); }
257 virtual void SetDataByteOrder(int order)
258 { this->SetDataByteOrder(order); }
259 vtkSetMacro(FileNameSliceOffset,int);
260 vtkSetMacro(FileNameSliceSpacing,int);
261 vtkSetMacro(SwapBytes, int);
262 virtual int OpenFile()
263 { return vtkImageReader2::OpenFile(); }
264 virtual void SeekFile(int i, int j, int k)
265 { vtkImageReader2::SeekFile(i, j, k); }
266 vtkSetMacro(FileLowerLeft, int);
267 virtual void ComputeInternalFileName(int slice)
268 { vtkImageReader2::ComputeInternalFileName(slice); }
269 vtkGetFilePathMacro(InternalFileName);
270 const char * GetDataByteOrderAsString()
271 { return vtkImageReader2::GetDataByteOrderAsString(); }
272 unsigned long GetHeaderSize()
273 { return vtkImageReader2::GetHeaderSize(); }*/
274
275 void ExecuteInformation() override;
278 vtkInformationVector* outputVector) override;
279
280private:
281 vtkMetaImageReader(const vtkMetaImageReader&) = delete;
282 void operator=(const vtkMetaImageReader&) = delete;
283
284 vtkmetaio::MetaImage* MetaImagePtr;
285
286 double GantryAngle;
287 char PatientName[255];
288 char PatientID[255];
289 char Date[255];
290 char Series[255];
291 char Study[255];
292 char ImageNumber[255];
293 char Modality[255];
294 char StudyID[255];
295 char StudyUID[255];
296 char TransferSyntaxUID[255];
297
298 double RescaleSlope;
299 double RescaleOffset;
300 int BitsAllocated;
301 char DistanceUnits[255];
302 char AnatomicalOrientation[255];
303};
304
305VTK_ABI_NAMESPACE_END
306#endif
general representation of visualization data
Superclass of binary file readers.
virtual int GetNumberOfScalarComponents()
Set/Get the number of scalar components.
virtual int * GetDataExtent()
Get/Set the extent of the data on disk.
virtual int GetDataScalarType()
Get the file format.
virtual double * GetDataSpacing()
Set/Get the spacing of the data in the file.
virtual double * GetDataOrigin()
Set/Get the origin of the data (location of first pixel in the file).
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
read binary UNC meta image data
double * GetImagePositionPatient()
static vtkMetaImageReader * New()
Construct object with FlipNormals turned off and Normals set to true.
int GetDataByteOrder() override
These methods should be used instead of the SwapBytes methods.
void ExecuteInformation() override
~vtkMetaImageReader() override
const char * GetFileExtensions() override
Get the file extensions for this format.
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
int CanReadFile(const char *name) override
Test whether the file with the given name can be read by this reader.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
#define VTK_FILEPATH