00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __mitkVolumeDivider_h
00012 #define __mitkVolumeDivider_h
00013
00014 #include "mitkObject.h"
00015 #include "mitkBSPTree.h"
00016 #include "mitkVisualizationIncludes.h"
00017
00018 unsigned char const OBJECT_BLOCK = 0;
00019 unsigned char const EMPTY_BLOCK = 1;
00020
00021 class mitkVolume;
00022
00023 template <typename VT>
00024 class MinMaxEntry
00025 {
00026 public:
00027 MinMaxEntry(VT minv, VT maxv) : minval(minv), maxval(maxv) {}
00028 VT minval;
00029 VT maxval;
00030 };
00031
00032 typedef struct _cuboid_bsp_tree_node
00033 {
00034 int fidx;
00035 int pos[3];
00036 int size[3];
00037 float bound[6];
00038 double minval;
00039 double maxval;
00040
00041 } CuboidBSPTreeNode;
00042 typedef mitkBSPTree<CuboidBSPTreeNode> CuboidBSPTree;
00043
00048 class MITK_VISUALIZATION_API mitkVolumeDivider : public mitkObject
00049 {
00050 public:
00051 MITK_TYPE(mitkVolumeDivider, mitkObject)
00052
00053 virtual void PrintSelf(ostream &os);
00054
00055 mitkVolumeDivider();
00056
00057 void SetMargins(int xlm, int xrm, int ybm, int ytm, int zfm, int zbm);
00058 void GetMargins(int &xlm, int &xrm, int &ybm, int &ytm, int &zfm, int &zbm);
00059
00060 void SetOverlaps(int xo, int yo, int zo);
00061 void GetOverlaps(int &xo, int &yo, int &zo);
00062
00063 void SetSubVolumeSize(int wmin, int wmax, int hmin, int hmax, int dmin, int dmax);
00064 void SetSubVolumeSize(int sizemin[3], int sizemax[3]);
00065
00066 unsigned int GetBlockNum();
00067
00068 CuboidBSPTree* SemiSelfAdaptiveDivide(mitkVolume *vol, bool xadaptive=true, bool gengrads=true);
00069 CuboidBSPTree* SemiSelfAdaptiveDivide(mitkVolume *vol, mitkVolume *encnormvol, mitkVolume *gradmagvol=NULL, bool xadaptive=true);
00070
00071 CuboidBSPTree* SemiSelfAdaptiveDivideEx(mitkVolume *vol, bool yfirst=true, bool gengrads=true);
00072 CuboidBSPTree* SemiSelfAdaptiveDivideEx(mitkVolume *vol, mitkVolume *encnormvol, mitkVolume *gradmagvol=NULL, bool yfirst=true);
00073
00074 CuboidBSPTree* GetBSPTree() { return m_BSPTree; }
00075
00076 bool ReadNodeData(CuboidBSPTreeNode *node, int pixbytes, void *voldata, unsigned char *graddata=NULL);
00077 bool ReadNodeData(CuboidBSPTreeNode *node, int pixbytes, void *voldata, unsigned short *encnorms, unsigned char *gradmags=NULL);
00078
00079 protected:
00080 virtual ~mitkVolumeDivider();
00081
00082 void _deleteBSPTree();
00083 bool _clearCache();
00084
00085 int m_XLeftMargin;
00086 int m_XRightMargin;
00087 int m_YBottomMargin;
00088 int m_YTopMargin;
00089 int m_ZFrontMargin;
00090 int m_ZBackMargin;
00091 int m_XOverlap;
00092 int m_YOverlap;
00093 int m_ZOverlap;
00094
00095 int m_SubVolSizeMin[3];
00096 int m_SubVolSizeMax[3];
00097
00098 CuboidBSPTree *m_BSPTree;
00099
00100 mitkString *m_CachePath;
00101 mitkStringList *m_FirstLevelPath;
00102 mitkStringList *m_CacheFileNames;
00103
00104 private:
00105 mitkVolumeDivider(const mitkVolumeDivider&);
00106 void operator = (const mitkVolumeDivider&);
00107
00108 };
00109
00110
00111
00112
00113
00114
00115 #endif
00116