本文整理汇总了C++中TImage::GetPixel方法的典型用法代码示例。如果您正苦于以下问题:C++ TImage::GetPixel方法的具体用法?C++ TImage::GetPixel怎么用?C++ TImage::GetPixel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TImage
的用法示例。
在下文中一共展示了TImage::GetPixel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint_vertex
void paint_vertex(VertexDescriptorType target, VertexDescriptorType source, TGraph& g) const
{
itk::Index<2> target_index;
target_index[0] = target[0];
target_index[1] = target[1];
itk::Index<2> source_index;
source_index[0] = source[0];
source_index[1] = source[1];
assert(image->GetLargestPossibleRegion().IsInside(source_index));
assert(image->GetLargestPossibleRegion().IsInside(target_index));
Image->SetPixel(target_index, Image->GetPixel(source_index));
}
示例2: PaintPatch
void PaintPatch(TVertexDescriptor target, TVertexDescriptor source) const
{
TVertexDescriptor target_patch_corner;
target_patch_corner[0] = target[0] - PatchHalfWidth;
target_patch_corner[1] = target[1] - PatchHalfWidth;
TVertexDescriptor source_patch_corner;
source_patch_corner[0] = source[0] - PatchHalfWidth;
source_patch_corner[1] = source[1] - PatchHalfWidth;
TVertexDescriptor target_node;
TVertexDescriptor source_node;
for(std::size_t i = 0; i < PatchHalfWidth * 2 + 1; ++i)
{
for(std::size_t j = 0; j < PatchHalfWidth * 2 + 1; ++j)
{
target_node[0] = target_patch_corner[0] + i;
target_node[1] = target_patch_corner[1] + j;
source_node[0] = source_patch_corner[0] + i;
source_node[1] = source_patch_corner[1] + j;
// Only paint the pixel if it is currently a hole
if( MaskImage->IsHole(ITKHelpers::CreateIndex(target_node)) )
{
//std::cout << "Copying pixel " << source_node << " to pixel " << target_node << std::endl;
itk::Index<2> target_index = ITKHelpers::CreateIndex(target);
itk::Index<2> source_index = ITKHelpers::CreateIndex(source);
assert(Image->GetLargestPossibleRegion().IsInside(source_index));
assert(Image->GetLargestPossibleRegion().IsInside(target_index));
Image->SetPixel(target_index, Image->GetPixel(source_index));
}
}
}
};