/vol/vipdata/irtk/packages/registration/include/irtkImageFreeFormRegistration.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _IRTKIMAGEFREEFORMREGISTRATION_H
00014
00015 #define _IRTKIMAGEFREEFORMREGISTRATION_H
00016
00017
00018 typedef enum { RegisterX, RegisterY, RegisterXY, RegisterXYZ } irtkImageFreeFormRegistrationMode;
00019
00020 #ifdef HAS_TBB
00021
00022 class irtkMultiThreadedImageFreeFormRegistrationEvaluate;
00023 class irtkMultiThreadedImageFreeFormRegistrationEvaluateGradient;
00024
00025 #endif
00026
00036 class irtkImageFreeFormRegistration : public irtkImageRegistration
00037 {
00038
00039 #ifdef HAS_TBB
00040
00041 friend class irtkMultiThreadedImageFreeFormRegistrationEvaluate;
00042 friend class irtkMultiThreadedImageFreeFormRegistrationEvaluateGradient;
00043
00044 #endif
00045
00047 friend float irtkFreeFormRegistration_Ptr2NRfunc (float *x);
00048
00050 friend void irtkFreeFormRegistration_Ptr2NRdfunc(float *x, float *dx);
00051
00052 protected:
00053
00055 irtkBSplineFreeFormTransformation *_affd;
00056
00058 irtkMultiLevelFreeFormTransformation *_mffd;
00059
00061 irtkSimilarityMetric *_tmpMetricA, *_tmpMetricB;
00062
00066 float *_mffdLookupTable;
00067
00071 float *_affdLookupTable;
00072
00075 float *_localLookupTable;
00076
00078 double _Lambda1;
00079
00081 double _Lambda2;
00082
00084 double _Lambda3;
00085
00087 double _DX;
00088
00090 double _DY;
00091
00093 double _DZ;
00094
00096 Bool _Subdivision;
00097
00099 double _SpeedupFactor;
00100
00102 irtkImageFreeFormRegistrationMode _Mode;
00103
00105 virtual void Initialize();
00106
00108 virtual void Initialize(int);
00109
00111 virtual void Finalize();
00112
00114 virtual void Finalize(int);
00115
00117 virtual double SmoothnessPenalty();
00118
00120 virtual double SmoothnessPenalty(int);
00121
00123 virtual double VolumePreservationPenalty();
00124
00126 virtual double VolumePreservationPenalty(int);
00127
00129 virtual double TopologyPreservationPenalty();
00130
00132 virtual double TopologyPreservationPenalty(int);
00133
00139 virtual double Evaluate();
00140
00148 virtual double EvaluateDerivative(int, double);
00149
00159 virtual double EvaluateGradient(float, float *);
00160
00162 virtual void UpdateLUT();
00163
00164 public:
00165
00167 irtkImageFreeFormRegistration();
00168
00170 virtual void SetOutput(irtkTransformation *);
00171
00173 virtual const char *NameOfClass();
00174
00176 virtual void Print();
00177
00179 virtual void GuessParameter();
00180
00182 virtual Bool Read(char *, char *, int &);
00183
00185 virtual void Write(ostream &);
00186
00187
00188 virtual SetMacro(DX, double);
00189 virtual GetMacro(DX, double);
00190 virtual SetMacro(DY, double);
00191 virtual GetMacro(DY, double);
00192 virtual SetMacro(DZ, double);
00193 virtual GetMacro(DZ, double);
00194 virtual SetMacro(SpeedupFactor, double);
00195 virtual GetMacro(SpeedupFactor, double);
00196
00197
00198 virtual SetMacro(Mode, irtkImageFreeFormRegistrationMode);
00199 virtual GetMacro(Mode, irtkImageFreeFormRegistrationMode);
00200 };
00201
00202 inline void irtkImageFreeFormRegistration::SetOutput(irtkTransformation *transformation)
00203 {
00204
00205 this->Debug("irtkImageFreeFormRegistration::SetOutput");
00206
00207 if (strcmp(transformation->NameOfClass(),
00208 "irtkMultiLevelFreeFormTransformation") != 0) {
00209 cerr << "irtkImageFreeFormRegistration::SetOutput: Transformation must be "
00210 << "irtkMultiLevelFreeFormTransformation" << endl;
00211 exit(0);
00212 }
00213 _transformation = transformation;
00214 }
00215
00216 inline const char *irtkImageFreeFormRegistration::NameOfClass()
00217 {
00218 return "irtkFreeFormRegistration";
00219 }
00220
00221 inline void irtkImageFreeFormRegistration::Print()
00222 {}
00223
00224 #endif