当前位置: 首页>>代码示例>>C++>>正文


C++ DcmFileFormat::getDataset方法代码示例

本文整理汇总了C++中DcmFileFormat::getDataset方法的典型用法代码示例。如果您正苦于以下问题:C++ DcmFileFormat::getDataset方法的具体用法?C++ DcmFileFormat::getDataset怎么用?C++ DcmFileFormat::getDataset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DcmFileFormat的用法示例。


在下文中一共展示了DcmFileFormat::getDataset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);

    }
}
开发者ID:umm-mrrc,项目名称:augReality,代码行数:28,代码来源:vtkdicom.cpp

示例2: 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;
}
开发者ID:jhnstrk,项目名称:CTK,代码行数:26,代码来源:ctkDICOMDatabase.cpp

示例3: 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;
	}
}
开发者ID:twissmueller,项目名称:dicmlib,代码行数:33,代码来源:DicomImporter.cpp

示例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;
}
开发者ID:fvichot,项目名称:medInria-public,代码行数:35,代码来源:itkDCMTKImageIO.cpp

示例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);
  }
}
开发者ID:JanKolomaznik,项目名称:MedV4D,代码行数:32,代码来源:LocalService.cpp

示例6: opendir

Examen*
ParserDicom::loadFile(string dirName)
{
    // Open directory
    DIR* dir = opendir(dirName.c_str());
    if (dir == NULL) {
        return NULL;
    }

    // Get examen informations
    ExamenParams* params = getInfos(dir, dirName);
    if (params == NULL) {
        return NULL;
    }

    // Create struct examen
    Volume* img = new Volume(params->width, params->height, params->depth);
    Examen* exam = new Examen(img, params);

    // Read data
    int index = 0;
    struct dirent* file;
    rewinddir(dir);
    string pathDirectory = dirName + PATH_SEPARATOR;
    int tabSize = params->width * params->height;
    float tab[tabSize];
    while ((file = readdir(dir)) != NULL) {
        if (strcmp(file->d_name, ".") != 0 &&
                strcmp(file->d_name, "..") != 0) {
            string fullpath = pathDirectory + file->d_name;
            DcmFileFormat dcm;
            OFCondition cond = dcm.loadFile(fullpath.c_str());
            if (cond.bad()) {
                delete img;
                delete params;
                return NULL;
            }
            DiDocument* didoc = new DiDocument(fullpath.c_str());
            DiMono2Image* dimg = new DiMono2Image(didoc, EIS_Normal);
            OFString s;
            dcm.getDataset()->findAndGetOFString(DCM_BitsStored, s);
            int bitsStored = atoi(s.c_str());

            short* slice = (short*) dimg->getOutputData(0, bitsStored, 0);
            for(int i=0; i<tabSize; ++i) {
                tab[i] = (float) slice[i];
            }
            img->setSlice(tab, index++);
            delete dimg;
            delete didoc;
        }
    }
    closedir(dir);
    return exam;
}
开发者ID:jjalageas,项目名称:cpMoteur3D,代码行数:55,代码来源:ParserDicom.cpp

示例7: LoadRTDose

  mitk::DataNode::Pointer RTDoseReader::
      LoadRTDose(const char* filename)
  {
    DcmFileFormat fileformat;
    OFCondition outp = fileformat.loadFile(filename, EXS_Unknown);
    if(outp.bad())
    {
      MITK_ERROR << "Cant read the file" << std::endl;
    }
    DcmDataset *dataset = fileformat.getDataset();

    std::string name = filename;
    itk::FilenamesContainer file;
    file.push_back(name);

    mitk::DicomSeriesReader* reader = new mitk::DicomSeriesReader;

    mitk::DataNode::Pointer originalNode = reader->LoadDicomSeries(file,false);

    if(originalNode.IsNull())
    {
      MITK_ERROR << "Error reading the dcm file" << std::endl;
      return 0;
    }

    mitk::Image::Pointer originalImage
        = dynamic_cast<mitk::Image*>(originalNode->GetData());

    DRTDoseIOD doseObject;
    OFCondition result = doseObject.read(*dataset);

    if(result.bad())
    {
      MITK_ERROR << "Error reading the Dataset" << std::endl;
      return 0;
    }

    OFString gridScaling;
    Float32 gridscale;

    doseObject.getDoseGridScaling(gridScaling);
    gridscale = OFStandard::atof(gridScaling.c_str());

    AccessByItk_1(originalImage, MultiplayGridScaling, gridscale);

    double prescripeDose = this->GetMaxDoseValue(dataset);

    originalNode->SetName("RT Dose");
    originalNode->SetFloatProperty(mitk::Constants::PRESCRIBED_DOSE_PROPERTY_NAME.c_str(),prescripeDose);
    originalNode->SetFloatProperty(mitk::Constants::REFERENCE_DOSE_PROPERTY_NAME.c_str(), 40);
    originalNode->SetBoolProperty(mitk::Constants::DOSE_PROPERTY_NAME.c_str(),true);
    return originalNode;
  }
