13 #ifndef mitkPixelType_h
14 #define mitkPixelType_h
24 #include <itkImageIOBase.h>
25 #include <vtkImageData.h>
32 return itk::ImageIOBase::GetComponentTypeAsString(itk::ImageIOBase::MapPixelType<T>::CType);
35 template <
typename PixelT>
124 template <
typename ComponentT,
typename PixelT>
127 template <
typename ItkImageType>
130 template <
typename ItkImageType>
135 std::size_t bytesPerComponent,
136 std::size_t numOfComponents,
137 const std::string &componentTypeName,
138 const std::string &pixelTypeName);
150 std::string m_ComponentTypeName;
152 std::string m_PixelTypeName;
154 std::size_t m_NumberOfComponents;
156 std::size_t m_BytesPerComponent;
170 template <
typename ComponentT,
typename PixelT>
177 PixelComponentTypeToString<ComponentT>(),
178 PixelTypeToString<PixelT>());
186 template <
typename ComponentT,
typename PixelT, std::
size_t numOfComponents>
189 return MakePixelType<ComponentT, PixelT>(numOfComponents);
198 template <
typename ItkImageType>
206 template <
typename TPixelType,
unsigned int VImageDimension>
213 template <typename ItkImageType>
219 typedef typename ItkImageType::PixelType ImportPixelType;
225 typedef typename ItkImageType::PixelType PixelT;
232 PixelComponentTypeToString<ComponentT>(),
233 PixelTypeToString<PixelT>());
241 template <
typename TPixelType,
unsigned int VImageDimension>
245 return MakePixelType<ItkImageType>(numOfComponents);
255 template <
typename ItkImageType>
260 mitkThrow() <<
" Variable pixel type given but the length is not specified. Use the parametric MakePixelType( "
261 "size_t ) method instead.";
266 typedef typename ItkImageType::InternalPixelType PixelT;
271 return MakePixelType<ItkImageType>(numComp);
280 imageIO->GetPixelType(),
281 imageIO->GetComponentSize(),
282 imageIO->GetNumberOfComponents(),
283 imageIO->GetComponentTypeAsString(imageIO->GetComponentType()),
284 imageIO->GetPixelTypeAsString(imageIO->GetPixelType()));
291 template <
typename T>
294 return MakePixelType<T, T, 1>();
Image class for storing images.
Class for defining the data type of pixels.
ItkIOPixelType GetPixelType() const
std::string GetTypeAsString() const
Returns a string representing the pixel type and pixel components.
PixelType(const mitk::PixelType &aPixelType)
itk::IOPixelEnum ItkIOPixelType
size_t GetBitsPerComponent() const
Get the number of bits per components.
std::string GetPixelTypeAsString() const
Returns a string containing the ITK pixel type name.
std::string GetComponentTypeAsString() const
Returns a string containing the name of the component.
PixelType & operator=(const PixelType &other)
bool operator==(const PixelType &rhs) const
friend PixelType MakePixelType(size_t)
itk::IOComponentEnum ItkIOComponentType
ItkIOComponentType GetComponentType() const
Get the component type (the scalar (!) type). Each element may contain m_NumberOfComponents (more tha...
size_t GetNumberOfComponents() const
Get the number of components of which each element consists.
size_t GetSize() const
Get size of the PixelType in bytes.
size_t GetBpe() const
Get the number of bits per element (of an element)
bool operator!=(const PixelType &rhs) const
Find image slices visible on a given plane.
MITKCORE_EXPORT mitk::PixelType MakePixelType(vtkImageData *vtkimagedata)
deduct the PixelType for a given vtk image
PixelType MakeScalarPixelType()
An interface to the MakePixelType method for creating scalar pixel types.
std::string PixelComponentTypeToString()
std::string PixelTypeToString()
A helper template for compile-time checking of supported ITK image types.
Object for compile-time resolving of the number of components for given type.
PixelTypeTrait< isPrimitiveType< T >::value, T >::ValueType ComponentType
itk::Image< TPixelType, VDimension > ImageType
Object for compile-time translation of a pixel type into an itk::ImageIOBase::IOPixelType information...
This is an implementation of a type trait to provide a compile-time check for PixelType used in the i...