实例23 置信连接算法对脑部MHA文件进行三维分割
在这个例子中使用前面例子中的代码,并设置图像的维数为 3 。应用梯度各向异性扩散来平滑图像。这个滤波器使用两个迭代器、一个值为 0.05 的 time step 和一个值为 3 的conductance 值,然后使用置信连接方式对平滑后的图像进行分割。使用的五个种子点的坐标分别为( 118 , 85 , 92 )、( 63 , 87 , 94 )、( 63 , 157 , 90 )、( 111 , 188 , 90 )、( 111 , 50 , 88 )。置信连接滤波器使用的参数:邻域范围是 2 ; 迭代器数目为5;和 f 值 为2.5( 跟前面的例子中一样 ) 。然后使VolView 来显示结果。
#include "itkConfidenceConnectedImageFilter.h"
#include "itkCastImageFilter.h"
#include "itkCurvatureFlowImageFilter.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
int main( int argc, char *argv[] )
{
//if( argc < 3 )
// {
// std::cerr << "Missing Parameters " << std::endl;
// std::cerr << "Usage: " << argv[0];
// std::cerr << " inputImage outputImage " << std::endl;
// return EXIT_FAILURE;
// }
typedef float InternalPixelType;
const unsigned int Dimension = 3;
typedef itk::Image&