本文整理汇总了C++中ImageType::GetBufferPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageType::GetBufferPointer方法的具体用法?C++ ImageType::GetBufferPointer怎么用?C++ ImageType::GetBufferPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageType
的用法示例。
在下文中一共展示了ImageType::GetBufferPointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dimensions
static SoXipDataImage *
createXipImageSingle(SoItkDataImage * xipItkImage, SbXipImage::DataType typeFlag,
int bitsPerComp, SbXipImage::ComponentLayoutType compLayout)
{
typedef typename itk::Image<Type, nDims> ImageType;
ImageType * itkImage = reinterpret_cast<ImageType *>(xipItkImage->getPointer());
typename ImageType::RegionType region = itkImage->GetBufferedRegion();
SbXipImageDimensions dimensions(1, 1, 1);
for (unsigned int i = 0; i < nDims; ++ i)
{
dimensions[i] = region.GetSize()[i];
}
SbXipImage* image =
new SbXipImage(dimensions, typeFlag, bitsPerComp,
itkImage->GetBufferPointer(), nComps,
SbXipImage::INTERLEAVED, compLayout,
xipItkImage->getModelMatrix());
if (!image) return 0;
SoXipDataImage * xipImage = new SoXipDataImage;
xipImage->ref();
xipImage->addRef(xipItkImage);
xipImage->set(image);
return xipImage;
}
示例2: memcpy
void
NrrdPlugin::readSlice(int idx[3], int sz[3],
int nbytes, uchar *slice)
{
typedef itk::Image<T, 3> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(m_fileName[0].toAscii().data());
typedef itk::NrrdImageIO NrrdIOType;
NrrdIOType::Pointer nrrdIO = NrrdIOType::New();
reader->SetImageIO(nrrdIO);
typedef itk::RegionOfInterestImageFilter<ImageType,ImageType> RegionExtractor;
ImageType::RegionType region;
ImageType::SizeType size;
ImageType::IndexType index;
index[2] = idx[2];
index[1] = idx[1];
index[0] = idx[0];
size[2] = sz[2];
size[1] = sz[1];
size[0] = sz[0];
region.SetIndex(index);
region.SetSize(size);
// Extract the relevant sub-region.
RegionExtractor::Pointer extractor = RegionExtractor::New();
extractor->SetInput(reader->GetOutput());
extractor->SetRegionOfInterest(region);
extractor->Update();
ImageType *dimg = extractor->GetOutput();
char *tdata = (char*)(dimg->GetBufferPointer());
memcpy(slice, tdata, nbytes);
}