对连通区域算子得到的组分label id可能是不连续的,甚至是不不按顺序的,需要用RelabelComponentImageFilter 对label重新从1开始编号
#include "itkImage.h"
#include <vtkSmartPointer.h>
#include <vtkPNGWriter.h>
#include "itkScalarConnectedComponentImageFilter.h"
#include <itkRelabelComponentImageFilter.h>
#include <itkImageToVTKImageFilter.h>
#include <itkVTKImageToImageFilter.h>
#include <itkLabelStatisticsImageFilter.h>
#include <string>
#include <iostream>
#include<vtkImageShiftScale.h>
void SetPixel(itk::Image<unsigned char, 2>* const image, int x1, int y1, int x2, int y2, unsigned char value)
{
// Make a square
for (itk::Image<unsigned char, 2>::IndexValueType r = x1; r < x2; r++)
{
for (itk::Image<unsign
这篇博客介绍了如何使用RelabelComponentImageFilter工具,该工具用于将连通区域分析得到的不连续或无序label ID重新排序并从1开始编号。通过示例展示了在处理图像组件时,如何实现标签的连续和有序,从而便于后续的图像处理操作。
订阅专栏 解锁全文
839

被折叠的 条评论
为什么被折叠?



