本文整理汇总了C++中OFCondition::good方法的典型用法代码示例。如果您正苦于以下问题:C++ OFCondition::good方法的具体用法?C++ OFCondition::good怎么用?C++ OFCondition::good使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OFCondition
的用法示例。
在下文中一共展示了OFCondition::good方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Drop
OFCondition Association::Drop(OFCondition cond) {
// tear down association
if(cond == EC_Normal) {
/* release association */
cond = ASC_releaseAssociation(assoc);
}
else if(cond == DUL_PEERREQUESTEDRELEASE) {
cond = ASC_abortAssociation(assoc);
if (cond.good()) {
return cond;
}
}
else if(cond == DUL_PEERABORTEDASSOCIATION) {
return cond;
}
else {
cond = ASC_abortAssociation(assoc);
if (cond.good()) {
return cond;
}
}
Destroy();
return cond;
}
示例2: copyElement
// copy element from dataset to directory record
static void copyElement(DcmItem& dataset,
const DcmTagKey &key,
DcmDirectoryRecord& record,
const OFBool optional,
const OFBool copyEmpty)
{
/* check whether tag exists in source dataset (if optional) */
if (!optional || (copyEmpty && dataset.tagExists(key)) || dataset.tagExistsWithValue(key))
{
DcmElement *delem = NULL;
/* get copy of element from source dataset */
OFCondition status = dataset.findAndGetElement(key, delem, OFFalse /*searchIntoSub*/, OFTrue /*createCopy*/);
if (status.good())
{
/* ... and insert it into the destination dataset (record) */
status = record.insert(delem, OFTrue /*replaceOld*/);
if (status.good())
{
DcmTag tag(key);
/* check for correct VR in the dataset */
if (delem->getVR() != tag.getEVR())
{
/* create warning message */
LOG(WARNING) << "DICOMDIR: possibly wrong VR: "
<< tag.getTagName() << " " << key << " with "
<< DcmVR(delem->getVR()).getVRName() << " found, expected "
<< tag.getVRName() << " instead";
}
} else
delete delem;
} else if (status == EC_TagNotFound)
status = record.insertEmptyElement(key);
printAttributeErrorMessage(key, status, "insert");
}
}
示例3: acceptSubAssociation
OFCondition RetrieveDICOMFilesFromPACS::acceptSubAssociation(T_ASC_Network *associationNetwork, T_ASC_Association **association)
{
const char *knownAbstractSyntaxes[] = { UID_VerificationSOPClass };
const char *transferSyntaxes[] = { NULL, NULL, NULL, NULL };
int numTransferSyntaxes;
OFCondition condition = ASC_receiveAssociation(associationNetwork, association, ASC_DEFAULTMAXPDU);
if (condition.good())
{
#ifndef DISABLE_COMPRESSION_EXTENSION
// Si disposem de compressió la demanem, i podrem accelerar el temps de descàrrega considerablement
// De moment demanem la compressió lossless que tot PACS que suporti compressió ha
// de proporcionar: JPEGLossless:Non-Hierarchical-1stOrderPrediction
transferSyntaxes[0] = UID_JPEGProcess14SV1TransferSyntax;
transferSyntaxes[1] = UID_LittleEndianExplicitTransferSyntax;
transferSyntaxes[2] = UID_BigEndianExplicitTransferSyntax;
transferSyntaxes[3] = UID_LittleEndianImplicitTransferSyntax;
numTransferSyntaxes = 4;
#else
// Defined in dcxfer.h
if (gLocalByteOrder == EBO_LittleEndian)
{
transferSyntaxes[0] = UID_LittleEndianExplicitTransferSyntax;
transferSyntaxes[1] = UID_BigEndianExplicitTransferSyntax;
}
else
{
transferSyntaxes[0] = UID_BigEndianExplicitTransferSyntax;
transferSyntaxes[1] = UID_LittleEndianExplicitTransferSyntax;
}
transferSyntaxes[2] = UID_LittleEndianImplicitTransferSyntax;
numTransferSyntaxes = 3;
#endif
// Accept the Verification SOP Class if presented
condition = ASC_acceptContextsWithPreferredTransferSyntaxes((*association)->params, knownAbstractSyntaxes, DIM_OF(knownAbstractSyntaxes),
transferSyntaxes, numTransferSyntaxes);
if (condition.good())
{
// The array of Storage SOP Class UIDs comes from dcuid.h
condition = ASC_acceptContextsWithPreferredTransferSyntaxes((*association)->params, dcmAllStorageSOPClassUIDs, numberOfAllDcmStorageSOPClassUIDs,
transferSyntaxes, numTransferSyntaxes);
}
}
if (condition.good())
{
condition = ASC_acknowledgeAssociation(*association);
}
else
{
ASC_dropAssociation(*association);
ASC_destroyAssociation(association);
}
return condition;
}
示例4: CanReadFile
bool DCMTKImageIO::CanReadFile(const char* filename)
{
DcmFileFormat dicomFile;
OFCondition condition = dicomFile.loadFile( filename );
if ( !condition.good() ) {
return false;
}
E_TransferSyntax xfer = dicomFile.getDataset()->getOriginalXfer();
if( xfer == EXS_JPEG2000LosslessOnly ||
xfer == EXS_JPEG2000 ||
xfer == EXS_JPEG2000MulticomponentLosslessOnly ||
xfer == EXS_JPEG2000Multicomponent ) {
return false;
}
// search for mandatory tags
DcmStack stack;
DcmTagKey searchKey;
unsigned int group = 0x0028; // samples per pixel
unsigned int elem = 0x0002; // samples per pixel
searchKey.set(group, elem);
if (dicomFile.search(searchKey, stack, ESM_fromHere, OFTrue) != EC_Normal)
return false;
group = 0x0028; // pixel type
elem = 0x0100; // pixel type
searchKey.set(group, elem);
if (dicomFile.search(searchKey, stack, ESM_fromHere, OFTrue) != EC_Normal)
return false;
return true;
}
示例5: LOG
void
LocalService::SolveFile(
const boost::filesystem::path & fileName, const boost::filesystem::path & path,
ResultSet &result)
{
OFString ofStr;
DcmFileFormat dfile;
OFCondition cond = dfile.loadFile( fileName.string().data());
if (! cond.good())
{
LOG( "Loading of " << fileName << " failed. (" << cond.text() << ")" );
return;
}
DcmDataset *dataSet = dfile.getDataset();
TableRow row;
SerieInfo serInfo;
// load data and check if it is already in tree
CheckDataSet( dataSet, serInfo, row, path.string());
// look if this row is already in resultSet
FoundStudiesSet::iterator found = m_alreadyFoundInRun.find(row.studyID);
// if not, add it
if( found == m_alreadyFoundInRun.end() )
{
m_alreadyFoundInRun.insert( FoundStudiesSet::value_type( row.studyID) );
result.push_back( row);
}
}
示例6: ReadAnnotationCollectionFromFile
// Caller is responsible for deallocating returned object
AnnotationCollection* DcmModel::ReadAnnotationCollectionFromFile(const std::string& fileName){
DcmModelInternal dcmModelInternal(_uidPrefix);
AnnotationCollection* pCollection = NULL;
try
{
OFCondition ofCondition = dcmModelInternal.ReadDocFromFile(&pCollection, fileName);
if (!ofCondition.good())
{
if (pCollection){
delete pCollection;
pCollection = NULL;
}
std::string err = std::string("Failed to load SR from file <").append(fileName).append(">:");
err += ofCondition.text();
dcmModelInternal.printDebug(std::string(__FILE__).append(": ").append(err).c_str());
}
}
catch(const std::exception& ex)
{
std::string err = std::string("Error loading SR from file<").append(fileName).append(">:");
err += ex.what();
dcmModelInternal.printDebug(err.c_str());
}
return pCollection;
}
示例7: copyStringWithDefault
// copy optional string value from dataset to directory record
static void copyStringWithDefault(DcmItem& dataset,
const DcmTagKey &key,
DcmDirectoryRecord& record,
const char *defaultValue,
const OFBool printWarning)
{
OFCondition status;
if (dataset.tagExistsWithValue(key))
{
OFString stringValue;
/* retrieve string value from source dataset and put it into the destination dataset */
status = dataset.findAndGetOFStringArray(key, stringValue);
if (status.good())
status = record.putAndInsertString(key, stringValue.c_str());
} else {
if (printWarning && (defaultValue != NULL))
{
/* create warning message */
LOG(WARNING) << "DICOMDIR: " << DcmTag(key).getTagName() << " "
<< key << " missing, using alternative: " << defaultValue;
}
/* put default value */
status = record.putAndInsertString(key, defaultValue);
}
}
示例8: loadFileHeader
//------------------------------------------------------------------------------
void ctkDICOMDatabase::loadFileHeader (QString fileName)
{
Q_D(ctkDICOMDatabase);
DcmFileFormat fileFormat;
OFCondition status = fileFormat.loadFile(fileName.toLatin1().data());
if (status.good())
{
DcmDataset *dataset = fileFormat.getDataset();
DcmStack stack;
while (dataset->nextObject(stack, true) == EC_Normal)
{
DcmObject *dO = stack.top();
if (dO->isaString())
{
QString tag = QString("%1,%2").arg(
dO->getGTag(),4,16,QLatin1Char('0')).arg(
dO->getETag(),4,16,QLatin1Char('0'));
std::ostringstream s;
dO->print(s);
d->LoadedHeader[tag] = QString(s.str().c_str());
}
}
}
return;
}
示例9: echo
bool EchoToPACS::echo(PacsDevice pacsDevice)
{
PACSConnection pacsConnection(pacsDevice);
/// Es fa la connexió connexió
if (connectToPACS(&pacsConnection))
{
/// Es fa un echo al pacs
OFCondition condition = echoToPACS(&pacsConnection);
/// Desconnexió
disconnectFromPACS(&pacsConnection);
if (condition.good())
{
m_lastError = EchoOk;
}
else
{
ERROR_LOG("Doing echo to " + pacsDevice.getAETitle() + " does not respond correctly. Error description: " + condition.text());
m_lastError = EchoFailed;
}
}
else
{
INFO_LOG("Doing echo to " + pacsDevice.getAETitle() + " does not respond.");
m_lastError = EchoCanNotConnectToPACS;
}
return m_lastError == EchoOk;
}
示例10: DropNetwork
OFCondition GIL::DICOM::DCMTK::Network::InitializeNetwork(int timeout, Association::RoleType role, int port)
{
if (m_pDCMTKNetwork != NULL) {
LOG_WARN("DICOMNetwork", "Shutting down previous initiallized network");
DropNetwork();
}
OFCondition cond;
switch (role) {
case Association::RT_Acceptor:
cond = ASC_initializeNetwork(NET_ACCEPTOR, 0, timeout, &m_pDCMTKNetwork);
break;
case Association::RT_Requestor:
cond = ASC_initializeNetwork(NET_REQUESTOR, port, timeout, &m_pDCMTKNetwork);
break;
case Association::RT_AcceptorRequestor:
cond = ASC_initializeNetwork(NET_ACCEPTORREQUESTOR, port, timeout, &m_pDCMTKNetwork);
break;
default:
cond = EC_IllegalParameter;
break;
}
m_Initiallized = cond.good();
return cond;
}
示例11: toSeriesInstanceUIDContainer
Series::InstanceUIDContainer Series::toSeriesInstanceUIDContainer(OFList< QRResponse* > responses)
{
InstanceUIDContainer instanceUIDContainer;
OFIterator< QRResponse* > it;
DcmDataset dataset;
OFCondition result;
// Every while loop run will get all image for a specific study
for (it = responses.begin(); it != responses.end(); ++it)
{
// Be sure we are not in the last response which does not have a dataset
if ((*it)->m_dataset != NULL)
{
OFString seriesInstanceUID;
result = (*it)->m_dataset->findAndGetOFStringArray(DCM_SeriesInstanceUID, seriesInstanceUID);
// Only try to get study if we actually have study instance uid, otherwise skip it
if (result.good())
{
instanceUIDContainer.push_back(seriesInstanceUID.c_str());
}
else
{
const std::string msg = "There is no \"SeriersInstanceUID\" tag in the selected series :"
+ std::string(result.text());
throw ::fwPacsIO::exceptions::TagMissing(msg);
}
}
}
return instanceUIDContainer;
}
示例12: subOperationCallback
void RetrieveDICOMFilesFromPACS::subOperationCallback(void *subOperationCallbackData, T_ASC_Network *associationNetwork, T_ASC_Association **subAssociation)
{
RetrieveDICOMFilesFromPACS *retrieveDICOMFilesFromPACS = (RetrieveDICOMFilesFromPACS*)subOperationCallbackData;
if (associationNetwork == NULL)
{
// Help no net !
return;
}
if (*subAssociation == NULL)
{
OFCondition condition = retrieveDICOMFilesFromPACS->acceptSubAssociation(associationNetwork, subAssociation);
if (!condition.good())
{
ERROR_LOG("S'ha produit un error negociant l'associacio de la connexio DICOM entrant, descripcio error: " + QString(condition.text()));
}
else
{
INFO_LOG("Rebuda solicitud de connexio pel port de connexions DICOM entrants del PACS.");
}
}
else
{
retrieveDICOMFilesFromPACS->subOperationSCP(subAssociation);
}
}
示例13:
bool
ParserDicom::isValidFile(string filename)
{
DcmFileFormat dcm;
OFCondition cond = dcm.loadFile(filename.c_str());
return cond.good();
}
示例14: 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);
}
}
示例15: addAllStoragePresentationContexts
OFCondition Network::addAllStoragePresentationContexts(T_ASC_Parameters *params, bool bProposeCompression, int lossy)
{
OFCondition cond = EC_Normal;
int i;
int pid = 1;
/*
** We prefer to accept Explicitly encoded transfer syntaxes.
** If we are running on a Little Endian machine we prefer
** LittleEndianExplicitTransferSyntax to BigEndianTransferSyntax.
** Some SCP implementations will just select the first transfer
** syntax they support (this is not part of the standard) so
** organise the proposed transfer syntaxes to take advantage
** of such behaviour.
*/
const char** transferSyntaxes;
int transferSyntaxes_count;
const char* const_transferSyntaxes[] = {UID_JPEGProcess14SV1TransferSyntax, NULL, NULL, UID_LittleEndianImplicitTransferSyntax };
if(bProposeCompression) {
if(lossy == 8) {
const_transferSyntaxes[0] = UID_JPEGProcess1TransferSyntax;
}
if(lossy == 12) {
const_transferSyntaxes[0] = UID_JPEGProcess2_4TransferSyntax;
}
}
/* gLocalByteOrder is defined in dcxfer.h */
if (gLocalByteOrder == EBO_LittleEndian) {
/* we are on a little endian machine */
const_transferSyntaxes[1] = UID_LittleEndianExplicitTransferSyntax;
const_transferSyntaxes[2] = UID_BigEndianExplicitTransferSyntax;
} else {
/* we are on a big endian machine */
const_transferSyntaxes[1] = UID_BigEndianExplicitTransferSyntax;
const_transferSyntaxes[2] = UID_LittleEndianExplicitTransferSyntax;
}
if(bProposeCompression) {
transferSyntaxes = &const_transferSyntaxes[0];
transferSyntaxes_count = DIM_OF(const_transferSyntaxes);
}
else {
transferSyntaxes = &const_transferSyntaxes[1];
transferSyntaxes_count = DIM_OF(const_transferSyntaxes)-1;
}
/* the array of Storage SOP Class UIDs comes from dcuid.h */
for (i=0; i<numberOfAllDcmStorageSOPClassUIDs && cond.good(); i++) {
cond = ASC_addPresentationContext(params, pid, dcmAllStorageSOPClassUIDs[i], transferSyntaxes, transferSyntaxes_count);
pid += 2; /* only odd presentation context id's */
}
return cond;
}