162 lines
3.0 KiB
C
162 lines
3.0 KiB
C
|
/*
|
||
|
*
|
||
|
* Copyright (C) 1996-2016, OFFIS e.V.
|
||
|
* All rights reserved. See COPYRIGHT file for details.
|
||
|
*
|
||
|
* This software and supporting documentation were developed by
|
||
|
*
|
||
|
* OFFIS e.V.
|
||
|
* R&D Division Health
|
||
|
* Escherweg 2
|
||
|
* D-26121 Oldenburg, Germany
|
||
|
*
|
||
|
*
|
||
|
* Module: dcmimgle
|
||
|
*
|
||
|
* Author: Joerg Riesmeier
|
||
|
*
|
||
|
* Purpose: DicomPixelRepresentationTemplate (Header)
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
|
||
|
#ifndef DIPXREPT_H
|
||
|
#define DIPXREPT_H
|
||
|
|
||
|
#include "dcmtk/config/osconfig.h"
|
||
|
|
||
|
#include "dcmtk/dcmimgle/diutils.h"
|
||
|
|
||
|
#ifndef DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
#ifdef HAVE_EXPLICIT_TEMPLATE_SPECIALIZATION
|
||
|
#define DCMTK_EXPLICIT_SPECIALIZATION template<>
|
||
|
#else
|
||
|
#define DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
#endif
|
||
|
#endif
|
||
|
|
||
|
|
||
|
/*---------------------*
|
||
|
* class declaration *
|
||
|
*---------------------*/
|
||
|
|
||
|
/** Template class to determine pixel representation.
|
||
|
* Size of basic structure, sign-extension
|
||
|
*/
|
||
|
template<class T>
|
||
|
class DiPixelRepresentationTemplate
|
||
|
{
|
||
|
|
||
|
public:
|
||
|
|
||
|
/// default constructor
|
||
|
DiPixelRepresentationTemplate() {}
|
||
|
|
||
|
/// destructor
|
||
|
virtual ~DiPixelRepresentationTemplate() {}
|
||
|
|
||
|
/** check whether template type T is signed or not
|
||
|
*
|
||
|
** @return true if signed, false otherwise
|
||
|
*/
|
||
|
inline int isSigned() const;
|
||
|
|
||
|
protected:
|
||
|
|
||
|
/** determine integer representation for template type T
|
||
|
*
|
||
|
** @return integer representation
|
||
|
*/
|
||
|
virtual inline EP_Representation getRepresentation() const;
|
||
|
};
|
||
|
|
||
|
|
||
|
/********************************************************************/
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline EP_Representation DiPixelRepresentationTemplate<Uint8>::getRepresentation() const
|
||
|
{
|
||
|
return EPR_Uint8;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline EP_Representation DiPixelRepresentationTemplate<Sint8>::getRepresentation() const
|
||
|
{
|
||
|
return EPR_Sint8;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline EP_Representation DiPixelRepresentationTemplate<Uint16>::getRepresentation() const
|
||
|
{
|
||
|
return EPR_Uint16;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline EP_Representation DiPixelRepresentationTemplate<Sint16>::getRepresentation() const
|
||
|
{
|
||
|
return EPR_Sint16;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline EP_Representation DiPixelRepresentationTemplate<Uint32>::getRepresentation() const
|
||
|
{
|
||
|
return EPR_Uint32;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline EP_Representation DiPixelRepresentationTemplate<Sint32>::getRepresentation() const
|
||
|
{
|
||
|
return EPR_Sint32;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline int DiPixelRepresentationTemplate<Uint8>::isSigned() const
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline int DiPixelRepresentationTemplate<Uint16>::isSigned() const
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline int DiPixelRepresentationTemplate<Uint32>::isSigned() const
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline int DiPixelRepresentationTemplate<Sint8>::isSigned() const
|
||
|
{
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline int DiPixelRepresentationTemplate<Sint16>::isSigned() const
|
||
|
{
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
|
||
|
DCMTK_EXPLICIT_SPECIALIZATION
|
||
|
inline int DiPixelRepresentationTemplate<Sint32>::isSigned() const
|
||
|
{
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
|
||
|
#endif
|