00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SO_SOIMAGEREGISTRATIONTRANSFORM_H_
00025 #define _SO_SOIMAGEREGISTRATIONTRANSFORM_H_
00026
00027 #include <Inventor/SbMatrix.h>
00028 #include <Inventor/fields/SoSFEnum.h>
00029 #include <Inventor/fields/SoSFMatrix.h>
00030 #include <Inventor/fields/SoSFInt32.h>
00031 #include <Inventor/fields/SoSFVec2f.h>
00032 #include <Inventor/fields/SoSFVec3i32.h>
00033 #include <Inventor/fields/SoSFBool.h>
00034
00035 #include <ImageViz/Fields/SoSFImageDataAdapter.h>
00036 #include <ImageViz/SoImageViz.h>
00037 #include <ImageViz/Engines/SoImageVizEngineOutput.h>
00038 #include <ImageViz/Engines/SoImageVizEngine.h>
00039 #include <ImageViz/Engines/SoSubImageVizEngine.h>
00040 #include <ImageViz/Nodes/Registration/SoRegistrationResult.h>
00041
00042
00094 class SoImageRegistrationTransform : public SoImageVizEngine
00095 {
00096 SO_IMAGEVIZ_ENGINE_HEADER( SoImageRegistrationTransform );
00097
00098 public:
00099
00105 struct RegistrationEvent : public SbEventArg
00106 {
00108 SoImageVizEngine* getSource() const
00109 {
00110 return m_engine;
00111 }
00112
00114 float getProgress() const
00115 {
00116 return m_progress;
00117 }
00118
00127 double getSimilarity() const
00128 {
00129 return m_similarity;
00130 }
00131
00133 SbMatrix getTransform() const
00134 {
00135 return m_transform;
00136 }
00137
00139 RegistrationEvent( SoImageVizEngine* engine, float progress, double similarity, const SbMatrix& matrix )
00140 : m_engine( engine ),
00141 m_progress( progress ),
00142 m_similarity( similarity ),
00143 m_transform( matrix )
00144 { }
00145
00147 ~RegistrationEvent() { }
00148
00149 private:
00150 SoImageVizEngine* m_engine;
00151 float m_progress;
00152 double m_similarity;
00153 SbMatrix m_transform;
00154 };
00155
00157 SbEventHandler<RegistrationEvent&> onProgressRegistration;
00158
00160 SoImageRegistrationTransform();
00161
00165 SoSFEnum computeMode;
00166
00168 SoSFImageDataAdapter inMovingImage;
00169
00171 SoSFImageDataAdapter inFixedImage;
00172
00175 SoSFMatrix initialTransform;
00176
00179 SoSFBool autoParameterMode;
00180
00188 SoSFVec2f optimizerStep;
00189
00196 SoSFVec3i32 coarsestResampling;
00197
00201 enum TransformationType
00202 {
00206 TRANSLATION = 4,
00207
00211 RIGID = 0,
00215 RIGID_ISOTROPIC_SCALING = 1,
00219 RIGID_ANISOTROPIC_SCALING = 2,
00223 AFFINE = 3,
00224 };
00225
00230 SoSFEnum transformType;
00231
00236 SoSFBool ignoreFinestLevel;
00237
00241 enum MetricType
00242 {
00251 EUCLIDIAN = 0,
00259 CORRELATION,
00273 NORMALIZED_MUTUAL_INFORMATION,
00274 };
00275
00280 SoSFEnum metricType;
00281
00282
00284 SoImageVizEngineOutput<SoSFFieldContainer, SoRegistrationResult*> outTransform;
00285
00287 SbMatrix getOutputTransformation()
00288 {
00289 return outTransform.getValue()->transformation.getValue();
00290 }
00291
00292 private:
00294 virtual ~SoImageRegistrationTransform();
00295 };
00296
00297 #endif //_SO_SOIMAGEREGISTRATIONTRANSFORM_H_
00298