开发者ID:DiagnosisMultisystems,项目名称:MITK,代码行数:53,代码来源:mitkRTDoseReader.cpp

示例8: Store

  StoreStatus ServerContext::Store(std::string& resultPublicId,
                                   DcmFileFormat& dicomInstance,
                                   const char* dicomBuffer,
                                   size_t dicomSize)
  {
    DicomMap dicomSummary;
    FromDcmtkBridge::Convert(dicomSummary, *dicomInstance.getDataset());

    DicomInstanceHasher hasher(dicomSummary);
    resultPublicId = hasher.HashInstance();

    Json::Value dicomJson;
    FromDcmtkBridge::ToJson(dicomJson, *dicomInstance.getDataset());
      
    StoreStatus status = StoreStatus_Failure;
    if (dicomSize > 0)
    {
      status = Store(dicomBuffer, dicomSize, dicomSummary, dicomJson, "");
    }   

    return status;
  }
开发者ID:amirkogithub,项目名称:orthanc,代码行数:22,代码来源:ServerContext.cpp

示例9: main

int main(void)
{
	DcmFileFormat fileformat;
	OFCondition oc = fileformat.loadFile("D:\\021A3C1C.dcm");
	if(oc.good())
	{
		OFString patientName;
		if(fileformat.getDataset()->findAndGetOFString(DCM_PatientName, patientName).good())
		{
			std::cout<<"Patient Name:"<<patientName<<std::endl;
		}
	}
	return 0;
}
开发者ID:NavigationTest,项目名称:Navigation,代码行数:14,代码来源:DCMTest.cpp

示例10: 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);
}
开发者ID:chinhtrandn,项目名称:starviewer,代码行数:50,代码来源:convertdicomtolittleendian.cpp

示例11: get_patientname

std::string ImageMatrix::get_patientname(const std::string & dirpath){
	std::string filepath = dirpath + "\\ADC\\ADC_1";
	DcmFileFormat *pDicomFile = new DcmFileFormat();
	OFCondition oc = pDicomFile->loadFile(filepath.c_str());
	if(oc.good()){
		DcmDataset *pDataset = pDicomFile->getDataset();
		const char * name;
		pDataset -> findAndGetString(DCM_PatientName, name);
		std::string res(name);
		delete pDataset;
		return res;
	}
	else
	return "fuck";
}
开发者ID:fengbs,项目名称:Dicom,代码行数:15,代码来源:ImageMatrix.cpp

示例12: 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";
    }
}
开发者ID:umm-mrrc,项目名称:augReality,代码行数:17,代码来源:vtkdicom.cpp

示例13: GetReaderConfidenceLevel

  IFileIO::ConfidenceLevel DICOMSegmentationIO::GetReaderConfidenceLevel() const
  {
    if (AbstractFileIO::GetReaderConfidenceLevel() == Unsupported)
      return Unsupported;

    const std::string fileName = this->GetLocalFileName();

    DcmFileFormat dcmFileFormat;
    OFCondition status = dcmFileFormat.loadFile(fileName.c_str());

    if (status.bad())
      return Unsupported;

    OFString modality;
    if (dcmFileFormat.getDataset()->findAndGetOFString(DCM_Modality, modality).good())
    {
      if (modality.compare("SEG") == 0)
        return Supported;
      else
        return Unsupported;
    }
    return Unsupported;
  }
开发者ID:pollen-metrology,项目名称:MITK,代码行数:23,代码来源:mitkDICOMSegmentationIO.cpp

示例14: storeSCP

