17 : m_ComponentType(other.m_ComponentType),
18 m_PixelType(other.m_PixelType),
19 m_ComponentTypeName(other.m_ComponentTypeName),
20 m_PixelTypeName(other.m_PixelTypeName),
21 m_NumberOfComponents(other.m_NumberOfComponents),
22 m_BytesPerComponent(other.m_BytesPerComponent)
28 m_ComponentType = other.m_ComponentType;
29 m_PixelType = other.m_PixelType;
30 m_ComponentTypeName = other.m_ComponentTypeName;
31 m_PixelTypeName = other.m_PixelTypeName;
32 m_NumberOfComponents = other.m_NumberOfComponents;
33 m_BytesPerComponent = other.m_BytesPerComponent;
45 return m_ComponentType;
50 return m_PixelTypeName;
55 return m_ComponentTypeName;
60 return m_PixelTypeName +
" (" + m_ComponentTypeName +
")";
65 return (m_NumberOfComponents * m_BytesPerComponent);
75 return m_NumberOfComponents;
80 return m_BytesPerComponent * 8;
89 std::size_t bytesPerComponent,
90 std::size_t numberOfComponents,
91 const std::string &componentTypeName,
92 const std::string &pixelTypeName)
93 : m_ComponentType(componentType),
94 m_PixelType(pixelType),
95 m_ComponentTypeName(componentTypeName),
96 m_PixelTypeName(pixelTypeName),
97 m_NumberOfComponents(numberOfComponents),
98 m_BytesPerComponent(bytesPerComponent)
104 bool returnValue = ( this->m_PixelType == rhs.m_PixelType
105 && this->m_ComponentType == rhs.m_ComponentType
106 && this->m_NumberOfComponents == rhs.m_NumberOfComponents
107 && this->m_BytesPerComponent == rhs.m_BytesPerComponent );
109 MITK_DEBUG <<
"|> mitk::PixelType::operator== rhs, lhs: \n" 110 <<
"| m_BytesPerComponent = " << m_BytesPerComponent <<
", " << rhs.m_BytesPerComponent <<
'\n' 111 <<
"| m_NumberOfComponents = " << m_NumberOfComponents <<
", " << rhs.m_NumberOfComponents <<
'\n' 112 <<
"| m_PixelTypeName = " << m_PixelTypeName <<
", " << rhs.m_PixelTypeName <<
'\n' 113 <<
"| m_ComponentTypeName = " << m_ComponentTypeName <<
", " << rhs.m_ComponentTypeName <<
'\n' 114 <<
"| m_PixelType = " << m_PixelType <<
", " << rhs.m_PixelType <<
'\n' 115 <<
"| m_ComponentType = " << m_ComponentType <<
", " << rhs.m_ComponentType
116 <<
", returnValue = " << returnValue << (returnValue ?
"[True]" :
"[False]") <<
". <|";
128 int numOfComponents = vtkimagedata->GetNumberOfScalarComponents();
130 switch (vtkimagedata->GetScalarType())
134 return mitk::MakePixelType<char, char>(numOfComponents);
137 case VTK_UNSIGNED_CHAR:
138 return mitk::MakePixelType<unsigned char, unsigned char>(numOfComponents);
142 return mitk::MakePixelType<short, short>(numOfComponents);
145 case VTK_UNSIGNED_SHORT:
146 return mitk::MakePixelType<unsigned short, unsigned short>(numOfComponents);
150 return mitk::MakePixelType<int, int>(numOfComponents);
153 case VTK_UNSIGNED_INT:
154 return mitk::MakePixelType<unsigned int, unsigned int>(numOfComponents);
158 return mitk::MakePixelType<long, long>(numOfComponents);
161 case VTK_UNSIGNED_LONG:
162 return mitk::MakePixelType<unsigned long, unsigned long>(numOfComponents);
166 return mitk::MakePixelType<float, float>(numOfComponents);
170 return mitk::MakePixelType<double, double>(numOfComponents);
177 mitkThrow() <<
"tried to make pixeltype from vtkimage of unknown data type(short, char, int, ...)";
vcl_size_t GetBitsPerComponent() const
Get the number of bits per components.
std::string GetTypeAsString() const
Returns a string representing the pixel type and pixel components.
vcl_size_t GetNumberOfComponents() const
Get the number of components of which each element consists.
bool operator!=(const PixelType &rhs) const
PixelType(const mitk::PixelType &aPixelType)
itk::ImageIOBase::IOPixelType ItkIOPixelType
vcl_size_t GetBpe() const
Get the number of bits per element (of an element)
int GetComponentType() const
Get the component type (the scalar (!) type). Each element may contain m_NumberOfComponents (more tha...
MITKCORE_EXPORT mitk::PixelType MakePixelType(vtkImageData *vtkimagedata)
deduct the PixelType for a given vtk image
itk::ImageIOBase::IOPixelType GetPixelType() const
vcl_size_t GetSize() const
Get size of the PixelType in bytes.
bool operator==(const PixelType &rhs) const
PixelType & operator=(const PixelType &other)
std::string GetComponentTypeAsString() const
Returns a string containing the name of the component.
std::string GetPixelTypeAsString() const
Returns a string containing the ITK pixel type name.
Class for defining the data type of pixels.