12 template <
class TFixedImage,
class TMovingImage>
20 m_NumberOfPixelsCounted = 0;
22 m_ModelRotation = FINITE_STRAIN;
23 m_OrientationMatrix.set_size(FixedImageDimension,FixedImageDimension);
29 template <
class TFixedImage,
class TMovingImage>
40 template <
class TFixedImage,
class TMovingImage>
47 itkExceptionMacro(<<
"Transform has not been assigned");
49 m_Transform->SetParameters( parameters );
51 if (m_ModelRotation != NONE)
53 typedef itk::MatrixOffsetTransformBase <CoordinateRepresentationType, FixedImageDimension, FixedImageDimension> BaseTransformType;
54 BaseTransformType *currentTrsf =
dynamic_cast<BaseTransformType *
> (this->m_Transform.GetPointer());
55 vnl_matrix <double> jacMatrix = currentTrsf->GetMatrix().GetVnlMatrix().as_matrix();
57 if (m_ModelRotation == FINITE_STRAIN)
59 vnl_matrix <double> tmpMat(FixedImageDimension, FixedImageDimension);
63 m_OrientationMatrix = jacMatrix;
71 template <
class TFixedImage,
class TMovingImage>
79 itkExceptionMacro(<<
"Transform is not present");
84 itkExceptionMacro(<<
"Interpolator is not present");
89 itkExceptionMacro(<<
"MovingImage is not present");
94 itkExceptionMacro(<<
"FixedImage is not present");
97 if( m_FixedImageRegion.GetNumberOfPixels() == 0 )
99 itkExceptionMacro(<<
"FixedImageRegion is empty");
103 if( m_MovingImage->GetSource() )
105 m_MovingImage->GetSource()->Update();
109 if( m_FixedImage->GetSource() )
111 m_FixedImage->GetSource()->Update();
115 if ( !m_FixedImageRegion.Crop( m_FixedImage->GetBufferedRegion() ) )
118 <<
"FixedImageRegion does not overlap the fixed image buffered region" );
121 m_Interpolator->SetInputImage( m_MovingImage );
125 this->InvokeEvent( itk::InitializeEvent() );
132 template <
class TFixedImage,
class TMovingImage>
137 Superclass::PrintSelf( os, indent );
138 os << indent <<
"Moving Image: " << m_MovingImage.GetPointer() << std::endl;
139 os << indent <<
"Fixed Image: " << m_FixedImage.GetPointer() << std::endl;
140 os << indent <<
"Transform: " << m_Transform.GetPointer() << std::endl;
141 os << indent <<
"Interpolator: " << m_Interpolator.GetPointer() << std::endl;
142 os << indent <<
"FixedImageRegion: " << m_FixedImageRegion << std::endl;
143 os << indent <<
"Moving Image Mask: " << m_MovingImageMask.GetPointer()
145 os << indent <<
"Fixed Image Mask: " << m_FixedImageMask.GetPointer()
147 os << indent <<
"Number of Pixels Counted: " << m_NumberOfPixelsCounted
virtual ~BaseOrientedModelImageToImageMetric()
virtual void Initialize()
void ExtractRotationFromJacobianMatrix(vnl_matrix< RealType > &jacobianMatrix, vnl_matrix< RealType > &rotationMatrix, vnl_matrix< RealType > &tmpMat)
BaseOrientedModelImageToImageMetric()
void PrintSelf(std::ostream &os, itk::Indent indent) const ITK_OVERRIDE
Superclass::ParametersType ParametersType
void SetTransformParameters(const ParametersType ¶meters) const