3D Human Airway Tree
Program generuje ludzkie drzewo oskrzelowe
Branch.h
Idź do dokumentacji tego pliku.
1 /*=========================================================================
2 
3  Program: 3D Human Airway Tree
4  Module: Branch.h
5  Copyright (c) Kacper Pluta <kacperp@wsinf.edu.pl>
6  All rights reserved.
7  See Copyright.txt or http://leo.wsinf.edu.pl/~kacperp/3dtree for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 
22 #ifndef BRANCH_H
23 #define BRANCH_H
24 
25 #include <boost/shared_ptr.hpp>
26 #include "BasicObject.h"
27 #include <vtkPolyData.h>
28 #include <vtkTubeFilter.h>
29 #include <vtkCellArray.h>
30 #include <vtkTriangleFilter.h>
31 
33 class Branch : public BasicObject
34 {
35 private:
36  bool isEndBranch;
37  vtkPolyData *branchRegion;
38  vtkTubeFilter *tubeFilter;
39  int nV; // Ilość punktów
40  double vX, vY, vZ, h;
41  int equation;
42  double rS; // Promień spirali
43  unsigned int nCyc;
44  vtkPoints *points;
45  vtkCellArray *lines;
46  vtkPolyData *polyData;
47  //Zastosowanie filtru na gałęzi naprawia test kolizji
48  vtkTriangleFilter *triFilter;
49 
50 public:
52  static boost::shared_ptr<Branch> New(double r, double p_h, twisting p_twist = TWIST_ON);
53  static boost::shared_ptr<Branch> New(double r, double p_h, vtkTransform *relativeTrans, int rootEQ, twisting p_twist = TWIST_ON);
55  void AddRegion(vtkPolyData *t_Region){branchRegion->DeepCopy(t_Region);}
57  vtkPolyData *GetRegion() const {return branchRegion;}
59  void RemoveRegion();
61  virtual double GetDiameter() const {return tubeFilter->GetRadius()*2.0;}
63  int GetEQ() const {return equation;}
64  virtual double GetHeight() const {return h;}
66  virtual double GetRadius() const {return tubeFilter->GetRadius();}
67  virtual void ChangeRadiusWithoutEffect(double r)
68  {
69  tubeFilter->SetRadius(r);
70  triFilter->Update();
71  this->Update();
72  }
73 
75  virtual double* GetCenter() const {return GetOutput()->GetCenter();}
76  virtual ~Branch();
77  void SetIsEnd(){ isEndBranch = true; }
78  bool GetIsEnd() const { return isEndBranch; }
79 protected:
80  Branch(double r, double p_h, twisting p_twist);
81  Branch(double r, double p_h, vtkTransform *relativeTrans, int rootEQ, twisting p_twist);
82 };
83 
84 #endif // BRANCH_H