00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00078 #ifndef __vtkVolume16Reader_h
00079 #define __vtkVolume16Reader_h
00080
00081 #include <stdio.h>
00082 #include "vtkVolumeReader.h"
00083 #include "vtkTransform.h"
00084 class vtkUnsignedCharArray;
00085 class vtkUnsignedShortArray;
00086
00087 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
00088 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
00089
00090 class VTK_IO_EXPORT vtkVolume16Reader : public vtkVolumeReader
00091 {
00092 public:
00093 vtkTypeMacro(vtkVolume16Reader,vtkVolumeReader);
00094 void PrintSelf(ostream& os, vtkIndent indent);
00095
00099 static vtkVolume16Reader *New();
00100
00102
00103 vtkSetVector2Macro(DataDimensions,int);
00104 vtkGetVectorMacro(DataDimensions,int,2);
00106
00108
00110 vtkSetMacro(DataMask,unsigned short);
00111 vtkGetMacro(DataMask,unsigned short);
00113
00115
00116 vtkSetMacro(HeaderSize,int);
00117 vtkGetMacro(HeaderSize,int);
00119
00121
00131 void SetDataByteOrderToBigEndian();
00132 void SetDataByteOrderToLittleEndian();
00133 int GetDataByteOrder();
00134 void SetDataByteOrder(int);
00135 const char *GetDataByteOrderAsString();
00137
00139
00140 vtkSetMacro(SwapBytes,int);
00141 vtkGetMacro(SwapBytes,int);
00142 vtkBooleanMacro(SwapBytes,int);
00144
00146
00149 vtkSetObjectMacro(Transform,vtkTransform);
00150 vtkGetObjectMacro(Transform,vtkTransform);
00152
00154 vtkStructuredPoints *GetImage(int ImageNumber);
00155
00156 protected:
00157 vtkVolume16Reader();
00158 ~vtkVolume16Reader();
00159
00160 void Execute();
00161 void ExecuteInformation();
00162 int DataDimensions[2];
00163 unsigned short DataMask;
00164 int SwapBytes;
00165 int HeaderSize;
00166 vtkTransform *Transform;
00167
00168 void TransformSlice (unsigned short *slice, unsigned short *pixels, int k, int dimensions[3], int bounds[3]);
00169 void ComputeTransformedDimensions(int dimensions[3]);
00170 void ComputeTransformedBounds(int bounds[6]);
00171 void ComputeTransformedSpacing(float Spacing[3]);
00172 void ComputeTransformedOrigin(float origin[3]);
00173 void AdjustSpacingAndOrigin(int dimensions[3], float Spacing[3], float origin[3]);
00174 vtkUnsignedShortArray *ReadImage(int ImageNumber);
00175 vtkUnsignedShortArray *ReadVolume(int FirstImage, int LastImage);
00176 int Read16BitImage(FILE *fp, unsigned short *pixels, int xsize, int ysize,
00177 int skip, int swapBytes);
00178
00179 private:
00180 vtkVolume16Reader(const vtkVolume16Reader&);
00181 void operator=(const vtkVolume16Reader&);
00182 };
00183
00184 #endif
00185
00186