]> Creatis software - gdcm.git/blobdiff - src/gdcmHeader.cxx
Solve pb when structure (list, map, ...) is empty.
[gdcm.git] / src / gdcmHeader.cxx
index c560a82a9407b2b913d508788a0136c6512c369e..2830ff3ceffeb003fe128bc124f6017863e84185 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmHeader.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/11 11:37:14 $
-  Version:   $Revision: 1.229 $
+  Date:      $Date: 2005/01/17 11:13:21 $
+  Version:   $Revision: 1.233 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -22,6 +22,7 @@
 #include "gdcmDebug.h"
 #include "gdcmTS.h"
 #include "gdcmValEntry.h"
+#include "gdcmBinEntry.h"
 #include <stdio.h> //sscanf
 
 #include <vector>
@@ -194,8 +195,41 @@ bool Header::Write(std::string fileName, FileType filetype)
           RemoveEntryNoDestroy(e);
       }
    }
+
+/*
+#ifdef GDCM_WORDS_BIGENDIAN
+   // Super Super hack that will make gdcm a BOMB ! but should
+   // Fix temporarily the dashboard
+   BinEntry *b = GetBinEntry(GrPixel,NumPixel);
+   if ( GetPixelSize() ==  16 )
+   {
+      uint16_t *im16 = (uint16_t*)b->GetBinArea();
+      int lgr = b->GetLength();
+      for( int i = 0; i < lgr / 2; i++ )
+      {
+         im16[i]= (im16[i] >> 8) | (im16[i] << 8 );
+      }
+   }
+#endif //GDCM_WORDS_BIGENDIAN
+*/
+
    Document::WriteContent(fp,filetype);
 
+/*
+#ifdef GDCM_WORDS_BIGENDIAN
+   // Flip back the pixel ... I told you this is a hack
+   if ( GetPixelSize() ==  16 )
+   {
+      uint16_t *im16 = (uint16_t*)b->GetBinArea();
+      int lgr = b->GetLength();
+      for( int i = 0; i < lgr / 2; i++ )
+      {
+         im16[i]= (im16[i] >> 8) | (im16[i] << 8 );
+      }
+   }
+#endif //GDCM_WORDS_BIGENDIAN
+*/
+
    fp->close();
    delete fp;
 
@@ -814,7 +848,7 @@ int Header::GetHighBitPosition()
 }
 
 /**
- * \brief   Check wether the pixels are signed or UNsigned data.
+ * \brief   Check whether the pixels are signed or UNsigned data.
  * \warning The method defaults to false (UNsigned) when information is Missing.
  *          The responsability of checking this value is left to the caller.
  * @return  True when signed, false when UNsigned
@@ -872,7 +906,7 @@ int Header::GetSamplesPerPixel()
 }
 
 /**
- * \brief   Check wether this a monochrome picture or not by accessing
+ * \brief   Check whether this a monochrome picture or not by accessing
  *          the "Photometric Interpretation" tag ( 0x0028, 0x0004 ).
  * @return  true when "MONOCHROME1" or "MONOCHROME2". False otherwise.
  */
@@ -892,7 +926,7 @@ bool Header::IsMonochrome()
 }
 
 /**
- * \brief   Check wether this a "PALETTE COLOR" picture or not by accessing
+ * \brief   Check whether this a "PALETTE COLOR" picture or not by accessing
  *          the "Photometric Interpretation" tag ( 0x0028, 0x0004 ).
  * @return  true when "PALETTE COLOR". False otherwise.
  */
@@ -911,7 +945,7 @@ bool Header::IsPaletteColor()
 }
 
 /**
- * \brief   Check wether this a "YBR_FULL" color picture or not by accessing
+ * \brief   Check whether this a "YBR_FULL" color picture or not by accessing
  *          the "Photometric Interpretation" tag ( 0x0028, 0x0004 ).
  * @return  true when "YBR_FULL". False otherwise.
  */
@@ -1163,39 +1197,6 @@ int Header::GetLUTNbits()
    return lutNbits;
 }
 
-/**
- * \brief Accesses the info from 0002,0010 : Transfer Syntax and TS
- *        else 1.
- * @return The full Transfer Syntax Name (as opposed to Transfer Syntax UID)
- */
-std::string Header::GetTransferSyntaxName()
-{
-   // use the TS (TS : Transfer Syntax)
-   std::string transferSyntax = GetEntry(0x0002,0x0010);
-
-   if ( transferSyntax == GDCM_NOTLOADED )
-   {
-      gdcmVerboseMacro( "Transfer Syntax not loaded. " << std::endl
-               << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE" );
-      return "Uncompressed ACR-NEMA";
-   }
-   if ( transferSyntax == GDCM_UNFOUND )
-   {
-      gdcmVerboseMacro( "Unfound Transfer Syntax (0002,0010)");
-      return "Uncompressed ACR-NEMA";
-   }
-
-   while ( ! isdigit((unsigned char)transferSyntax[transferSyntax.length()-1]) )
-   {
-      transferSyntax.erase(transferSyntax.length()-1, 1);
-   }
-   // we do it only when we need it
-   TS* ts         = Global::GetTS();
-   std::string tsName = ts->GetValue( transferSyntax );
-
-   //delete ts; /// \todo Seg Fault when deleted ?!
-   return tsName;
-}
 
 //-----------------------------------------------------------------------------
 // Protected