Closing Issue #75: string for StationName is static but was never cleared.

This commit is contained in:
Proton local user
2023-05-26 17:18:21 +02:00
parent 7df40c19ad
commit c833837d8b

View File

@ -100,6 +100,7 @@ CalculateInternalTransformV3(
const char* queryStationName(const char* pcFName){ const char* queryStationName(const char* pcFName){
static std::string buffer; static std::string buffer;
buffer.clear();
/* Check if we can open the file */ /* Check if we can open the file */
gdcm::Reader R; gdcm::Reader R;
@ -112,10 +113,8 @@ const char* queryStationName(const char* pcFName){
const gdcm::File &file = R.GetFile(); const gdcm::File &file = R.GetFile();
const gdcm::DataSet &ds = file.GetDataSet(); const gdcm::DataSet &ds = file.GetDataSet();
std::string s (gGetStringValueFromTag(gdcm::Tag(0x0008,0x1010), ds)); std::string s(gGetStringValueFromTag(gdcm::Tag(0x0008,0x1010), ds));
std::copy(s.rbegin(), s.rend(), std::back_inserter(buffer)); std::copy(s.begin(), s.end(), buffer.begin());
std::reverse(buffer.begin(),buffer.end());
return buffer.c_str(); return buffer.c_str();
@ -134,10 +133,12 @@ int query2DimageReconstructionDiameter(const char *pcFName){
const gdcm::File &file = R.GetFile(); const gdcm::File &file = R.GetFile();
const gdcm::DataSet &ds = file.GetDataSet(); const gdcm::DataSet &ds = file.GetDataSet();
char* sTmpString = new char [255]; std::string buffer;
strcpy( sTmpString,gGetStringValueFromTag(gdcm::Tag(0x0018,0x1100), ds));
return std::atoi(sTmpString); std::string s(gGetStringValueFromTag(gdcm::Tag(0x0018,0x1100), ds));
std::copy(s.begin(), s.end(), buffer.begin());
return std::stoi(buffer);
} }