From: bharath Date: Sun, 1 Aug 2010 20:22:59 +0000 (+0000) Subject: Modified to use SetNextOutput function. X-Git-Tag: v1.2.0~453 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c815fc7a61c591bcd3e12289cffb42ab532bd454;p=clitk.git Modified to use SetNextOutput function. --- diff --git a/registration/clitkAffineRegistrationGenericFilter.txx b/registration/clitkAffineRegistrationGenericFilter.txx index 73300d7..2194c82 100644 --- a/registration/clitkAffineRegistrationGenericFilter.txx +++ b/registration/clitkAffineRegistrationGenericFilter.txx @@ -69,7 +69,7 @@ AffineRegistrationGenericFilter::AffineRegist { InitializeImageType<2>(); InitializeImageType<3>(); - m_Verbose=false; + m_Verbose=true; } //==========================================================================================================// //============================================================================================================// @@ -157,6 +157,7 @@ void AffineRegistrationGenericFilter::SetArgs { m_ArgsInfo=a; if (m_ArgsInfo.reference_given) AddInputFilename(m_ArgsInfo.reference_arg); + if (m_ArgsInfo.target_given) { AddInputFilename(m_ArgsInfo.target_arg); } @@ -201,7 +202,8 @@ void AffineRegistrationGenericFilter::UpdateW //Whatever the pixel type, internally we work with an image represented in float typedef typename InputImageType::PixelType InternalPixelType; - typedef itk::Image< InternalPixelType, InputImageType::ImageDimension > InternalImageType; + typedef itk::Image< PixelType, InputImageType::ImageDimension > InternalImageType; + //Read in the reference/fixed image // typedef itk::ImageFileReader< InternalImageType > ReaderType; @@ -377,6 +379,7 @@ void AffineRegistrationGenericFilter::UpdateW movingImagePyramid->SetInput(movingImage); movingImagePyramid->SetNumberOfLevels(m_ArgsInfo.levels_arg); if (m_Verbose) std::cout<<"Creating the image pyramid..."<Update(); movingImagePyramid->Update(); @@ -456,17 +459,19 @@ void AffineRegistrationGenericFilter::UpdateW genericAffineTransform->SetArgsInfo(m_ArgsInfo); typedef itk::Transform< double, InputImageType::ImageDimension, InputImageType::ImageDimension > TransformType; typename TransformType::Pointer transform = genericAffineTransform->GetTransform(); + std::cout< GenericInterpolatorType; typename GenericInterpolatorType::Pointer genericInterpolator=GenericInterpolatorType::New(); genericInterpolator->SetArgsInfo(m_ArgsInfo); typedef itk::InterpolateImageFunction< InternalImageType, TCoordRep > InterpolatorType; typename InterpolatorType::Pointer interpolator=genericInterpolator->GetInterpolatorPointer(); - + std::cout<<"end of interpolator"<::UpdateW //============================================================================ // Multiresolution registration //============================================================================ + std::cout<<"start MultiResolution..."< RegistrationType; typename RegistrationType::Pointer registration = RegistrationType::New(); registration->SetFixedImage( fixedImage ); @@ -554,7 +560,6 @@ void AffineRegistrationGenericFilter::UpdateW for (unsigned int i=0; i::UpdateW //============================================================================ // Prepare the resampling filter in order to transform the moving image. //============================================================================ - if (m_ArgsInfo.output_given || m_ArgsInfo.checker_after_given || m_ArgsInfo.after_given ) { + // if (m_ArgsInfo.output_given || m_ArgsInfo.checker_after_given || m_ArgsInfo.after_given ) { transform->SetParameters( finalParameters ); typedef itk::ResampleImageFilter< InternalImageType,InternalImageType > ResampleFilterType; typename ResampleFilterType::Pointer resampler = ResampleFilterType::New(); @@ -593,16 +599,20 @@ void AffineRegistrationGenericFilter::UpdateW resampler->SetOutputOrigin( fixedImage->GetOrigin() ); resampler->SetOutputSpacing( fixedImage->GetSpacing() ); resampler->SetDefaultPixelValue( 0 ); - + resampler->Update(); //Output? - if (m_ArgsInfo.output_given) { + // if (m_ArgsInfo.output_given) { //We write an output in the same pixeltype then the input - typedef itk::ImageFileWriter< FixedImageType > WriterType; + /*typedef itk::ImageFileWriter< FixedImageType > WriterType; typename WriterType::Pointer outputWriter = WriterType::New(); outputWriter->SetFileName(m_ArgsInfo.output_arg ); outputWriter->SetInput( resampler->GetOutput() ); - outputWriter->Update(); - } + outputWriter->Update();*/ + typedef InternalImageType OutputImageType; + typename OutputImageType::Pointer outputImage = resampler->GetOutput(); + std::cout<<"Writing Output....."<template SetNextOutput(outputImage); + // } //============================================================================ @@ -671,7 +681,7 @@ void AffineRegistrationGenericFilter::UpdateW differenceAfterWriter->SetInput( differenceAfterFilter->GetOutput() ); differenceAfterWriter->Update(); } - } +// } //============================================================================ // Difference Before?