ANIMA  4.0
animaSimuBlochGRE.hxx
Go to the documentation of this file.
1 #pragma once
2 #include "animaSimuBlochGRE.h"
3 
4 #include <itkObjectFactory.h>
5 #include <itkImageRegionIterator.h>
6 #include <itkImageRegionConstIterator.h>
7 
8 namespace anima
9 {
10 
11 template< class TImage>
13 {
14  this->SetNumberOfRequiredInputs(3);
15 }
16 
17 template< class TImage>
18 void SimuBlochGRE<TImage>::SetInputT1(const TImage* T1)
19 {
20  SetInput(0, const_cast<TImage*>(T1));
21 }
22 
23 template< class TImage>
24 void SimuBlochGRE<TImage>::SetInputT2s(const TImage* T2s)//changed for GRE
25 {
26  SetInput(1, const_cast<TImage*>(T2s));
27 }
28 
29 template< class TImage>
30 void SimuBlochGRE<TImage>::SetInputM0(const TImage* M0)
31 {
32  SetInput(2, const_cast<TImage*>(M0));
33 }
34 
35 template< class TImage>
38 {
39  typename TImage::ConstPointer T1 = this->GetInput(0);
40  typename TImage::ConstPointer T2s = this->GetInput(1); //changed for GRE
41  typename TImage::ConstPointer M0 = this->GetInput(2);
42 
43  itk::ImageRegionIterator<TImage> outputIterator(this->GetOutput(), outputRegionForThread);
44  itk::ImageRegionConstIterator<TImage> inputIteratorT1(T1, outputRegionForThread);
45  itk::ImageRegionConstIterator<TImage> inputIteratorT2s(T2s, outputRegionForThread); //changed for GRE
46  itk::ImageRegionConstIterator<TImage> inputIteratorM0(M0, outputRegionForThread);
47 
48  // For each voxel, calculate the signal of Gradient Echo using bloch equation
49  while(!outputIterator.IsAtEnd())
50  {
51  if ( (inputIteratorT1.Get() <= 0) || ( inputIteratorT2s.Get() <= 0)) //changed for GRE
52  {
53  outputIterator.Set(0);
54  }
55  else
56  {
57  outputIterator.Set(inputIteratorM0.Get() * (1-exp(- m_TR / inputIteratorT1.Get())) * exp(- m_TE / inputIteratorT2s.Get()) ); //changed for GRE
58  }
59 
60  ++inputIteratorT1;
61  ++inputIteratorT2s; //changed for GRE
62  ++inputIteratorM0;
63 
64  ++outputIterator;
65  }
66 }
67 
68 } // end of namespace anima
Superclass::OutputImageRegionType OutputImageRegionType
void SetInputT1(const TImage *T1)
void SetInputM0(const TImage *M0)
void SetInputT2s(const TImage *T2s)
virtual void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE