NorMIT-nav  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SeansVesselReg.hxx
Go to the documentation of this file.
1 #ifndef SeansVesselSegmentation_hxx
2 #define SeansVesselSegmentation_hxx
3 
4 #include "cxResourceExport.h"
5 
8 #include "cxTransform3D.h"
9 #include "vtkSmartPointer.h"
10 
11 namespace cx
12 {
30 class cxResource_EXPORT SeansVesselReg
31 {
32 public:
36  struct cxResource_EXPORT Context
37  {
41 
42  vtkPolyDataPtr getMovingPoints();
43  vtkPolyDataPtr getFixedPoints();
44  vtkPolyDataPtr getDifferenceLines();
45 
48 
51  double mMetric;
52 
53  double mLtsRatio;
54 
55  //---------------------------------------------------------------------------
56  //TODO non-linear needs to handle this!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
58  //---------------------------------------------------------------------------
59  };
60  typedef boost::shared_ptr<Context> ContextPtr;
61 
63  ~SeansVesselReg();
64 
65  bool initialize(DataPtr source, DataPtr target, QString logPath);
66  bool isValid() const;
67  bool execute();
68  bool performOneRegistration();
69 
70  Transform3D getLinearResult(ContextPtr context=ContextPtr());
71  double getResultMetric(ContextPtr context=ContextPtr());
72  double getResultLtsRatio(ContextPtr context=ContextPtr());
73  Transform3D getNonLinearTransform();
74  void checkQuality(Transform3D linearTransform);
75 // ImagePtr loadMinc(char* source_file);
76  void setDebugOutput(bool on)
77  {
78  mt_verbose = on;
79  }
80  vtkPolyDataPtr getDifferenceLines();
81  void notifyPreRegistrationWarnings();
82 
83 
87  double mt_lambda;
88  double mt_sigma;
90 // bool mt_doStepping;
94  bool mt_verbose;
96  double margin;
97  QString m_logPath;
98 
99  // debug interface:
100  ContextPtr createContext(DataPtr source, DataPtr target);
101  void performOneRegistration(ContextPtr context, bool linear);
102  void computeDistances(ContextPtr context = ContextPtr());
103  static vtkPolyDataPtr convertToPolyData(vtkPointsPtr input);
104 
112  static vtkPolyDataPtr extractPolyData(ImagePtr image, int p_neighborhoodFilterThreshold,
113  double p_BoundingBox[6]);
114 private:
115  Transform3D getLinearTransform(vtkGeneralTransformPtr concatenation);
116 
117 protected:
118  bool runAlgorithm(ContextPtr context, vtkGeneralTransformPtr myConcatenation, int largeSteps, double fraction);
119  void printOutResults(QString fileNamePrefix, vtkGeneralTransformPtr myConcatenation);
120  vtkAbstractTransformPtr linearRegistration(vtkPointsPtr sortedSourcePoints, vtkPointsPtr sortedTargetPoints);
121  vtkAbstractTransformPtr nonLinearRegistration(vtkPointsPtr sortedSourcePoints, vtkPointsPtr sortedTargetPoints);
122  vtkPolyDataPtr convertToPolyData(DataPtr data, QString id);
124  vtkPointsPtr createSortedPoints(vtkIdListPtr sortedIDList, vtkPointsPtr unsortedPoints, int numPoints);
125  vtkPolyDataPtr crop(vtkPolyDataPtr input, vtkPolyDataPtr fixed, double margin);
126  ContextPtr linearRefineAllLTS(ContextPtr context);
127  void linearRefine(ContextPtr context);
128  SeansVesselReg::ContextPtr splitContext(ContextPtr context);
129 
130  void print(vtkPointsPtr points);
131  void print(vtkPolyDataPtr data);
132 
133 
134 
135 // Transform3D mLinearTransformResult;
137 
138 // //---------------------------------------------------------------------------
139 // //TODO non-linear needs to handle this!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
140 // bool mInvertedTransform; ///< the calculated registration goes from target to source instead of source to target
141 // //---------------------------------------------------------------------------
142 };
143 }//namespace cx
144 #endif
void setDebugOutput(bool on)
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
vtkGeneralTransformPtr mConcatenation
output: concatenation of all transforms so far
double mt_distanceDeltaStopThreshold
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
ContextPtr mLastRun
result from last run of execute()
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:48
bool mInvertedTransform
the calculated registration goes from target to source instead of source to target ...
double mt_maximumDurationSeconds
vtkCellLocatorPtr mTargetPointLocator
input: target data wrapped in a locator
vtkPolyDataPtr mTargetPoints
input: target data
vtkSmartPointer< class vtkIdList > vtkIdListPtr
double mMetric
output: mean least squares from BEFORE last iteration.
vtkPointsPtr mSortedSourcePoints
source points sorted according to distance to target, mSortedSourcePoints==mSortedTargetPoints ...
boost::shared_ptr< class Data > DataPtr
vtkSmartPointer< class vtkCellLocator > vtkCellLocatorPtr
vtkSmartPointer< class vtkPolyData > vtkPolyDataPtr
double mLtsRatio
local copy of the lts ratio, can be changed for current iteration.
vtkSmartPointer< class vtkAbstractTransform > vtkAbstractTransformPtr
vtkAbstractTransformPtr mTransform
output: transform from last iteration
vtkSmartPointer< class vtkGeneralTransform > vtkGeneralTransformPtr
vtkPointsPtr mSortedTargetPoints
source points projected onto the target points (closest points) mSortedSourcePoints==mSortedTargetPoi...
boost::shared_ptr< Context > ContextPtr
void print(QString header, QRect r)
vtkSmartPointer< class vtkPoints > vtkPointsPtr
vtkPointsPtr mSourcePoints
input: current source data, modified according to last iteration