X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=src%2FgdcmHeader.cxx;h=29955e13029d535e3746bba7de03d1aabe8dcc59;hb=f2b0c784e97995ff66779139cf279b521f562f62;hp=4ec3a7906e1babeef1838436334fcb4138ed4269;hpb=66553b88cd6daaac48ac62a910199cb2fff276f6;p=gdcm.git diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index 4ec3a790..29955e13 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -1,4 +1,4 @@ -// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.64 2003/05/07 12:49:10 frog Exp $ +// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.68 2003/05/28 19:36:21 frog Exp $ #include #include @@ -12,6 +12,7 @@ #include #include "gdcmUtil.h" #include "gdcmHeader.h" +using namespace std; // Refer to gdcmHeader::CheckSwap() #define HEADER_LENGTH_TO_READ 256 @@ -713,7 +714,6 @@ void gdcmHeader::SetMaxSizeLoadElementValue(long NewSize) { void gdcmHeader::LoadElementValue(gdcmElValue * ElVal) { size_t item_read; guint16 group = ElVal->GetGroup(); - guint16 elem = ElVal->GetElement(); string vr = ElVal->GetVR(); guint32 length = ElVal->GetLength(); bool SkipLoad = false; @@ -1440,18 +1440,36 @@ int gdcmHeader::GetZSize(void) { return 1; } +/** + * \ingroup gdcmHeader + * \brief Return the size (in bytes) of a single pixel of data. + * @return The size in bytes of a single pixel of data. + * + */ +int gdcmHeader::GetPixelSize(void) { + string PixelType = GetPixelType(); + if (PixelType == "8U" || PixelType == "8S") + return 1; + if (PixelType == "16U" || PixelType == "16S") + return 2; + if (PixelType == "32U" || PixelType == "32S") + return 4; + dbg.Verbose(0, "gdcmHeader::GetPixelSize: Unknown pixel type"); + return 0; +} + /** * \ingroup gdcmHeader * \brief Build the Pixel Type of the image. * Possible values are: - * - U8 unsigned 8 bit, - * - S8 signed 8 bit, - * - U16 unsigned 16 bit, - * - S16 signed 16 bit, - * - U32 unsigned 32 bit, - * - S32 signed 32 bit, + * - 8U unsigned 8 bit, + * - 8S signed 8 bit, + * - 16U unsigned 16 bit, + * - 16S signed 16 bit, + * - 32U unsigned 32 bit, + * - 32S signed 32 bit, * \warning 12 bit images appear as 16 bit. - * @return + * @return */ string gdcmHeader::GetPixelType(void) { string BitsAlloc; @@ -1545,11 +1563,11 @@ void gdcmHeader::LoadElements(void) { } } -void gdcmHeader::PrintPubElVal(ostream & os) { +void gdcmHeader::PrintPubElVal(std::ostream & os) { PubElValSet.Print(os); } -void gdcmHeader::PrintPubDict(ostream & os) { +void gdcmHeader::PrintPubDict(std::ostream & os) { RefPubDict->Print(os); }