4 #include <itkObjectFactory.h> 5 #include <itkImageRegionIterator.h> 6 #include <itkImageRegionConstIterator.h> 11 template<
class TImage>
14 this->SetNumberOfRequiredInputs(3);
17 template<
class TImage>
20 SetInput(0, const_cast<TImage*>(T1));
23 template<
class TImage>
26 SetInput(1, const_cast<TImage*>(T2s));
29 template<
class TImage>
32 SetInput(2, const_cast<TImage*>(M0));
35 template<
class TImage>
38 this->SetInput(3, const_cast<TImage*>(B1));
41 template<
class TImage>
45 typename TImage::ConstPointer T1 = this->GetInput(0);
46 typename TImage::ConstPointer T2s = this->GetInput(1);
47 typename TImage::ConstPointer M0 = this->GetInput(2);
48 typename TImage::ConstPointer B1;
50 itk::ImageRegionIterator<TImage> outputIterator(this->GetOutput(), outputRegionForThread);
51 itk::ImageRegionConstIterator<TImage> inputIteratorT1(T1, outputRegionForThread);
52 itk::ImageRegionConstIterator<TImage> inputIteratorT2s(T2s, outputRegionForThread);
53 itk::ImageRegionConstIterator<TImage> inputIteratorM0(M0, outputRegionForThread);
55 itk::ImageRegionConstIterator<TImage> inputIteratorB1;
56 bool b1DataPresent = (this->GetNumberOfIndexedInputs() == 4);
59 B1 = this->GetInput(3);
60 inputIteratorB1 = itk::ImageRegionConstIterator<TImage> (B1, outputRegionForThread);
64 while(!outputIterator.IsAtEnd())
66 if ((inputIteratorT1.Get() <= 0) || (inputIteratorT2s.Get() <= 0))
68 outputIterator.Set(0);
82 b1Value = inputIteratorB1.Get();
84 double t1Value = inputIteratorT1.Get();
85 double t2sValue = inputIteratorT2s.Get();
86 double m0Value = inputIteratorM0.Get();
88 double sinFA = std::sin(M_PI * b1Value * m_FA / 180);
89 double cosFA = std::cos(M_PI * b1Value * m_FA / 180);
91 outputIterator.Set(m0Value * (1- exp(- m_TR / t1Value)) * sinFA / (1 - exp(- m_TR / t1Value) * cosFA ) * exp(- m_TE / t2sValue));
void SetInputT1(const TImage *T1)
void SetInputM0(const TImage *M0)
void SetInputB1(const TImage *B1)
Superclass::OutputImageRegionType OutputImageRegionType
void SetInputT2s(const TImage *T2s)
virtual void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE