Skip to content

Commit

Permalink
ENH: Add getter methods for itk::KdTreeGenerator publicly set ivars
Browse files Browse the repository at this point in the history
Add getter methods for `itk::KdTreeGenerator` publicly set source sample
and bucket size ivars.

Test the methods.
  • Loading branch information
jhlegarreta authored and dzenanz committed Jan 25, 2023
1 parent f76d26a commit 2c5dec1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Modules/Numerics/Statistics/include/itkKdTreeGenerator.h
Expand Up @@ -110,14 +110,16 @@ class ITK_TEMPLATE_EXPORT KdTreeGenerator : public Object
/** Typedef for the smart pointer to the Subsample */
using SubsamplePointer = typename SubsampleType::Pointer;

/** Sets the input sample that provides the measurement vectors. */
/** Set/Get the input sample that provides the measurement vectors. */
void
SetSample(TSample * sample);
itkGetConstMacro(SourceSample, TSample *);

/** Sets the number of measurement vectors that can be stored in a
* terminal node. */
void
SetBucketSize(unsigned int size);
itkGetConstMacro(BucketSize, unsigned int);

/** Returns the pointer to the generated k-d tree. */
OutputPointer
Expand Down
7 changes: 6 additions & 1 deletion Modules/Numerics/Statistics/test/itkKdTreeGeneratorTest.cxx
Expand Up @@ -49,7 +49,12 @@ itkKdTreeGeneratorTest(int, char *[])


treeGenerator->SetSample(sample);
treeGenerator->SetBucketSize(16);
ITK_TEST_SET_GET_VALUE(sample, treeGenerator->GetSourceSample());

unsigned int bucketSize = 16;
treeGenerator->SetBucketSize(bucketSize);
ITK_TEST_SET_GET_VALUE(bucketSize, treeGenerator->GetBucketSize());

treeGenerator->Update();

using TreeType = TreeGeneratorType::KdTreeType;
Expand Down

0 comments on commit 2c5dec1

Please sign in to comment.