X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDataEntry.cxx;h=833be232f3c7efc3d1f29f4f3fad5c568ca0987c;hb=56ad78cdf3b5de32f0a94a38cd32ddc9f403ffc3;hp=416fccf350f128d0234784a95d8cf2cc5123cee3;hpb=b94ec5095152b45a5a88a59951eac68c324daa3d;p=gdcm.git diff --git a/src/gdcmDataEntry.cxx b/src/gdcmDataEntry.cxx index 416fccf3..833be232 100644 --- a/src/gdcmDataEntry.cxx +++ b/src/gdcmDataEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDataEntry.cxx,v $ Language: C++ - Date: $Date: 2008/02/13 11:44:09 $ - Version: $Revision: 1.52 $ + Date: $Date: 2008/04/10 12:15:35 $ + Version: $Revision: 1.54 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -30,6 +30,8 @@ #include // for atof #include // for isdigit #endif +#include // memcpy +#include // atof // Could be defined like MAX_SIZE_LOAD_ELEMENT_VALUE #define GDCM_MAX_LENGTH_TO_CONVERT_TO_HEXA 8 @@ -427,10 +429,12 @@ void DataEntry::SetString(std::string const &value) NewBinArea(); memcpy(BinArea, value.c_str(), l); if (l%2) // padded with blank except for UI - if ( vr == "UI" ) - BinArea[l] = '\0'; - else - BinArea[l] = ' '; + { + if ( vr == "UI" ) + BinArea[l] = '\0'; + else + BinArea[l] = ' '; + } } State = STATE_LOADED; } @@ -598,25 +602,39 @@ std::string const &DataEntry::GetHexaRepresentation() const } else if( vr == "FL" ) { - float *data=(float *)BinArea; + unsigned char *toto=(unsigned char *)BinArea; for (unsigned int i=0; i < GetValueCount(); i++) { - s2 << std::setw( 4 ) << std::setfill( '0' ); + s2.str(""); if( i!=0 ) s2 << '\\'; - s2 << data[i]; + unsigned int a4; + for(int iif=0; iif<4; iif++) + { + a4=toto[iif]; + s2 << a4; + } } *StrHexaArea=s2.str(); } else if( vr == "FD" ) { - double *data=(double *)BinArea; + //double *data=(double *)BinArea; + unsigned char *toto=(unsigned char *)BinArea; for (unsigned int i=0; i < GetValueCount(); i++) { - s2 << std::setw( 8 ) << std::setfill( '0' ); - if( i!=0 ) + s2.str(""); + if( i!=0 ) s2 << '\\'; - s2 << data[i]; + //s2 << data[i]; + + unsigned int a4; + for(int iid=0; iid<8; iid++) + { + a4=toto[iid]; + s2 << a4; + } + } *StrHexaArea=s2.str(); }