本文整理汇总了C++中inputimagetype::Pointer::GetBufferPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetBufferPointer方法的具体用法?C++ Pointer::GetBufferPointer怎么用?C++ Pointer::GetBufferPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inputimagetype::Pointer
的用法示例。
在下文中一共展示了Pointer::GetBufferPointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSlice
Input2DImageType::Pointer Curvelet::getSlice(InputImageType::Pointer im, int slice)
{
Input2DImageType::Pointer out = Input2DImageType::New();
Input2DImageType::SizeType size;
size[0] = im->GetLargestPossibleRegion().GetSize()[0];
size[1] = im->GetLargestPossibleRegion().GetSize()[1];
Input2DImageType::IndexType index;
index.Fill(0);
Input2DImageType::RegionType region;
region.SetSize(size);
region.SetIndex(index);
out->SetRegions(region);
out->Allocate();
if(out->GetBufferPointer()==NULL)
printf("Could not allocate memory -1 ... I'm going to crash any moment now.. \n");
memcpy(out->GetBufferPointer(),im->GetBufferPointer()+slice*size[0]*size[1],size[0]*size[1]*sizeof(unsigned char));
return out;
}
示例2: RunOnInputImage
InputImageType::Pointer Curvelet::RunOnInputImage(InputImageType::Pointer InputImage)
{
//InputImage = NewInputImage;
slices = InputImage->GetLargestPossibleRegion().GetSize()[2];
InputImageType::Pointer outputim = InputImageType::New();
outputim->SetRegions(InputImage->GetLargestPossibleRegion());
outputim->Allocate();
FloatImageType::Pointer cosim = FloatImageType::New();
cosim->SetRegions(InputImage->GetLargestPossibleRegion());
cosim->Allocate();
FloatImageType::Pointer sinim = FloatImageType::New();
sinim->SetRegions(InputImage->GetLargestPossibleRegion());
sinim->Allocate();
if(outputim->GetBufferPointer() == NULL || cosim->GetBufferPointer() == NULL || sinim->GetBufferPointer() == NULL)
{
printf("Couldnt' allocate memory - 3.. going to crash now\n");
}
int max_dim = tile_size;
int xsize = InputImage->GetLargestPossibleRegion().GetSize()[0];
int ysize = InputImage->GetLargestPossibleRegion().GetSize()[1];
int kx = 0;int ky = 0;
kx = xsize /(max_dim-this->border);
ky = ysize /(max_dim-this->border);
int remx = xsize % (max_dim-this->border);
int remy = ysize % (max_dim-this->border);
if ( remx > 0 )
kx ++;
if ( remy > 0 )
ky ++;
for(int xco = 0; xco < kx; xco++)
{
for(int yco = 0; yco < ky; yco++)
{
InputImageType::SizeType imsize = InputImage->GetLargestPossibleRegion().GetSize();
InputImageType::IndexType index;
InputImageType::SizeType size;
InputImageType::RegionType region;
index.Fill(0);
size[0] = MIN((xco)*(max_dim-this->border)+max_dim-1,imsize[0]-1) - xco * (max_dim-this->border) +1;
size[1] = MIN((yco)*(max_dim-this->border)+max_dim-1,imsize[1]-1) - yco * (max_dim-this->border) +1;
size[2] = imsize[2];
InputImageType::Pointer imtile = InputImageType::New();
region.SetIndex(index);
region.SetSize(size);
imtile->SetRegions(region);
imtile->Allocate();
if(imtile->GetBufferPointer()==NULL)
printf("Couldn't allocate memory - 4 .. going to crash now\n");
InputImageType::RegionType region1;
index[0] = xco *(max_dim-this->border);
index[1] = yco *(max_dim-this->border);
index[2] = 0;
region1.SetIndex(index);
region1.SetSize(size);
typedef itk::ImageRegionIterator<InputImageType> IteratorType;
IteratorType iter1(InputImage,region1);
IteratorType iter2(imtile,region);
//printf("xco = %d yco = %d :\n",xco,yco);
region1.Print(std::cout);
region.Print(std::cout);
iter1.GoToBegin();
iter2.GoToBegin();
for(;!iter1.IsAtEnd();++iter1,++iter2)
{
iter2.Set(iter1.Get());
}
InputImageType::Pointer outputtile = InputImageType::New();
outputtile->SetRegions(imtile->GetLargestPossibleRegion());
outputtile->Allocate();
FloatImageType::Pointer cosimtile = FloatImageType::New();
cosimtile->SetRegions(imtile->GetLargestPossibleRegion());
cosimtile->Allocate();
FloatImageType::Pointer sinimtile = FloatImageType::New();
sinimtile->SetRegions(imtile->GetLargestPossibleRegion());
sinimtile->Allocate();
if(outputtile->GetBufferPointer() == NULL || cosimtile->GetBufferPointer()==NULL || sinimtile->GetBufferPointer() == NULL )
{
printf("Couldn't allocate memory - 5 .. going to crash now ..\n");
}
{
#pragma omp parallel for shared(cosimtile,imtile,sinimtile,outputtile) num_threads(numt)
//.........这里部分代码省略.........