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


C++ TImage::begin方法代码示例

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


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

示例1: updateMask

void CExtractRegion::updateMask( TImage& mask, TImage& work, uint index )
{
	TImage::iterator in = work.begin();
	TImage::iterator out = mask.begin();
	while( in != work.end() )
	{
		if ( (*in) > 0 ) (*out) = index;
		++in; ++out;
	}
}
开发者ID:BackupTheBerlios,项目名称:aips-svn,代码行数:10,代码来源:cextractregion.cpp

示例2: load

vtkImageData* CImageLoader::load( std::string sFilename, TImagePtr& imagePtr )
{
	cerr << "Loading data... ";
	TDataFile theData = getFileServer().loadDataSet( sFilename );
	if ( theData.first->getType() == typeid( short ) )
	{
		imagePtr = static_pointer_cast<TImage>( theData.first );
		cerr << "Correct" << endl;
	}
	else
		cerr << theData.first->getType().name() << endl;
	cerr << "done" << endl;
	cerr << "Starting conversion... ";
	// Create vtk structured points structure
  vtkImageData* sp = vtkImageData::New();
  sp->SetDimensions( theData.first->getExtent(0), theData.first->getExtent(1), theData.first->getExtent(2) );
  sp->AllocateScalars();	
  // Assign dataset to structured points
  vtkPointData *p=sp->GetPointData();
	vtkShortArray* sArray = NULL;
	vtkDoubleArray* fArray = NULL;
	TField* floatSet = dynamic_cast<TField*>( theData.first.get() );	
	if ( floatSet != NULL )
	{
		fArray = vtkDoubleArray::New();
		fArray->SetArray(floatSet->getArray(),
			theData.first->getExtent(0)*theData.first->getExtent(1)*theData.first->getExtent(2), 1 );
		p->SetScalars( fArray );
		sp->SetScalarTypeToDouble();
	}
	else 
	{
		TImage* shortSet = dynamic_cast<TImage*>( theData.first.get() );
		if ( shortSet != NULL )
		{
			short* sA = new short[theData.first->getExtent(0)*theData.first->getExtent(1)*theData.first->getExtent(2)];
			short* sAs = sA;
			for( TImage::iterator it = shortSet->begin(); it != shortSet->end(); ++it, ++sAs )
				*sAs = *it;
			sArray = vtkShortArray::New();
			sArray->SetArray( sA,
				theData.first->getExtent(0)*theData.first->getExtent(1)*theData.first->getExtent(2), 1 );
			p->SetScalars( sArray );
			sp->SetScalarTypeToShort();
		}		
		else
		{
	    sp->Delete();		
			throw( FileException( "CVTkHandler - Unknown image format in dataset. Image was not saved" ) );
		}
	}
	sp->UpdateData();
	sp->SetSpacing( 1.0, 1.0, 1.0 );
	sp->SetOrigin( static_cast<double>( theData.first->getExtent(0) )/ 2.0, 
		static_cast<double>( theData.first->getExtent(1) )/ 2.0,
		static_cast<double>( theData.first->getExtent(2) )/ 2.0	);
	cerr << sp->GetNumberOfScalarComponents() << endl;
	cerr << "done" << endl;	
	return sp;
}
开发者ID:BackupTheBerlios,项目名称:aips-svn,代码行数:60,代码来源:cimageloader.cpp

示例3: computeSize

ulong CExtractRegion::computeSize( TImage& region )
{
	ulong size = 0;
	TImage::iterator in = region.begin();
	while( in != region.end() )
	{
		if ( (*in) > 0 ) size++;
		++in;
	}	
	return size;
}
开发者ID:BackupTheBerlios,项目名称:aips-svn,代码行数:11,代码来源:cextractregion.cpp


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