1 /*===================================================================
3 The Medical Imaging Interaction Toolkit (MITK)
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 See LICENSE.txt or http://www.mitk.org for details.
15 ===================================================================*/
16 #ifndef _itkRegularizedIVIMReconstructionFilter_txx
17 #define _itkRegularizedIVIMReconstructionFilter_txx
19 #include "itkConstShapedNeighborhoodIterator.h"
20 #include "itkNeighborhoodInnerProduct.h"
21 #include "itkImageRegionIterator.h"
22 #include "itkImageRegionConstIterator.h"
23 #include "itkNeighborhoodAlgorithm.h"
24 #include "itkZeroFluxNeumannBoundaryCondition.h"
25 #include "itkOffset.h"
26 #include "itkProgressReporter.h"
34 template <class TInputPixel, class TOutputPixel, class TRefPixelType>
35 RegularizedIVIMReconstructionFilter<TInputPixel, TOutputPixel, TRefPixelType>
36 ::RegularizedIVIMReconstructionFilter()
42 template <class TInputPixel, class TOutputPixel, class TRefPixelType>
44 RegularizedIVIMReconstructionFilter<TInputPixel, TOutputPixel, TRefPixelType>
47 // first we cast the input image to match output type
48 typename CastType::Pointer infilter = CastType::New();
49 infilter->SetInput(this->GetInput());
51 typename OutputImageType::Pointer image = infilter->GetOutput();
53 typename SingleIterationFilterType::Pointer filter;
54 for(int i=0; i<m_NumberIterations; i++)
56 filter = SingleIterationFilterType::New();
57 filter->SetInput( image.GetPointer() );
58 filter->SetOriginalImage( m_ReferenceImage );
59 filter->SetBValues(m_BValues);
60 filter->SetLambda(m_Lambda);
61 filter->SetNumberOfThreads(this->GetNumberOfThreads());
62 filter->UpdateLargestPossibleRegion();
63 image = filter->GetOutput();
64 std::cout << "Iteration " << i+1 << "/" <<
65 m_NumberIterations << std::endl;
68 typename OutputImageType::Pointer output = this->GetOutput();
69 output->SetOrigin( image->GetOrigin() ); // Set the image origin
70 output->SetDirection( image->GetDirection() ); // Set the image direction
71 output->SetSpacing(image->GetSpacing());
72 output->SetLargestPossibleRegion( image->GetLargestPossibleRegion() );
73 output->SetBufferedRegion( image->GetLargestPossibleRegion() );
76 itk::ImageRegionIterator<OutputImageType> oit(
77 output, output->GetLargestPossibleRegion());
80 itk::ImageRegionConstIterator<OutputImageType> iit(
81 image, image->GetLargestPossibleRegion());
94 * Standard "PrintSelf" method
96 template <class TInputPixel, class TOutputPixel, class TRefPixelType>
98 RegularizedIVIMReconstructionFilter<TInputPixel, TOutputPixel, TRefPixelType>
103 Superclass::PrintSelf( os, indent );
106 } // end namespace itk