Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkImageDescriptor.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 mitkImageDescriptor_h
14 #define mitkImageDescriptor_h
15 
16 #include <itkObjectFactory.h>
17 
18 #include <string>
19 #include <vector>
20 
21 #include <mitkChannelDescriptor.h>
22 #include <mitkCommon.h>
23 
25 #define MAX_IMAGE_DIMENSIONS 8
26 
27 namespace mitk
28 {
40  class MITKCORE_EXPORT ImageDescriptor : public itk::Object
41  {
42  public:
44 
45  itkFactorylessNewMacro(Self);
46 
47  itkCloneMacro(Self);
48 
58  void AddNewChannel(mitk::PixelType ptype, const char *name = nullptr);
59 
65  void Initialize(const unsigned int *dims, const unsigned int dim);
66 
75  void Initialize(const ImageDescriptor::Pointer refDescriptor, unsigned int channel = 0);
76 
85  const unsigned int *GetDimensions() const { return m_Dimensions; }
86 
94  unsigned int GetNumberOfDimensions() const { return m_NumberOfDimensions; }
95 
108  const std::string GetChannelName(unsigned int id) const;
109 
117  PixelType GetChannelTypeByName(const char *name) const;
118 
126  PixelType GetChannelTypeById(unsigned int id) const;
127 
134  ChannelDescriptor GetChannelDescriptor(unsigned int id = 0) const;
135 
140  unsigned int GetNumberOfChannels() const { return m_NumberOfChannels; }
141  protected:
144 
146  ~ImageDescriptor() override{};
147 
148  private:
150  std::vector<ChannelDescriptor> m_ChannelDesc;
151 
153  std::vector<std::string> m_ChannelNames;
154 
156  typedef std::vector<std::string>::const_iterator ConstChannelNamesIter;
157 
159  typedef std::vector<ChannelDescriptor>::const_iterator ConstChannelsIter;
160 
161  unsigned int m_NumberOfChannels;
162 
163  unsigned int m_NumberOfDimensions;
164 
165  unsigned int m_Dimensions[MAX_IMAGE_DIMENSIONS];
166  };
167 
168 } // end namespace
169 #endif
#define MITKCORE_EXPORT
Holds essential information about a single channel of an Image.
Holds all essential metadata about an Image object.
PixelType GetChannelTypeByName(const char *name) const
Get the pixel type of a channel identified by name.
unsigned int GetNumberOfDimensions() const
Get the number of active dimensions.
ChannelDescriptor GetChannelDescriptor(unsigned int id=0) const
Get the ChannelDescriptor for a specific channel.
const std::string GetChannelName(unsigned int id) const
Get the name of a channel by its index.
PixelType GetChannelTypeById(unsigned int id) const
Get the pixel type of a channel identified by index.
void Initialize(const ImageDescriptor::Pointer refDescriptor, unsigned int channel=0)
Initialize this descriptor from an existing ImageDescriptor.
mitkClassMacroItkParent(ImageDescriptor, itk::Object)
const unsigned int * GetDimensions() const
Get the array of dimension sizes.
void AddNewChannel(mitk::PixelType ptype, const char *name=nullptr)
Add a new channel to this image descriptor.
unsigned int GetNumberOfChannels() const
Get the total number of channels.
void Initialize(const unsigned int *dims, const unsigned int dim)
Initialize the image descriptor with dimension sizes.
Describes the data type of image pixels.
Definition: mitkPixelType.h:75
#define MAX_IMAGE_DIMENSIONS
Maximum number of dimensions supported per image channel.
Find image slices visible on a given plane.