itk:: PolylineParametertricPath类
通常用于以简洁的方式表示二维图像分割算法的输出。也可以用于表示n维的任意开闭曲线作为线性分段逼近。 #include "itkPolyLineParametricPath.h" //Path通过维度实例化,这里以2d为例 const unsigned int Dimension = 2; typedef itk::Image< unsigned char, Dimension > ImageType; typedef itk::PolyLineParametricPath< Dimension > PathType; ImageType::ConstPointer image = reader->GetOutput(); PathType::Pointer path = PathType::New(); path->Initialize(); typedef PathType::ContinuousIndexType ContinuousIndexType; ContinuousIndexType cindex; typedef ImageType::PointType ImagePointType; ImagePointType origin = image->GetOrigin(); ImageType::SpacingType spacing = image->GetSpacing(); ImageType::SizeType size = image->GetBufferedRegion().GetSize(); ImagePointType point; point[0] = origin[0] + spacing[0] * size[0]; point[1] = origin[1] + spacing[1] * size[1]; image->TransformPhysicalPointToContinuousIndex( origin, cindex ); path->AddVertex( cindex ); image->TransformPhysicalPointToContinuousIndex( point, cindex ); path->AddVertex( cindex );