Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1060

GDCM lib: How to convert charset to UTF8 when I read dicom file tags just like 'PATIENT_NAME' or 'STUDY_DESCRIPTION'?

$
0
0

1、When I use 'DCMTK' lib to read dicom files, it can convert charset to UTF8 like this:

void test1() {    DcmFileFormat format;    format.loadFile(R"(C:\test\1.dcm)");    format.convertToUTF8();  // convert chartset to UTF8    std::string patient_name;      format.getDataset()->findAndGetOFString(DCM_PatientName, patient_name);    // patient_name string value will print in UTF8 charset    std::cout << "patient name is: " << patient_name << std::endl;  }

2、When I use 'GDCM' lib to read dicom files,I can't find some APIs to convert charset to UTF8:

void test2() {    gdcm::ImageReader reader;    reader.SetFileName(R"(C:\test\1.dcm)");    // get patient_name tag value    const gdcm::DataElement &el = reader.GetFile().GetDataSet().GetDataElement(gdcm::Attribute<0x0010, 0x0010>().GetTag());    // patient_name string is printed on the console and displayed as garbled text    std::cout << "patient_name: " << el.GetValue() << std::endl;}

My Question:

1、How can I convert charset to UTF8 when I use 'GDCM' lib ?

2、Is there some APIs or Ways to do this just like in 'DCMTK' ?


Viewing all articles
Browse latest Browse all 1060

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>