]> Creatis software - gdcm.git/blobdiff - src/gdcmHeader.cxx
To display the actual value of Transfer Syntax (instead of its code)
[gdcm.git] / src / gdcmHeader.cxx
index 4ec3a7906e1babeef1838436334fcb4138ed4269..29955e13029d535e3746bba7de03d1aabe8dcc59 100644 (file)
@@ -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 <stdio.h>
 #include <cerrno>
@@ -12,6 +12,7 @@
 #include <sstream>
 #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);
 }