Medical Imaging Interaction Toolkit  2018.4.99-4c24e3cb
Medical Imaging Interaction Toolkit
itkImportMitkImageContainer.txx
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef _itkImportMitkImageContainer_txx
14 #define _itkImportMitkImageContainer_txx
15 
16 #include "itkImportMitkImageContainer.h"
17 
18 namespace itk
19 {
20  template <typename TElementIdentifier, typename TElement>
21  ImportMitkImageContainer<TElementIdentifier, TElement>::ImportMitkImageContainer() : m_imageAccess(nullptr)
22  {
23  }
24 
25  template <typename TElementIdentifier, typename TElement>
26  ImportMitkImageContainer<TElementIdentifier, TElement>::~ImportMitkImageContainer()
27  {
28  if (m_imageAccess != nullptr)
29  delete m_imageAccess;
30  m_imageAccess = nullptr;
31  }
32 
33  /*
34  template <typename TElementIdentifier, typename TElement>
35  void
36  ImportMitkImageContainer< TElementIdentifier , TElement >
37  ::SetImageDataItem(mitk::ImageDataItem* imageDataItem)
38  {
39  m_ImageDataItem = imageDataItem;
40 
41  this->SetImportPointer( (TElement*) m_ImageDataItem->GetData(), m_ImageDataItem->GetSize()/sizeof(Element), false);
42 
43  this->Modified();
44  }
45  */
46 
47  template <typename TElementIdentifier, typename TElement>
48  void ImportMitkImageContainer<TElementIdentifier, TElement>::SetImageAccessor(mitk::ImageAccessorBase *imageAccess,
49  size_t noOfBytes)
50  {
51  m_imageAccess = imageAccess;
52 
53  this->SetImportPointer((TElement *)m_imageAccess->GetData(), noOfBytes / sizeof(Element), false);
54 
55  this->Modified();
56  }
57 
58  template <typename TElementIdentifier, typename TElement>
59  void ImportMitkImageContainer<TElementIdentifier, TElement>::PrintSelf(std::ostream &os, Indent indent) const
60  {
61  Superclass::PrintSelf(os, indent);
62 
63  os << indent << "ImageAccessor: " << m_imageAccess << std::endl;
64  }
65 
66 } // end namespace itk
67 
68 #endif