760 likes | 927 Views
CSci 6971: Image Registration Lecture 8: Registration Components February 6, 2004. Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware. Image Metrics. How similar is image A to image B ?. Image Metrics. Does Image B matches Image A better than Image C ?. Image Metrics.
E N D
CSci 6971: Image Registration Lecture 8: Registration ComponentsFebruary 6, 2004 Prof. Chuck Stewart, RPI Dr. Luis Ibanez, Kitware
Image Metrics How similar is image A to image B ? Lecture 8
Image Metrics Does Image Bmatches Image A better than Image C ? Lecture 8
Image Metrics >< Match( A , B ) Match( A , C ) Image B Image A Image C Lecture 8
Image Metrics Match( A , B )Simplest MetricMean Squared Differences Lecture 8
Mean Squared Differences For each pixel in A Image A Image B Difference( index ) = A( index ) – B( index ) Sum += Difference( index ) 2 Match( A , B ) = Sum / numberOfPixels Lecture 8
j j i i Moving Image Grid Fixed Image Grid y’ y Space Transform x’ x Moving ImagePhysical Coordinates Fixed ImagePhysical Coordinates For each pixel in the Fixed Image Lecture 8
Image Metrics FixedImage Metric Value MovingImage Interpolator Transform Parameters Lecture 8
Mean Squared Differences #include "itkImage.h" #include "itkMeanSquaresImageToImageMetric.h" #include "itkLinearInterpolateImageFunction.h" #include "itkTranslationTransform.h" typedef itk::Image< char, 2 > ImageType; ImageType::ConstPointerfixedImage = GetFixedImage(); ImageType::ConstPointermovingImage = GetMovingImage(); typedef itk::LinearInterpolateImageFunction<ImageType, double >InterpolatorType; InterpolatorType::Pointerinterpolator = InterpolatorType::New(); typedef itk::TranslationTransform< double, 2 > TransformType; TransformType::Pointertransform = TransformType::New(); Lecture 8
Mean Squared Differences typedef itk::MeanSquaresImageToImageMetric< ImageType,ImageType > MetricType; MetricType::Pointermetric = MetricType::New(); metric->SetInterpolator( interpolator ); metric->SetTransform( transform ); metric->SetFixedImage( fixedImage ); metric->SetMovingImage( movingImage ); MetricType::TransformParametersTypetranslation( Dimension ); translation[0] = 12; translation[1] = 27; double value = metric->GetValue( translation ); Lecture 8
Mean Squared Differences MetricType::TransformParametersTypetranslation( Dimension ); double value[21][21]; for( int dx = 0; dx <= 20; dx++) { for( int dy = 0; dy <= 20; dy++) { translation[0] = dx; translation[1] = dy; value[dx][dy] = metric->GetValue( translation ); } } Lecture 8
Evaluating many matches y y Transform x x Fixed Image Moving Image Lecture 8
Plotting the Metric Mean Squared Differences Transform Parametric Space Lecture 8
Plotting the Metric Mean Squared Differences Transform Parametric Space Lecture 8
Evaluating many matches y y Transform (-15,-25) mm x x Fixed Image Moving Image Lecture 8
Plotting the Metric Mean Squared Differences Transform Parametric Space Lecture 8
Plotting the Metric Mean Squared Differences Transform Parametric Space Lecture 8
The Best Transform Parameters Evaluation of the full parameter spaceis equivalent to performoptimization by exhaustive search Lecture 8
The Best Transform Parameters Very SafebutVery Slow Lecture 8
The Best Transform Parameters Better Optimization Methodsfor exampleGradient Descent Lecture 8
Image Registration Framework FixedImage Metric MovingImage Interpolator Optimizer Transform Parameters Lecture 8
G( x , y ) = ∆ f( x , y ) Gradient Descent Optimizer f( x , y ) S = Step L = LearningRate S=L∙ G( x , y ) Lecture 8
G( x , y ) = ∆ f( x , y ) Gradient Descent Optimizer f( x , y ) S=L∙ G( x , y ) Lecture 8
G( x , y ) = ∆ f( x , y ) Gradient Descent Optimizer f( x , y ) L too large S=L∙G( x , y ) Lecture 8
G( x , y ) = ∆ f( x , y ) Gradient Descent Optimizer f( x , y ) L too small S=L∙G( x , y ) Lecture 8
Gradient Descent Optimizer What’s wrong with this algorithm ? Lecture 8
Gradient Descent Optimizer = millimeters SUnits ? = intensity f(x,y) Units ? = intensity / millimeters G(x,y)Units ? S=L∙G( x , y ) = millimeters2 / intensity LUnits ? Lecture 8
Gradient Descent Optimizer f( x ) S=L∙G( x ) 1 1 Lecture 8
Gradient Descent Optimizer f( x ) S=L∙G( x ) S=Large in high gradients S=Small in low gradients 1 1 Lecture 8
Gradient Descent Optimizer f( x ) S=L∙G( x ) Works great with this function Works badly with this function Lecture 8
Gradient Descent Variant Driving Safe ! Lecture 8
Regular Step Gradient Descent f( x ) ^ S=D∙G( x ) IfG changes direction Di=Di-1/ 2.0 D1 D1 D2 D1 Lecture 8
Regular Step Gradient Descent f( x ) ^ S=D∙G( x ) User Selects D1 User Selects Dstop User Selects Gstop D1 D1 D2 D1 Lecture 8
Optimizers are like a car Watch while you are driving ! Lecture 8
Watch over your optimizer Example:Optimizer registering an image with itself starting at (-15mm, -25mm) Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 1.0 mm Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 2.0 mm Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 5.0 mm Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 10.0 mm Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 20.0 mm Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 40.0 mm Lecture 8
Watch over your optimizer Example:Optimizer registering an image shifted by (-15mm, -25mm)The optimizer starts at (0mm,0mm) Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 1.0 mm Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 2.0 mm Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 5.0 mm Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 10.0 mm Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 20.0 mm Lecture 8
Plotting the Optimizer’s Path Mean Squared Differences Step Length = 40.0 mm Lecture 8
Other Image Metrics Normalized Correlation Lecture 8
Normalized Correlation For each pixel in A Image A Image B SumAB += A( index ) ∙ B( index ) SumAA += A( index ) ∙ A( index ) SumBB += B( index ) ∙ B( index ) Match( A , B ) = SumAB / √ ( SumAA∙SumBB ) Lecture 8