Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef _itkImportMitkImageContainer_txx
18 #define _itkImportMitkImageContainer_txx
19 
20 #include "itkImportMitkImageContainer.h"
21 
22 namespace itk
23 {
24  template <typename TElementIdentifier, typename TElement>
25  ImportMitkImageContainer<TElementIdentifier, TElement>::ImportMitkImageContainer() : m_imageAccess(nullptr)
26  {
27  }
28 
29  template <typename TElementIdentifier, typename TElement>
30  ImportMitkImageContainer<TElementIdentifier, TElement>::~ImportMitkImageContainer()
31  {
32  if (m_imageAccess != nullptr)
33  delete m_imageAccess;
34  m_imageAccess = nullptr;
35  }
36 
37  /*
38  template <typename TElementIdentifier, typename TElement>
39  void
40  ImportMitkImageContainer< TElementIdentifier , TElement >
41  ::SetImageDataItem(mitk::ImageDataItem* imageDataItem)
42  {
43  m_ImageDataItem = imageDataItem;
44 
45  this->SetImportPointer( (TElement*) m_ImageDataItem->GetData(), m_ImageDataItem->GetSize()/sizeof(Element), false);
46 
47  this->Modified();
48  }
49  */
50 
51  template <typename TElementIdentifier, typename TElement>
52  void ImportMitkImageContainer<TElementIdentifier, TElement>::SetImageAccessor(mitk::ImageAccessorBase *imageAccess,
53  size_t noOfBytes)
54  {
55  m_imageAccess = imageAccess;
56 
57  this->SetImportPointer((TElement *)m_imageAccess->GetData(), noOfBytes / sizeof(Element), false);
58 
59  this->Modified();
60  }
61 
62  template <typename TElementIdentifier, typename TElement>
63  void ImportMitkImageContainer<TElementIdentifier, TElement>::PrintSelf(std::ostream &os, Indent indent) const
64  {
65  Superclass::PrintSelf(os, indent);
66 
67  os << indent << "ImageAccessor: " << m_imageAccess << std::endl;
68  }
69 
70 } // end namespace itk
71 
72 #endif