MCPcopy Create free account
hub / github.com/MITK/MITK / itkSampleLabel

Function itkSampleLabel

Modules/Classification/CLUtilities/include/mitkCLUtil.h:391–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 11

CastToMitkImageFunction · 0.85
SetDirectionMethod · 0.80
ValueMethod · 0.80
NewFunction · 0.50
GetMethod · 0.45
SetMethod · 0.45
SetOriginMethod · 0.45
GetOriginMethod · 0.45
SetSpacingMethod · 0.45
GetSpacingMethod · 0.45
GoToBeginMethod · 0.45

Tested by

no test coverage detected