OFCondition RetrieveDICOMFilesFromPACS::storeSCP(T_ASC_Association *association, T_DIMSE_Message *msg, T_ASC_PresentationContextID presentationContextID)
{
    T_DIMSE_C_StoreRQ *storeRequest = &msg->msg.CStoreRQ;
    OFBool useMetaheader = OFTrue;
    StoreSCPCallbackData storeSCPCallbackData;
    DcmFileFormat retrievedFile;
    DcmDataset *retrievedDataset = retrievedFile.getDataset();

    storeSCPCallbackData.dcmFileFormat = &retrievedFile;
    storeSCPCallbackData.retrieveDICOMFilesFromPACS = this;
    storeSCPCallbackData.fileName = storeRequest->AffectedSOPInstanceUID;

    OFCondition condition = DIMSE_storeProvider(association, presentationContextID, storeRequest, NULL, useMetaheader, &retrievedDataset, storeSCPCallback,
                                                (void*) &storeSCPCallbackData, DIMSE_BLOCKING, 0);

    if (condition.bad())
    {
        // Remove file
        ERROR_LOG("S'ha produit al processar una peticio de descarregar d'un fitxer, descripcio error " + QString(condition.text()));
        unlink(qPrintable(storeSCPCallbackData.fileName));
    }

    return condition;
}
开发者ID:chinhtrandn,项目名称:starviewer,代码行数:24,代码来源:retrievedicomfilesfrompacs.cpp

示例15: referencedRTPlan

    std::vector<itk::SmartPointer<BaseData> > RTDoseReader::Read()
    {
        std::vector<itk::SmartPointer<mitk::BaseData> > result;

        DICOMTag referencedRTPlan(0x300c, 0x0002);
        mitk::IDICOMTagsOfInterest* toiSrv = GetDicomTagsOfInterestService();
        if (toiSrv)
        {
            toiSrv->AddTagOfInterest(referencedRTPlan);
        }

        std::string location = GetInputLocation();
        mitk::DICOMFileReaderSelector::Pointer selector = mitk::DICOMFileReaderSelector::New();
        selector->LoadBuiltIn3DConfigs();
        selector->SetInputFiles({ location });

        mitk::DICOMFileReader::Pointer reader = selector->GetFirstReaderWithMinimumNumberOfOutputImages();
        reader->SetAdditionalTagsOfInterest(toiSrv->GetTagsOfInterest());

        reader->SetInputFiles({ location });
        reader->AnalyzeInputFiles();
        reader->LoadImages();

        if (reader->GetNumberOfOutputs() == 0){
            MITK_ERROR << "Could not determine a DICOM reader for this file" << std::endl;
            return result;
        }

        const mitk::DICOMImageBlockDescriptor& desc = reader->GetOutput(0);

        mitk::Image::Pointer originalImage = desc.GetMitkImage();

        if (originalImage.IsNull())
        {
            MITK_ERROR << "Error reading the RTDOSE file in mitk::DicomFileReader" << std::endl;
            return result;
        }

        DcmFileFormat fileformat;
        OFCondition outp = fileformat.loadFile(location.c_str(), EXS_Unknown);
        if (outp.bad())
        {
            MITK_ERROR << "Error reading the RTDOSE file in DCMTK" << std::endl;
            return result;
        }
        DcmDataset *dataset = fileformat.getDataset();

        DRTDoseIOD doseObject;
        OFCondition DCMTKresult = doseObject.read(*dataset);

        if (DCMTKresult.bad())
        {
            MITK_ERROR << "Error reading the RTDOSE file in DCMTK" << std::endl;
            return result;
        }

        OFString gridScaling;
        Float32 gridscale;

        doseObject.getDoseGridScaling(gridScaling);
        gridscale = OFStandard::atof(gridScaling.c_str());

        AccessByItk_1(originalImage, MultiplyGridScaling, gridscale);

        auto statistics = this->scaledDoseImage->GetStatistics();
        double maxDose = statistics->GetScalarValueMax();

        this->scaledDoseImage->SetPropertyList(originalImage->GetPropertyList());
        this->scaledDoseImage->SetProperty(mitk::RTConstants::PRESCRIBED_DOSE_PROPERTY_NAME.c_str(), mitk::GenericProperty<double>::New(0.8*maxDose));

        result.push_back(this->scaledDoseImage.GetPointer());
        return result;
    }
开发者ID:pollen-metrology,项目名称:MITK,代码行数:73,代码来源:mitkRTDoseReader.cpp


注:本文中的DcmFileFormat::getDataset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。