21 : m_ComponentType(other.m_ComponentType),
22 m_PixelType(other.m_PixelType),
23 m_ComponentTypeName(other.m_ComponentTypeName),
24 m_PixelTypeName(other.m_PixelTypeName),
25 m_NumberOfComponents(other.m_NumberOfComponents),
26 m_BytesPerComponent(other.m_BytesPerComponent)
32 m_ComponentType = other.m_ComponentType;
33 m_PixelType = other.m_PixelType;
34 m_ComponentTypeName = other.m_ComponentTypeName;
35 m_PixelTypeName = other.m_PixelTypeName;
36 m_NumberOfComponents = other.m_NumberOfComponents;
37 m_BytesPerComponent = other.m_BytesPerComponent;
49 return m_ComponentType;
54 return m_PixelTypeName;
59 return m_ComponentTypeName;
64 return m_PixelTypeName +
" (" + m_ComponentTypeName +
")";
69 return (m_NumberOfComponents * m_BytesPerComponent);
74 return this->GetSize() * 8;
79 return m_NumberOfComponents;
84 return m_BytesPerComponent * 8;
91 mitk::PixelType::PixelType(
const int componentType,
92 const ItkIOPixelType pixelType,
93 std::size_t bytesPerComponent,
94 std::size_t numberOfComponents,
95 const std::string &componentTypeName,
96 const std::string &pixelTypeName)
97 : m_ComponentType(componentType),
98 m_PixelType(pixelType),
99 m_ComponentTypeName(componentTypeName),
100 m_PixelTypeName(pixelTypeName),
101 m_NumberOfComponents(numberOfComponents),
102 m_BytesPerComponent(bytesPerComponent)
110 MITK_DEBUG <<
"m_NumberOfComponents = " << m_NumberOfComponents <<
" " << rhs.m_NumberOfComponents << std::endl;
111 MITK_DEBUG <<
"m_BytesPerComponent = " << m_BytesPerComponent <<
" " << rhs.m_BytesPerComponent << std::endl;
112 MITK_DEBUG <<
"m_PixelTypeName = " << m_PixelTypeName <<
" " << rhs.m_PixelTypeName << std::endl;
113 MITK_DEBUG <<
"m_PixelType = " << m_PixelType <<
" " << rhs.m_PixelType << std::endl;
116 (this->m_PixelType == rhs.m_PixelType && this->m_ComponentType == rhs.m_ComponentType &&
117 this->m_NumberOfComponents == rhs.m_NumberOfComponents && this->m_BytesPerComponent == rhs.m_BytesPerComponent);
134 int numOfComponents = vtkimagedata->GetNumberOfScalarComponents();
136 switch (vtkimagedata->GetScalarType())
140 return mitk::MakePixelType<char, char>(numOfComponents);
143 case VTK_UNSIGNED_CHAR:
144 return mitk::MakePixelType<unsigned char, unsigned char>(numOfComponents);
148 return mitk::MakePixelType<short, short>(numOfComponents);
151 case VTK_UNSIGNED_SHORT:
152 return mitk::MakePixelType<unsigned short, unsigned short>(numOfComponents);
156 return mitk::MakePixelType<int, int>(numOfComponents);
159 case VTK_UNSIGNED_INT:
160 return mitk::MakePixelType<unsigned int, unsigned int>(numOfComponents);
164 return mitk::MakePixelType<long, long>(numOfComponents);
167 case VTK_UNSIGNED_LONG:
168 return mitk::MakePixelType<unsigned long, unsigned long>(numOfComponents);
172 return mitk::MakePixelType<float, float>(numOfComponents);
176 return mitk::MakePixelType<double, double>(numOfComponents);
183 mitkThrow() <<
"tried to make pixeltype from vtkimage of unknown data type(short, char, int, ...)";
std::string GetTypeAsString() const
Returns a string representing the pixel type and pixel components.
std::string GetPixelTypeAsString() const
Returns a string containing the ITK pixel type name.
PixelType(const mitk::PixelType &aPixelType)
itk::ImageIOBase::IOPixelType GetPixelType() const
vcl_size_t GetBitsPerComponent() const
Get the number of bits per components.
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
vcl_size_t GetSize() const
Get size of the PixelType in bytes.
vcl_size_t GetBpe() const
Get the number of bits per element (of an element)
MITKCORE_EXPORT mitk::PixelType MakePixelType(vtkImageData *vtkimagedata)
deduct the PixelType for a given vtk image
std::string GetComponentTypeAsString() const
Returns a string containing the name of the component.
int GetComponentType() const
Get the component type (the scalar (!) type). Each element may contain m_NumberOfComponents (more tha...
bool operator!=(const PixelType &rhs) const
bool operator==(const PixelType &rhs) const
vcl_size_t GetNumberOfComponents() const
Get the number of components of which each element consists.
PixelType & operator=(const PixelType &other)
Class for defining the data type of pixels.