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