ANIMA  4.0
animaMCMResampleImageFilter.hxx
Go to the documentation of this file.
1 #pragma once
3 
4 #include <animaMCMImage.h>
6 
7 namespace anima
8 {
9 
10 template <typename TImageType, typename TInterpolatorPrecisionType>
11 unsigned int
14 {
15  return m_ReferenceOutputModel->GetSize();
16 }
17 
22 template <typename TImageType, typename TInterpolatorPrecisionType>
23 itk::LightObject::Pointer
26 {
27  itk::LightObject::Pointer outputPointer = Superclass::InternalClone();
28 
29  Self *castPointer = dynamic_cast <Self *> (outputPointer.GetPointer());
30 
31  if (m_ReferenceOutputModel)
32  castPointer->SetReferenceOutputModel(m_ReferenceOutputModel);
33 
34  return outputPointer;
35 }
36 
37 template <typename TImageType, typename TInterpolatorPrecisionType>
38 void
41 {
42  m_WorkModels.resize(this->GetNumberOfWorkUnits());
43  for (unsigned int i = 0;i < this->GetNumberOfWorkUnits();++i)
44  m_WorkModels[i] = m_ReferenceOutputModel->Clone();
45 
46  InputImageType *output = dynamic_cast <InputImageType *> (this->GetOutput());
47  output->SetDescriptionModel(m_ReferenceOutputModel);
48  output->SetVectorLength(m_ReferenceOutputModel->GetSize());
49 
50  this->Superclass::BeforeThreadedGenerateData();
51 }
52 
53 template <typename TImageType, typename TInterpolatorPrecisionType>
54 void
57 {
58  m_ReferenceOutputModel = model->Clone();
59 }
60 
61 template <typename TImageType, typename TInterpolatorPrecisionType>
62 void
65 {
67 
68  typename InterpolatorType::Pointer tmpInterpolator = InterpolatorType::New();
69  tmpInterpolator->SetReferenceOutputModel(m_ReferenceOutputModel);
70  this->SetInterpolator(tmpInterpolator.GetPointer());
71 }
72 
73 template <typename TImageType, typename TInterpolatorPrecisionType>
74 void
76 ::ReorientInterpolatedModel(const InputPixelType &interpolatedModel, vnl_matrix <double> &modelOrientationMatrix,
77  InputPixelType &orientedModel, itk::ThreadIdType threadId)
78 {
79  m_WorkModels[threadId]->SetModelVector(interpolatedModel);
80 
81  m_WorkModels[threadId]->Reorient(modelOrientationMatrix,(!this->GetFiniteStrainReorientation()));
82  orientedModel = m_WorkModels[threadId]->GetModelVector();
83 }
84 
85 } // end namespace anima
virtual void ReorientInterpolatedModel(const InputPixelType &interpolatedModel, vnl_matrix< double > &modelOrientationMatrix, InputPixelType &orientedModel, itk::ThreadIdType threadId) ITK_OVERRIDE
Needs to be implemented in sub-classes, does the actual re-orientation of the model.
virtual unsigned int GetOutputVectorLength() ITK_OVERRIDE
virtual void BeforeThreadedGenerateData() ITK_OVERRIDE
Superclass::InputImageType InputImageType
void SetReferenceOutputModel(const MCModelPointer &model)
Sets reference output MCM model, necessary to determine output organization (and rotate) ...
itk::InterpolateImageFunction< InputImageType, TInterpolatorPrecisionType > InterpolatorType
Superclass::InputPixelType InputPixelType
virtual itk::LightObject::Pointer InternalClone() const ITK_OVERRIDE
virtual void InitializeInterpolator() ITK_OVERRIDE
Initializes the default interpolator, might change in derived classes.