00001 #ifndef _FVR_vuFourierCluster_H_
00002 #define _FVR_vuFourierCluster_H_
00003
00004 #include <vuSimpleTypes.h>
00005 #include "vuLightfield/vuFixelMap.h"
00006 #include "vuLightfield/vuSphericView.h"
00007 #include "vuFourier/vuFourierVolume.h"
00008 #include "vuSliceFilter.h"
00009 #include "vuMisc/vuProgressHandler.h"
00010
00011 template <int SIZE, class TYPE>
00012 class vuFourierCluster : public vuFourierVolume<SIZE>
00013 {
00014 typedef void(vuFourierCluster<SIZE,TYPE>::* KernelCallback)(vuVector&,float*);
00015
00016 private:
00017 using vuFourierVolume<SIZE>::m_ZSize;
00018 using vuFourierVolume<SIZE>::m_Volume;
00019 using vuFourierVolume<SIZE>::wrapAndInitialize;
00020 using vuFourierVolume<SIZE>::computeDimensions;
00021 using vuFourierVolume<SIZE>::shift2D;
00022 using vuFourierVolume<SIZE>::calcViewVectors;
00023 using vuFourierVolume<SIZE>::vcoord;
00024 public:
00025 vuFourierCluster();
00026 ~vuFourierCluster();
00027
00028 void preprocess(dword idx, vuSphericView<SIZE,TYPE> **view,
00029 vuProgressHandler *handler=NULL);
00030
00031 void prepareForInteractive(dword width, dword height);
00032 void addView(vuSphericView<SIZE,TYPE> *view);
00033
00034 void setSliceFilter(vuSliceFilter *sliceFilter);
00035 vuSliceFilter *getSliceFilter();
00036
00038 bool isPreprocessed();
00039
00041 bool isPreparedForInteractive();
00042
00044 void setNoInteractiveMode();
00045
00046 protected:
00047 using vuFourierVolume<SIZE>::m_XSize;
00048 using vuFourierVolume<SIZE>::m_YSize;
00049
00050 inline int wcoord(int x, int y, int z) const
00051 {
00052 return ((z * m_YSize + y) * m_XSize + x);
00053 }
00054
00055 void addViewToVolume(vuSphericView<SIZE,TYPE> *view);
00056 void handleSlice(float *slice, dword sliceWidth, dword sliceHeight,
00057 vuSphericView<SIZE,TYPE> *view);
00058
00059 void normalizeVolume();
00060 void initializeVolume(dword width, dword height);
00061 void transformSlice(float *slice, dword width, dword height);
00062 void ensurePlan(dword width, dword height);
00063 void destroyPlan();
00064 void calcSliceDimensions(vuSphericView<SIZE,TYPE> *view,
00065 dword &width,dword &height);
00066
00067
00068 void doFilteringSeparable(vuVector& pos, float *value);
00069 void doFilteringSpheric(vuVector& pos, float *value);
00070
00071
00072
00073 void weightView(vuSphericView<SIZE,TYPE> *view);
00074 void doWeighting(vuVector& pos, float *value);
00075
00076
00077
00078 void premultiplySlice(vuFixelMap2F *slice);
00079
00080 protected:
00081 fftwnd_plan m_Plan;
00082 dword m_PlanWidth;
00083 dword m_PlanHeight;
00084 bool m_IsPreprocessed;
00085 bool m_IsPreparedForInteractive;
00086 float *m_WeightVolume;
00087 vuSliceFilter *m_SliceFilter;
00088 float *m_CacheVolume;
00089
00090
00091 float mc_HalfWidth;
00092 int mc_High;
00093 int mc_Low;
00094 bool mc_IsWidthOdd;
00095 };
00096
00097 template class vuFourierCluster<1,byte>;
00098 template class vuFourierCluster<2,byte>;
00099 template class vuFourierCluster<3,byte>;
00100 template class vuFourierCluster<1,float>;
00101 template class vuFourierCluster<2,float>;
00102 template class vuFourierCluster<3,float>;
00103
00104 typedef vuFourierCluster<1,byte> vuFourierCluster1B;
00105 typedef vuFourierCluster<2,byte> vuFourierCluster2B;
00106 typedef vuFourierCluster<3,byte> vuFourierCluster3B;
00107 typedef vuFourierCluster<1,float> vuFourierCluster1F;
00108 typedef vuFourierCluster<2,float> vuFourierCluster2F;
00109 typedef vuFourierCluster<3,float> vuFourierCluster3F;
00110
00111 #endif