Authors belong to:
- University of LYON http://www.universite-lyon.fr/
- - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ - Léon Bérard cancer center http://www.centreleonberard.fr
- CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
This software is distributed WITHOUT ANY WARRANTY; without even
- BSD See included LICENSE.txt file
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-======================================================================-====*/
+===========================================================================**/
#ifndef CLITKAFFINEREGISTRATIONGENERICFILTER_CXX
#define CLITKAFFINEREGISTRATIONGENERICFILTER_CXX
#include "clitkAffineRegistrationGenericFilter.h"
+// clitk include
+#include "clitkIO.h"
+#include "clitkCommon.h"
+#include "clitkImageCommon.h"
+#include "clitkAffineRegistration_ggo.h"
+#include "clitkImageArithm_ggo.h"
+#include "clitkCorrelationRatioImageToImageMetric.h"
+#include "clitkTransformUtilities.h"
+#include "clitkGenericMetric.h"
+#include "clitkGenericOptimizer.h"
+#include "clitkGenericInterpolator.h"
+#include "clitkGenericAffineTransform.h"
+#include "clitkImageToImageGenericFilter.h"
+
+
+//itk include
+#include <itkMultiResolutionImageRegistrationMethod.h>
+#include <itkMultiResolutionPyramidImageFilter.h>
+#include <itkImageToImageMetric.h>
+#include <itkEuler2DTransform.h>
+#include <itkCenteredEuler3DTransform.h>
+#include <itkImage.h>
+#include <itkResampleImageFilter.h>
+#include <itkCastImageFilter.h>
+#include <itkNormalizeImageFilter.h>
+#include <itkDiscreteGaussianImageFilter.h>
+#include <itkImageMaskSpatialObject.h>
+#include <itkCommand.h>
+#include <itkCheckerBoardImageFilter.h>
+#include <itkSubtractImageFilter.h>
+#include <itkLightObject.h>
+#include <itkImageMomentsCalculator.h>
+#include <itkThresholdImageFilter.h>
+
+// other includes
+#include <time.h>
+#include <iostream>
+#include <iomanip>
+
namespace clitk
{
}
// Execute
- void Execute(itk::Object *caller, const itk::EventObject & event) {
+ void Execute(itk::Object *caller, const itk::EventObject & event) ITK_OVERRIDE {
Execute( (const itk::Object *)caller, event);
}
- void Execute(const itk::Object * object, const itk::EventObject & event) {
+ void Execute(const itk::Object * object, const itk::EventObject & event) ITK_OVERRIDE {
if ( !(itk::IterationEvent().CheckEvent( &event )) ) {
return;
}
// Two arguments are passed to the Execute() method: the first
// is the pointer to the object which invoked the event and the
// second is the event that was invoked.
- void Execute(itk::Object * object, const itk::EventObject & event) {
+ void Execute(itk::Object * object, const itk::EventObject & event) ITK_OVERRIDE {
if ( !(itk::IterationEvent().CheckEvent( &event )) ) {
return;
}
}
}
- void Execute(const itk::Object * , const itk::EventObject & ) {
+ void Execute(const itk::Object * , const itk::EventObject & ) ITK_OVERRIDE {
return;
}
typedef typename InputImageType::PixelType PixelType;
//typedef typename InputImageType::ImageDimension Dimension;
-
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
bool threadsGiven=m_ArgsInfo.threads_given;
int threads=m_ArgsInfo.threads_arg;
-#endif
//Coordinate Representation
typedef double TCoordRep;
// If given, we connect a mask to reference or target
//============================================================================
typedef itk::ImageMaskSpatialObject< InputImageType::ImageDimension > MaskType;
- typename MaskType::Pointer fixedMask=NULL;
+ typename MaskType::Pointer fixedMask=ITK_NULLPTR;
if (m_ArgsInfo.referenceMask_given) {
fixedMask= MaskType::New();
typedef itk::Image< unsigned char, InputImageType::ImageDimension > ImageMaskType;
}
typedef itk::ImageMaskSpatialObject< InputImageType::ImageDimension > MaskType;
- typename MaskType::Pointer movingMask=NULL;
+ typename MaskType::Pointer movingMask=ITK_NULLPTR;
if (m_ArgsInfo.targetMask_given) {
movingMask= MaskType::New();
typedef itk::Image< unsigned char, InputImageType::ImageDimension > ImageMaskType;
typename MetricType::Pointer metric=genericMetric->GetMetricPointer();
if (movingMask) metric->SetMovingImageMask(movingMask);
-#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
- if (threadsGiven) metric->SetNumberOfThreads( threads );
+ if (threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+ metric->SetNumberOfThreads( threads );
#else
- if (m_Verbose) std::cout<<"Not setting the number of threads (not compiled with USE_OPTIMIZED_REGISTRATION_METHODS)..."<<std::endl;
+ metric->SetNumberOfWorkUnits( threads );
#endif
+ }
//============================================================================
// Initialize using image moments.
if (m_Verbose) std::cout << "Starting the registration now..." << std::endl;
try {
- registration->StartRegistration();
+ registration->Update();
} catch ( itk::ExceptionObject & err ) {
std::cerr << "ExceptionObject caught !" << std::endl;
std::cerr << err << std::endl;