13 #ifndef mitkPixelType_h
14 #define mitkPixelType_h
24 #include <itkImageIOBase.h>
25 #include <vtkImageData.h>
37 return itk::ImageIOBase::GetComponentTypeAsString(itk::ImageIOBase::MapPixelType<T>::CType);
49 template <
typename PixelT>
198 template <
typename ComponentT,
typename PixelT>
201 template <
typename ItkImageType>
204 template <
typename ItkImageType>
209 std::size_t bytesPerComponent,
210 std::size_t numOfComponents,
211 const std::string &componentTypeName,
212 const std::string &pixelTypeName);
224 std::string m_ComponentTypeName;
226 std::string m_PixelTypeName;
228 std::size_t m_NumberOfComponents;
230 std::size_t m_BytesPerComponent;
254 template <
typename ComponentT,
typename PixelT>
261 PixelComponentTypeToString<ComponentT>(),
262 PixelTypeToString<PixelT>());
273 template <
typename ComponentT,
typename PixelT, std::
size_t numOfComponents>
276 return MakePixelType<ComponentT, PixelT>(numOfComponents);
288 template <
typename ItkImageType>
296 template <
typename TPixelType,
unsigned int VImageDimension>
306 template <typename ItkImageType>
312 typedef typename ItkImageType::PixelType ImportPixelType;
318 typedef typename ItkImageType::PixelType PixelT;
325 PixelComponentTypeToString<ComponentT>(),
326 PixelTypeToString<PixelT>());
338 template <
typename TPixelType,
unsigned int VImageDimension>
342 return MakePixelType<ItkImageType>(numOfComponents);
356 template <
typename ItkImageType>
361 mitkThrow() <<
" Variable pixel type given but the length is not specified. Use the parametric MakePixelType( "
362 "size_t ) method instead.";
367 typedef typename ItkImageType::InternalPixelType PixelT;
372 return MakePixelType<ItkImageType>(numComp);
386 imageIO->GetPixelType(),
387 imageIO->GetComponentSize(),
388 imageIO->GetNumberOfComponents(),
389 imageIO->GetComponentTypeAsString(imageIO->GetComponentType()),
390 imageIO->GetPixelTypeAsString(imageIO->GetPixelType()));
406 template <
typename T>
409 return MakePixelType<T, T, 1>();
Image class for storing multi-dimensional medical image data.
Describes the data type of image pixels.
ItkIOPixelType GetPixelType() const
Get the ITK I/O pixel type enumeration value.
std::string GetTypeAsString() const
Get a combined string of pixel type and component type.
PixelType(const mitk::PixelType &aPixelType)
Copy constructor.
itk::IOPixelEnum ItkIOPixelType
ITK I/O pixel type enumeration.
size_t GetBitsPerComponent() const
Get the number of bits per single scalar component.
std::string GetPixelTypeAsString() const
Get the ITK pixel type as a human-readable string.
std::string GetComponentTypeAsString() const
Get the scalar component type as a human-readable string.
PixelType & operator=(const PixelType &other)
Copy assignment operator.
bool operator==(const PixelType &rhs) const
Compare two PixelType objects for equality.
friend PixelType MakePixelType(size_t)
itk::IOComponentEnum ItkIOComponentType
ITK I/O component type enumeration.
ItkIOComponentType GetComponentType() const
Get the scalar component type.
size_t GetNumberOfComponents() const
Get the number of components per pixel.
size_t GetSize() const
Get the total size of one pixel in bytes.
size_t GetBpe() const
Get the total number of bits per pixel element.
bool operator!=(const PixelType &rhs) const
Compare two PixelType objects for inequality.
#define mitkThrow()
Throw a generic mitk::Exception with source location information.
Compile-time type traits for resolving pixel component types, composite pixel types,...
Find image slices visible on a given plane.
MITKCORE_EXPORT mitk::PixelType MakePixelType(vtkImageData *vtkimagedata)
Deduce and create a PixelType from a vtkImageData object.
PixelType MakeScalarPixelType()
Create a scalar (single-component) PixelType from a C++ type.
std::string PixelComponentTypeToString()
Return the ITK component type name for the given C++ scalar type.
std::string PixelTypeToString()
Return the ITK pixel type name for the given pixel type.
Compile-time check for supported ITK image types.
Object for compile-time resolving of the number of components for given type.
PixelTypeTrait< isPrimitiveType< T >::value, T >::ValueType ComponentType
Compile-time trait that maps a pixel type and dimension to the corresponding ITK image type.
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...