VTK
vtkMetaImageReader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkMetaImageReader.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
66#ifndef vtkMetaImageReader_h
67#define vtkMetaImageReader_h
68
69#include "vtkIOImageModule.h" // For export macro
70#include "vtkImageReader2.h"
71
72namespace vtkmetaio { class MetaImage; } // forward declaration
73
74class VTKIOIMAGE_EXPORT vtkMetaImageReader : public vtkImageReader2
75{
76public:
78 void PrintSelf(ostream& os, vtkIndent indent);
79
84
85 virtual const char * GetFileExtensions()
86 { return ".mhd .mha"; }
87
88 virtual const char * GetDescriptiveName()
89 { return "MetaIO Library: MetaImage"; }
90
91 // These duplicate functions in vtkImageReader2, vtkMedicalImageReader.
92 double * GetPixelSpacing()
93 { return this->GetDataSpacing(); }
95 { return (this->GetDataExtent()[1] - this->GetDataExtent()[0] + 1); }
97 { return (this->GetDataExtent()[3] - this->GetDataExtent()[2] + 1); }
99 { return this->GetDataOrigin(); }
101 { return this->GetNumberOfScalarComponents(); }
103 { return this->GetDataScalarType(); }
105
106 vtkGetMacro(RescaleSlope, double);
107 vtkGetMacro(RescaleOffset, double);
108 vtkGetMacro(BitsAllocated, int);
109 vtkGetStringMacro(DistanceUnits);
110 vtkGetStringMacro(AnatomicalOrientation);
111 vtkGetMacro(GantryAngle, double);
112 vtkGetStringMacro(PatientName);
116 vtkGetStringMacro(ImageNumber);
120 vtkGetStringMacro(TransferSyntaxUID);
121
126 virtual int CanReadFile(const char* name);
127
128protected:
131
132 // These functions make no sense for this (or most) file readers
133 // and should be hidden from the user...but then the getsettest fails.
134 /*virtual void SetFilePrefix(const char * arg)
135 { vtkImageReader2::SetFilePrefix(arg); }
136 virtual void SetFilePattern(const char * arg)
137 { vtkImageReader2::SetFilePattern(arg); }
138 virtual void SetDataScalarType(int type)
139 { vtkImageReader2::SetDataScalarType(type); }
140 virtual void SetDataScalarTypeToFloat()
141 { this->SetDataScalarType(VTK_FLOAT); }
142 virtual void SetDataScalarTypeToDouble()
143 { this->SetDataScalarType(VTK_DOUBLE); }
144 virtual void SetDataScalarTypeToInt()
145 { this->SetDataScalarType(VTK_INT); }
146 virtual void SetDataScalarTypeToShort()
147 { this->SetDataScalarType(VTK_SHORT); }
148 virtual void SetDataScalarTypeToUnsignedShort()
149 {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
150 virtual void SetDataScalarTypeToUnsignedChar()
151 {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
152 vtkSetMacro(NumberOfScalarComponents, int);
153 vtkSetVector6Macro(DataExtent, int);
154 vtkSetMacro(FileDimensionality, int);
155 vtkSetVector3Macro(DataSpacing, double);
156 vtkSetVector3Macro(DataOrigin, double);
157 vtkSetMacro(HeaderSize, unsigned long);
158 unsigned long GetHeaderSize(unsigned long)
159 { return 0; }
160 virtual void SetDataByteOrderToBigEndian()
161 { this->SetDataByteOrderToBigEndian(); }
162 virtual void SetDataByteOrderToLittleEndian()
163 { this->SetDataByteOrderToBigEndian(); }
164 virtual void SetDataByteOrder(int order)
165 { this->SetDataByteOrder(order); }
166 vtkSetMacro(FileNameSliceOffset,int);
167 vtkSetMacro(FileNameSliceSpacing,int);
168 vtkSetMacro(SwapBytes, int);
169 virtual int OpenFile()
170 { return vtkImageReader2::OpenFile(); }
171 virtual void SeekFile(int i, int j, int k)
172 { vtkImageReader2::SeekFile(i, j, k); }
173 vtkSetMacro(FileLowerLeft, int);
174 virtual void ComputeInternalFileName(int slice)
175 { vtkImageReader2::ComputeInternalFileName(slice); }
176 vtkGetStringMacro(InternalFileName)
177 const char * GetDataByteOrderAsString(void)
178 { return vtkImageReader2::GetDataByteOrderAsString(); }
179 unsigned long GetHeaderSize(void)
180 { return vtkImageReader2::GetHeaderSize(); }*/
181
184 virtual int RequestInformation(vtkInformation * request,
185 vtkInformationVector ** inputVector,
186 vtkInformationVector * outputVector);
187
188private:
189 vtkMetaImageReader(const vtkMetaImageReader&) VTK_DELETE_FUNCTION;
190 void operator=(const vtkMetaImageReader&) VTK_DELETE_FUNCTION;
191
192 vtkmetaio::MetaImage *MetaImagePtr;
193
194 double GantryAngle;
195 char PatientName[255];
196 char PatientID[255];
197 char Date[255];
198 char Series[255];
199 char Study[255];
200 char ImageNumber[255];
201 char Modality[255];
202 char StudyID[255];
203 char StudyUID[255];
204 char TransferSyntaxUID[255];
205
206 double RescaleSlope;
207 double RescaleOffset;
208 int BitsAllocated;
209 char DistanceUnits[255];
210 char AnatomicalOrientation[255];
211};
212
213#endif
general representation of visualization data
Definition: vtkDataObject.h:65
Superclass of binary file readers.
virtual int GetNumberOfScalarComponents()
virtual int * GetDataExtent()
virtual int GetDataScalarType()
Get the file format.
virtual double * GetDataSpacing()
virtual double * GetDataOrigin()
a simple class to control print indentation
Definition: vtkIndent.h:40
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.
void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo)
This is a convenience method that is implemented in many subclasses instead of RequestData.
virtual int CanReadFile(const char *name)
Test whether the file with the given name can be read by this reader.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual const char * GetDescriptiveName()
Return a descriptive name for the file format that might be useful in a GUI.
virtual const char * GetFileExtensions()
Get the file extensions for this format.
int GetDataByteOrder(void)
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
@ name
Definition: vtkX3D.h:219
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.