本文整理汇总了C++中OFCondition::text方法的典型用法代码示例。如果您正苦于以下问题:C++ OFCondition::text方法的具体用法?C++ OFCondition::text怎么用?C++ OFCondition::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OFCondition
的用法示例。
在下文中一共展示了OFCondition::text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssociationCleanup
OFCondition AssociationCleanup(T_ASC_Association *assoc)
{
OFString temp_str;
OFCondition cond = ASC_dropSCPAssociation(assoc);
if (cond.bad())
{
LOG(FATAL) << cond.text();
return cond;
}
cond = ASC_destroyAssociation(&assoc);
if (cond.bad())
{
LOG(FATAL) << cond.text();
return cond;
}
return cond;
}
示例2: main
int main(int argc, char** argv)
{
// Check whether host and port are given
if (argc < 3)
{
print_usage();
return 2;
}
std::string host = argv[1];
unsigned int port = atoi(argv[2]);
std::string peerAET = "";
if (argc > 3)
{
peerAET = argv[3];
}
// Setup SCU
DcmSCU scu;
scu.setPeerHostName(host);
scu.setPeerPort(port);
OFString verificationSOP = UID_VerificationSOPClass;
OFList<OFString> ts;
ts.push_back(UID_LittleEndianExplicitTransferSyntax);
ts.push_back(UID_BigEndianExplicitTransferSyntax);
ts.push_back(UID_LittleEndianImplicitTransferSyntax);
scu.addPresentationContext(verificationSOP, ts);
if (peerAET != "")
{
scu.setPeerAETitle(peerAET);
}
OFCondition result = scu.initNetwork();
if (result.bad())
{
std::cerr << "Error setting up SCU: " << result.text() << "\n";
return 2;
}
// Negotiate association
result = scu.negotiateAssociation();
if (result.bad())
{
std::cerr << "Error negotiating association: " << result.text() << "\n";
return 2;
}
// Issue ECHO request and let scu find presentation context itself (0)
result = scu.sendECHORequest(0);
if (result.bad())
{
std::cerr << "Error issuing ECHO request or received rejecting response: " << result.text() << "\n";
return 2;
}
std::cout << "Successfully sent DICOM Echo to host " << argv[1] << " on port " << argv[2] << "\n";
return 0;
}
示例3: 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);
}
}
示例4: 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;
}
示例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: findScp
OFCondition Internals::findScp(T_ASC_Association * assoc,
T_DIMSE_Message * msg,
T_ASC_PresentationContextID presID,
IFindRequestHandler* findHandler,
IWorklistRequestHandler* worklistHandler,
const std::string& remoteIp,
const std::string& remoteAet,
const std::string& calledAet)
{
FindScpData data;
data.lastRequest_ = NULL;
data.findHandler_ = findHandler;
data.worklistHandler_ = worklistHandler;
data.remoteIp_ = &remoteIp;
data.remoteAet_ = &remoteAet;
data.calledAet_ = &calledAet;
OFCondition cond = DIMSE_findProvider(assoc, presID, &msg->msg.CFindRQ,
FindScpCallback, &data,
/*opt_blockMode*/ DIMSE_BLOCKING,
/*opt_dimse_timeout*/ 0);
// if some error occured, dump corresponding information and remove the outfile if necessary
if (cond.bad())
{
OFString temp_str;
LOG(ERROR) << "Find SCP Failed: " << cond.text();
}
return cond;
}
示例7: load
bool DicomdirLoader::load(const std::string &studyinstanceuid, const Glib::ustring &dicomdir) {
DcmDicomDir dir(dicomdir.c_str());
OFCondition ret;
if (busy() ) {
return false;
}
if ( (ret=dir.error()) != EC_Normal ) {
std::cout << "DicomdirLoader::load Error: " << ret.text() << std::endl;
return false;
}
// Open DICOMDIR and look for StudyInstanceUID
// Add all IMAGE record types to m_FileList and fill cache
// FileLoader::Start
DcmDirectoryRecord *studyRec = find_study(studyinstanceuid, dir);
if ( !studyRec ) {
std::cout << "DicomdirLoader::load Error: cannot find study" << std::endl;
return false;
}
m_filelist = new std::list< Glib::ustring >;
m_cache.clear();
if ( !scan_study(studyinstanceuid, studyRec, dicomdir) ) {
std::cout << "DicomdirLoader::load: no visible images" << std::endl;
return false;
}
FileLoader::start();
return true;
}
示例8: 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;
}
示例9: retrieve
PACSRequestStatus::RetrieveRequestStatus RetrieveDICOMFilesFromPACS::retrieve(const QString &studyInstanceUID, const QString &seriesInstanceUID, const QString &sopInstanceUID)
{
T_ASC_PresentationContextID presentationContextID;
T_DIMSE_C_MoveRSP moveResponse;
DcmDataset *statusDetail = NULL;
m_pacsConnection = new PACSConnection(m_pacs);
PACSRequestStatus::RetrieveRequestStatus retrieveRequestStatus;
MoveSCPCallbackData moveSCPCallbackData;
DcmDataset *dcmDatasetToRetrieve = getDcmDatasetOfImagesToRetrieve(studyInstanceUID, seriesInstanceUID, sopInstanceUID);
m_numberOfImagesRetrieved = 0;
// TODO S'hauria de comprovar que es tracti d'un PACS amb el servei de retrieve configurat
if (!m_pacsConnection->connectToPACS(PACSConnection::RetrieveDICOMFiles))
{
ERROR_LOG("S'ha produit un error al intentar connectar al PACS per fer un retrieve. AE Title: " + m_pacs.getAETitle());
return PACSRequestStatus::RetrieveCanNotConnectToPACS;
}
// Which presentation context should be used, It's important that the connection has MoveStudyRoot level
T_ASC_Association *association = m_pacsConnection->getConnection();
presentationContextID = ASC_findAcceptedPresentationContextID(association, MoveAbstractSyntax);
if (presentationContextID == 0)
{
ERROR_LOG("No s'ha trobat cap presentation context valid");
return PACSRequestStatus::RetrieveFailureOrRefused;
}
moveSCPCallbackData.association = association;
moveSCPCallbackData.presentationContextId = presentationContextID;
moveSCPCallbackData.retrieveDICOMFilesFromPACS = this;
// Set the destination of the images to us
T_DIMSE_C_MoveRQ moveRequest = getConfiguredMoveRequest(association);
ASC_getAPTitles(association->params, moveRequest.MoveDestination, NULL, NULL);
OFCondition condition = DIMSE_moveUser(association, presentationContextID, &moveRequest, dcmDatasetToRetrieve, moveCallback, &moveSCPCallbackData,
DIMSE_BLOCKING, 0, m_pacsConnection->getNetwork(), subOperationCallback, this, &moveResponse, &statusDetail,
NULL /*responseIdentifiers*/);
if (condition.bad())
{
ERROR_LOG(QString("El metode descarrega no ha finalitzat correctament. Codi error: %1, descripcio error: %2").arg(condition.code())
.arg(condition.text()));
}
m_pacsConnection->disconnect();
retrieveRequestStatus = getDIMSEStatusCodeAsRetrieveRequestStatus(moveResponse.DimseStatus);
processServiceClassProviderResponseStatus(moveResponse.DimseStatus, statusDetail);
// Dump status detail information if there is some
if (statusDetail != NULL)
{
delete statusDetail;
}
delete dcmDatasetToRetrieve;
return retrieveRequestStatus;
}
示例10: moveScp
OFCondition Internals::moveScp(T_ASC_Association * assoc,
T_DIMSE_Message * msg,
T_ASC_PresentationContextID presID,
IMoveRequestHandler& handler,
const std::string& remoteIp,
const std::string& remoteAet,
const std::string& calledAet)
{
MoveScpData data;
data.target_ = std::string(msg->msg.CMoveRQ.MoveDestination);
data.lastRequest_ = NULL;
data.handler_ = &handler;
data.remoteIp_ = &remoteIp;
data.remoteAet_ = &remoteAet;
data.calledAet_ = &calledAet;
OFCondition cond = DIMSE_moveProvider(assoc, presID, &msg->msg.CMoveRQ,
MoveScpCallback, &data,
/*opt_blockMode*/ DIMSE_BLOCKING,
/*opt_dimse_timeout*/ 0);
// if some error occured, dump corresponding information and remove the outfile if necessary
if (cond.bad())
{
OFString temp_str;
LOG(ERROR) << "Move SCP Failed: " << cond.text();
}
return cond;
}
示例11: Deserialize
void ctkDICOMDataset::Deserialize()
{
Q_D(ctkDICOMDataset);
// read attribute m_ctkDICOMDataset
// construct a DcmDataset from it
// calls InitializeData(DcmDataset*)
// this method can be called both from sub-classes when they get the InitializeData signal from the persistence framework
// and from EnsureDcmDataSetIsInitialized() when a GetElement.. or SetElement.. method is called.
if (d->m_DICOMDataSetInitialized) return; // only need to do this once
QString stringbuffer = this->GetStoredSerialization();
if ( stringbuffer.isEmpty() )
{
d->m_DICOMDataSetInitialized = true;
return; // TODO nicer: hold three states: newly created / loaded but not initialized / restored from DB
}
//std::cerr << "** " << (void*)this << " ctkDICOMDataset: Deserialize Dataset from string of size " << stringbuffer.size() << "\n" << stringbuffer.toStdString() << std::endl;
QByteArray qtArray = QByteArray::fromBase64( stringbuffer.toAscii() );
//std::cerr << "** " << (void*)this << " ctkDICOMDataset: Deserialize Dataset from byte array of size " << qtArray.size() << std::endl;
DcmInputBufferStream dcmbuffer;
dcmbuffer.setBuffer( qtArray.data(), qtArray.size() );
//std::cerr << "** Buffer state: " << dcmbuffer.status().code() << " " << dcmbuffer.good() << " " << dcmbuffer.eos() << " tell " << dcmbuffer.tell() << " avail " << dcmbuffer.avail() << std::endl;
DcmDataset dataset;
dataset.transferInit();
//std::cerr << "** Dataset state: " << dataset.transferState() << std::endl << std::endl;
OFCondition condition = dataset.read( dcmbuffer, EXS_LittleEndianImplicit );
dataset.transferEnd();
// do this in all cases, even when reading reported an error
this->InitializeFromDataset(&dataset);
if ( condition.bad() )
{
std::cerr << "** Condition code of Dataset::read() is "
<< condition.code() << std::endl;
std::cerr << "** Buffer state: " << dcmbuffer.status().code()
<< " " << dcmbuffer.good()
<< " " << dcmbuffer.eos()
<< " tell " << dcmbuffer.tell()
<< " avail " << dcmbuffer.avail() << std::endl;
std::cerr << "** Dataset state: "
<< static_cast<int>(dataset.transferState()) << std::endl;
std::cerr << "Could not DcmDataset::read(..): "
<< condition.text() << std::endl;
//throw std::invalid_argument( std::string("Could not DcmDataset::read(..): ") + condition.text() );
}
}
示例12: _loadDataset
bool DicomSurfaceSegmentationLoad::_loadDataset()
{
bool success = false;
SmartPtr_DCMDataSet newDataset(new DcmDataset());
_datasetPointer = newDataset;
const OFCondition status = _datasetPointer->loadFile(_filename.c_str(), EXS_LittleEndianExplicit);
if(status.bad())
{
std::cerr << "Loading the dataset failed: " << status.text() << std::endl;
throw std::exception(status.text());
}
else
{
success = true;
}
return success;
}
示例13: convert
Status ConvertDicomToLittleEndian::convert(QString inputFile, QString outputFile)
{
DcmFileFormat fileformat;
DcmDataset *dataset = fileformat.getDataset();
OFCondition error;
Status state;
// Transfer Syntax del fitxer d'entrada
E_TransferSyntax opt_ixfer = EXS_Unknown;
E_FileReadMode opt_readMode = ERM_autoDetect;
E_TransferSyntax opt_oxfer = EXS_LittleEndianExplicit;
QString descriptionError;
E_EncodingType opt_oenctype = EET_ExplicitLength;
E_GrpLenEncoding opt_oglenc = EGL_recalcGL;
E_PaddingEncoding opt_opadenc = EPD_noChange;
OFCmdUnsignedInt opt_filepad = 0;
OFCmdUnsignedInt opt_itempad = 0;
E_FileWriteMode writeMode = EWM_fileformat;
error = fileformat.loadFile(qPrintable(QDir::toNativeSeparators(inputFile)), opt_ixfer, EGL_noChange, DCM_MaxReadLength, opt_readMode);
if (error.bad())
{
ERROR_LOG(QString("No s'ha pogut obrir el fitxer a convertir LittleEndian %1, descripcio error: %2").arg(inputFile, error.text()));
return state.setStatus(error);
}
dataset->loadAllDataIntoMemory();
DcmXfer opt_oxferSyn(opt_oxfer);
dataset->chooseRepresentation(opt_oxfer, NULL);
if (!dataset->canWriteXfer(opt_oxfer))
{
descriptionError = "Error: no conversion to transfer syntax " + QString(opt_oxferSyn.getXferName()) + " possible";
state.setStatus(qPrintable(descriptionError), false, 1300);
ERROR_LOG(descriptionError);
return state;
}
error = fileformat.saveFile(qPrintable(QDir::toNativeSeparators(outputFile)), opt_oxfer, opt_oenctype, opt_oglenc, opt_opadenc,
OFstatic_cast(Uint32, opt_filepad), OFstatic_cast(Uint32, opt_itempad), writeMode);
if (!error.good())
{
ERROR_LOG(QString("S'ha produit un error al intentar gravar la imatge %1 convertida a LittleEndian al path %2, descripcio error: %3")
.arg(inputFile, outputFile, error.text()));
}
return state.setStatus(error);
}
示例14: EchoScp
OFCondition EchoScp( T_ASC_Association * assoc, T_DIMSE_Message * msg, T_ASC_PresentationContextID presID)
{
OFString temp_str;
LOG(INFO) << "Received Echo Request";
//LOG(DEBUG) << DIMSE_dumpMessage(temp_str, msg->msg.CEchoRQ, DIMSE_INCOMING, NULL, presID));
/* the echo succeeded !! */
OFCondition cond = DIMSE_sendEchoResponse(assoc, presID, &msg->msg.CEchoRQ, STATUS_Success, NULL);
if (cond.bad())
{
LOG(ERROR) << "Echo SCP Failed: " << cond.text();
}
return cond;
}
示例15: printAttributeErrorMessage
// print an error message to the console (stderr) that something went wrong with an attribute
static void printAttributeErrorMessage(const DcmTagKey &key,
const OFCondition &error,
const char *operation)
{
if (error.bad())
{
OFString str;
if (operation != NULL)
{
str = "cannot ";
str += operation;
str += " ";
}
LOG(ERROR) << error.text() << ": " << str << DcmTag(key).getTagName() << " " << key;
}
}