Medical Imaging Interaction Toolkit  2018.4.99-1640525a
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 (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 MITKCHANNELDESCRIPTOR_H
14 #define MITKCHANNELDESCRIPTOR_H
15 
16 #include "mitkPixelType.h"
17 #include <string>
18 
19 namespace mitk
20 {
28  {
29  public:
30  ChannelDescriptor(mitk::PixelType type, size_t numOfElements, bool allocate = false);
31 
33 
35  PixelType GetPixelType() const { return m_PixelType; }
37  size_t GetSize() const { return m_Size; }
43  unsigned char *GetData() const { return m_Data; }
44  protected:
45  friend class Image;
46  friend class ImageAccessorBase;
47 
48  void SetData(void *dataPtr)
49  {
50  if (dataPtr == nullptr)
51  {
52  m_Data = (unsigned char *)dataPtr;
53  }
54  }
55 
56  void AllocateData();
57 
59  std::string m_Name;
60 
65 
67  size_t m_Size;
68 
74  unsigned char *m_Data;
75  };
76 
77 } // end namespace mitk
78 #endif // MITKCHANNELDESCRIPTOR_H
vcl_size_t GetSize() const
Get the size in bytes of the channel.
#define MITKCORE_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
An object which holds all essential information about a single channel of an Image.
PixelType GetPixelType() const
Get the type of channel&#39;s elements.
Image class for storing images.
Definition: mitkImage.h:72
void SetData(void *dataPtr)
unsigned char * GetData() const
Get the pointer to the actual data of the channel.
Class for defining the data type of pixels.
Definition: mitkPixelType.h:51