Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkVolume16Reader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkVolume16Reader.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00065 #ifndef __vtkVolume16Reader_h
00066 #define __vtkVolume16Reader_h
00067 
00068 #include "vtkVolumeReader.h"
00069 
00070 class vtkTransform;
00071 class vtkUnsignedCharArray;
00072 class vtkUnsignedShortArray;
00073 
00074 #define VTK_FILE_BYTE_ORDER_BIG_ENDIAN 0
00075 #define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN 1
00076 
00077 class VTK_IO_EXPORT vtkVolume16Reader : public vtkVolumeReader
00078 {
00079 public:
00080   vtkTypeRevisionMacro(vtkVolume16Reader,vtkVolumeReader);
00081   void PrintSelf(ostream& os, vtkIndent indent);
00082 
00086   static vtkVolume16Reader *New();
00087 
00089 
00090   vtkSetVector2Macro(DataDimensions,int);
00091   vtkGetVectorMacro(DataDimensions,int,2);
00093 
00095 
00097   vtkSetMacro(DataMask,unsigned short);
00098   vtkGetMacro(DataMask,unsigned short);
00100 
00102 
00103   vtkSetMacro(HeaderSize,int);
00104   vtkGetMacro(HeaderSize,int);
00106 
00108 
00118   void SetDataByteOrderToBigEndian();
00119   void SetDataByteOrderToLittleEndian();
00120   int GetDataByteOrder();
00121   void SetDataByteOrder(int);
00122   const char *GetDataByteOrderAsString();
00124 
00126 
00127   vtkSetMacro(SwapBytes,int);
00128   vtkGetMacro(SwapBytes,int);
00129   vtkBooleanMacro(SwapBytes,int);
00131 
00133 
00136   virtual void SetTransform(vtkTransform*);
00137   vtkGetObjectMacro(Transform,vtkTransform);
00139 
00141   vtkImageData *GetImage(int ImageNumber);
00142 
00143 protected:
00144   vtkVolume16Reader();
00145   ~vtkVolume16Reader();
00146 
00147   virtual void ExecuteData(vtkDataObject *);
00148   virtual void ExecuteInformation();
00149   int   DataDimensions[2];
00150   unsigned short DataMask;
00151   int   SwapBytes;
00152   int   HeaderSize;
00153   vtkTransform *Transform;
00154 
00155   void TransformSlice (unsigned short *slice, unsigned short *pixels, int k, int dimensions[3], int bounds[3]);
00156   void ComputeTransformedDimensions(int dimensions[3]);
00157   void ComputeTransformedBounds(int bounds[6]);
00158   void ComputeTransformedSpacing(double Spacing[3]);
00159   void ComputeTransformedOrigin(double origin[3]);
00160   void AdjustSpacingAndOrigin(int dimensions[3], double Spacing[3], double origin[3]);
00161   void ReadImage(int ImageNumber, vtkUnsignedShortArray *);
00162   void ReadVolume(int FirstImage, int LastImage, vtkUnsignedShortArray *);
00163   int Read16BitImage(FILE *fp, unsigned short *pixels, int xsize, int ysize, 
00164                      int skip, int swapBytes);
00165 
00166 private:
00167   vtkVolume16Reader(const vtkVolume16Reader&);  // Not implemented.
00168   void operator=(const vtkVolume16Reader&);  // Not implemented.
00169 };
00170 
00171 #endif
00172 
00173