00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00053 #ifndef __vtkVolume16Reader_h
00054 #define __vtkVolume16Reader_h
00055
00056 #include "vtkVolumeReader.h"
00057
00058 class vtkTransform;
00059 class vtkUnsignedCharArray;
00060 class vtkUnsignedShortArray;
00061
00062 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
00063 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
00064
00065 class VTK_IO_EXPORT vtkVolume16Reader : public vtkVolumeReader
00066 {
00067 public:
00068 vtkTypeRevisionMacro(vtkVolume16Reader,vtkVolumeReader);
00069 void PrintSelf(ostream& os, vtkIndent indent);
00070
00074 static vtkVolume16Reader *New();
00075
00077
00078 vtkSetVector2Macro(DataDimensions,int);
00079 vtkGetVectorMacro(DataDimensions,int,2);
00081
00083
00085 vtkSetMacro(DataMask,unsigned short);
00086 vtkGetMacro(DataMask,unsigned short);
00088
00090
00091 vtkSetMacro(HeaderSize,int);
00092 vtkGetMacro(HeaderSize,int);
00094
00096
00106 void SetDataByteOrderToBigEndian();
00107 void SetDataByteOrderToLittleEndian();
00108 int GetDataByteOrder();
00109 void SetDataByteOrder(int);
00110 const char *GetDataByteOrderAsString();
00112
00114
00115 vtkSetMacro(SwapBytes,int);
00116 vtkGetMacro(SwapBytes,int);
00117 vtkBooleanMacro(SwapBytes,int);
00119
00121
00124 virtual void SetTransform(vtkTransform*);
00125 vtkGetObjectMacro(Transform,vtkTransform);
00127
00129 vtkImageData *GetImage(int ImageNumber);
00130
00131 protected:
00132 vtkVolume16Reader();
00133 ~vtkVolume16Reader();
00134
00135 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00136 virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00137 int DataDimensions[2];
00138 unsigned short DataMask;
00139 int SwapBytes;
00140 int HeaderSize;
00141 vtkTransform *Transform;
00142
00143 void TransformSlice (unsigned short *slice, unsigned short *pixels, int k, int dimensions[3], int bounds[3]);
00144 void ComputeTransformedDimensions(int dimensions[3]);
00145 void ComputeTransformedBounds(int bounds[6]);
00146 void ComputeTransformedSpacing(double Spacing[3]);
00147 void ComputeTransformedOrigin(double origin[3]);
00148 void AdjustSpacingAndOrigin(int dimensions[3], double Spacing[3], double origin[3]);
00149 void ReadImage(int ImageNumber, vtkUnsignedShortArray *);
00150 void ReadVolume(int FirstImage, int LastImage, vtkUnsignedShortArray *);
00151 int Read16BitImage(FILE *fp, unsigned short *pixels, int xsize, int ysize,
00152 int skip, int swapBytes);
00153
00154 private:
00155 vtkVolume16Reader(const vtkVolume16Reader&);
00156 void operator=(const vtkVolume16Reader&);
00157 };
00158
00159 #endif
00160
00161