Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename TImage,typename TPointSet>
- void convertITKImageToPointSet( typename const TImage::Pointer fImage,
- typename const TImage::PixelType forgroundValue,
- typename TPointSet::Pointer fOutputPointSet)
- {
- fOutputPointSet = TPointSet::New();
- TPointSet::PointType tempPoint;
- itk::ImageRegionConstIterator<TImage> imageIterator(fImage,fImage->GetLargestPossibleRegion());
- int numberOfPts = 0;
- for (auto it = imageIterator.Begin();it != imageIterator.End();++it)
- {
- if (it.Value() == forgroundValue)
- {
- fImage->TransformIndexToPhysicalPoint(it.GetIndex(),tempPoint);
- fOutputPointSet->SetPoint(numberOfPts,tempPoint);
- numberOfPts++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement