如何使用区域增长算法来定义感兴趣区域?
How to use region-growing algorithms to define a region of interest?
我正在处理 DICOM 图像(CT 扫描)并且想在我的照片中分离出一些感兴趣的结构,例如人体器官(如主动脉,请参见随附的图像)。我在 ITK 和 VTK 的帮助下用 C++ 编码。
假设这些器官具有特定的亮度强度,因此我可以使用区域增长算法(下面的代码)自动识别它们。为此,我之前根据属于器官的体素的平均值和标准偏差值计算了一些阈值。
如何在 ITK/VTK 功能的帮助下只保留图像中的主动脉? 我想我正在寻找的是一个过滤器,可以做与 ITK mask image filter.
完全相反的事情
请在下面找到器官隔离对应的(伪)代码。我根据区域生长的结果计算了 5 体素的扩张,以确保包括器官的所有体素,并在裁剪后在器官周围有足够的余量。
typedef short InputPixelType;
typedef unsigned char OutputPixelType;
const int Dimension = 3;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
// Region growing
typedef itk::ConnectedThresholdImageFilter< InputImagetype,
OutputImagetype > ConnectedFilterType;
ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New();
connectedThreshold->SetInput(input);
connectedThreshold->SetUpper(upperThreshold);
connectedThreshold->SetLower(lowerThreshold);
//Initializing seed
InternalImagetype::IndexType index;
index[0] = seed_x;
index[1] = seed_y;
connectedThreshold->SetSeed(index);
// Dilate the resulting region-growing of 5 voxels for safety
typedef itk::BinaryBallStructuringElement< OutputImageType,
Dimension > StructuringElementType;
typedef itk::BinaryDilateImageFilter< OutputImageType,
OutputImageType, StruturingElementType > DilateFilterType;
StructuringElementType structuringElement;
structuringElement.SetRadius(5);
structuringElement.CreateStructuringElement();
DilateFilterType::Pointer dilateFilter = DilateFilterType::New();
dilateFilter->SetInput(connectedThreshold->GetOutput());
dilatefilter->SetKernel(structuringElement);
// Saving the results of the RG+dilation
typedef itk::ImageFileWriter< OutputImageType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetInput(dilateFilter->GetOutput());
writer->SetFileName("organ-segmented-with-dilation.mhd");
try {
writer->Update();
} catch(itk::ExceptionObject& err) {
std::cerr << "Exception caught! " << err.what() << std::endl;
return EXIT_FAILURE;
}
// What to do next to crop the input image with this region-growing?
欢迎任何帮助或评论。
Mask filter 本身可以做与通常做的相反的事情。默认情况下,屏蔽值为 0,外部值为 0。这意味着与掩码的非零部分相对应的图像部分被保留,其余部分被归零。如果这不是您想要的,您可以通过设置不同的掩码和外部值轻松反转逻辑。
郑重声明,我使用 ITK mask negated filter 解决了我的问题,与基本的遮罩过滤器相反,它直接回答了这个问题。
我正在处理 DICOM 图像(CT 扫描)并且想在我的照片中分离出一些感兴趣的结构,例如人体器官(如主动脉,请参见随附的图像)。我在 ITK 和 VTK 的帮助下用 C++ 编码。
假设这些器官具有特定的亮度强度,因此我可以使用区域增长算法(下面的代码)自动识别它们。为此,我之前根据属于器官的体素的平均值和标准偏差值计算了一些阈值。
如何在 ITK/VTK 功能的帮助下只保留图像中的主动脉? 我想我正在寻找的是一个过滤器,可以做与 ITK mask image filter.
完全相反的事情请在下面找到器官隔离对应的(伪)代码。我根据区域生长的结果计算了 5 体素的扩张,以确保包括器官的所有体素,并在裁剪后在器官周围有足够的余量。
typedef short InputPixelType;
typedef unsigned char OutputPixelType;
const int Dimension = 3;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
// Region growing
typedef itk::ConnectedThresholdImageFilter< InputImagetype,
OutputImagetype > ConnectedFilterType;
ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New();
connectedThreshold->SetInput(input);
connectedThreshold->SetUpper(upperThreshold);
connectedThreshold->SetLower(lowerThreshold);
//Initializing seed
InternalImagetype::IndexType index;
index[0] = seed_x;
index[1] = seed_y;
connectedThreshold->SetSeed(index);
// Dilate the resulting region-growing of 5 voxels for safety
typedef itk::BinaryBallStructuringElement< OutputImageType,
Dimension > StructuringElementType;
typedef itk::BinaryDilateImageFilter< OutputImageType,
OutputImageType, StruturingElementType > DilateFilterType;
StructuringElementType structuringElement;
structuringElement.SetRadius(5);
structuringElement.CreateStructuringElement();
DilateFilterType::Pointer dilateFilter = DilateFilterType::New();
dilateFilter->SetInput(connectedThreshold->GetOutput());
dilatefilter->SetKernel(structuringElement);
// Saving the results of the RG+dilation
typedef itk::ImageFileWriter< OutputImageType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetInput(dilateFilter->GetOutput());
writer->SetFileName("organ-segmented-with-dilation.mhd");
try {
writer->Update();
} catch(itk::ExceptionObject& err) {
std::cerr << "Exception caught! " << err.what() << std::endl;
return EXIT_FAILURE;
}
// What to do next to crop the input image with this region-growing?
欢迎任何帮助或评论。
Mask filter 本身可以做与通常做的相反的事情。默认情况下,屏蔽值为 0,外部值为 0。这意味着与掩码的非零部分相对应的图像部分被保留,其余部分被归零。如果这不是您想要的,您可以通过设置不同的掩码和外部值轻松反转逻辑。
郑重声明,我使用 ITK mask negated filter 解决了我的问题,与基本的遮罩过滤器相反,它直接回答了这个问题。