X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDataEntry.cxx;h=b5cb2d1313beecfad15a886991217d2823095359;hb=4a301cb7dd6feb87518b533d892dadd74b8a5de7;hp=32405c6fbfbdb4d3730df9b4392e757f83e309c7;hpb=c11eeca290f653c81f34d5e94b11241c4daad317;p=gdcm.git diff --git a/src/gdcmDataEntry.cxx b/src/gdcmDataEntry.cxx index 32405c6f..b5cb2d13 100644 --- a/src/gdcmDataEntry.cxx +++ b/src/gdcmDataEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDataEntry.cxx,v $ Language: C++ - Date: $Date: 2007/09/18 16:07:19 $ - Version: $Revision: 1.49 $ + Date: $Date: 2008/02/13 15:41:26 $ + Version: $Revision: 1.53 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -545,6 +545,7 @@ std::string const &DataEntry::GetHexaRepresentation() const return *StrHexaArea; // When short integer(s) are stored, convert the following (n * 2) characters // as a displayable string, the values being separated by a back-slash + s2 << std::hex; if( vr == "US" ) @@ -594,33 +595,48 @@ std::string const &DataEntry::GetHexaRepresentation() const s2 << data[i]; } *StrHexaArea=s2.str(); - } else if( vr == "FL" ) + } + 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(); } else { - int l = (Length > GDCM_MAX_LENGTH_TO_CONVERT_TO_HEXA) ? GDCM_MAX_LENGTH_TO_CONVERT_TO_HEXA : Length; + unsigned int l = (Length > GDCM_MAX_LENGTH_TO_CONVERT_TO_HEXA) ? GDCM_MAX_LENGTH_TO_CONVERT_TO_HEXA : Length; uint8_t *data=(uint8_t *)BinArea; for (unsigned int i=0; i < l; i++) { @@ -787,7 +803,7 @@ void DataEntry::DeleteBinArea(void) delete StrArea; StrArea = 0; } - if (StrArea) + if (StrHexaArea) { delete StrHexaArea; StrHexaArea = 0;