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 =========================================================================*/
65 #ifndef vtkMetaImageReader2_h
66 #define vtkMetaImageReader2_h
67 
68 #include "vtkIOImageModule.h" // For export macro
69 #include "vtkImageReader2.h"
70 
71 //BTX
72 namespace vtkmetaio { class MetaImage; } // forward declaration
73 //ETX
74 
76 {
77 public:
79  void PrintSelf(ostream& os, vtkIndent indent);
80 
83 
84  virtual const char * GetFileExtensions()
85  { return ".mhd .mha"; }
86 
87  virtual const char * GetDescriptiveName()
88  { return "MetaIO Library: MetaImage"; }
89 
90  // These duplicate functions in vtkImageReader2, vtkMedicalImageReader.
91  double * GetPixelSpacing()
92  { return this->GetDataSpacing(); }
93  int GetWidth()
94  { return (this->GetDataExtent()[1] - this->GetDataExtent()[0] + 1); }
95  int GetHeight()
96  { return (this->GetDataExtent()[3] - this->GetDataExtent()[2] + 1); }
98  { return this->GetDataOrigin(); }
100  { return this->GetNumberOfScalarComponents(); }
102  { return this->GetDataScalarType(); }
103  int GetDataByteOrder(void);
104 
105  vtkGetMacro(RescaleSlope, double);
106  vtkGetMacro(RescaleOffset, double);
107  vtkGetMacro(BitsAllocated, int);
108  vtkGetStringMacro(DistanceUnits);
109  vtkGetStringMacro(AnatomicalOrientation);
110  vtkGetMacro(GantryAngle, double);
111  vtkGetStringMacro(PatientName);
112  vtkGetStringMacro(PatientID);
115  vtkGetStringMacro(ImageNumber);
116  vtkGetStringMacro(Modality);
118  vtkGetStringMacro(StudyUID);
119  vtkGetStringMacro(TransferSyntaxUID);
120 
122  virtual int CanReadFile(const char* name);
123 
124 protected:
127 
128  // These functions make no sense for this (or most) file readers
129  // and should be hidden from the user...but then the getsettest fails.
130  /*virtual void SetFilePrefix(const char * arg)
131  { vtkImageReader2::SetFilePrefix(arg); }
132  virtual void SetFilePattern(const char * arg)
133  { vtkImageReader2::SetFilePattern(arg); }
134  virtual void SetDataScalarType(int type)
135  { vtkImageReader2::SetDataScalarType(type); }
136  virtual void SetDataScalarTypeToFloat()
137  { this->SetDataScalarType(VTK_FLOAT); }
138  virtual void SetDataScalarTypeToDouble()
139  { this->SetDataScalarType(VTK_DOUBLE); }
140  virtual void SetDataScalarTypeToInt()
141  { this->SetDataScalarType(VTK_INT); }
142  virtual void SetDataScalarTypeToShort()
143  { this->SetDataScalarType(VTK_SHORT); }
144  virtual void SetDataScalarTypeToUnsignedShort()
145  {this->SetDataScalarType(VTK_UNSIGNED_SHORT);}
146  virtual void SetDataScalarTypeToUnsignedChar()
147  {this->SetDataScalarType(VTK_UNSIGNED_CHAR);}
148  vtkSetMacro(NumberOfScalarComponents, int);
149  vtkSetVector6Macro(DataExtent, int);
150  vtkSetMacro(FileDimensionality, int);
151  vtkSetVector3Macro(DataSpacing, double);
152  vtkSetVector3Macro(DataOrigin, double);
153  vtkSetMacro(HeaderSize, unsigned long);
154  unsigned long GetHeaderSize(unsigned long)
155  { return 0; }
156  virtual void SetDataByteOrderToBigEndian()
157  { this->SetDataByteOrderToBigEndian(); }
158  virtual void SetDataByteOrderToLittleEndian()
159  { this->SetDataByteOrderToBigEndian(); }
160  virtual void SetDataByteOrder(int order)
161  { this->SetDataByteOrder(order); }
162  vtkSetMacro(FileNameSliceOffset,int);
163  vtkSetMacro(FileNameSliceSpacing,int);
164  vtkSetMacro(SwapBytes, int);
165  virtual int OpenFile()
166  { return vtkImageReader2::OpenFile(); }
167  virtual void SeekFile(int i, int j, int k)
168  { vtkImageReader2::SeekFile(i, j, k); }
169  vtkSetMacro(FileLowerLeft, int);
170  virtual void ComputeInternalFileName(int slice)
171  { vtkImageReader2::ComputeInternalFileName(slice); }
172  vtkGetStringMacro(InternalFileName)
173  const char * GetDataByteOrderAsString(void)
174  { return vtkImageReader2::GetDataByteOrderAsString(); }
175  unsigned long GetHeaderSize(void)
176  { return vtkImageReader2::GetHeaderSize(); }*/
177 
180  virtual int RequestInformation(vtkInformation * request,
181  vtkInformationVector ** inputVector,
182  vtkInformationVector * outputVector);
183 
184 private:
185  vtkMetaImageReader(const vtkMetaImageReader&); // Not implemented.
186  void operator=(const vtkMetaImageReader&); // Not implemented.
187 
188 //BTX
189  vtkmetaio::MetaImage *MetaImagePtr;
190 //ETX
191 
192  double GantryAngle;
193  char PatientName[255];
194  char PatientID[255];
195  char Date[255];
196  char Series[255];
197  char Study[255];
198  char ImageNumber[255];
199  char Modality[255];
200  char StudyID[255];
201  char StudyUID[255];
202  char TransferSyntaxUID[255];
203 
204  double RescaleSlope;
205  double RescaleOffset;
206  int BitsAllocated;
207  char DistanceUnits[255];
208  char AnatomicalOrientation[255];
209 };
210 
211 #endif
212 
213 
214 
vtkMetaImageReader::GetDataByteOrder
int GetDataByteOrder(void)
vtkMetaImageReader::New
static vtkMetaImageReader * New()
vtkMetaImageReader::GetImagePositionPatient
double * GetImagePositionPatient()
Definition: vtkMetaImageReader.h:97
vtkMetaImageReader::GetFileExtensions
virtual const char * GetFileExtensions()
Definition: vtkMetaImageReader.h:84
vtkMetaImageReader::GetPixelRepresentation
int GetPixelRepresentation()
Definition: vtkMetaImageReader.h:101
vtkMetaImageReader::GetPixelSpacing
double * GetPixelSpacing()
Definition: vtkMetaImageReader.h:91
vtkMetaImageReader::GetDescriptiveName
virtual const char * GetDescriptiveName()
Definition: vtkMetaImageReader.h:87
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkMetaImageReader::ExecuteInformation
void ExecuteInformation()
vtkIOImageModule.h
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
VTKIOIMAGE_EXPORT
#define VTKIOIMAGE_EXPORT
Definition: vtkIOImageModule.h:15
vtkMetaImageReader
read binary UNC meta image data
Definition: vtkMetaImageReader.h:76
vtkmetaio
Definition: vtkMetaImageReader.h:72
vtkMetaImageReader::GetHeight
int GetHeight()
Definition: vtkMetaImageReader.h:95
vtkImageReader2::GetDataScalarType
virtual int GetDataScalarType()
vtkMetaImageReader::ExecuteDataWithInformation
void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo)
vtkImageReader2::GetNumberOfScalarComponents
virtual int GetNumberOfScalarComponents()
vtkgl::name
GLuint const GLchar * name
Definition: vtkgl.h:11983
vtkMetaImageReader::GetNumberOfComponents
int GetNumberOfComponents()
Definition: vtkMetaImageReader.h:99
vtkMetaImageReader::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkMetaImageReader::GetWidth
int GetWidth()
Definition: vtkMetaImageReader.h:93
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMetaImageReader::CanReadFile
virtual int CanReadFile(const char *name)
vtkMetaImageReader::vtkMetaImageReader
vtkMetaImageReader()
vtkImageReader2
Superclass of binary file readers.
Definition: vtkImageReader2.h:58
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkImageReader2::GetDataOrigin
virtual double * GetDataOrigin()
vtkImageReader2::GetDataExtent
virtual int * GetDataExtent()
vtkMetaImageReader::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkMetaImageReader::~vtkMetaImageReader
~vtkMetaImageReader()
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkImageReader2::GetDataSpacing
virtual double * GetDataSpacing()
vtkImageReader2.h