21 for (
auto &elem : m_Dimensions)
26 this->m_NumberOfChannels = 0;
34 for (
unsigned int i = 0; i < this->m_NumberOfDimensions; i++)
35 elems *= this->m_Dimensions[i];
39 this->m_ChannelDesc.push_back(desc);
44 m_ChannelNames.push_back(name);
46 this->m_NumberOfChannels++;
54 this->m_NumberOfChannels = refDescriptor->GetNumberOfChannels();
55 this->m_NumberOfDimensions = refDescriptor->GetNumberOfDimensions();
56 const unsigned int *refDims = refDescriptor->GetDimensions();
59 for (
unsigned int i = 0; i < this->m_NumberOfDimensions; i++)
61 this->m_Dimensions[i] = refDims[i];
66 this->m_ChannelDesc.push_back(desc);
67 this->m_ChannelNames.push_back(refDescriptor->GetChannelName(channel));
72 this->m_NumberOfDimensions = dim;
75 for (
unsigned int i = 0; i < this->m_NumberOfDimensions; i++)
77 this->m_Dimensions[i] = dims[i];
83 return this->m_ChannelDesc[id];
88 unsigned int idFound = 0;
89 const std::string search_str(name);
91 for (
auto iter = this->m_ChannelNames.begin(); iter < this->m_ChannelNames.end(); iter++)
93 if (search_str.compare(*iter))
94 idFound = iter - this->m_ChannelNames.begin();
97 return (m_ChannelDesc[idFound]).GetPixelType();
102 if (
id > this->m_NumberOfChannels)
104 throw std::invalid_argument(
"The given id exceeds the number of active channel.");
115 if (
id > this->m_ChannelNames.size())
116 return "Out-of-range-access";
118 return this->m_ChannelNames.at(
id);
std::string GetPixelTypeAsString() const
Returns a string containing the ITK pixel type name.
An object which holds all essential information about a single channel of an Image.
void Initialize(const unsigned int *dims, const unsigned int dim)
Initialize the image descriptor by the dimensions.
PixelType GetPixelType() const
Get the type of channel's elements.
const std::string GetChannelName(unsigned int id) const
Get the name of selected channel.
PixelType GetChannelTypeByName(const char *name) const
Get the pixel type of a channel specified by its name.
PixelType GetChannelTypeById(unsigned int id) const
Get the pixel type of a channel specified by its id.
ChannelDescriptor GetChannelDescriptor(unsigned int id=0) const
Get the ChannelDescriptor for a channel specified by its id.
void AddNewChannel(mitk::PixelType ptype, const char *name=nullptr)
Class for defining the data type of pixels.