@@ -435,6 +435,10 @@ void Optimize::InitializeSampler() {
435435
436436 m_sampler->SetCorrespondenceOn ();
437437
438+ m_sampler->SetSamplingScale (m_sampling_scale);
439+ m_sampler->SetSamplingAutoScale (m_sampling_auto_scale);
440+ m_sampler->SetSamplingScaleValue (m_sampling_scale_value);
441+
438442 m_sampler->SetAdaptivityMode ();
439443 m_sampler->GetEnsembleEntropyFunction ()->SetRecomputeCovarianceInterval (m_recompute_regularization_interval);
440444 m_sampler->GetDisentangledEnsembleEntropyFunction ()->SetRecomputeCovarianceInterval (
@@ -1708,7 +1712,11 @@ void Optimize::AddImage(ImageType::Pointer image, std::string name) {
17081712 m_sampler->AddImage (image, this ->GetNarrowBand (), name);
17091713 this ->m_num_shapes ++;
17101714 if (image) {
1711- this ->m_spacing = image->GetSpacing ()[0 ] * 5 ;
1715+ double new_spacing = image->GetSpacing ()[0 ] * 5 ;
1716+ if (m_spacing == 0 || new_spacing < this ->m_spacing ) {
1717+ // pick the smallest spacing
1718+ m_spacing = new_spacing;
1719+ }
17121720 }
17131721}
17141722
@@ -2019,6 +2027,24 @@ void Optimize::SetSharedBoundaryEnabled(bool enabled) { m_sampler->SetSharedBoun
20192027// ---------------------------------------------------------------------------
20202028void Optimize::SetSharedBoundaryWeight (double weight) { m_sampler->SetSharedBoundaryWeight (weight); }
20212029
2030+ // ---------------------------------------------------------------------------
2031+ void Optimize::SetSamplingScale (bool enabled) { m_sampling_scale = enabled; }
2032+
2033+ // ---------------------------------------------------------------------------
2034+ bool Optimize::GetSamplingScale () { return m_sampling_scale; }
2035+
2036+ // ---------------------------------------------------------------------------
2037+ void Optimize::SetSamplingAutoScale (bool auto_scale) { m_sampling_auto_scale = auto_scale; }
2038+
2039+ // ---------------------------------------------------------------------------
2040+ bool Optimize::GetSamplingAutoScale () { return m_sampling_auto_scale; }
2041+
2042+ // ---------------------------------------------------------------------------
2043+ void Optimize::SetSamplingScaleValue (double scale_value) { m_sampling_scale_value = scale_value; }
2044+
2045+ // ---------------------------------------------------------------------------
2046+ double Optimize::GetSamplingScaleValue () { return m_sampling_scale_value; }
2047+
20222048// ---------------------------------------------------------------------------
20232049void Optimize::SetEarlyStoppingConfig (EarlyStoppingConfig config) { m_sampler->SetEarlyStoppingConfig (config); }
20242050
0 commit comments