Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkChannelDescriptor.h
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 MITKCHANNELDESCRIPTOR_H
18 #define MITKCHANNELDESCRIPTOR_H
19 
20 #include "mitkPixelType.h"
21 #include <string>
22 
23 namespace mitk
24 {
32  {
33  public:
34  ChannelDescriptor(mitk::PixelType type, size_t numOfElements, bool allocate = false);
35 
37 
39  PixelType GetPixelType() const { return m_PixelType; }
41  size_t GetSize() const { return m_Size; }
47  unsigned char *GetData() const { return m_Data; }
48  protected:
49  friend class Image;
50  friend class ImageAccessorBase;
51 
52  void SetData(void *dataPtr)
53  {
54  if (dataPtr == nullptr)
55  {
56  m_Data = (unsigned char *)dataPtr;
57  }
58  }
59 
60  void AllocateData();
61 
63  std::string m_Name;
64 
69 
71  size_t m_Size;
72 
78  unsigned char *m_Data;
79  };
80 
81 } // end namespace mitk
82 #endif // MITKCHANNELDESCRIPTOR_H
#define MITKCORE_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
unsigned char * GetData() const
Get the pointer to the actual data of the channel.
An object which holds all essential information about a single channel of an Image.
PixelType GetPixelType() const
Get the type of channel's elements.
Image class for storing images.
Definition: mitkImage.h:76
void SetData(void *dataPtr)
vcl_size_t GetSize() const
Get the size in bytes of the channel.
Class for defining the data type of pixels.
Definition: mitkPixelType.h:55