本文整理汇总了C++中DcmDataset::findAndGetOFStringArray方法的典型用法代码示例。如果您正苦于以下问题:C++ DcmDataset::findAndGetOFStringArray方法的具体用法?C++ DcmDataset::findAndGetOFStringArray怎么用?C++ DcmDataset::findAndGetOFStringArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DcmDataset
的用法示例。
在下文中一共展示了DcmDataset::findAndGetOFStringArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load_dcmFiles
// Load our vtkImageData object from a list of DICOM image filenames...
// http://www.vtk.org/pipermail/vtkusers/2007-August/042635.html
void vtkDicom::load_dcmFiles(QStringList dcm_fileList) {
DcmFileFormat dcm;
std::string imgFname;
std::cout << "vtkdicom: Files/Images(?): " << dcm_fileList.size() << "\n";
for (int sei = 0; sei < dcm_fileList.size(); ++sei) {
imgFname = dcm_fileList.at(sei).toLocal8Bit().constData();
OFCondition status = dcm.loadFile(imgFname.c_str());
if (!status.good()) {
std::cout << " vtkdicom: Error: cannot read file (" << status.text() << ")" << "\n";
return;
}
if (sei == 0) {
OFString acquisitionNumber, instanceNumber, imagePositionPatient, patientsName;
DcmDataset *dcmDs = dcm.getDataset();
dcmDs->findAndGetOFStringArray(DCM_ImagePositionPatient, imagePositionPatient);
dcmDs->findAndGetOFString(DCM_AcquisitionNumber, acquisitionNumber);
dcmDs->findAndGetOFString(DCM_InstanceNumber, instanceNumber);
dcmDs->findAndGetOFString(DCM_PatientName, patientsName);
std::cout << "vtkdicom: I#, IPP: " << instanceNumber << " - " << imagePositionPatient << "\n";
}
dcm.loadAllDataIntoMemory();
const unsigned short* p = NULL;
dcm.getDataset()->findAndGetUint16Array(DCM_PixelData, p);
}
}
示例2: dumpDicomFile
void vtkDicom::dumpDicomFile(std::string imgFname)
{
DcmFileFormat dfile;
OFCondition status = dfile.loadFile(imgFname.c_str());
if (status.good()) {
OFString acquisitionNumber, instanceNumber, imagePositionPatient, patientsName;
dfile.loadAllDataIntoMemory();
DcmDataset *dcmDs = dfile.getDataset();
dcmDs->findAndGetOFStringArray(DCM_ImagePositionPatient, imagePositionPatient);
dcmDs->findAndGetOFString(DCM_AcquisitionNumber, acquisitionNumber);
dcmDs->findAndGetOFString(DCM_InstanceNumber, instanceNumber);
dcmDs->findAndGetOFString(DCM_PatientName, patientsName);
std::cout << " " << instanceNumber << " - " << imagePositionPatient << "\n";
} else {
std::cout << " Error: cannot read file (" << status.text() << ")" << "\n";
}
}
示例3: main
int main(int argc, const char *argv[]) {
string root_path;
// SOURCE_CODE_LOCATION is set by cmake during compilation.
// this contains the path to the source folder.
// This is only helper for convenience. Without this
// in_file below should contain absolute path.
#ifdef SOURCE_CODE_LOCATION
root_path = SOURCE_CODE_LOCATION;
#endif
// where does this example dcm come from, is
// is explained at https://github.com/marcinwol/dcmtk-basic-example
string in_file {root_path + "/DCMIMAGES/77654033/20010101/CR1/6154"};
DcmFileFormat file_format;
OFCondition status = file_format.loadFile(in_file.c_str());
if (status.bad()) {
cerr << "Problem openning file:" << in_file << endl;
return 1;
}
DcmDataset* dataset = file_format.getDataset();
OFString patient_name;
OFCondition condition;
condition = dataset->findAndGetOFStringArray(DCM_PatientName, patient_name);
if (condition.good()) {
cout << "Patient name is: " << patient_name << endl;
} else {
cerr << "Could not get patient name" << endl;
}
cout << "Program finish." << endl;
return 0;
}