17 for (
auto &elem : m_Dimensions)
22 this->m_NumberOfChannels = 0;
30 for (
unsigned int i = 0; i < this->m_NumberOfDimensions; i++)
31 elems *= this->m_Dimensions[i];
35 this->m_ChannelDesc.push_back(desc);
40 m_ChannelNames.push_back(name);
42 this->m_NumberOfChannels++;
50 this->m_NumberOfChannels = refDescriptor->GetNumberOfChannels();
51 this->m_NumberOfDimensions = refDescriptor->GetNumberOfDimensions();
52 const unsigned int *refDims = refDescriptor->GetDimensions();
55 for (
unsigned int i = 0; i < this->m_NumberOfDimensions; i++)
57 this->m_Dimensions[i] = refDims[i];
62 this->m_ChannelDesc.push_back(desc);
63 this->m_ChannelNames.push_back(refDescriptor->GetChannelName(channel));
68 this->m_NumberOfDimensions = dim;
71 for (
unsigned int i = 0; i < this->m_NumberOfDimensions; i++)
73 this->m_Dimensions[i] = dims[i];
79 return this->m_ChannelDesc[id];
84 unsigned int idFound = 0;
85 const std::string search_str(name);
87 for (
auto iter = this->m_ChannelNames.begin(); iter < this->m_ChannelNames.end(); iter++)
89 if (search_str.compare(*iter))
90 idFound = iter - this->m_ChannelNames.begin();
93 return (m_ChannelDesc[idFound]).GetPixelType();
98 if (
id > this->m_NumberOfChannels)
100 throw std::invalid_argument(
"The given id exceeds the number of active channel.");
111 if (
id > this->m_ChannelNames.size())
112 return "Out-of-range-access";
114 return this->m_ChannelNames.at(
id);
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.
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.
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)
std::string GetPixelTypeAsString() const
Returns a string containing the ITK pixel type name.
Class for defining the data type of pixels.