ANIMA  4.0
animaMCMImage.hxx
Go to the documentation of this file.
1 #pragma once
2 #include "animaMCMImage.h"
3 
4 namespace anima
5 {
6 
7 template <typename TPixel, unsigned int VImageDimension>
9 {
10  m_DescriptionModel = 0;
11 }
12 
13 template <typename TPixel, unsigned int VImageDimension>
14 void
16 {
17  if (!mcm)
18  return;
19 
20  unsigned int imageVectorSize = this->GetVectorLength();
21  m_DescriptionModel = mcm->Clone();
22 
23  if (imageVectorSize != m_DescriptionModel->GetSize())
24  {
25  this->SetNumberOfComponentsPerPixel(m_DescriptionModel->GetSize());
26  this->Allocate();
27  }
28 }
29 
30 template <typename TPixel, unsigned int VImageDimension>
33 {
34  return m_DescriptionModel;
35 }
36 
37 template< typename TPixel, unsigned int VImageDimension >
38 void
39 MCMImage <TPixel,VImageDimension>::Graft(const itk::DataObject *data)
40 {
41  if(data == ITK_NULLPTR)
42  return;
43 
44  Superclass::Graft(data);
45 
46  // Attempt to cast data to an Image
47  const Self *constImgData = dynamic_cast <const Self *> (data);
48  Self *imgData = const_cast <Self *> (constImgData);
49 
50  if (!imgData)
51  {
52  itkExceptionMacro( << "itk::VectorImage::Graft() cannot cast "
53  << typeid( data ).name() << " to "
54  << typeid( const Self * ).name() );
55  }
56 
57  // Copy from MCMImage< TPixel, dim >
58  this->SetDescriptionModel(imgData->GetDescriptionModel());
59 }
60 
61 
62 } // end namespace anima
MCMType::Pointer MCMPointer
Definition: animaMCMImage.h:22