//typedef typename InputImageType::ImageDimension Dimension;
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
bool threadsGiven=m_ArgsInfo.threads_given;
int threads=m_ArgsInfo.threads_arg;
#endif
typename MetricType::Pointer metric=genericMetric->GetMetricPointer();
if (movingMask) metric->SetMovingImageMask(movingMask);
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
if (threadsGiven) metric->SetNumberOfThreads( threads );
#else
if (m_Verbose) std::cout<<"Not setting the number of threads (not compiled with USE_OPTIMIZED_REGISTRATION_METHODS)..."<<std::endl;
typename MetricType::Pointer metric=genericMetric->GetMetricPointer();
if (movingMask) metric->SetMovingImageMask(movingMask);
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
if (threadsGiven) {
metric->SetNumberOfThreads( threads );
if (m_Verbose) std::cout<< "Using " << threads << " threads." << std::endl;
typename FixedImageType::Pointer m_FixedImage;
typename FixedImageMaskType::ConstPointer m_FixedImageMask;
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
FixedImagePixelType m_FixedImageSamplesIntensityThreshold;
bool m_UseFixedImageSamplesIntensityThreshold;
#endif
m_Maximize=false;
m_Verbose=false;
m_FixedImageRegionGiven=false;
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
m_FixedImageSamplesIntensityThreshold=0;
m_UseFixedImageSamplesIntensityThreshold=false;
#endif
//m_Metric->SetFixedImageRegion(mask_region);
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
//============================================================================
// Set the lower intensity threshold
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "clitkOptNormalizedCorrelationImageToImageMetric.h"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "clitkOptNormalizedCorrelationImageToImageMetric.txx"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.h"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx"
#else
#ifndef __clitkOptNormalizedCorrelationImageToImageMetric_h
#define __clitkOptNormalizedCorrelationImageToImageMetric_h
-#include "itkOptImageToImageMetric.h"
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkImageToImageMetric.h"
+#else
+ #include "itkOptImageToImageMetric.h"
+#endif
#include "itkCovariantVector.h"
#include "itkPoint.h"
#include "itkIndex.h"
}
// Jacobian should be evaluated at the unmapped (fixed image) point.
+#if ITK_VERSION_MAJOR >= 4
+ TransformJacobianType jacobian;
+ transform->ComputeJacobianWithRespectToParameters(fixedImagePoint, jacobian);
+#else
const TransformJacobianType & jacobian = transform
->GetJacobian( fixedImagePoint );
+#endif
for(unsigned int par=0; par<this->m_NumberOfParameters; par++) {
RealType sumF = itk::NumericTraits< RealType >::Zero;
#ifndef __clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD_h
#define __clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD_h
-#include "itkOptImageToImageMetric.h"
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkImageToImageMetric.h"
+#else
+ #include "itkOptImageToImageMetric.h"
+#endif
#include "itkCovariantVector.h"
#include "itkPoint.h"
#include "itkIndex.h"
}
// Jacobian should be evaluated at the unmapped (fixed image) point.
+#if ITK_VERSION_MAJOR >= 4
+ TransformJacobianType jacobian;
+ transform->ComputeJacobianWithRespectToParameters( fixedImagePoint, jacobian );
+#else
const TransformJacobianType & jacobian = transform->GetJacobian( fixedImagePoint );
+#endif
// for(unsigned int par=0; par<this->m_NumberOfParameters; par++)
// {
typename MetricType::Pointer metric=genericMetric->GetMetricPointer();
if (movingMask) metric->SetMovingImageMask(movingMask);
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
if (threadsGiven) metric->SetNumberOfThreads( threads );
#else
if (m_Verbose) std::cout<<"Not setting the number of threads (not compiled with USE_OPTIMIZED_REGISTRATION_METHODS)..."<<std::endl;
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.h"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.h"
#else
// gets integrated into the main directories.
#include "itkConfigure.h"
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
+#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4
#include "itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx"
#else
#ifndef __itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD_h
#define __itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD_h
-#include "itkOptImageToImageMetric.h"
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkImageToImageMetric.h"
+#else
+ #include "itkOptImageToImageMetric.h"
+#endif
#include "itkCovariantVector.h"
#include "itkPoint.h"
#include "itkIndex.h"
transform = this->m_Transform;
}
+#if ITK_VERSION_MAJOR >= 4
+ JacobianType jacobian;
+ transform->ComputeJacobianWithRespectToParameters(this->m_FixedImageSamples[sampleNumber].point, jacobian);
+#else
const JacobianType& jacobian =
transform->GetJacobian( this->m_FixedImageSamples[sampleNumber].point );
+#endif
// for ( unsigned int mu = 0; mu < this->m_NumberOfParameters; mu++ )
// {
indicesHelper = &(this->m_BSplineTransformIndices);
}
+#if ITK_VERSION_MAJOR >= 4
+ this->m_BSplineTransform->ComputeJacobianFromBSplineWeightsWithRespectToPosition(
+ this->m_FixedImageSamples[sampleNumber].point,
+ *weightsHelper, *indicesHelper );
+#else
this->m_BSplineTransform->GetJacobian(
this->m_FixedImageSamples[sampleNumber].point,
*weightsHelper, *indicesHelper );
+#endif
}
for( unsigned int dim = 0; dim < Superclass::FixedImageDimension; dim++ ) {
#ifndef __itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD_h
#define __itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD_h
-#include "itkOptImageToImageMetric.h"
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkImageToImageMetric.h"
+#else
+ #include "itkOptImageToImageMetric.h"
+#endif
#include "itkCovariantVector.h"
#include "itkPoint.h"
#include "itkIndex.h"
}
// Jacobian should be evaluated at the unmapped (fixed image) point.
+#if ITK_VERSION_MAJOR >= 4
+ TransformJacobianType jacobian;
+ transform->ComputeJacobianWithRespectToParameters(this->m_FixedImageSamples[fixedImageSample].point, jacobian);
+#else
const TransformJacobianType & jacobian = transform ->GetJacobian( this->m_FixedImageSamples[fixedImageSample].point );
+#endif
//double sum;
unsigned int par, dim;
for( par=0; par<this->m_NumberOfParameters; par+=3) {