【问题标题】:ITK - Calculate texture features for segmented 3D brain MRIITK - 计算分段 3D 脑 MRI 的纹理特征
【发布时间】:2015-06-16 16:22:14
【问题描述】:

我正在尝试使用带有 C++ 的 ITK 库为分段 3D 脑部 MRI 计算 texture features。所以我关注了这个example。该示例采用3D image,并为所有 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();
}

该程序有效。但是我有这个问题:即使我更改了window size,它也会为不同的 3D 图像提供 相同的结果

有人用 ITK 来做这件事吗?如果有任何其他方法可以实现这一点,有人可以指出我的解决方案吗?

我们将不胜感激。

【问题讨论】:

  • 您确定图像读取正确吗?例如,如果你计算一些简单的东西作为输入的强度范围,你会得到正确的结果吗? itk.org/Wiki/ITK/Examples/ImageProcessing/…
  • @lib 是的,图像被正确读取,我知道因为我能够正确显示它
  • 我使用示例页面中的main 函数运行您的代码(我所做的唯一更改是对size 对象以适应我的特定图像的大小)并得到了不同的结果不同的图像。你是如何将图像读入程序的?您是否对两个图像使用相同的 ImageFileReader 对象?如果是这种情况,您可能会在内存中覆盖其中一个并在同一图像上执行两次操作。

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


【解决方案1】:

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

编辑:

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

【讨论】:

    【解决方案2】:

    您的代码中有一些奇怪的地方是size.Fill(50),而在示例中他们显示它应该保持图像尺寸:

     size.Fill(3); //window size=3x3x3
    

    【讨论】:

    • 不,size.Fill(3) 不代表图像尺寸,它包含roi 感兴趣区域的大小。 window的大小是计算灰度共生矩阵所需要的,与图像尺寸无关。
    • 是的,对不起,我现在看到了。但是您能否针对不同的感兴趣区域获得不同的结果? (可视化它们或计算最大强度?)直方图范围 0-255,对您的图像有好处吗?
    猜你喜欢
    • 1970-01-01
    • 2015-10-30
    • 2014-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-09
    相关资源
    最近更新 更多