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

Volume.h

Go to the documentation of this file.
00001 #ifndef _VOLUME_H_
00002 #define _VOLUME_H_
00003 
00004 #include <fstream.h>
00005 #include "vuTFunc/vuTFIntensity.h"
00006 #include "vuSimpleTypes.h"
00007 #include "vuCamera.h"
00008 #include "vuVector.h"
00009 #include "Filter.h"
00010 
00011 #define NCOMP   7
00012 
00013 class VolumeSet;
00014 
00015 //#define FVR_NO_SLICE_COPY
00016 
00017 class Volume
00018 {
00019     friend class VolumeSet;
00020 public:
00021     // Default constructor, copy constructor,
00022     // and destructor.
00023     Volume();
00024     Volume(Volume& inst);
00025     ~Volume();
00026 
00027     // Assignment operator for the volume class.
00028     Volume& operator=(Volume& rhs);
00029 
00031     bool convert(byte* data, dword XSize, dword YSize, dword ZSize, 
00032                  dword d_size, const vuTFIntensity &tfunc, dword component,
00033                  float osamp=1.0f, float m_pad=1.0f, dword a_pad=0);
00034         
00035     // Write the current image to disk.
00036     void writeImage(void);
00037 
00038     // Set the interpolation filter.
00039     void setFilter(SpecFVRNS::Filter* filter);
00040 
00041     // Set the scale and bias for the slice extraction
00042     // stage of the algorithm.
00043     void setSliceScale(float scale);
00044     void setSliceBias(float bias);
00045 
00046     // Rotate the slice about its x, y, or z axis.
00047     // The rotations are local to the slice (it carries
00048     // its own coordinate axis system).
00049     void rotateSliceX(float alpha);
00050     void rotateSliceY(float alpha);
00051     void rotateSliceZ(float alpha);
00052     void setViewMatrix(const vuMatrix& mat);
00053     void setCamera(const vuCamera& cam);
00054     void getCamera(vuCamera& cam) const;
00055 
00056     // Compute the slice for the current angle and
00057     // return the rgb's in a byte*.
00058     // Stop is middle section, pass is bandwidth
00059     void clearSlice(void);
00060     void computeSlice(void);
00061     void computeSlice(dword x_stop, dword y_stop, dword x_pass, dword y_pass);
00062     float* getSliceData(void);
00063 
00064     // Get the dimensions of the current slice (for
00065     // the current version, the same values are returned
00066     // for all angles.)
00067     dword getSliceWidth(void) const;
00068     dword getSliceHeight(void) const;
00069 
00070     dword getInternalSliceWidth(void) const;
00071     dword getInternalSliceHeight(void) const;
00072 
00073     // set oversampling -- 2 uses twice the number of samples
00074     void setOversampling(float s);
00075 
00076 protected:
00077     // Set the width of the wrap in the frequency
00078     // domain.  Should be half the filter size.
00079     void setWrap(dword wrap);
00080 
00081     // Fix the frequency volume so that it wraps its
00082     // values periodically to half of the filter width.
00083     void wrapVolume(void);
00084 
00085     // Interpolate the slice, using the currently
00086     // selected filter.
00087     void interpolateSlice(void);
00088     void interpolateSlice(dword x_stop, dword y_stop, dword x_pass, dword y_pass);
00089 
00090     // Scale and bias the frequency slice into the rgb
00091     // slice.
00092     void scaleAndBias(void);
00093 
00094         inline int Volume::vcoord(int x, int y, int z) const
00095         {
00096                 return ((z * m_YSize + y) * m_XSize + x) * 2;
00097         }
00098 
00099         inline int Volume::scoord(int x, int y) const
00100         {
00101                 return (y * m_SliceXSize + x) * 2;
00102         }
00103 
00104         void preprocess(void);
00105         void write_fvr(char* out) const;
00106         bool read_fvr(ifstream& fin, dword XSize, dword YSize, dword ZSize, dword d_size);
00107 protected:
00108     // Variables for the volume.
00109     float* m_Volume;       // Volume frequency data
00110     dword  m_XSize;        // Width of volume (and slice)
00111     dword  m_YSize;        // Height of volume (and slice)
00112     dword  m_ZSize;        // Depth of volume
00113     dword  m_Wrap;         // Width of the wrap on the volume
00114 
00115     // Variables for the interpolation filter
00116     SpecFVRNS::Filter* m_Filter;
00117 
00118     // Variables for the slice
00119     float* m_Slice;             // Slice frequency data
00120 
00121     vuVector m_XStep;        // Xstep for sampling
00122     vuVector m_YStep;        // Ystep for sampling
00123     dword  m_SliceXSize;   // Slice x-size
00124     dword  m_SliceYSize;   // Slice y-size
00125     vuVector m_XAxis;        // Slice x-axis
00126     vuVector m_YAxis;        // Slice y-axis
00127     vuVector m_ZAxis;        // Slice z-axis
00128     vuVector m_Origin;       // Bottom left corner of slice
00129 
00130     // image vars
00131     float* m_Image;
00132     dword m_ImageXSize;
00133     dword m_ImageYSize;
00134     dword m_ImageStep;
00135     float* m_SlicePtr;
00136     float m_Scale;         // Slice scale factor
00137     float m_Bias;          // Slice bias factor
00138 
00139     int   m_CurImage;      // Counter for saved images.
00140 
00141     dword m_InnerXSize;
00142     dword m_InnerYSize;
00143     
00144 #ifndef FVR_NO_SLICE_COPY
00145     float* m_SSlice;    // Slice spatial data
00146 #endif
00147 };
00148 
00149 #endif
00150 
00151 

Generated on Wed Dec 15 21:20:33 2004 for vuVolume by  doxygen 1.3.9.1