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


C++ DcmDataset::findAndGetSint32方法代码示例

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


在下文中一共展示了DcmDataset::findAndGetSint32方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DcmFileFormat

bool Dicom::DicomReader::OpenDicoms(const std::list<std::string>& dcms)
{
	if (m_pImageData)
	{
		//已经打开了数据
		return false;
	}

	std::map<int,DcmFileFormat*> mapDcms;

	int iMaxLayer = -1;
	int iMinLayer = INT_MAX;

	{
		//获取图像数据
		std::list<std::string>::const_iterator iter = dcms.begin();
		while (iter != dcms.end())
		{
			DcmFileFormat* pDcmFile = new DcmFileFormat();
			OFCondition cond = pDcmFile->loadFile(iter->c_str());
			if (cond.bad())
			{
				delete pDcmFile;
				++iter;
				continue;
			}

			DcmDataset* pDataset = pDcmFile->getDataset();

			Uint16 iC = 0, iR = 0, iB = 0;
			pDataset->findAndGetUint16(DCM_Columns, iC);
			pDataset->findAndGetUint16(DCM_Rows, iR);
			pDataset->findAndGetUint16(DCM_BitsAllocated, iB);
			if (mapDcms.size()<1)
			{
				m_iColumns = iC;
				m_iRows = iR;
				m_iBits = iB;
			}

			if (iC != m_iColumns || iR != m_iRows || iB != m_iBits)
			{
				delete pDcmFile;
				++iter;
				continue;
			}

			Sint32 iL = -1;

			pDataset->findAndGetSint32(DCM_InstanceNumber, iL);
			if (iL>-1 && mapDcms.find(iL) == mapDcms.end())
			{
				mapDcms[iL] = pDcmFile;
				if (iL > iMaxLayer)
					iMaxLayer = iL;
				if (iL < iMinLayer)
					iMinLayer = iL;
			}
			else
			{
				delete pDcmFile;
			}

			++iter;
		}

		if (m_iBits != 16)
			return false;
	}


	//总层数
	m_iLayers = iMaxLayer-iMinLayer+1;
	m_pImageData = new Image::ImageData<short>(m_iRows, m_iColumns, m_iLayers);
	Image::ImageData<short>* pImageShort = reinterpret_cast<Image::ImageData<short>*>(m_pImageData);
	char* pDataPtr = m_pImageData->GetDataPtr();

	{
		//设置图像数据
		std::map<int, DcmFileFormat*>::iterator iter = mapDcms.begin();
		while (iter != mapDcms.end())
		{
			DcmFileFormat* pDcmFile = iter->second;
			DcmDataset* pDataSet = pDcmFile->getDataset();
			{
				const Uint16* pSrcData = NULL;
				unsigned long iCount = 0;
				pDataSet->findAndGetUint16Array(DCM_PixelData, pSrcData, &iCount);
				if (iCount == pImageShort->GetX()*pImageShort->GetY())
				{
					memcpy(pDataPtr+(iCount*2*(iter->first-iMinLayer)), pSrcData, iCount * 2);
				}
				else
				{
					assert("Read dicom error!");
				}
			}
			delete pDcmFile;

			++iter;
//.........这里部分代码省略.........
开发者ID:dilide,项目名称:XClinicWorkspace,代码行数:101,代码来源:DicomReader.cpp


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