本文整理汇总了C++中image::Pointer::SetOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetOrigin方法的具体用法?C++ Pointer::SetOrigin怎么用?C++ Pointer::SetOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image::Pointer
的用法示例。
在下文中一共展示了Pointer::SetOrigin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: image
//.........这里部分代码省略.........
DistanceImageType::IndexType currentIndex;
currentIndex[0] = ( currentPoint[0]-xmin ) / m_DistanceImageSpacing;
currentIndex[1] = ( currentPoint[1]-ymin ) / m_DistanceImageSpacing;
currentIndex[2] = ( currentPoint[2]-zmin ) / m_DistanceImageSpacing;
narrowbandPoints.push(currentIndex);
distanceImg->SetPixel(currentIndex, distance);
NeighborhoodImageIterator::RadiusType radius;
radius.Fill(1);
NeighborhoodImageIterator nIt(radius, distanceImg, distanceImg->GetLargestPossibleRegion());
unsigned int relativeNbIdx[] = {4, 10, 12, 14, 16, 22};
bool isInBounds = false;
while ( !narrowbandPoints.empty() )
{
nIt.SetLocation(narrowbandPoints.front());
narrowbandPoints.pop();
for (int i = 0; i < 6; i++)
{
nIt.GetPixel(relativeNbIdx[i], isInBounds);
if( isInBounds && nIt.GetPixel(relativeNbIdx[i]) == 10)
{
currentIndex = nIt.GetIndex(relativeNbIdx[i]);
currentPoint[0] = currentIndex[0]*m_DistanceImageSpacing + xmin;
currentPoint[1] = currentIndex[1]*m_DistanceImageSpacing + ymin;
currentPoint[2] = currentIndex[2]*m_DistanceImageSpacing + zmin;
distance = this->CalculateDistanceValue(currentPoint);
if ( abs(distance) <= m_DistanceImageSpacing*2 )
{
nIt.SetPixel(relativeNbIdx[i], distance);
narrowbandPoints.push(currentIndex);
}
}
}
}
ImageIterator imgRegionIterator (distanceImg, distanceImg->GetLargestPossibleRegion());
imgRegionIterator.GoToBegin();
double prevPixelVal = 1;
unsigned int _size[3] = { (unsigned int)(size[0] - 1), (unsigned int)(size[1] - 1), (unsigned int)(size[2] - 1) };
//Set every pixel inside the surface to -10 except the edge point (so that the received surface is closed)
while (!imgRegionIterator.IsAtEnd()) {
if ( imgRegionIterator.Get() == 10 && prevPixelVal < 0 )
{
while (imgRegionIterator.Get() == 10)
{
if (imgRegionIterator.GetIndex()[0] == _size[0] || imgRegionIterator.GetIndex()[1] == _size[1] || imgRegionIterator.GetIndex()[2] == _size[2]
|| imgRegionIterator.GetIndex()[0] == 0U || imgRegionIterator.GetIndex()[1] == 0U || imgRegionIterator.GetIndex()[2] == 0U )
{
imgRegionIterator.Set(10);
prevPixelVal = 10;
++imgRegionIterator;
break;
}
else
{
imgRegionIterator.Set(-10);
++imgRegionIterator;
prevPixelVal = -10;
}
}
}
else if (imgRegionIterator.GetIndex()[0] == _size[0] || imgRegionIterator.GetIndex()[1] == _size[1] || imgRegionIterator.GetIndex()[2] == _size[2]
|| imgRegionIterator.GetIndex()[0] == 0U || imgRegionIterator.GetIndex()[1] == 0U || imgRegionIterator.GetIndex()[2] == 0U)
{
imgRegionIterator.Set(10);
prevPixelVal = 10;
++imgRegionIterator;
}
else {
prevPixelVal = imgRegionIterator.Get();
++imgRegionIterator;
}
}
Image::Pointer resultImage = this->GetOutput();
Point3D origin;
origin[0] = xmin;
origin[1] = ymin;
origin[2] = zmin;
CastToMitkImage(distanceImg, resultImage);
resultImage->GetGeometry()->SetOrigin(origin);
resultImage->SetOrigin(origin);
}