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 
82  static vtkMetaImageReader *New();
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);
113  vtkGetStringMacro(Date);
114  vtkGetStringMacro(Series);
115  vtkGetStringMacro(ImageNumber);
116  vtkGetStringMacro(Modality);
117  vtkGetStringMacro(StudyID);
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 
178  void ExecuteInformation();
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 
virtual int * GetDataExtent()
static vtkImageReader2 * New()
Store vtkAlgorithm input/output information.
double * GetImagePositionPatient()
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
virtual int GetNumberOfScalarComponents()
virtual const char * GetDescriptiveName()
virtual int GetDataByteOrder()
virtual double * GetDataOrigin()
virtual int CanReadFile(const char *vtkNotUsed(fname))
virtual double * GetDataSpacing()
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual int GetDataScalarType()
virtual void ExecuteInformation()
read binary UNC meta image data
Superclass of binary file readers.
void PrintSelf(ostream &os, vtkIndent indent)
Store zero or more vtkInformation instances.
virtual const char * GetFileExtensions()
#define VTKIOIMAGE_EXPORT
virtual void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo)
general representation of visualization data
Definition: vtkDataObject.h:64