4 #include <itkImageRegionIterator.h> 5 #include <itkImageRegionConstIterator.h> 9 template <
class TScalarType,
unsigned int NDimensions>
17 this->Superclass::GenerateOutputInformation();
19 m_VectorSize = this->GetInput(0)->GetNumberOfComponentsPerPixel();
21 output->SetVectorLength(m_VectorSize);
24 template <
class TScalarType,
unsigned int NDimensions>
29 unsigned int nbInputs = this->GetNumberOfIndexedInputs();
31 throw itk::ExceptionObject(__FILE__, __LINE__,
"There should be one input... Exiting...",ITK_LOCATION);
33 m_VectorSize = this->GetInput(0)->GetNumberOfComponentsPerPixel();
34 m_TensorDimension = floor( ( std::sqrt((
double)(8 * m_VectorSize + 1)) - 1) / 2.0);
36 this->GetOutput()->SetNumberOfComponentsPerPixel(m_VectorSize);
37 this->AllocateOutputs();
40 template <
class TScalarType,
unsigned int NDimensions>
45 typedef itk::ImageRegionConstIterator< TInputImage > InIteratorType;
46 typedef itk::ImageRegionIterator< TOutputImage > OutRegionIteratorType;
48 InIteratorType inIterator(this->GetInput(), outputRegionForThread);
49 OutRegionIteratorType outIterator(this->GetOutput(), outputRegionForThread);
52 vnl_matrix <double> tmpTensor(m_TensorDimension, m_TensorDimension);
53 vnl_matrix <double> tmpExpTensor(m_TensorDimension, m_TensorDimension);
57 while (!outIterator.IsAtEnd())
59 outValue = inIterator.Get();
61 if (!isZero(outValue))
65 leCalculator->GetTensorExponential(tmpTensor,tmpExpTensor);
70 outIterator.Set(outValue);
TOutputImage::PixelType OutputPixelType
Superclass::OutputImageRegionType OutputImageRegionType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE
void GetVectorRepresentation(const vnl_matrix< T1 > &tensor, itk::VariableLengthVector< T2 > &vector, unsigned int vecDim=0, bool scale=false)
void BeforeThreadedGenerateData() ITK_OVERRIDE
void GetTensorFromVectorRepresentation(const itk::VariableLengthVector< T1 > &vector, vnl_matrix< T2 > &tensor, unsigned int tensDim=0, bool scale=false)
typename LECalculatorType::Pointer LECalculatorPointer
void GenerateOutputInformation() ITK_OVERRIDE
itk::VectorImage< TScalarType, NDimensions > TOutputImage