| 389 | |
| 390 | template <class TImageType1, class TImageType2> |
| 391 | static void itkSampleLabel(TImageType1* image, TImageType2* output, double acceptrate, unsigned int label) |
| 392 | { |
| 393 | std::srand (time(nullptr)); |
| 394 | |
| 395 | itk::ImageRegionConstIterator< TImageType1 > inputIter(image, image->GetLargestPossibleRegion()); |
| 396 | itk::ImageRegionIterator< TImageType2 > outputIter(output, output->GetLargestPossibleRegion()); |
| 397 | |
| 398 | while (!inputIter.IsAtEnd()) |
| 399 | { |
| 400 | double r = (double)(rand()) / RAND_MAX; |
| 401 | if(inputIter.Get() == label && r < acceptrate) |
| 402 | outputIter.Set(label); |
| 403 | |
| 404 | ++inputIter; |
| 405 | ++outputIter; |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | template <class TImageType> |
| 410 | static void itkSampleLabel(TImageType* image, mitk::Image::Pointer & output, unsigned int n_samples_drawn) |
nothing calls this directly
no test coverage detected