{
DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile(file.toStdString().c_str());
if (status.good())
{
OFString patientName;
if (fileformat.getDataset()->findAndGetOFString(DCM_PatientName, patientName).good())
{
QString currentPatientName
(patientName.
c_str());
if(currentPatientName == lastPatientName)
{
writeToAnonym(lastGenNum, path, fileformat, currentPatientName, file);
}
else
{
std::string randNum = generateNumber();
writeToAnonym(randNum, path, fileformat, currentPatientName, file);
lastPatientName = currentPatientName;
lastGenNum = randNum;
}
}
else
std::cerr << "Error: cannot access Patient's Name!" << endl;
}
else
std::cerr << "Error: cannot read DICOM file (" << status.text() << ")" << endl;
}
void ArchiveDicom::anonymous(QString path, QString file)
{
DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile(file.toStdString().c_str());
if (status.good())
{
OFString patientName;
if (fileformat.getDataset()->findAndGetOFString(DCM_PatientName, patientName).good())
{
QString currentPatientName(patientName.c_str());
if(currentPatientName == lastPatientName)
{
writeToAnonym(lastGenNum, path, fileformat, currentPatientName, file);
}
else
{
std::string randNum = generateNumber();
writeToAnonym(randNum, path, fileformat, currentPatientName, file);
lastPatientName = currentPatientName;
lastGenNum = randNum;
}
}
else
std::cerr << "Error: cannot access Patient's Name!" << endl;
}
else
std::cerr << "Error: cannot read DICOM file (" << status.text() << ")" << endl;
}
To copy to clipboard, switch view to plain text mode
Bookmarks