本文整理汇总了C++中DcmFileFormat::getMetaInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ DcmFileFormat::getMetaInfo方法的具体用法?C++ DcmFileFormat::getMetaInfo怎么用?C++ DcmFileFormat::getMetaInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DcmFileFormat
的用法示例。
在下文中一共展示了DcmFileFormat::getMetaInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DetermineSopClass
void DicomImporter::DetermineSopClass(const String& _file)
{
try
{
DcmFileFormat ff;
ff.loadFile(_file.c_str());
DcmMetaInfo *m = ff.getMetaInfo();
DcmElement* elem = NULL;
elem = DcmtkHelper::searchElement(m, 0002, 0002);
std::string sopClass;
if (elem != NULL)
{
sopClass = DcmtkConvert::DcmElementValueToString(elem);
}
else
{
return;
}
if (sopClass == "1.2.840.10008.1.3.10")
{
dicomdirFiles.push_back(_file);
}
else
{
nonDicomdirFiles.push_back(_file);
}
}
catch (...)
{
throw;
}
}
示例2: IsFileValid
bool DicomImporter::IsFileValid(const String& _file)
{
try
{
//
// create the dicom fileformat and check if this is possible
//
DcmFileFormat ff;
OFCondition cond = ff.loadFile(_file.c_str());
if (cond.bad()) return false;
//
// ist it in part 10 format (does meta-header exist)?
//
DcmMetaInfo *m = ff.getMetaInfo();
if (m == NULL || m->card() == 0) return false;
//
// does the file contain data (does the dataset exist)?
//
DcmDataset *d = ff.getDataset();
if (d == NULL) return false;
//
// yes, it is a valid dicom file!
//
return true;
}
catch (...)
{
throw;
}
}
示例3: loadDcmFile
int Opendcm::loadDcmFile()
{
// OFCondition status;
DcmFileFormat fileformat;
fileformat.loadFile("/home/jeannypan/Documents/dcmtk_image/real_dicom.dcm");
QString sopClass,;
fileformat.getMetaInfo()->findAndGetString(DCM_MediaStorageSOPClassUID),sopClass
// QString out;
// string sopClass;
// status= fileformat.loadFile("/home/jeannypan/Documents/dcmtk_image/real_dicom.dcm");
// if (status.good())
// {
// OFString sopClassUID, xferUID;
// //if(fileformat.getMetaInfo()->findAndGetString(DCM_MediaStorageSOPClassUID),sopClassUID).good())
// if(fileformat.getMetaInfo()->findAndGetOFString(DCM_MediaStorageSOPClassUID,sopClassUID).good())
// //COUT << "SOP Class UID:" << sopClassUID << OFendl;
// sopClass =sopClassUID;
// sopClass = QString ::fromStdString(sopClass);
// //sopClass = QsopClassUID;
// //out="SOP Class UID:";
// //out += sopClass;
// ui->textEdit->setPlainText(sopClass);
// //ui->textBrowser->out();
// if(fileformat.getMetaInfo() ->findAndGetOFString(DCM_TransferSyntaxUID,xferUID).good())
// //COUT << "Transfer Syntax UID:" << xferUID << OFendl;
// out="SOP Class UID:";//+sopClassUID;
// ui->textEdit->setText(out);
// //ui->textBrowser->out();
// //fileformat.print(out);
// } else
// //cerr << "Error: cannot read DICOM file"<<status.text()<<endl;
// out="Error: cannot read DICOM file";//+sopClassUID;
// ui->textEdit->setPlainText(out);
// //ui->textBrowser->out();
return 0;
}
示例4: CreateResource
bool CreateResource(DcmDirectoryRecord*& target,
ResourceType level,
DcmFileFormat& dicom,
const char* filename,
const char* path)
{
DcmDataset& dataset = *dicom.getDataset();
OFCondition result;
OFString id;
E_DirRecType type;
switch (level)
{
case ResourceType_Patient:
result = dataset.findAndGetOFString(DCM_PatientID, id);
type = ERT_Patient;
break;
case ResourceType_Study:
result = dataset.findAndGetOFString(DCM_StudyInstanceUID, id);
type = ERT_Study;
break;
case ResourceType_Series:
result = dataset.findAndGetOFString(DCM_SeriesInstanceUID, id);
type = ERT_Series;
break;
case ResourceType_Instance:
result = dataset.findAndGetOFString(DCM_SOPInstanceUID, id);
type = ERT_Image;
break;
default:
throw OrthancException(ErrorCode_InternalError);
}
if (!result.good())
{
throw OrthancException(ErrorCode_InternalError);
}
IndexKey key = std::make_pair(level, std::string(id.c_str()));
Index::iterator it = index_.find(key);
if (it != index_.end())
{
target = it->second;
return false; // Already existing
}
std::auto_ptr<DcmDirectoryRecord> record(new DcmDirectoryRecord(type, NULL, filename));
switch (level)
{
case ResourceType_Patient:
FillPatient(*record, dataset);
break;
case ResourceType_Study:
FillStudy(*record, dataset);
break;
case ResourceType_Series:
FillSeries(*record, dataset);
break;
case ResourceType_Instance:
FillInstance(*record, dataset, *dicom.getMetaInfo(), path);
break;
default:
throw OrthancException(ErrorCode_InternalError);
}
if (record->isAffectedBySpecificCharacterSet())
{
copyElementType1C(dataset, DCM_SpecificCharacterSet, *record);
}
target = record.get();
GetRoot().insertSub(record.release());
index_[key] = target;
return true; // Newly created
}