c++ - ITK - 计算分段 3D 大脑 MRI 的纹理特征

标签 c++ image-processing feature-extraction itk

我正在尝试使用带有 C++ 的 ITK 库为分段的 3D 大脑 MRI 计算纹理特征。所以我跟着这个example .该示例采用 3D 图像,并为所有 13 个可能的空间方向提取 3 个不同的特征。在我的程序中,我只想让给定的 3D 图像得到:

  • 能量
  • 相关性
  • 惯性
  • Haralick 相关性
  • 逆差矩
  • 集群突出
  • 丛生阴影

这是我目前所拥有的:

//definitions of used types
typedef itk::Image<float, 3> InternalImageType;
typedef itk::Image<unsigned char, 3> VisualizingImageType;
typedef itk::Neighborhood<float, 3> NeighborhoodType;
typedef itk::Statistics::ScalarImageToCooccurrenceMatrixFilter<InternalImageType>
Image2CoOccuranceType;
typedef Image2CoOccuranceType::HistogramType HistogramType;
typedef itk::Statistics::HistogramToTextureFeaturesFilter<HistogramType> Hist2FeaturesType;
typedef InternalImageType::OffsetType OffsetType;
typedef itk::AddImageFilter <InternalImageType> AddImageFilterType;
typedef itk::MultiplyImageFilter<InternalImageType> MultiplyImageFilterType;

void calcTextureFeatureImage (OffsetType offset, InternalImageType::Pointer inputImage)
{
// principal variables
//Gray Level Co-occurance Matrix Generator
Image2CoOccuranceType::Pointer glcmGenerator=Image2CoOccuranceType::New();
glcmGenerator->SetOffset(offset);
glcmGenerator->SetNumberOfBinsPerAxis(16); //reasonable number of bins
glcmGenerator->SetPixelValueMinMax(0, 255); //for input UCHAR pixel type
Hist2FeaturesType::Pointer featureCalc=Hist2FeaturesType::New();
//Region Of Interest
typedef itk::RegionOfInterestImageFilter<InternalImageType,InternalImageType> roiType;
roiType::Pointer roi=roiType::New();
roi->SetInput(inputImage);



InternalImageType::RegionType window;
InternalImageType::RegionType::SizeType size;
size.Fill(50);
window.SetSize(size);

window.SetIndex(0,0);
window.SetIndex(1,0);
window.SetIndex(2,0);

roi->SetRegionOfInterest(window);
roi->Update();

glcmGenerator->SetInput(roi->GetOutput());
glcmGenerator->Update();

featureCalc->SetInput(glcmGenerator->GetOutput());
featureCalc->Update();

std::cout<<"\n Entropy : ";
std::cout<<featureCalc->GetEntropy()<<"\n Energy";
std::cout<<featureCalc->GetEnergy()<<"\n Correlation";
std::cout<<featureCalc->GetCorrelation()<<"\n Inertia";             
std::cout<<featureCalc->GetInertia()<<"\n HaralickCorrelation";
std::cout<<featureCalc->GetHaralickCorrelation()<<"\n InverseDifferenceMoment";
std::cout<<featureCalc->GetInverseDifferenceMoment()<<"\nClusterProminence";
std::cout<<featureCalc->GetClusterProminence()<<"\nClusterShade";
std::cout<<featureCalc->GetClusterShade();
}

程序有效。但是我遇到了这个问题:即使我更改了窗口大小,它也会为不同的 3D 图像提供相同的结果

有人用 ITK 来做这个吗?如果有任何其他方法可以实现这一点,请问有人能指出解决方案吗?

我们将不胜感激任何帮助。

最佳答案

我认为您的图像只有一个灰度级别。例如,如果您使用 itk-snap 工具对图像进行分割,当您保存分割结果时,itk-snap 会将其保存为一个灰度级别。因此,如果您尝试为使用 itk-snap 分割的图像计算纹理特征,即使您更改图像或窗口大小,您也总是会得到相同的结果,因为您只有 一个灰色共现矩阵中的尺度级别。尝试使用未分段的图像运行您的程序,您肯定会得到不同的结果。

编辑:

为了计算分割图像的纹理特征,尝试另一种分割方法,它保存未分割图像的原始灰度级。

关于c++ - ITK - 计算分段 3D 大脑 MRI 的纹理特征,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29570064/

相关文章:

R:在逻辑回归上使用 Caret 进行交叉验证的特征选择

c++ - Basler Pylon 4 SDK 和 OPENCV 2.4.9,CPylonImage 到 Mat

c++ - visual c++ 2010 无法添加资源文件

python - 检测和定位两个图像中与文本不同的区域(平面/曲线/旋转)

feature-extraction - 如何处理 tf-idf 中非常不常见的术语?

elasticsearch - 是否可以使用特征向量查询 Elastic Search?

c++ - 控制投影仪的单个像素

c++ - 复制构造函数产生访问冲突后的 flann::Index 的析构函数

PHP 图像处理。棕褐色、饱和度、 toastr 滤镜与 CSS 中的完全相同

java - 使用Java优化内存中的JPG图像